optimize

Inputs

preprocessedstr

results/{scenario}/preprocessed: Path to preprocessed EnergyDatapackage containing elements, sequences and datapackage.json.

optimizedstr

results/{scenario}/optimized/ Target path to store dump of oemof.solph.Energysystem with optimization results and parameters.

logfilestr

results/{scenario}/{scenario}.log: path to logfile

Outputs

es.dump

oemof.solph.EnergySystem with results, meta-results and parameters

Description

Given an EnergyDataPackage, this script creates an oemof.solph.EnergySystem and an oemof.solph.Model, which is optimized.

The following constraints are added:

The EnergySystem with results, meta-results and parameters is saved.

optimize.add_electricity_gas_relation_constraints(model, relations)

Adds constraint equate_flows_by_keyword to model.

The components belonging to ‘electricity’ or ‘gas’ are selected by keywords. The keywords of components powered by gas start with config.settings.optimize.gas_key and such powered by electricity with config.settings.optimize.el_key, followed by carrier and region e.g. <GAS_KEY>-<carrier>-<region>.

Parameters:
  • model (oemof.solph.Model) – optmization model

  • relations (pd.DataFrame) – Contains electricity/gas relations in column ‘var_value’. Further contains at least columns ‘carrier’ and ‘region’.

optimize.add_output_parameters_to_bpchp(parameters, energysystem)

Adds keywords for electricity-gas relation constraint to backpressure CHPs.

This is necessary as oemof.tabular does not support output_parameters of these components, yet. The keywords are set as attributes of the output flow towards heat_bus.

Parameters:
  • parameters (pd.DataFrame) – Contains output_parameters of backpressure CHP scalars.

  • energysystem (oemof.solph.network.EnergySystem) – The energy system

optimize.drop_values_by_keyword(df, keyword='None')

drops row if var_value is None

optimize.get_additional_scalars()

Returns additional scalars as pd.DataFrame or None if file does not exist

optimize.get_bpchp_output_parameters(scalars)

Gets ‘output_parameters’ of backpressure CHPs from scalars and returns None if it is missing or None.

optimize.get_electricity_gas_relations(scalars)

Gets electricity/gas relations from scalars. Returns None if no relations are given.

Returns:

Contains rows of scalars with ‘var_name’ EL_GAS_RELATION. If no relation is given returns None.

Return type:

pd.DataFrame

optimize.get_emission_limit(scalars)

Gets emission limit from scalars and returns None if it is missing or None.