Transform
Tessif system model to pypsa system model transformation.
tessif_pypsa_0_19_3.transform is a tessif_pypsa_0_19_3 module
aggregating all the functionality for automatically transforming a
tessif system model into a
pypsa energy system.
- tessif_pypsa_0_19_3.transform.infer_pypsa_transformer_types(tessif_transformers, forced_links=None)[source]
Utility to infer how tessif transformers should be transformed into pypsa components.
Tessif transformerscan have singular or multiple outputs and therefor be both:Pypsa links (if #(outputs) > 1)
Pypsa generators (if #(inputs) == #(outputs) == 1)
For a tessif transformer being transformed into a pypsa link, one of the following has to be true:
Transformer.node_typeis found insidetessif.frused.spellings.combined_heat_powernumber of
Transformer.outputs> 1
On the other hand, for a tessif transformer beeing transformed into a pypsa generator, one of the following has to be true:
Transformer.node_typeis found insidetessif.frused.spellings.power_plantor insidetessif.frused.spellings.heat_plant.number of
Transformer.outputsequals number ofTransformer.inputsequals 1.
- Parameters
tessif_transformers¶ (Iterable) – Iterable of tessif transformers of which the appropriate transformation type is to be inferred.
forced_links¶ (Container, None, default=None) –
Container of uid representations of
tessif transformersto be transfrormed into pypsa links.
- Returns
inferred_transformers – Mapping of
Tessif transformeruids keyed either bylinksor bygenerators- Return type
- tessif_pypsa_0_19_3.transform.compute_unneeded_supply_chains(tessif_es, pypsa_generator_uids)[source]
Utility to compute unneeded tessif components uids.
Due to transforming certain
tessif transformersinto pypsa generators corresponding supply chains (usually atessif busand atessif source) are not needed and hence need to be removed, to allow succesfull optimization.- Parameters
tessif_es¶ (
tessif.model.energy_system.AbstractEnergySystem) – The tessif energy system of which thegeneratorsupply chains are to be removed.pypsa_generator_uids¶ (Iterable) – Iterable of
tessif transformersof which the corresponding supply chains need to be removed. Returned byinfer_pypsa_transformer_types()[‘generators’] by design.
- Returns
components_to_remove – Dictionairy of componend uid lists keyed by pypsa component type of components which are to be removed.
- Return type
- tessif_pypsa_0_19_3.transform.parse_flow_parameters(component, interface)[source]
Utility to parse flow related parameters from
Tessif componentsto Pypsa components- Parameters
- Returns
parsed_flow_parameters – Dictionairy representing the parsed flow parameters ready to be used as key word arguments for creating pypsa components.
- Return type
- Raises
ValueError: – A value error is raised in case a nominal_value (max flow_rate value) is requested to be infinit AND in addition to milp parameters. This is due to the fact that an infinit nominal value is parsed into an expansion problem because pypsa can not deal with infinity values. Which in turn causes conflicts in dealing with milp parameters.
- tessif_pypsa_0_19_3.transform.create_pypsa_busses(busses)[source]
Creates pypsa buses out of tessif busses.
- tessif_pypsa_0_19_3.transform.create_pypsa_generators_from_sources(sources, tessif_busses)[source]
Create pypsa generators out of tessif sources.
- Parameters
- Returns
Sequence of pypsa dictionairies representing the generator components representing tessif sources.
- Return type
class:~collections.abc.Sequence
Note
Tessif sources can have multiple outputs, pypsa generators not. So in case a tessif source requests to have multiple outputs, a singular pypsa generator is created for each output.
- tessif_pypsa_0_19_3.transform.create_pypsa_sinks(sinks, tessif_busses, timeseries='max')[source]
Create pypsa generators out of tessif sinks.
- Parameters
sinks¶ (Sequence) – Sequence of
tessif.model.components.Sinkobjects that are to be transformed into load objects.tessif_busses¶ (Sequence) – Sequence of
tessif.model.components.Busobjects present in the same energy system assources.timeseries¶ (str, ['max', 'min', 'avg']) –
String specifying how to handle timeseries values. Since pypsa loads can only handle fixed timeseries values (in contrast to time varying range of lower and upper load limits), a flag has to be stated how timeseries values are to be handled.
Must be one of:
max(default):flow_rate.maxis used, for setting the timeseries values.min(default):flow_rate.minis used, for setting the timeseries values.avg:The average of each time step between
flow_rate.min and flow_rate.maxis used.
- Returns
Sequence of pypsa dictionairies representing the load components representing tessif sinks.
- Return type
- tessif_pypsa_0_19_3.transform.create_pypsa_excess_sinks(sinks, tessif_busses)[source]
Create pypsa generators out of tessif sinks.
- Parameters
- Returns
Sequence of pypsa dictionairies representing the storage unit components representing tessif excess sinks.
- Return type
- tessif_pypsa_0_19_3.transform.create_pypsa_generators_from_transformers(transformers, tessif_busses)[source]
Create pypsa generators out of tessif transformers.
- Parameters
- Returns
Sequence of pypsa dictionairies representing the generator components representing tessif transformers.
- Return type
class:~collections.abc.Sequence
Note
Tessif transformers can have multiple outputs, pypsa generators not. So in case a tessif transformer requests to have multiple outputs, a singular pypsa generator is created for each output.
- tessif_pypsa_0_19_3.transform.create_pypsa_links_from_transformers(transformers, tessif_busses)[source]
Create pypsa links out of tessif transformers.
- Parameters
- Returns
Sequence of pypsa dictionairies representing the link components representing tessif transformers.
- Return type
class:~collections.abc.Sequence
Warning
In case of chp transformation pypsa uses the highest installed capacity as reference capacity to calculate outgoing flows using the respective conversion factors.
Make sure the conversion factors reflect the expected installed capacities. If target capacaties are 100 and 50, make sure conversion factors are of ration 2/1 (i.e 0.6 and 0.3).
- Raises
NotImplementedError – Raised if more than 1 input is used, because tessif can’t handle this case yet.
- tessif_pypsa_0_19_3.transform.create_pypsa_connectors(connectors, tessif_busses)[source]
Create pypsa links out of tessif connectors.
- Parameters
- Returns
Sequence of pypsa dictionairies representing the link components representing tessif connectors.
- Return type
class:~collections.abc.Sequence
Note
Transforming
tessif connectorsto pypsa links following compatibility issues are faced:Pypsa links are one-directional according to their efficiency calculations. For bidirectional tessif links to make sense, bidirectional pypsa links are set to an efficiency of 1.0.
Tessif connectors are not designed to constrain their flows, where as pypsa links are. Therefor pypsa links created from tessif connectors are parameterized as follows:
nominal capacity is extendable having no extension costs
specific min/max power flow is set to -1.0/1.0 respectively
flow specific costs are set to 0.0
- tessif_pypsa_0_19_3.transform.create_pypsa_storages(storages, tessif_busses)[source]
Create pypsa generators out of tessif storages.
- Parameters
- Returns
Sequence of pypsa dictionairies representing the storage components representing tessif storages.
- Return type
Note
Pypsa forces the ratio of capacity and output flow to be constant, even during expansion. Doing that it restricts possible capacty expansion in relation to out_flow expansion. Meaning, outflow expansion is subject to parameterization while capacity expansion is just a subsequent byproduct.
Since this seems quite unintuitive, tessif parameterizes it the other way round, meaning the values for capacity expansion are enforced on the flow rate expansion repsecting the stated ration of capacity to flow rate.
- tessif_pypsa_0_19_3.transform.transform(tessif_es, transformer_style='infer', forced_links=None, excess_sinks=None, **kwargs)[source]
Transform a tessif energy system into a pypsa energy system.
- Parameters
tessif_es¶ (
tessif.model.energy_system.AbstractEnergySystem) – The tessif energy system that is to be transformed into a pypsa energy system.String specifying how tessif transformer should be transformed into pypsa components:
infer(default):Transformers are treated according to
infer_pypsa_transformer_types()with the exception offorced_links, which are treated as Pypsa linkslinks:All transformers are treated as links, giving up pypsa commitment simulations and plant related CO2 emissions, but preserving tessif energy system representation. (Meaning all nodes present inside the tessif energy system will be present inside the pypsa energy system.)
forced_links¶ (Container, None, default=None) –
Container of uid representations of
tessif transformersto be transfrormed into pypsa links.excess_sinks¶ (Container, None, default=None) – Container of uid representations of
tessif sinksto be transfrormed into pypsa store units.
- Returns
pypsa_es – The pypsa energy system that was transformed out of the tessif energy system.
- Return type
pypsa.Network