Post-Process
Wrapping the tessif-pypsa post-processing.
- class tessif_pypsa_0_19_3.post_process.PypsaResultier(optimized_es, **kwargs)[source]
Bases:
tessif.post_process.ResultierTransform nodes and edges into their name representation. Child of
Resultierand mother of all pypsa Resultiers.- Parameters
optimized_es¶ (
Network) – An optimized pypsa network.
- class tessif_pypsa_0_19_3.post_process.IntegratedGlobalResultier(optimized_es, **kwargs)[source]
Bases:
tessif_pypsa_0_19_3.post_process.PypsaResultier,tessif.post_process.IntegratedGlobalResultierExtracting the integrated global results out of the energy system and conveniently aggregating them (rounded to unit place) inside a dictionairy keyed by result name.
Integrated global results (IGR) mapped by result name.
Integrated global results currently consist of meta and non-meta results. the meta results are handled by the
analyzemodule (seetessif.analyze.Comparatier.integrated_global_results) and consist of:timememory
results, whereas the non-meta results usually consist of:
emissionscosts
results which are handled here. Tessif’s energy system, however, allow to formulate a number of
global_constraintswhich then would automatically be post processed here.The befornamed strings serve as key inside the mapping.
- Parameters
optimized_es¶ (
Network) – An optimized pypsa network.
See also
For functionality documentation see the respective
base class.
- class tessif_pypsa_0_19_3.post_process.ScaleResultier(optimized_es, **kwargs)[source]
Bases:
tessif_pypsa_0_19_3.post_process.PypsaResultier,tessif.post_process.ScaleResultierExtract number of constraints.
- Parameters
optimized_es¶ – Model specific, optimized energy system containing its results.
See also
For functionality documentation see the respective
base class.
- class tessif_pypsa_0_19_3.post_process.LoadResultier(optimized_es, **kwargs)[source]
Bases:
tessif_pypsa_0_19_3.post_process.PypsaResultier,tessif.post_process.LoadResultierTransforming flow results into dictionairies keyed by node uid string representation.
- Parameters
optimized_es¶ (
Network) – An optimized pypsa network.
See also
For functionality documentation see the respective
base class.
- class tessif_pypsa_0_19_3.post_process.CapacityResultier(optimized_es, **kwargs)[source]
Bases:
tessif.post_process.CapacityResultier,tessif_pypsa_0_19_3.post_process.LoadResultierTransforming installed capacity results dictionairies keyed by node.
- Parameters
optimized_es¶ (
Network) – An optimized pypsa network.- Raises
NotImplementedError: – Raised when postprocessing a Link that is supposed to have multiple in and outputs. Caus right now this doesn’t seem possible.
See also
For functionality documentation see the respective
base class.
- class tessif_pypsa_0_19_3.post_process.StorageResultier(optimized_es, **kwargs)[source]
Bases:
tessif_pypsa_0_19_3.post_process.PypsaResultier,tessif.post_process.StorageResultierTransforming storage results into dictionairies keyed by node.
- Parameters
optimized_es¶ (
Network) – An optimized pypsa network.
See also
For functionality documentation see the respective
base class.
- class tessif_pypsa_0_19_3.post_process.NodeCategorizer(optimized_es, **kwargs)[source]
Bases:
tessif_pypsa_0_19_3.post_process.PypsaResultier,tessif.post_process.NodeCategorizerCategorizing the nodes of an optimized pypsa energy system.
Categorization utilizes
Uid.Nodes are categorized by:
Energy
sector(‘power’, ‘heat’, ‘mobility’, ‘coupled’)Region(‘arbitrary label’)Coordinates(latitude, longitude in degree)Energy
carrier(‘solar’, ‘wind’, ‘electricity’, ‘steam’ …)Node type(‘arbitrary label’)
- Parameters
optimized_es¶ (
Network) – An optimized pypsa network.
See also
For functionality documentation see the respective
base class.Note
Pypsa has no intrinsic way of utilizing
Uidsbesides using its string representation as name. Therefor it is necessary to utilize tessif’snode uid stylesas demonstrated in the examples below, to reap the benefits of theNodeCategorizer.For the uid representation technique to work you either have to construct the pypsa after changing the
node_uid_style.Handle the imports of the following examples and simulate the energy system:
>>> import tessif.examples.data.pypsa.py_hard as pypsa_examples >>> import tessif.transform.es2mapping.ppsa as post_process_pypsa >>> import pprint
Display the energy system component’s
Coordinates:>>> # change the uid style to use coordinates >>> configs.node_uid_style = 'coords' >>> resultier = post_process_pypsa.NodeCategorizer( ... pypsa_examples.create_transshipment_problem()) >>> pprint.pprint(resultier.node_coordinates) {'bus-01_53_10': Coordinates(latitude='53', longitude='10'), 'bus-02_53_10': Coordinates(latitude='53', longitude='10'), 'connector-01->02_53_10': Coordinates(latitude='53', longitude='10'), 'sink-01_53_10': Coordinates(latitude='53', longitude='10'), 'sink-02_53_10': Coordinates(latitude='53', longitude='10'), 'source-01_53_10': Coordinates(latitude='53', longitude='10'), 'source-02_53_10': Coordinates(latitude='53', longitude='10')}
Group energy system components by their
region:>>> # change the uid style to use regions >>> configs.node_uid_style = 'region' >>> resultier = post_process_pypsa.NodeCategorizer( ... pypsa_examples.create_transshipment_problem()) >>> pprint.pprint(resultier.node_region_grouped) {'Germany': ['bus-01_Germany', 'bus-02_Germany', 'source-01_Germany', 'source-02_Germany', 'connector-01->02_Germany', 'sink-01_Germany', 'sink-02_Germany']}
Group energy system components by their
sector>>> # change the uid style to use sectors >>> configs.node_uid_style = 'sector' >>> resultier = post_process_pypsa.NodeCategorizer( ... pypsa_examples.create_transshipment_problem()) >>> pprint.pprint(resultier.node_sector_grouped) {'Power': ['bus-01_Power', 'bus-02_Power', 'source-01_Power', 'source-02_Power', 'connector-01->02_Power', 'sink-01_Power', 'sink-02_Power']}
Group energy system components by their
node_type:>>> # change the uid style to use node types >>> configs.node_uid_style = 'node_type' >>> resultier = post_process_pypsa.NodeCategorizer( ... pypsa_examples.create_transshipment_problem()) >>> pprint.pprint(resultier.node_type_grouped) {'AC-bus': ['bus-01_AC-Bus', 'bus-02_AC-Bus'], 'AC-link': ['connector-01->02_AC-Link'], 'AC-sink': ['sink-01_AC-Sink', 'sink-02_AC-Sink'], 'AC-source': ['source-01_AC-Source', 'source-02_AC-Source']}
- 5 Group energy system components by their energy
carrier:>>> # change the uid style to use the energy carrier >>> configs.node_uid_style = 'carrier' >>> resultier = post_process_pypsa.NodeCategorizer( ... pypsa_examples.create_transshipment_problem()) >>> pprint.pprint(resultier.node_carrier_grouped) {'Electricity': ['bus-01_Electricity', 'bus-02_Electricity', 'source-01_Electricity', 'source-02_Electricity', 'connector-01->02_Electricity', 'sink-01_Electricity', 'sink-02_Electricity']}
Map the node uid representation <Labeling_Concept> of each component of the energy system to their energy
carrier:>>> # change the uid style to use the energy carrier >>> configs.node_uid_style = 'carrier' >>> resultier = post_process_pypsa.NodeCategorizer( ... pypsa_examples.create_transshipment_problem()) >>> pprint.pprint(resultier.node_energy_carriers) {'bus-01_Electricity': 'Electricity', 'bus-02_Electricity': 'Electricity', 'connector-01->02_Electricity': 'Electricity', 'sink-01_Electricity': 'Electricity', 'sink-02_Electricity': 'Electricity', 'source-01_Electricity': 'Electricity', 'source-02_Electricity': 'Electricity'}
>>> # reset the uid style >>> configs.node_uid_style = 'name'
- class tessif_pypsa_0_19_3.post_process.FlowResultier(optimized_es, **kwargs)[source]
Bases:
tessif.post_process.FlowResultier,tessif_pypsa_0_19_3.post_process.LoadResultierTransforming flow results into dictionairies keyed by edges.
- Parameters
optimized_es¶ (
Network) – An optimized pypsa network.
See also
For functionality documentation see the respective
base class.
- class tessif_pypsa_0_19_3.post_process.AllResultier(optimized_es, **kwargs)[source]
Bases:
tessif_pypsa_0_19_3.post_process.CapacityResultier,tessif_pypsa_0_19_3.post_process.FlowResultier,tessif_pypsa_0_19_3.post_process.StorageResultier,tessif_pypsa_0_19_3.post_process.ScaleResultierTransform energy system results into a dictionary keyed by attribute.
Incorporates all the functionalities from its bases.
- Parameters
optimized_es¶ (
Network) – An optimized pypsa network.
Note
This class allows interfacing with ALL framework processing utilities. It extracts every bit of info the author ever needed in his postprocessing.
It is meant to be a “one fits all” solution for small energy systems. Perfectly fit for showing “proof of concepts” or debugging energy system components.
Not meant to be used with large energy systems.
- class tessif_pypsa_0_19_3.post_process.LabelFormatier(optimized_es, **kwargs)[source]
Bases:
tessif.post_process.LabelFormatier,tessif_pypsa_0_19_3.post_process.FlowResultier,tessif_pypsa_0_19_3.post_process.CapacityResultierGenerate component summaries as multiline label dictionairy entries.
- Parameters
optimized_es¶ (
Network) – An optimized pypsa network.
See also
For functionality documentation see the respective
base class.
- class tessif_pypsa_0_19_3.post_process.NodeFormatier(optimized_es, cgrp='name', drawutil='nx', **kwargs)[source]
Bases:
tessif.post_process.NodeFormatier,tessif_pypsa_0_19_3.post_process.CapacityResultierTransforming energy system results into node visuals.
- Parameters
optimized_es¶ (
Network) – An optimized pypsa network.Which group of color attribute(s) to return. One of:
{'name', 'carrer', 'sector'}
Color related attributes are grouped by
tessif.frused.namedtuples.NodeColorGroupingsand are thus returned as atyping.NamedTuple. Certain api functionalities expect those attributes to be dicts. (Usually those working only onESTransformerinput). Use this parameter on Formatier creation to provide the expected dictionairy.drawutil¶ (str, default='nx') – Which drawuing utility backend to format node size, fil_size and shape to.
'dc'forplotly-dash-cytoscapeor'nx'fornetworkx-matplotlib.
See also
For functionality documentation see the respective
base class.
- class tessif_pypsa_0_19_3.post_process.MplLegendFormatier(optimized_es, cgrp='all', markers='formatier', **kwargs)[source]
Bases:
tessif.post_process.MplLegendFormatier,tessif_pypsa_0_19_3.post_process.CapacityResultierGenerating visually enhanced matplotlib legends for nodes and edges.
- Parameters
optimized_es¶ (
Network) – An optimized pypsa network.Which group of color attribute(s) to return. One of:
{'name', 'carrer', 'sector'}
Color related attributes are grouped by
tessif.frused.namedtuples.NodeColorGroupingsand are thus returned as atyping.NamedTuple. Certain api functionalities expect those attributes to be dicts. (Usually those working only onESTransformerinput). Use this parameter on Formatier creation to provide the expected dictionairy.markers¶ (str, default='formatier') –
What marker to use for legend entries. Either
'formatier'or one of thematplotlib.markers.If
'formatier'is used, markers will be inferred fromNodeFormatier.node_shape.
See also
For functionality documentation see the respective
base class.
- class tessif_pypsa_0_19_3.post_process.EdgeFormatier(optimized_es, drawutil='nx', cls=None, **kwargs)[source]
Bases:
tessif.post_process.EdgeFormatier,tessif_pypsa_0_19_3.post_process.FlowResultierTransforming energy system results into edge visuals.
- Parameters
optimized_es¶ (
Network) – An optimized pypsa network.drawutil¶ (str, default='nx') – Which drawuing utility backend to format node size, fil_size and shape to.
'dc'forplotly-dash-cytoscapeor'nx'fornetworkx-matplotlib.2-Tuple /
CLS namedtupledefining the relative flow cost thresholds and the respective style specifications. Used to map specific flow costs to edge line style representations.If
None, default implementation is used based ondrawutil.For
drawutil='nx'Networkx-Matplotlib:cls = ([0, .33, .66], ['dotted', 'dashed', 'solid'])
For
drawutil='dc'Dash-Cytoscape styles are used:cls = ([0, .33, .66], ['dotted', 'dashed', 'solid'])
Translating to all edges of relative specific flows costs, between
0and.33are correlated to have a':'/'dotted'linestyle.
See also
For functionality documentation see the respective
base class.
- class tessif_pypsa_0_19_3.post_process.AllFormatier(optimized_es, cgrp='all', markers='formatier', drawutil='nx', cls=None, **kwargs)[source]
Bases:
tessif_pypsa_0_19_3.post_process.LabelFormatier,tessif_pypsa_0_19_3.post_process.NodeFormatier,tessif_pypsa_0_19_3.post_process.MplLegendFormatier,tessif_pypsa_0_19_3.post_process.EdgeFormatierTransforming ES results into visual expression dicts keyed by attribute. Incorperates all the functionalities from its parents.
- Parameters
optimized_es¶ (
Network) – An optimized pypsa network.Which group of color attribute(s) to return. One of:
{'name', 'carrer', 'sector'}
Color related attributes are grouped by
tessif.frused.namedtuples.NodeColorGroupingsand are thus returned as atyping.NamedTuple. Certain api functionalities expect those attributes to be dicts. (Usually those working only onESTransformerinput). Use this parameter on Formatier creation to provide the expected dictionairy.Used by
NodeFormatierandMplLegendFormatiermarkers¶ (str, default='formatier') –
What marker to use for legend entries. Either
'formatier'or one of thematplotlib.markers.If
'formatier'is used, markers will be inferred fromNodeFormatier.node_shape.Used by
MplLegendFormatierdrawutil¶ (str, default='nx') – Which drawuing utility backend to format node size, fil_size and shape to.
'dc'forplotly-dash-cytoscapeor'nx'fornetworkx-matplotlib.2-Tuple /
CLS namedtupledefining the relative flow cost thresholds and the respective style specifications. Used to map specific flow costs to edge line style representations.If
None, default implementation is used based ondrawutil.For
drawutil='nx'Networkx-Matplotlib:cls = ([0, .33, .66], ['dotted', 'dashed', 'solid'])
For
drawutil='dc'Dash-Cytoscape styles are used:cls = ([0, .33, .66], ['dotted', 'dashed', 'solid'])
Translating to all edges of relative specific flows costs, between
0and.33are correlated to have a':'/'dotted'linestyle.
Note
This class allows interfacing with ALL framework processing utilities. It extracts every bit of info the author ever needed in his postprocessing.
It is meant to be a “one fits all” solution for small energy systems. Perfectly fit for showing “proof of concepts” or debugging energy system components.
Not meant to be used with large energy systems.
- class tessif_pypsa_0_19_3.post_process.ICRHybridier(optimized_es, colored_by='name', **kwargs)[source]
Bases:
tessif_pypsa_0_19_3.post_process.PypsaResultier,tessif.post_process.ICRHybridierAggregate numerical and visual information for visualizing the Integrated_Component_Results (ICR).
- Parameters
optimized_es¶ (
Network) – An optimized pypsa network.
See also
For non model specific attributes see the respective
base class.- property node_characteristic_value
Characteristic values of the energy system components mapped to their node uid representation.
Components of variable size or have a characteristic value as stated in
tessif.frused.defaults.energy_system_nodes.Characteristic value in this context means:
\(cv = \frac{\text{characteristic flow}} {\text{installed capacity}}\) for:
Sourceobjects ( generator in pypsa)Sinkobjects ( load in pypsa)Transformerobjects ( generator in pypsa)Connectorobjects ( link or transformer in pypsa)
\(cv = \frac{\text{mean}\left(\text{SOC}\right)} {\text{capacity}}\) for:
Storage( generator in pypsa)
Characteristic flow in this context means:
mean(LoadResultier.node_summed_loads)SourceobjectsSinkobjects
mean(0th outflow)for:Transformerobjects
The node fillsize of integrated component results graphs scales with the characteristic value. If no capacity is defined (i.e for nodes of variable size, like busses or excess sources and sinks, node size is set to it’s default (
nxgrph_visualize_defaults[node_fill_size]).