EnergySystem¶
Overview¶
EnergySystem stores system-level settings and attributes used by the model.
Use Cases¶
Configure global model behavior and system assumptions.
Read, modify, and write the
energy_systemdata structure.
Examples¶
The code below shows an example of how to implement a subclass of the
EnergySystem abstract class. Please read the docstrings
carefully as they contain detailed information on required methods and
syntax.
from __future__ import annotations
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from zen_creator.model import Model
from zen_creator.utils.attribute import Attribute
from .energy_system import EnergySystem
class TemplateEnergySystem(EnergySystem):
"""Template class for energy systems.
This template is a starting point for implementing a custom energy system
class. You must implement both methods below to provide `set_nodes` and
`set_edges` for your model.
Search for `TODO` markers to find sections that should be customized.
"""
name: str = "template_energy_system"
def __init__(self, model: Model):
super().__init__(model=model)
def _set_set_nodes(self) -> Attribute:
"""Return the set_nodes attribute.
The attribute `set_nodes` must have a default value of `None`
so that it does not get written to the `attributes.json` file
for the energy system. The attribute data should contain
a dataframe of nodes and their latitute and longitude coordinates.
The `energy_system.set nodes` attribute defined in
this function *should not* be used to get a list
of nodes. Please use model.config.system.set_nodes instead. The node
list in the configurations is always up to date, while the dataframe
saved here my contain coordinates for additional nodes.
TODO: Replace this placeholder with your node-loading logic.
"""
return Attribute(name="set_nodes", default_value=None, element=self)
def _set_set_edges(self) -> Attribute:
"""Return the set_edges attribute.
Return the set_nodes attribute.
The attribute `set_edges` must have a default value of `None`
so that it does not get written to the `attributes.json` file
for the energy system. The attribute data should contain
a dataframe of edges names and their `to` and `from` nodes.
TODO: Replace this placeholder with your edge-loading logic.
"""
return Attribute(name="set_edges", default_value=None, element=self)
Summary
Initialize an Element instance. |
Constructors
- EnergySystem.__init__(model: Model)¶
Initialize an Element instance.
- Parameters:
model (Model) – The model this element belongs to.
power_unit (str) – The unit for power values. Defaults to “MW”.
Member Reference
- class zen_creator.EnergySystem(model: Model)
Bases:
Element,ABC- property carbon_emissions_annual_limit: Attribute
- property carbon_emissions_budget: Attribute
- property carbon_emissions_cumulative_existing: Attribute
- property discount_rate: Attribute
- property knowledge_depreciation_rate: Attribute
- property knowledge_spillover_rate: Attribute
- property market_share_unbounded: Attribute
- name: str = 'energy_system'
- property price_carbon_emissions: Attribute
- property price_carbon_emissions_annual_overshoot: Attribute
- property price_carbon_emissions_budget_overshoot: Attribute
- property relative_output_path: Path
Get the relative output path for the energy system.
- Returns:
The relative path for output files.
- Return type:
Path
- set_default_values_energy_system()
Initialize all attributes to their default values.
- property set_edges: Attribute
- property set_nodes: Attribute
- write() None
Write the energy system folder.
This method writes all files in the energy system folder of the model. It overrides the standard write method from the element class to also save the unit files.