zen_garden.model.energy_system

Class defining a standard EnergySystem. Contains methods to construct the energy system from the given input data and that defines the variables, parameters and constraints which apply to the Energy System. The class takes the abstract optimization model as an input.

Classes

EnergySystem(optimization_setup)

Class defining a standard energy system.

EnergySystemRules(optimization_setup)

This class takes care of the rules for the EnergySystem.

class zen_garden.model.energy_system.EnergySystem(optimization_setup)

Class defining a standard energy system.

__init__(optimization_setup)

Initialization of the energy_system.

Parameters:

optimization_setup – The OptimizationSetup of the EnergySystem class

calculate_connected_edges(node, direction: str)

Calculates connected edges going in or going out.

Parameters:
  • node – current node, connected by edges

  • direction – direction of edges, either in or out. In: node = endnode, out: node = startnode

Returns:

_set_connected_edges: list of connected edges

calculate_edges_from_nodes()

Calculates set_nodes_on_edges from set_nodes.

Returns:

set_nodes_on_edges: dict with edges and corresponding nodes

calculate_haversine_distances_from_nodes()

Computes the distance (in km) between two nodes.

The Haversine function is used to compute the distance in kilometers based on

their lon lat coordinates.

Returns:

dict containing all edges along with their distances

calculate_reversed_edge(edge)

Calculates the reversed edge corresponding to an edge.

Parameters:

edge – input edge

Returns:

_reversed_edge: edge corresponding to the reversed direction of edge

construct_constraints()

Constructs the constraints of the class <EnergySystem>.

construct_objective()

Constructs the pe.Objective of the class <EnergySystem>.

construct_params()

Constructs the pe.Params of the class <EnergySystem>.

construct_sets()

Constructs the pe.Sets of the class <EnergySystem>.

construct_vars()

Constructs the pe.Vars of the class <EnergySystem>.

set_technology_of_carrier(technology, list_technology_of_carrier)

Appends technology to carrier in dict_technology_of_carrier.

Parameters:
  • technology – name of technology in model

  • list_technology_of_carrier – list of carriers correspondent to technology

store_input_data()

Retrieves and stores input data for EnergySystem as attributes.

class zen_garden.model.energy_system.EnergySystemRules(optimization_setup)

This class takes care of the rules for the EnergySystem.

__init__(optimization_setup)

Inits the constraints for a given energy system.

Parameters:

optimization_setup – The OptimizationSetup of the EnergySystem class

constraint_carbon_emissions_annual()

Add up all carbon emissions from technologies and carriers.

\[E_y = E_{y,\mathcal{H}} + E_{y,\mathcal{C}}\]

\(E_{y,\mathcal{H}}\): carbon emissions from technologies in year \(y\)

\(E_{y,\mathcal{C}}\): carbon emissions from carriers in year :math

constraint_carbon_emissions_annual_limit()

Time dependent carbon emissions limit from technologies and carriers.

\[E_y\leq e_y\]
constraint_carbon_emissions_annual_overshoot()

Enforces zero annual overshoot if price for annual overshoot is inf.

ensures annual carbon emissions overshoot is zero when carbon emissions price for annual overshoot is inf.

\[\text{if } \mu^o =\infty \text{,then: } E_y^\mathrm{o} = 0\]

\(E_y^\mathrm{o}\): overshoot of the annual carbon emissions limit of energy system

\(\mu^o\): carbon price for annual overshoot

constraint_carbon_emissions_budget()

Carbon emissions budget of whole time horizon. The prediction extends until the end of the horizon, i.e., last optimization time step plus the current carbon emissions until the end of the horizon.

\[E_y^\mathrm{cum} + (dy-1) E_y - E_y^\mathrm{bo} \leq e^b\]

\(E_y^\mathrm{cum}\): cumulative carbon emissions of energy system in year \(y\)

\(E_y\): annual carbon emissions of energy system in year \(y\)

\(E_y^\mathrm{bo}\): cumulative carbon emissions budget overshoot of energy system

\(e^b\): carbon emissions budget of energy system

constraint_carbon_emissions_budget_overshoot()

Enforces zero budget overshoot if price for budget overshoot is inf.

ensures carbon emissions overshoot of carbon budget is zero when carbon emissions price for budget overshoot is inf.

\[\text{if } \mu^{bo} =\infty \text{,then: }E_y^\mathrm{bo} = 0\]

\(E_y^\mathrm{bo}\): overshoot carbon emissions of energy system at the end of the time horizon

\(\mu^{bo}\): carbon price for budget overshoot

constraint_carbon_emissions_cumulative()

Cumulative carbon emissions over time.

\[\text{First planning period } y = y_0, \quad E_y^\mathrm{cum} = E_y\]
\[\text{Subsequent periods } y > y_0, \quad E_y^{cum} = E_{y-1}^{cum} + (dy-1)E_{y-1}+E_y\]

\(dy\): interval between planning periods

\(E_y\): annual carbon emissions in year \(y\)

\(E_y^{cum}\): cumulative carbon emissions in year \(y\)

constraint_cost_carbon_emissions_total()

Carbon cost associated with the carbon emissions of the system in each year.

\[OPEX_y^\mathrm{c} = E_y\mu + E_y^\mathrm{o}\mu^\mathrm{o}\]

\(OPEX_y^\mathrm{c}\): cost of carbon emissions in year \(y\)

\(E_y\): annual carbon emissions of energy system in year \(y\)

\(\mu\): carbon price

\(E_y^\mathrm{o}\): annual carbon emissions overshoot in year \(y\)

\(\mu^\mathrm{o}\): carbon price for annual overshoot

constraint_cost_total()

Add up all costs from technologies and carriers.

\[C_y = CAPEX_y + OPEX_y^\mathrm{t} + OPEX_y^\mathrm{c} + OPEX_y^\mathrm{e}\]

\(C_y\): total cost of energy system in year \(y\)

\(CAPEX_y\): annual capital expenditures in year \(y\)

\(OPEX_y^\mathrm{t}\): annual operational expenditures for operating technologies in year \(y\)

\(OPEX_y^\mathrm{c}\): annual operational expenditures for for importing and exporting carriers in year \(y\)

\(OPEX_y^\mathrm{e}\): annual operational expenditures for carbon emissions in year \(y\)

constraint_net_present_cost()

Discounts the annual capital flows to calculate the net_present_cost.

\[NPC_y = \sum_{i \in [0,dy(y))-1]} \left( \dfrac{1}{1+r} \right)^{\left(dy (y-y_0) + i \right)} C_y\]

\(NPC_y\): net present cost of energy system in year \(y\)

\(C_y\): total cost of energy system in year \(y\)

\(r\): discount rate

\(dy\): interval between planning periods

objective_total_carbon_emissions(model)

Objective function to minimize total emissions.

\[J = E^{\mathrm{cum}}_Y\]

\(E^{\mathrm{cum}}_Y\): cumulative carbon emissions at the end of the time horizon

Parameters:

model – optimization model

Returns:

total carbon emissions objective function

objective_total_cost(model)

Objective function to minimize the total net present cost.

\[J = \sum_{y\in\mathcal{Y}} NPC_y\]
Parameters:

model – optimization model

Returns:

net present cost objective function