zen_garden.model.element

Class defining a standard Element. Contains methods to add parameters, variables and constraints to the optimization problem. Parent class of the Carrier and Technology classes. The class takes the concrete optimization model as an input.

Classes

Element(element, optimization_setup)

Class defining a standard Element.

GenericRule(optimization_setup)

This class implements a generic rule for the model, which can be used to init the other rules of the technologies and carriers.

class zen_garden.model.element.Element(element: str, optimization_setup)

Class defining a standard Element.

__init__(element: str, optimization_setup)

Initialization of an element.

Parameters:
  • element – element that is added to the model

  • optimization_setup – The OptimizationSetup the element is part of

classmethod append_on_off_modeled(element, optimization_setup, index)

Checks if the on-off-behavior (min-load) of a technology needs to be modeled.

Parameters:
  • element – technology in model

  • optimization_setup – The OptimizationSetup the element is part of

  • index – index to check

Return model_on_off:

Bool indicating if on-off-behavior needs to be modeled

classmethod append_set_capex_index(element, optimization_setup, index)

Checks if the capex of a technology needs to be modeled as pwa or linear.

Parameters:
  • element – technology in model

  • optimization_setup – The OptimizationSetup the element is part of

  • index – index to check

Return model_capex:

Bool indicating if capex must be modeled as pwa or linear

classmethod check_on_off_modeled(tech, optimization_setup)

Classmethod checks if on-off-behavior of a technology needs to be modeled.

If the technology has a minimum load of 0 for all nodes and time steps, and all dependent carriers have a lower bound of 0 (only for conversion technologies modeled as pwa), then on-off-behavior is not necessary to model.

Parameters:
  • tech – technology in model

  • optimization_setup – The OptimizationSetup the element is part of

Return model_on_off:

Bool indicating if on-off-behaviour needs to be modeled

classmethod construct_constraints(optimization_setup)

Constructs the Constraints of the class <Element>.

Parameters:

optimization_setup – The OptimizationSetup the element is part of

classmethod construct_model_components(optimization_setup)

Constructs the model components of the class <Element>.

Parameters:

optimization_setup – The OptimizationSetup the element is part of

classmethod construct_params(optimization_setup)

Constructs the Params of the class <Element>.

Parameters:

optimization_setup – The OptimizationSetup the element is part of

classmethod construct_sets(optimization_setup)

Constructs the Sets of the class <Element>.

Parameters:

optimization_setup – The OptimizationSetup the element is part of

classmethod construct_vars(optimization_setup)

Constructs the Vars of the class <Element>.

Parameters:

optimization_setup – The OptimizationSetup the element is part of

classmethod create_custom_set(list_index, optimization_setup)

Creates custom set for model component.

Parameters:
  • list_index – list of names of indices

  • optimization_setup – The OptimizationSetup the element is part of

Returns:

list_index: list of names of indices

get_input_path()

Get input path where input data is stored input_path.

static handle_existing_set(index, element, sets, list_sets)

Handles existing sets in the model. Returns True if handled, False if unknown.

Parameters:
  • index – index to handle

  • element – element to handle

  • sets – sets of the optimization setup

  • list_sets – list of sets to append

static handle_set_capacity_types_index(element, sets, optimization_setup, list_sets)

Handles the set_capacity_types index for the custom set.

Parameters:
  • element – element to handle

  • sets – sets of the optimization setup

  • optimization_setup – The OptimizationSetup the element is part of

  • list_sets – list of sets to append

static handle_set_location_index(element, sets, list_sets)

Handles the set_location index for the custom set.

Parameters:
  • element – element to handle

  • sets – sets of the optimization setup

  • list_sets – list of sets to append

store_scenario_dict()

Stores scenario dict in each data input object.

class zen_garden.model.element.GenericRule(optimization_setup)

This class implements a generic rule for the model, which can be used to init the other rules of the technologies and carriers.

__init__(optimization_setup)

Constructor for generic rule.

Parameters:

optimization_setup – The optimization setup to use for the setup

align_and_mask(expr, mask)

Aligns and masks expr.

Parameters:
  • expr – expression to align and mask

  • mask – mask to apply

get_flow_expression_conversion(techs, nodes, factor=None, rename=False)

Return the flow expression for conversion technologies.

get_flow_expression_storage(rename=True)

Return the flow expression for storage technologies.

get_power2energy_time_step_array()

Returns array with power2energy time steps.

get_previous_storage_time_step_array()

Returns array with storage time steps and previous storage time steps.

get_storage2year_time_step_array()

Returns array with storage2year time steps.

get_year_time_step_array(storage=False)

Returns array with year and time steps of each year.

Parameters:

storage – boolean indicating if object is a storage object

get_year_time_step_duration_array()

Returns array with year and duration of time steps of each year.

map_and_expand(array, mapping)

Maps and expands array.

Parameters:
  • array – xarray to map and expand

  • mapping – pd.Series with mapping values