omf
Api
Transform an ES dict to an oemof |
Internal Functionalities
Create the energy system nodes. |
|
Transform an energy system object dict into a ready to pass flow parameter dict. |
|
Try inferring the timeindex from the energy system dictionairy. |
omf is a tessif module to transform
energy system data represented as mapping like it
is returned by ie: parse.
- tessif.transform.mapping2es.omf.parse_ideal_flow_params(es_object)[source]
Transform an energy system object dict into a ready to pass ideal flow parameter dict.
Read-in the dictionary representation of an energy system object to extract ideal optimization flow parameters and transform them into a keyword argument dictionary ready to provide to
oemof.solph.network.Flow.A flow is regarded as ‘ideal’ in this context as a flow that has no ‘physical’ restriction, i.e. no gradient, no maximum, no minimum, etc. Available ideal flow parameters are the following: (see also
oemof.solph.network.Flow)oemof.solph.network.Flow.variable_costsemissions
Note
An ideal flow can still be subject to an ‘expansion_plan’ problem. The respective parsing however is handled in
parse_invest_flow_params().- Parameters:
es_object¶ (
pandas.Series) –Series representation of the energy system node of which the timeseries is to be parsed.
(Usually accessed by string keying the columns of a
pandas.DataFramewhich in themselves are keyed by atimeseries-likekey inside an energy system dictionary which is usually returned by one of thetessif.parsefunctionalities)- Returns:
ideal_flow_parameters – Dictionary having keyword-value pairings ready to pass to
oemof.solph.network.Flow.- Return type:
- tessif.transform.mapping2es.omf.parse_linear_flow_params(es_object)[source]
Transform an energy system object dict into a ready to pass linear flow parameter dict.
Read-in the dictionary representation of an energy system object to extract linear optimization flow parameters and transform them into a keyword argument dictionary ready to provide to
oemof.solph.network.Flow.A flow is regarded as ‘linear’ in this context as a flow that only has linear ‘physical’ restriction, ie. gradient, maximum, minimum, and is otherwise characterized by b actual or nominal values. Available linear flow parameters are the following: (see also
oemof.solph.network.Flow)oemof.solph.network.Flow.nominal_valueoemof.solph.network.Flow.summed_minoemof.solph.network.Flow.summed_maxoemof.solph.network.Flow.minoemof.solph.network.Flow.maxoemof.solph.network.Flow.positive_gradientoemof.solph.network.Flow.negative_gradientoemof.solph.network.Flow.nominal_value
Note
A linear flow can still be subject to an ‘expansion_plan’ problem. The respective parsing however is handled in
parse_invest_flow_params().- Parameters:
es_object¶ (
pandas.Series) –Series representation of the energy system node of which the timeseries is to be parsed.
(Usually accessed by string keying the columns of a
pandas.DataFramewhich in themselves are keyed by atimeseries-likekey inside an energy system dictionary which is usually returned by one of thetessif.parsefunctionalities)- Returns:
linear_flow_parameters – Dictionary having keyword-value pairings ready to pass to
oemof.solph.network.Flow.- Return type:
- tessif.transform.mapping2es.omf.parse_invest_flow_params(es_object)[source]
Transform an energy system object dict into a ready to pass invest flow parameter dict.
Read-in the dictionary representation of an energy system object to extract investment optimization flow parameters and transform them into a keyword argument dictionary ready to provide to
oemof.solph.network.Flow.A flow is regarded as ‘investment’ in this context as a flow that has no nominal value (aka installed capacity) given as input. But rather one of which the installed capacity is subject to the optimization problem. Available investment flow parameters are the following: (see also
oemof.solph.options.Investment)oemof.solph.options.Investment.maximumoemof.solph.options.Investment.minimumoemof.solph.options.Investment.ep_costsoemof.solph.options.Investment.existing
Note
Any non-convex flow can be subject to an investment flow.
- Parameters:
es_object¶ (
pandas.Series) –Series representation of the energy system node of which the timeseries is to be parsed.
(Usually accessed by string keying the columns of a
pandas.DataFramewhich in themselves are keyed by atimeseries-likekey inside an energy system dictionary which is usually returned by one of thetessif.parsefunctionalities)- Returns:
investment_flow_parameters – Dictionary having keyword-value pairings ready to pass to
oemof.solph.network.Flow.- Return type:
- tessif.transform.mapping2es.omf.parse_nonconvex_flow_params(es_object)[source]
- Transform an energy system object dict into a ready to pass NonConvex
flow parameter dict.
Read-in the dictionary representation of an energy system object to extract NonConvex optimization flow parameters and transform them into a keyword argument dictionary ready to provide to
oemof.solph.network.Flow.A flow is regarded as ‘NonConvex’ in this context as a flow that has mixed integer linear ‘physical’ restrictions i.e, able to turn ‘off’, but having a minimum greater than 0. Available nonconvex flow parameters are the following: (see also
oemof.solph.options.NonConvex)oemof.solph.options.NonConvex.startup_costsoemof.solph.options.NonConvex.shutdown_costsoemof.solph.options.NonConvex.activity_costsoemof.solph.options.NonConvex.minimum_uptimeoemof.solph.options.NonConvex.minimum_downtimeoemof.solph.options.NonConvex.maximum_startupsoemof.solph.options.NonConvex.maximum_shutdowns'oemof.solph.options.NonConvex.initial_status
Note
Any non investment flow can be subject to a nonconvex flow.
- Parameters:
es_object¶ (
pandas.Series) –Series representation of the energy system node of which the timeseries is to be parsed.
(Usually accessed by string keying the columns of a
pandas.DataFramewhich in themselves are keyed by atimeseries-likekey inside an energy system dictionary which is usually returned by one of thetessif.parsefunctionalities)- Returns:
nonconvex_flow_parameters – Dictionary having keyword-value pairings ready to pass to
oemof.solph.network.Flow.- Return type:
- tessif.transform.mapping2es.omf.parse_fixed_flow_params(es_object)[source]
Transform an energy system object dict into a ready to pass fixed flow parameter dict.
Read-in the dictionary representation of an energy system object to extract fixed flow parameters and transform them into a keyword argument dictionary ready to provide to
oemof.solph.network.Flow.A flow is regarded as ‘fixed’ in this context as a flow that is set outside of the optimization flow problem, i.e the value(s) for
oemof.solph.network.Flow.fixare read-in/hardcoded before the actual Flow object initialization takes place. During the optimization the flow is then fixed tofix\(\cdot\)nominal_value.Available ideal flow parameters are the following: (see also
oemof.solph.network.Flow)oemof.solph.network.Flow.fixemissions
Note
A fixed flow can still be subject to an ‘expansion_plan’ problem. The respective parsing however is handled in
parse_invest_flow_params().- Parameters:
es_object¶ (
pandas.Series) –Series representation of the energy system node of which the timeseries is to be parsed.
(Usually accessed by string keying the columns of a
pandas.DataFramewhich in themselves are keyed by atimeseries-likekey inside an energy system dictionary which is usually returned by one of thetessif.parsefunctionalities.- Returns:
fixed_flow_parameters – Dictionary having keyword-value pairings ready to pass to
oemof.solph.network.Flow.- Return type:
- tessif.transform.mapping2es.omf.parse_flow_parameters(es_object={}, timeseries={})[source]
Transform an energy system object dict into a ready to pass flow parameter dict.
Read-in the dictionary representation of an energy system object to extract fixed flow parameters and transform them into a keyword argument dictionary ready to provide to
oemof.solph.network.Flow.- Parameters:
es_object¶ (
pandas.Series) –Series representation of the energy system node of which the timeseries is to be parsed.
(Usually accessed by string keying the columns of a
pandas.DataFramewhich in themselves are keyed by atimeseries-likekey inside an energy system dictionary which is usually returned by one of thetessif.parsefunctionalities)timeseries¶ (dict) – Dictionary containing a string of the represented kind of timeseries (i.e.
min,max,fix,variable_costseeoemof.solph.network.Flow) as key and the corresponding timeseries as sequence as value.
- Returns:
parsed_flow_parameters – Dictionary having keyword-value pairings ready to pass to
oemof.solph.network.Flow.- Return type:
- tessif.transform.mapping2es.omf.parse_timeseries(es_object, energy_system_dict)[source]
Create a timeseries mapping for the
es_objectby looking up its data inside theenergy_system_dict.Note
Timeseries data is expected to be string keyed like:
{ES_OBJECT}{SEPERATOR}{TIMESERIES_PARAMETER}.
So for example:
PV.max Onshore.fix
Where SEPERATOR is the
timeseries_seperator.- Parameters:
es_object¶ (
pandas.Series) –Series representation of the energy system node of which the timeseries is to be parsed.
(Usually accessed by string keying the columns of a
pandas.DataFramewhich in themselves are keyed by atimeseries-likekey inside theenergy_system_dict.energy_system_dict¶ (dict) – Dictionary of
pandas.DataFrameobjects keyed strings. With the key strings representing energy system components. Usually returned by something like thetessif.parsefunctionalities.
- Returns:
timeseries – Dictionary containing a string of the represented kind of timeseries (i.e.
min,max,fix,variable_costseeoemof.solph.network.Flow) as key and the corresponding timeseries as sequence as value.- Return type:
- tessif.transform.mapping2es.omf.generate_busses(energy_system_dict)[source]
Generate
Busobjects out of theenergy_system_dict.- Parameters:
energy_system_dict¶ (dict) – Dictionary of
pandas.DataFrameobjects keyed by strings. With the key strings representing energy system components. Usually returned by something like thetessif.parsefunctionalities.- Returns:
generated_busses – Generator object yielding the parsed
bus objects.- Return type:
- tessif.transform.mapping2es.omf.generate_sources(energy_system_dict, bus_dict)[source]
Generate
Sourceobjects out of theenergy_system_dictconnecting to theBusobjects inbus_dict- Parameters:
energy_system_dict¶ (dict) – Dictionary of
pandas.DataFrameobjects keyed by strings. With the key strings representing energy system components. Usually returned by something like thetessif.parsefunctionalities.bus_dict¶ (dict) – Dictionary of
Busobjects keyed by theirstr(label)representation.
- Returns:
generated_sources – Generator object yielding the parsed
source objects.- Return type:
- tessif.transform.mapping2es.omf.generate_sinks(energy_system_dict, bus_dict)[source]
Generate
Sinkobjects out of theenergy_system_dictconnecting to theBusobjects inbus_dict- Parameters:
energy_system_dict¶ (dict) – Dictionary of
pandas.DataFrameobjects keyed by strings. With the key strings representing energy system components. Usually returned by something like thetessif.parsefunctionalities.bus_dict¶ (dict) – Dictionary of
Busobjects keyed by theirstr(label)representation.
- Returns:
generated_sinks – Generator object yielding the parsed
sink objects.- Return type:
- tessif.transform.mapping2es.omf.generate_mimo_transformers(energy_system_dict, bus_dict)[source]
Generate multiple-input multiple output
Transformerobjects out of theenergy_system_dictconnecting to theBusobjects inbus_dictNote
Mimo transformer parsing assumes zero-based numbering! and are parsed based on respective
spellings.Notably:
- Parameters:
energy_system_dict¶ (dict) – Dictionary of
pandas.DataFrameobjects keyed by strings. With the key strings representing energy system components. Usually returned by something like thetessif.parsefunctionalities.bus_dict¶ (dict) – Dictionary of
Busobjects keyed by theirstr(label)representation.
- Returns:
generated_transformers – Generator object yielding the parsed
transformer objects.- Return type:
- tessif.transform.mapping2es.omf.generate_sito_flex_transformers(energy_system_dict, bus_dict)[source]
Generate single input two output
ExtractionTurbineCHPobjects out of theenergy_system_dictconnecting to theBusobjects inbus_dictNote
Sito flex transformer parsing assumes zero-based numbering! for the outflows and are parsed based on respective
spellings.Notably:
- Parameters:
energy_system_dict¶ (dict) – Dictionary of
pandas.DataFrameobjects keyed by strings. With the key strings representing energy system components. Usually returned by something like thetessif.parsefunctionalities.bus_dict¶ (dict) – Dictionary of
Busobjects keyed by theirstr(label)representation.
- Returns:
generated_sito_flex_transformers – Generator object yielding the parsed
Single Input Two Output Flexible Transformer objects.- Return type:
- tessif.transform.mapping2es.omf.generate_generic_chps(energy_system_dict, bus_dict, timeindex=None)[source]
Generate single input two output
GenericCHPobjects out of theenergy_system_dictconnecting to theBusobjects inbus_dictNote
This might become a convenience wrapper interface to parameterize the objects more intuitively.
Following mapping is used for parsing:
parameter_name_mapping = { 'minimum_fuelgas_losses': 'H_L_FG_share_min', 'maximum_fuelgas_losses': 'H_L_FG_share_max', 'maximum_power': 'P_max_woDH', 'minimum_power': 'P_min_woDH', 'maximum_efficiency': 'Eta_el_max_woDH', 'minimum_efficiency': 'Eta_el_min_woDH', 'minimum_heat': 'Q_CW_min', 'power_loss_index': 'Beta',}
Where the respective
spellings(left hand side) are mapped to theGenericCHPparameters (right hand side)- Parameters:
energy_system_dict¶ (dict) – Dictionary of
pandas.DataFrameobjects keyed by strings. With the key strings representing energy system components. Usually returned by something like thetessif.parsefunctionalities.bus_dict¶ (dict) – Dictionary of
Busobjects keyed by theirstr(label)representation.timeindex¶ (
DatetimeIndex, default=None) – Representation of the time frame and resolution used in the simulation. If none, the timeindex is tried to be inferred fromenergy_system_dictusinginfer_timeindex().
- Returns:
generated_generic_chps – Generator object yielding the parsed
generic chp objects.- Return type:
- tessif.transform.mapping2es.omf.generate_siso_nonlinear_transformers(energy_system_dict, bus_dict)[source]
Generate
OffsetTransformerobjects out of theenergy_system_dictconnecting to theBusobjects inbus_dict- Parameters:
energy_system_dict¶ (dict) – Dictionary of
pandas.DataFrameobjects keyed by strings. With the key strings representing energy system components. Usually returned by something like thetessif.parsefunctionalities.bus_dict¶ (dict) – Dictionary of
Busobjects keyed by theirstr(label)representation.
- Returns:
generated_siso_nonlinear_transformers – Generator object yielding the parsed
offset transformer objects.- Return type:
- tessif.transform.mapping2es.omf.generate_generic_storages(energy_system_dict, bus_dict)[source]
Generate
GenericStorageobjects out of theenergy_system_dictconnecting to theBusobjects inbus_dict- Parameters:
energy_system_dict¶ (dict) – Dictionary of
pandas.DataFrameobjects keyed by strings. With the key strings representing energy system components. Usually returned by something like thetessif.parsefunctionalities.bus_dict¶ (dict) – Dictionary of
Busobjects keyed by theirstr(label)representation.
- Returns:
generated_generic_storages – Generator object yielding the parsed
offset storage objects.- Return type:
- tessif.transform.mapping2es.omf.create_nodes(es_object_types, info_tag='Info', bus_tag='Grid', renewables_tag='Renewable', chp_tag='CHP', powerplant_tag='PowerPlant', heatplant_tag='HeatPlant', commodity_tag='Commodity', demand_tag='Demand', timeseries_tag='Timeseries')[source]
Create the energy system nodes.
- tessif.transform.mapping2es.omf.infer_timeindex(energy_system_dictionary)[source]
Try inferring the timeindex from the energy system dictionairy.
The timeframe to be simulated is referred to here as “timeindex”.
- Parameters:
energy_system_dictionary¶ (dict) – Dictionairy containing the energy system data. Typically returned by one of the
tessif.parsefunctionalities- Returns:
timeindex – The time frame inferred from the energy system dictionairy.
- Return type:
Example
Setting
spellings.get_from'slogging level to debug for decluttering doctest output:>>> from tessif.frused import configurations >>> configurations.spellings_logging_level = 'debug'
Read in the oemof standard energy system and transform it:
>>> import os >>> from tessif.frused.paths import example_dir >>> from tessif.parse import xl_like >>> import tessif.transform.mapping2es.omf as tomf >>> idx = tomf.infer_timeindex(xl_like( ... os.path.join( ... example_dir, 'data', 'omf', 'xlsx', 'energy_system.xlsx'))) >>> print(idx) DatetimeIndex(['2016-01-01 00:00:00', '2016-01-01 01:00:00', '2016-01-01 02:00:00', '2016-01-01 03:00:00', '2016-01-01 04:00:00'], dtype='datetime64[ns]', freq='H')
- tessif.transform.mapping2es.omf.transform(energy_system_dictionary, **kwargs)[source]
Transform an ES dict to an oemof
EnergySystem- Parameters:
energy_system_dictionary¶ (dict) – Dictionairy containing the energy system data. Typically returned by one of the
tessif.parsefunctionalitiestimeindex¶ (
DatetimeIndex, default=None) – Representation of the time frame and resolution If not stated it is tried to beinferred.global_constraints¶ (dict, default={'emissions': float('+inf')}) – Dictionairy of constraint values mapped to constraint names.
kwargs¶ – Key word arguments are passed to
add()
- Returns:
energy_system – The dictionairy transformed oemof energy system, ready for simulation.
- Return type:
EnergySystem
Example
Setting
spellings.get_from'slogging level to debug for decluttering doctest output:>>> from tessif.frused import configurations >>> configurations.spellings_logging_level = 'debug'
Read in the oemof standard energy system and transform it:
>>> import os >>> from tessif.frused.paths import example_dir >>> from tessif.parse import xl_like >>> import tessif.transform.mapping2es.omf as tomf >>> es = tomf.transform(xl_like( ... os.path.join( ... example_dir, 'data', 'omf', 'xlsx', 'energy_system.xlsx'))) >>> print(type(es)) <class 'oemof.solph.network.energy_system.EnergySystem'>
>>> print(*[node for node in es.nodes if str(node.label) == 'Power Grid']) Power Grid
Read in an ods version instead:
>>> es = tomf.transform(xl_like( ... os.path.join( ... example_dir, 'data', 'omf', 'xlsx', 'energy_system.ods'), ... engine='odf'))