syfop.node
- class syfop.node.Node(name, inputs, input_commodities, costs, convert_factor=1.0, convert_factors=None, size_commodity=None, input_proportions=None, storage=None, input_flow_costs=None)[source]
Bases:
NodeScalableBaseRepresents a node which has no preset input or output flows or profiles. That means, that input and output flows are determined by the nodes connected to it (they are optimization variables).
If costs is given, the node has a size variable:
- size
The size of the node: sum of the output flows are less or equal to the size. If there are multiple output commodities, only output flows for
size_commodityare used for the sum of output flows.
Examples
Electrolyzer: In a network where hydrogen is generated using renewable electricity, the electrolyzer can be modeled to be of type Node. It has a size variable, which represents the capacity of the electrolyzer. The input flow is the electricity and the output flow is the hydrogen. The costs are the costs per per unit of capacity.
Electricity: In a network where electricity is produced from different renewable sources, a virtual electricity node, which does not represent real technology, can be used to implement a combined storage. The costs should be set to zero, because the node does not represent real technology.
Curtailment: In a network with renewable electricity sources, a curtailment node can be used to consume electric energy which cannot be stored or used otherwise. The costs should be set to zero.
- Parameters:
name (str) – Name of the node, must be unique in the network
inputs (list of subclasses of syfob.nodes.NodeBase) – node objects that are inputs to this node, i.e. from each input node there is a connection to this node
input_commodities (list of str) – List of input commodities. If all inputs have the same commodity, a single string can be given.
costs (pint.Quantity) – Costs per size. See also
size_commodity. Can be set to zero, e.g. for curtailing nodes: in this case no size variable will be created.convert_factor (float or pint.Quantity) – Conversion factor for the output commodity. If this node has multiple different input comodities, the parameter
convert_factorsneeds to be used.convert_factors (dict) – a dictionary where each output commodity maps to a tuple of an input commodity to a convert factor, example:
{'hydrogen': ('electricity', 42 * ureg.t / ureg.MW)}size_commodity (str) – Which commodity is used to define the size of the Node. This parameter is only required, if there is more than one output commodity or if there are no output nodes connected (and it cannot be determined automatically).
input_proportions (dict) – Proportions of the input flows. The keys are the names of the input commodities and the values are a quantity of the type of the input commodity, all multiples of these values are allowed. Example:
{"electricity": 0.3 * ureg.MW, "co2": 2.3 * ureg.t/ureg.h}.storage (Storage) – Storage attached to the node.
input_flow_costs (pint.Quantity) – Costs per unit of input flow. Use this to add fuel costs. This is not available for other node types: NodeFixInput would add constant input flow costs, which does not change the optimation result and NodeScalableInput would add costs which are proportional to its size, which could be added to the
costsparameter. At maximum one input node is allowed ifinput_flow_costsis given.
- create_constraints(model, time_coords)[source]
- class syfop.node.NodeFixInput(name, input_flow, storage=None)[source]
Bases:
NodeInputBaseA node with a fixed input profile, i.e. input flow for each time stamp is given. There is no size variable and no scaling.
Example
CO2 stream: A node representing the CO2 stream from a ethanol refineries, which can be used to produce methanol. The CO2 stream is given as a fixed time series, which involves the seasonality of the ethanol production (e.g. given by fermentation of sugar cane).
- class syfop.node.NodeFixOutput(name, inputs, input_commodities, output_flow, input_proportions=None, storage=None)[source]
Bases:
NodeOutputBaseA node with a fixed output profile, i.e. output flow for each time stamp is given.
Example
Demand: A node representing the demand of a certain commodity. The demand is given as a fixed time series. Imagine the demand of electricity in a certain region for each hour over a year.
- Parameters:
name (str) – Name of the node, must be unique in the network
inputs (list of subclasses of syfob.nodes.NodeBase) – node objects that are inputs to this node, i.e. from each input node there is a connection to this node
input_commodities (list of str) – List of input commodities. If all inputs have the same commodity, a single string can be given. Only one input commodity is supported, i.e. if
input_commoditiesis of typelistall elements should be equal.output_flow (xr.DataArray) – Time series of the output flow.
input_proportions (dict) – Proportions of the input flows. The keys are the names of the input commodities and the values are a quantity of the type of the input commodity, all multiples of these values are allowed. Example:
{"electricity": 0.3 * ureg.MW, "co2": 2.3 * ureg.t/ureg.h}.storage (Storage) – Storage attached to the node
- class syfop.node.NodeScalableInput(name, input_profile, costs, storage=None)[source]
Bases:
NodeScalableBase,NodeInputBaseA given input profile is scaled by a size variable.
Example
The node represents wind or PV electricity generation. Capacity factor time series are given and multiplied with a size variable to create the input flow.
- Parameters:
name (str) – Name of the node, must be unique in the network
input_profile (xr.DataArray) – Time series of the input flow. Must be capacity factors, i.e. between 0 and 1.
costs (pint.Quantity) – Costs per unit of size.
storage (Storage) – Storage attached to the node.
- create_variables(model, time_coords)[source]
- class syfop.node.NodeScalableOutput[source]
Bases:
NodeScalableBase,NodeOutputBaseRepresents a node which has a size variable and a given output profile.
Note: This is not implemented yet!
- class syfop.node.Storage(costs, max_charging_speed, storage_loss, charging_loss)[source]
Bases:
objectA
Storagecan be attached to a node to store a certain amount of the output commodity for later time stamps. A storage has a size variable, which is measured in units of the output commodity of its node. Storage for nodes with multiple output commodities are not supported at the moment.The storage for one node does not support multiple different output commodities at the moment. If you need a storage for different output commodities, create a separate nodes for each commodity and attach a separate storage there.
Examples: hydrogen storage, CO2 storage, battery.
- discharge
The amount of the commodity that is discharged from the storage for each time stamp. A positive value for
chargeanddischargein the same time stamp does not make sense, but it is not forbidden in any way. However, such a case will not be optimal ifcharging_loss>0.
Note
The units of the variables
size,level,chargeanddischargeare given by the unit of the commodity times hours (independently of the interval size between time stamps). This means for a battery, the variables will be given in MWh if the unit for ‘electricity’ is set to MW. This means that the values inchargeanddischargedepend on the interval of time stamps.- Parameters:
costs (pint.Quantity) – Storage costs per unit of size, e.g.
1000 * ureg.EUR/ureg.kWh.max_charging_speed (float) – Maximum charging speed, i.e. the share of the total size that can be charged per hour (indepenent of the length of the interval between time stamps). For example, if the maximum charging speed is 0.5, two hours are needed to charge the storage completely. The same limit is applied for discharging speed.
storage_loss (float) – Loss of stored commodity per hour (indepenent of the length of the interval between time stamps) as share of the stored commodity. For example, if the storage loss for a battery is 0.01 and the battery is half full, 0.5% of the battery capacity is lost in the next hour.
charging_loss (float) – Loss of charged commodity as share of the charged commodity. For example, if
charging_lossis 0.01 and there is 100kg of excess hydrogen to be stored in a certain timestamp, only 99kg will end up in the storage.