Minimum Working Examples

create_mwe

Create a minimum working example using oemof.

create_star

Create a star like energy system using the oemof library.

emission_objective

Create a small working example using oemof.

undeclared_emission_objective

Create a minimum working example using oemof.

Meaningful working Examples

Note

Yet to come!

Full Fledged Use Case Wrappers

create_commitment_scenario

Create a model of a generic component based energy system using oemof.

create_expansion_scenario

Create a model of a generic component based energy system using oemof.

py_hard

py_hard is a tessif module for giving examples on how to create an oemof energy system.

It collects minimum working examples, meaningful working examples and full fledged use case wrappers for common scenarios.

tessif.examples.data.omf.py_hard.create_mwe(directory=None, filename=None)[source]

Create a minimum working example using oemof.

Creates a simple energy system simulation to potentially store it on disc in directory as filename

Parameters:
  • directory (str, default=None) –

    String representing of the path the created energy system is dumped to. Passed to dump().

    Will be joined with filename.

    If set to None (default) tessif.frused.paths.write_dir/omf will be the chosen directory.

  • filename (str, default=None) –

    dump() the energy system using this name.

    If set to None (default) filename will be mwe.oemof.

Returns:

optimized_es – Energy system carrying the optimization results.

Return type:

EnergySystem

Examples

Using create_mwe() to quickly access an optimized oemof energy system to use for doctesting, or trying out this frameworks utilities. (For a step by step explanation see Minimum Working Example):

>>> import tessif.examples.data.omf.py_hard as omf_py
>>> optimized_es = omf_py.create_mwe()
tessif.examples.data.omf.py_hard.create_star(directory=None, filename=None)[source]

Create a star like energy system using the oemof library.

Creates a simple energy system simulation to potentially store it on disc in directory as filename.

Usefull for testing behaviour of nodes with more than 1 inflow and outflow.

Parameters:
  • directory (str, default=None) –

    String representing of the path the created energy system is dumped to. Passed to dump().

    Will be joined with filename.

    If set to None (default) tessif.frused.paths.write_dir/omf will be the chosen directory.

  • filename (str, default=None) –

    dump() the energy system using this name.

    If set to None (default) filename will be star.oemof.

Returns:

optimized_es – Energy system carrying the optimization results.

Return type:

EnergySystem

Examples

Using create_star() to quickly access an optimized oemof energy system to use for doctesting, or trying out this frameworks utilities. (For a step by step explanation see Minimum Working Example):

>>> import tessif.examples.data.omf.py_hard as omf_py
>>> optimized_es = omf_py.create_star()
tessif.examples.data.omf.py_hard.emission_objective(directory=None, filename=None)[source]

Create a small working example using oemof. Optimizing it for costs and keeping the total emissions below an emission objective.

Creates a simple energy system simulation to potentially store it on disc in directory as filename

Parameters:
  • directory (str, default=None) –

    String representing of the path the created energy system is dumped to. Passed to dump().

    Will be joined with filename.

    If set to None (default) tessif.frused.paths.write_dir/omf will be the chosen directory.

  • filename (str, default=None) –

    dump() the energy system using this name.

    If set to None (default) filename will be mwe.oemof.

Returns:

optimized_es – Energy system carrying the optimization results.

Return type:

EnergySystem

Examples

Using emission_objective() to quickly access an optimized oemof energy system to use for doctesting, or trying out this frameworks utilities.

(For a step by step explanation on how to create an oemof minimum working example see Minimum Working Example):

>>> import tessif.examples.data.omf.py_hard as omf_py
>>> optimized_es = omf_py.emission_objective()

Conduct the post processing:

>>> import tessif.transform.es2mapping.omf as post_process_oemof
>>> global_resultier = post_process_oemof.IntegratedGlobalResultier(
...     optimized_es)
>>> load_resultier = post_process_oemof.LoadResultier(optimized_es)

And access some post processed results:

>>> import pprint
>>> pprint.pprint(global_resultier.global_results)
{'capex (ppcd)': 0.0,
 'costs (sim)': 110.0,
 'emissions (sim)': 30.0,
 'opex (ppcd)': 110.0}
