Networks
The network class is a subclass of the ModelComponent class. Furthermore, the network class has different subclasses that model different types of networks (fluid, electricity, simple). An overview of all networks that are currently modelled, along with their respective types, can be found here.
A network is defined as the set of all arcs (i.e., connections between nodes) of a
specific network type (e.g., “electricitySimple”). In addition to the performance and
cost parameters in defined in the respective json file of the network, networks can
generally be modelled as either bi- or uni-directional by modifying the parameter
bidirectional_network and bidirectional_network_precise in the
json file of the respective technology.
If bidirectional_network = 1 the following properties of the network are
enforced:
The size of an arc in both direction needs to be equal.
The capex and the fixed opex are only counted once for each arc. As such a connection once build can be used in both directions.
In each time step the flow can only be in one of the two directions.
With
bidirectional_network_precise = 1this is enforced with a disjunction and a cut adding integers and thus computational complexity in the solving.With
bidirectional_network_precise = 0this is enforced with a cut, thus not completly eliminating a flow in both directions at the same time.
Network Class
As mentioned, the network class is a subclass of the ModelComponent class. In general, all network subclasses share the equations of this class, though some exceptions are there for specific technologies (the subclass then overwrites the class method).
- class Network(netw_data: dict)
Class to read and manage data for networks
For each connection between nodes, an arc is created, with its respective cost, flows, losses and consumption at nodes.
Networks that can be used in two directions (e.g. electricity cables), are called bidirectional and are treated respectively with their size and costs. Other networks, e.g. pipelines, require two installations to be able to transport in two directions. As such their CAPEX is double and their size in both directions can be different.
Set declarations:
set_netw_carrier: Set of network carrier (i.e. only one carrier, that is transported in the network)set_arcs: Set of all arcs (from_node, to_node)set_arcs_unique: In case the network is bidirectional: Set of unique arcs (i.e. for each pair of arcs, one unique entry)Furthermore for each node:
set_receives_from: A set of nodes the node receives fromset_sends_to: A set of nodes the node sends to
set_consumed_carriers: In case the network has an energy consumption
Parameter declarations:
para_size_min: Min Size (for each arc)para_size_max: Max Size (for each arc)para_size_initial, var_size, var_capex: for existing networkspara_capex_gamma: \({\gamma}_1, {\gamma}_2, {\gamma}_3, {\gamma}_4\) for CAPEX calculation (annualized from given data on up-front CAPEX, lifetime and discount rate)para_opex_variable: Variable OPEXpara_opex_fixed: Fixed OPEX in % of up-front CAPEXpara_decommissioning_cost_annual: decommissioning costs for existing networks
Variable declarations:
var_capex: CAPEXvar_opex_variable: Variable OPEXvar_opex_fixed: Fixed OPEXFurthermore for each node:
var_netw_emissions_pos: positive emissions at nodevar_inflow: Inflow to node (as a sum of all inflows from other nodes)var_outflow: Outflow from node (as a sum of all outflows to other nodes)var_consumption: Consumption of other carriers (e.g. electricity required for compression of a gas)
Arc Block declaration
Each arc represents a connection between two nodes, and is thus indexed by ( node_from, node_to). For each arc, the following components are defined. Each variable is indexed by the timestep \(t\) (here left out for convenience).
Decision Variables:
var_size: Size \(S\)var_flow: Flow \(flow\)var_losses: Losses \(loss\)var_capex,var_capex_auxCAPEX: \(CAPEX\)var_opex_variable: Variable \(OPEXvariable\)
Constraint definitions:
Flow losses:
\[loss = flow * {\mu} * D\]Flow constraints:
\[S * minTransport \leq flow \leq S\]CAPEX of respective arc. The CAPEX is calculated as follows (for new networks). Note that for existing networks, the CAPEX is zero, but the fixed OPEX is calculated as a fraction of a hypothetical up-front CAPEX based on the existing size.
\[CAPEX_{arc} = {\gamma}_1 + {\gamma}_2 * S + {\gamma}_3 * distance + {\gamma}_4 * S * distance\]Variable OPEX:
\[OPEXvariable_{arc} = CAPEX_{arc} * opex_{variable}\]
Network constraint declarations This part calculates variables for all respective nodes.
CAPEX calculation of the whole network as a sum of CAPEX of all arcs. If
bidirectional_networkis set to 1 for this network, the capex and fixed opex for an arc is only counted once.OPEX fix, as fraction of total CAPEX
OPEX variable as a sum of variable OPEX for each arc
Total emissions as the sum of all arc emissions
Total inflow and outflow as a sum for each node:
\[outflow_{node} = \sum_{nodeTo \in sendsto_{node}} flow_{node, nodeTo}\]\[inflow_{node} = \sum_{nodeFrom \in receivesFrom_{node}} flow_{nodeFrom, node} - losses_{nodeFrom, node}\]Energy consumption of other carriers at each node.
If
bidirectional_networkis set to 1 for this network only additional constraints are enforced to ensure that at each time step a flow can only be in one direction. Forbidirectional_network_precise = 0, only a cut and a constraint on the sizes of the two directions of an arc are formulated:\[S_{nodeFrom, nodeTo} = S_{nodeTo, nodeFrom}\]\[flow_{nodeFrom, nodeTo} + flow_{nodeTo, nodeFrom} \lor S_{nodeTo, nodeFrom}\]For
bidirectional_network_precise = 1additional disjunctions are formulated, thus adding binaries and complexity to the model:\[flow_{nodeFrom, nodeTo} = 0 \lor flow_{nodeTo, nodeFrom} = 0\]
- Existing networks, i.e. existing = 1, can be decommissioned (decommission = ‘continuous’ or decommission =
‘only_complete’) or not (decommission = ‘impossible’). For networks that cannot be decommissioned, the size is fixed to the initial size given in the network data. For networks that can be decommissioned, the size can be smaller or equal to the initial size. When decommission = ‘continuous’ the size can take any value between the minimum and initial size. When decommission = ‘only_complete’ the size is either 0 or the initial size. Reducing the size comes at the decommissioning costs or benefits specified in the economics of the network.
- construct_netw_model(b_netw, data: dict, set_nodes, set_t_full, set_t_clustered)
Constructs a network as model block.
- Parameters:
b_netw – pyomo network block
data (dict) – dict containing model information
set_nodes – pyomo set containing all nodes
set_t_full – pyomo set containing timesteps
set_t_clustered – pyomo set containing clustered timesteps
- Returns:
pyomo block with network model
- fit_network_performance()
Fits network performance (bounds and coefficients).
- scale_model(b_netw, model, config: dict)
Scales network model
- Parameters:
b_netw – pyomo network block
model – pyomo model
config (dict) – config dict containing scaling factors
- Returns:
pyomo model
- write_results_netw_design(h5_group, model_block, config, data)
Function to report network design
- Parameters:
model_block – pyomo network block
config (dict) – dict containing model configuration
data (dict) – dict containing model information
h5_group – h5 group to write to
- write_results_netw_operation(h5_group, model_block)
Function to report network operation
- Parameters:
model_block – pyomo network block
h5_group – h5 group to write to
Generic Network
- class Fluid(netw_data: dict)
Network with a fluid as carrier
This network type resembles a network in which the carrier is a fluid.
Fluid networks enable: - Energy consumption - Emissions due to leakage
Parameter declarations:
para_send_kflow,para_send_kflowDistance,para_receive_kflow,para_receive_kflowDistance, Parameters for energy consumption at receiving and sending node
Variable declarations:
For each node:
var_consumption: Consumption of other carriers (e.g. electricity required for compression of a gas)
Arc Block declaration
Each arc represents a connection between two nodes, and is thus indexed by ( node_from, node_to). For each arc, the following components are defined. Each variable is indexed by the timestep \(t\) (here left out for convenience).
Decision Variables:
var_emissions: emissions from transport/lossesIf consumption at nodes exists for network:
var_consumption_send: Consumption at sending node \(Consumption_{ nodeFrom}\)var_consumption_receive: Consumption at receiving node \(Consumption_{nodeTo}\)
Constraint definitions:
Consumption at sending and receiving node:
\[Consumption_{nodeFrom} = flow * k_{1, send} + flow * distance * k_{2, send}\]\[Consumption_{nodeTo} = flow * k_{1, receive} + flow * distance * k_{2, receive}\]Emissions:
\[emissions = flow * f_{emissions} + loss * f_{loss2emission}\]
Network constraint declarations This part calculates variables for all respective nodes.
Total emissions as the sum of all arc emissions
Energy consumption of other carriers at each node.
- fit_network_performance()
Fits network performance for fluid network (bounds and coefficients).
- write_results_netw_design(h5_group, model_block, config, data)
Function to report network design
- Parameters:
model_block – pyomo network block
config (dict) – dict containing model configuration
data (dict) – dict containing model information
h5_group – h5 group to write to
- write_results_netw_operation(h5_group, model_block)
Function to report network operation
- Parameters:
model_block – pyomo network block
h5_group – h5 group to write to
- class Electricity(netw_data: dict)
Network with electricity as carrier
This network type resembles a network in which the carrier is electricity
Arc Block declaration
Each arc represents a connection between two nodes, and is thus indexed by ( node_from, node_to). For each arc, the following components are defined. Each variable is indexed by the timestep \(t\) (here left out for convenience).
Constraint definitions:
Network constraint declarations This part calculates variables for all respective nodes.
netw_emissions equal to zero
netw_consumption equal to zero
- fit_network_performance()
Fits network performance (bounds and coefficients).
- class Simple(netw_data: dict)
Network with no specific carrier
This network type resembles a network in which the carrier is not specified.
Constraint definitions:
Network constraint declarations This part calculates variables for all respective nodes.
netw_emissions equal to zero
netw_consumption equal to zero
- fit_network_performance()
Fits network performance (bounds and coefficients).