>>> for load_results in load_resultier.node_load.values():
...     print(load_results)
Power Line           Renewable  Transformer  Demand
1990-07-13 00:00:00       -0.0        -10.0    10.0
1990-07-13 01:00:00       -0.0        -10.0    10.0
1990-07-13 02:00:00       -0.0        -10.0    10.0
1990-07-13 03:00:00      -10.0         -0.0    10.0
Demand               Power Line
1990-07-13 00:00:00       -10.0
1990-07-13 01:00:00       -10.0
1990-07-13 02:00:00       -10.0
1990-07-13 03:00:00       -10.0
Renewable            Power Line
1990-07-13 00:00:00         0.0
1990-07-13 01:00:00         0.0
1990-07-13 02:00:00         0.0
1990-07-13 03:00:00        10.0
CBET                       CBE  Transformer
1990-07-13 00:00:00 -23.809524    23.809524
1990-07-13 01:00:00 -23.809524    23.809524
1990-07-13 02:00:00 -23.809524    23.809524
1990-07-13 03:00:00  -0.000000     0.000000
CBE                       CBET
1990-07-13 00:00:00  23.809524
1990-07-13 01:00:00  23.809524
1990-07-13 02:00:00  23.809524
1990-07-13 03:00:00   0.000000
Transformer               CBET  Power Line
1990-07-13 00:00:00 -23.809524        10.0
1990-07-13 01:00:00 -23.809524        10.0
1990-07-13 02:00:00 -23.809524        10.0
1990-07-13 03:00:00  -0.000000         0.0

See user’s guide on Secondary Objectives for more on this example.

tessif.examples.data.omf.py_hard.undeclared_emission_objective()[source]

Create a minimum working example using oemof. Optimizing it for costs and keeping the total emissions below an emission objective.

This energy system however however does not store the emission results back into the actual energy system (compared to emission_objective()).

Designed to test out the automated post processing of global constraints using tessif.simualte.omf_from_es().

Returns:

unoptimized_es – Energy system on which no simulation/optimization has been performed

Return type:

EnergySystem

Examples

Using emission_objective() to quickly access an unoptimized oemof energy system to use for doctesting, or trying out this frameworks utilities.

(For a step by step explanation on how to create an oemof minimum working example see Minimum Working Example):

>>> import tessif.examples.data.omf.py_hard as omf_py
>>> unoptimized_es = omf_py.undeclared_emission_objective()
>>> print(hasattr(unoptimized_es, 'global_constraints'))
False

Conduct the simulation:

>>> import tessif.simulate as simulate
>>> optimized_es = simulate.omf_from_es(unoptimized_es)

And the post processing:

>>> import tessif.transform.es2mapping.omf as post_process_oemof
>>> global_resultier = post_process_oemof.IntegratedGlobalResultier(
...     optimized_es)
>>> import pprint
>>> pprint.pprint(global_resultier.global_results)
{'capex (ppcd)': 0.0,
 'costs (sim)': 80.0,
 'emissions (sim)': 40.0,
 'opex (ppcd)': 80.0}

Note how their are no emisison results, since the emission objective was not declared for tessif to understand it.

tessif.examples.data.omf.py_hard.create_commitment_scenario(periods=3, directory=None, filename=None)[source]

Create a model of a generic component based energy system using oemof.

Parameters:
  • periods (int, default=3) – Number of time steps of the evaluated timeframe (one time step is one hour)

  • directory (str, default=None) –

    String representing of the path the created energy system is dumped to. Passed to dump().

    Will be joined with filename.

    If set to None (default) tessif.frused.paths.write_dir/omf will be the chosen directory.

  • filename (str, default=None) –

    dump() the energy system using this name.

    If set to None (default) filename will be commitment_scenario.oemof.

Returns:

optimized_es – Energy system carrying the optimization results.

Return type:

EnergySystem

Examples

Using create_commitment_scenario() to quickly access an optimized oemof energy system to use for doctesting, or trying out this frameworks utilities. (For a step by step explanation see Minimum Working Example):

>>> import tessif.examples.data.omf.py_hard as omf_py
>>> optimized_es = omf_py.create_commitment_scenario()
tessif.examples.data.omf.py_hard.create_expansion_scenario(periods=3, directory=None, filename=None)[source]

Create a model of a generic component based energy system using oemof. Basically the same energy system as create_commitment_scenario() but with expansions and emission constraint.

Parameters:
  • periods (int, default=3) – Number of time steps of the evaluated timeframe (one time step is one hour)

  • directory (str, default=None) –

    String representing of the path the created energy system is dumped to. Passed to dump().

    Will be joined with filename.

    If set to None (default) tessif.frused.paths.write_dir/omf will be the chosen directory.

  • filename (str, default=None) –

    dump() the energy system using this name.

    If set to None (default) filename will be expansion_scenario.oemof.

Returns:

optimized_es – Energy system carrying the optimization results.

Return type:

EnergySystem

Examples

Using create_expansion_scenario() to quickly access an optimized oemof energy system to use for doctesting, or trying out this frameworks utilities. (For a step by step explanation see Minimum Working Example):

>>> import tessif.examples.data.omf.py_hard as omf_py
>>> optimized_es = omf_py.create_expansion_scenario()