List of Component modules

components.PIDcontroller module

components.advanced_battery_bslib module

Battery implementation built upon the bslib library. It contains a Battery Class together with its Configuration and State.

class components.advanced_battery_bslib.Battery(my_simulation_parameters: SimulationParameters, config: BatteryConfig, my_display_config: DisplayConfig = DisplayConfig(pretty_name=None, display_in_webtool=False))

Bases: Component

Battery class.

Simulate state of charge and realized power of a ac coupled battery storage system with the bslib library. Relevant simulation parameters are loaded within the init for a specific or generic battery type.

Components to connect to: (1) Energy Management System

AcBatteryPowerUsed = 'AcBatteryPowerUsed'
ChargingPower = 'ChargingPower'
DcBatteryPowerUsed = 'DcBatteryPowerUsed'
DischargingPower = 'DischargingPower'
LoadingPowerInput = 'LoadingPowerInput'
StateOfCharge = 'StateOfCharge'
static get_battery_aging_information(config: BatteryConfig) Tuple[float, float]

Calculate battery aging.

This is used to calculate investment costs for battery per simulated period. Battery aging is ROUGHLY approximated by costs for each virtual charging cycle used in simulated period (costs_per_cycle = investment / lifetime_in_cycles).

get_component_kpi_entries(all_outputs: List, postprocessing_results: DataFrame) List[KpiEntry]

Calculates KPIs for the respective component and return all KPI entries as list.

static get_cost_capex(config: BatteryConfig, simulation_parameters: SimulationParameters) CapexCostDataClass

Returns investment cost, CO2 emissions and lifetime.

get_cost_opex(all_outputs: List, postprocessing_results: DataFrame) OpexCostDataClass

Calculate OPEX costs, consisting of maintenance costs.

i_doublecheck(timestep: int, stsv: SingleTimeStepValues) None

Doublechecks.

i_prepare_simulation() None

Prepares the simulation.

i_restore_state() None

Restores the state.

i_save_state() None

Saves the state.

i_simulate(timestep: int, stsv: SingleTimeStepValues, force_convergence: bool) None

Simulates the component.

write_to_report() List[str]

Write to report.

class components.advanced_battery_bslib.BatteryConfig(building_name: str, name: str, source_weight: int, system_id: str, custom_pv_inverter_power_generic_in_watt: float, custom_battery_capacity_generic_in_kilowatt_hour: float, charge_in_kwh: float, discharge_in_kwh: float, device_co2_footprint_in_kg: float | None, investment_costs_in_euro: float | None, lifetime_in_years: float | None, maintenance_costs_in_euro_per_year: float | None, subsidy_as_percentage_of_investment_costs: float | None, lifetime_in_cycles: float)

Bases: ConfigBase

Battery Configuration.

building_name: str

building_name in which component is

charge_in_kwh: float

amount of energy used to charge the car battery

custom_battery_capacity_generic_in_kilowatt_hour: float

battery capacity in in kWh

custom_pv_inverter_power_generic_in_watt: float

charging and discharging power in Watt

device_co2_footprint_in_kg: float | None

CO2 footprint of investment in kg

discharge_in_kwh: float

amount of energy discharged from the battery

classmethod from_dict(kvs: dict | list | str | int | float | bool | None, *, infer_missing=False) A

Converts a Python dictionary object to a dataclass instance.

Iterates over each dataclass field recursively; lists, dicts, and nested dataclasses will likewise be initialized as expected.

When directly invoking this function, an optional Meta configuration for the dataclass can be specified via LoadMeta; by default, this will apply recursively to any nested dataclasses. Here’s a sample usage of this below:

>>> LoadMeta(key_transform='CAMEL').bind_to(MyClass)
>>> fromdict(MyClass, {"myStr": "value"})
classmethod from_json(s: str | bytes | bytearray, *, parse_float=None, parse_int=None, parse_constant=None, infer_missing=False, **kw) A
classmethod get_default_config(building_name: str = 'BUI1', name: str = 'Battery') BatteryConfig

Returns default configuration of battery.

classmethod get_main_classname()

Return the full class name of the base class.

classmethod get_scaled_battery(total_pv_power_in_watt_peak: float, building_name: str = 'BUI1', name: str = 'Battery') BatteryConfig

Returns scaled configuration of battery according to pv power.

investment_costs_in_euro: float | None

cost for investment in Euro

lifetime_in_cycles: float

lifetime of battery in full cycles

lifetime_in_years: float | None

lifetime in years

maintenance_costs_in_euro_per_year: float | None
name: str

name of the device

classmethod schema(*, infer_missing: bool = False, only=None, exclude=(), many: bool = False, context=None, load_only=(), dump_only=(), partial: bool = False, unknown=None) SchemaF[A]
source_weight: int

priority of the device in hierachy: the higher the number the lower the priority

subsidy_as_percentage_of_investment_costs: float | None
system_id: str

name of battery to search in database (bslib)

to_dict(encode_json=False) Dict[str, dict | list | str | int | float | bool | None]

Return the fields of a dataclass instance as a new dictionary mapping field names to field values.

Example usage:

@dataclass class C:

x: int y: int

c = C(1, 2) assert asdict(c) == {‘x’: 1, ‘y’: 2}

When directly invoking this function, an optional Meta configuration for the dataclass can be specified via DumpMeta; by default, this will apply recursively to any nested dataclasses. Here’s a sample usage of this below:

>>> DumpMeta(key_transform='CAMEL').bind_to(MyClass)
>>> asdict(MyClass(my_str="value"))

If given, ‘dict_factory’ will be used instead of built-in dict. The function applies recursively to field values that are dataclass instances. This will also look into built-in containers: tuples, lists, and dicts.

to_json(*, skipkeys: bool = False, ensure_ascii: bool = True, check_circular: bool = True, allow_nan: bool = True, indent: int | str | None = None, separators: Tuple[str, str] | None = None, default: Callable | None = None, sort_keys: bool = False, **kw) str
class components.advanced_battery_bslib.BatteryState(state_of_charge: float = 0)

Bases: object

Battery state class.

clone()

Creates a copy of the Battery State.

state_of_charge: float = 0

state of charge of the battery

components.advanced_ev_battery_bslib module

Car Battery implementation built upon the bslib library. It contains a CarBattery Class together with its Configuration and State.

class components.advanced_ev_battery_bslib.CarBattery(my_simulation_parameters: SimulationParameters, config: CarBatteryConfig, my_display_config: DisplayConfig = DisplayConfig(pretty_name=None, display_in_webtool=False))

Bases: Component

Car Battery class.

Simulate state of charge and realized power of a ac coupled battery storage system with the bslib library. Relevant simulation parameters are loaded within the init for a specific or generic battery type.

Components to connect to: (1) CarBattery controller (controller_l1_generic_ev_charge)

AcBatteryChargingPower = 'AcBatteryChargingPower'
AcBatteryDischargingPower = 'AcBatteryDischargingPower'
DcBatteryChargingPower = 'DcBatteryChargingPower'
StateOfCharge = 'StateOfCharge'
TargetPowerToOrFromBattery = 'TargetPowerToOrFromBattery'
get_component_kpi_entries(all_outputs: List, postprocessing_results: DataFrame) List[KpiEntry]

Calculates KPIs for the respective component and return all KPI entries as list.

static get_cost_capex(config: CarBatteryConfig, simulation_parameters: SimulationParameters) CapexCostDataClass

Returns investment cost, CO2 emissions and lifetime.

get_cost_opex(all_outputs: List, postprocessing_results: DataFrame) OpexCostDataClass

Calculate OPEX costs.

No electricity costs for components except for Electricity Meter, because part of electricity consumption is feed by PV

electricity_consumption is considered vor generic_car already

get_default_connections_from_charge_controller() Any

Get default connections from charge controller.

i_doublecheck(timestep: int, stsv: SingleTimeStepValues) None

Doublechecks.

i_prepare_simulation() None

Prepares the simulation.

i_restore_state() None

Restores the state.

i_save_state() None

Saves the state.

i_simulate(timestep: int, stsv: SingleTimeStepValues, force_convergence: bool) None

Simulates the component.

write_to_report() List[str]

Writes Car Battery values to report.

class components.advanced_ev_battery_bslib.CarBatteryConfig(building_name: str, name: str, source_weight: int, system_id: str, p_inv_custom: float, e_bat_custom: float, total_charged_energy_in_kilowatthour: float, total_discharged_energy_in_kilowatthour: float)

Bases: ConfigBase

Configuration of a Car Battery.

building_name: str

building_name in which component is

e_bat_custom: float

battery capacity in in kWh

classmethod from_dict(kvs: dict | list | str | int | float | bool | None, *, infer_missing=False) A

Converts a Python dictionary object to a dataclass instance.

Iterates over each dataclass field recursively; lists, dicts, and nested dataclasses will likewise be initialized as expected.

When directly invoking this function, an optional Meta configuration for the dataclass can be specified via LoadMeta; by default, this will apply recursively to any nested dataclasses. Here’s a sample usage of this below:

>>> LoadMeta(key_transform='CAMEL').bind_to(MyClass)
>>> fromdict(MyClass, {"myStr": "value"})
classmethod from_json(s: str | bytes | bytearray, *, parse_float=None, parse_int=None, parse_constant=None, infer_missing=False, **kw) A
classmethod get_default_config(building_name: str = 'BUI1', name: str = 'CarBattery') CarBatteryConfig

Returns default configuration of a Car Battery.

classmethod get_main_classname()

Return the full class name of the base class.

name: str

name of the device

p_inv_custom: float

charging and discharging power in Watt

classmethod schema(*, infer_missing: bool = False, only=None, exclude=(), many: bool = False, context=None, load_only=(), dump_only=(), partial: bool = False, unknown=None) SchemaF[A]
source_weight: int

priority of the device in hierachy: the higher the number the lower the priority

system_id: str

name of battery to search in database (bslib)

to_dict(encode_json=False) Dict[str, dict | list | str | int | float | bool | None]

Return the fields of a dataclass instance as a new dictionary mapping field names to field values.

Example usage:

@dataclass class C:

x: int y: int

c = C(1, 2) assert asdict(c) == {‘x’: 1, ‘y’: 2}

When directly invoking this function, an optional Meta configuration for the dataclass can be specified via DumpMeta; by default, this will apply recursively to any nested dataclasses. Here’s a sample usage of this below:

>>> DumpMeta(key_transform='CAMEL').bind_to(MyClass)
>>> asdict(MyClass(my_str="value"))

If given, ‘dict_factory’ will be used instead of built-in dict. The function applies recursively to field values that are dataclass instances. This will also look into built-in containers: tuples, lists, and dicts.

to_json(*, skipkeys: bool = False, ensure_ascii: bool = True, check_circular: bool = True, allow_nan: bool = True, indent: int | str | None = None, separators: Tuple[str, str] | None = None, default: Callable | None = None, sort_keys: bool = False, **kw) str
total_charged_energy_in_kilowatthour: float

amount of energy used to charge the car battery

total_discharged_energy_in_kilowatthour: float

amount of energy discharged from the battery

class components.advanced_ev_battery_bslib.EVBatteryState(soc: float = 0)

Bases: object

Electric vehicle battery state class.

clone()

Creates a copy of the Car Battery State.

soc: float = 0

components.advanced_fuel_cell module

Advanced fuel cell module.

class components.advanced_fuel_cell.CHP(my_simulation_parameters: SimulationParameters, config: CHPConfig, my_display_config: DisplayConfig = DisplayConfig(pretty_name=None, display_in_webtool=False))

Bases: Component

CHP class.

Simulate chp efficiency (cop) as well as electrical (p_el) & thermal power (p_th), massflow (m_dot) and output temperature (t_out).

ControlSignal = 'ControlSignal'
ElectricityFromCHPTarget = 'ElectricityFromCHPTarget'
ElectricityOutput = 'ElectricityOutput'
GasDemandReal = 'GasDemandReal'
GasDemandTarget = 'GasDemandTarget'
HydrogenNotReleased = 'HydrogenNotReleased'
MassflowInputTemperature = 'MassflowInputTemperature'
MassflowOutput = 'Hot Water Energy Output'
MassflowOutputTemperature = 'MassflowOutputTemperature'
NumberofCycles = 'NumberofCycles'
ThermalOutputPower = 'ThermalOutputPower'
calculate_control_signal(stsv: SingleTimeStepValues) float

Calculate control signal.

i_doublecheck(timestep: int, stsv: SingleTimeStepValues) None

Doubelchecks.

i_prepare_simulation() None

Prepares the simulation.

i_restore_state() None

Restores the state.

i_save_state() None

Saves the state.

i_simulate(timestep: int, stsv: SingleTimeStepValues, force_convergence: bool) None

Simulate the component.

simulate_chp(control_signal: float, stsv: SingleTimeStepValues, timestep: int) Any

Simualtes the component.

write_to_report() List[str]

Write to report.

class components.advanced_fuel_cell.CHPConfig(building_name: str, name: str, min_operation_time: float, min_idle_time: float, gas_type: str, operating_mode: str, is_modulating: bool, p_el_min: float, p_th_min: float, eff_el_min: float, eff_th_min: float, mass_flow_max: float, p_el_max: float, p_th_max: float, eff_el_max: float, eff_th_max: float, temperature_max: float, delta_temperature: float)

Bases: ConfigBase

CHP Config class.

building_name: str
delta_temperature: float
eff_el_max: float
eff_el_min: float
eff_th_max: float
eff_th_min: float
classmethod from_dict(kvs: dict | list | str | int | float | bool | None, *, infer_missing=False) A

Converts a Python dictionary object to a dataclass instance.

Iterates over each dataclass field recursively; lists, dicts, and nested dataclasses will likewise be initialized as expected.

When directly invoking this function, an optional Meta configuration for the dataclass can be specified via LoadMeta; by default, this will apply recursively to any nested dataclasses. Here’s a sample usage of this below:

>>> LoadMeta(key_transform='CAMEL').bind_to(MyClass)
>>> fromdict(MyClass, {"myStr": "value"})
classmethod from_json(s: str | bytes | bytearray, *, parse_float=None, parse_int=None, parse_constant=None, infer_missing=False, **kw) A
gas_type: str
classmethod get_default_config(building_name: str = 'BUI1') Any

Get default config.

classmethod get_main_classname()

Return the full class name of the base class.

is_modulating: bool
mass_flow_max: float
min_idle_time: float
min_operation_time: float
name: str
operating_mode: str
p_el_max: float
p_el_min: float
p_th_max: float
p_th_min: float
classmethod schema(*, infer_missing: bool = False, only=None, exclude=(), many: bool = False, context=None, load_only=(), dump_only=(), partial: bool = False, unknown=None) SchemaF[A]
temperature_max: float
to_dict(encode_json=False) Dict[str, dict | list | str | int | float | bool | None]

Return the fields of a dataclass instance as a new dictionary mapping field names to field values.

Example usage:

@dataclass class C:

x: int y: int

c = C(1, 2) assert asdict(c) == {‘x’: 1, ‘y’: 2}

When directly invoking this function, an optional Meta configuration for the dataclass can be specified via DumpMeta; by default, this will apply recursively to any nested dataclasses. Here’s a sample usage of this below:

>>> DumpMeta(key_transform='CAMEL').bind_to(MyClass)
>>> asdict(MyClass(my_str="value"))

If given, ‘dict_factory’ will be used instead of built-in dict. The function applies recursively to field values that are dataclass instances. This will also look into built-in containers: tuples, lists, and dicts.

to_json(*, skipkeys: bool = False, ensure_ascii: bool = True, check_circular: bool = True, allow_nan: bool = True, indent: int | str | None = None, separators: Tuple[str, str] | None = None, default: Callable | None = None, sort_keys: bool = False, **kw) str
class components.advanced_fuel_cell.CHPConfigAdvanced

Bases: object

CHP config advanced class.

class components.advanced_fuel_cell.CHPState(start_timestep=None, electricity_output=0.0, cycle_number=None)

Bases: object

CHP state class.

components.advanced_fuel_cell_controller module

Advanced fuel cell controller module.

class components.advanced_fuel_cell_controller.ExtendedController(component_name: str, config: ExtendedControllerConfig, my_simulation_parameters: SimulationParameters, my_display_config: DisplayConfig = DisplayConfig(pretty_name=None, display_in_webtool=False))

Bases: Component

Extended Controller class.

ControllerCHP = 'Controller CHP'
ControllerGasHeater = 'Controller Gas Heater'
ElectricityDemand = 'Electricity Demand'
PV_Production = 'PV Production'
PowerFromOrToGrid = 'Power From Or To Grid'
PowerToElectrolyzer = 'Power To Electrolyzer'
RuntimeCounterCHP = 'RuntimeCounterCHP'
RuntimeCounterGasHeater = 'RuntimeCounterGasHeater'
Temperature0Percent = 'Temperature 0 Percent'
Temperature100Percent = 'Temperature 100 Percent'
Temperature20Percent = 'Temperature 20 Percent'
Temperature40Percent = 'Temperature 40 Percent'
Temperature60Percent = 'Temperature 60 Percent'
Temperature80Percent = 'Temperature 80 Percent'
i_doublecheck(timestep: int, stsv: SingleTimeStepValues) None

Doublechecks.

i_restore_state() None

Restores the state.

i_save_state() None

Saves the state.

i_simulate(timestep: int, stsv: SingleTimeStepValues, force_convergence: bool) None

Simulates the state.

class components.advanced_fuel_cell_controller.ExtendedControllerSimulation(config: ExtendedControllerConfig)

Bases: object

Extended Controller Simulation.

power_distribution_to_electrolyzer(power_from_or_to_grid: Any) Any

Power distribution to electrolyzer.

Hydrogen storage must be able to store the produced massflow of hydrogen. Otherwise the dimensioning of the system is incorrect –> is checked in hydrogen_storage power_from_or_to_grid is positive if there is a demand of energy and negative if there is a surplus of energy. power_available is defined the other way round –> negate the value

regulate_chp_mode_heat(temperatures_in_tank, previous_state, runtime_chp, pv_production, electricity_demand_household, seconds_per_timestep)

Regulate chp mode heat.

regulate_chp_mode_power(state_chp: Any, runtime_chp: Any, power_supply_pv: Any, electricity_demand_household: Any, seconds_per_timestep: Any) Any

Regulate the power.

Parameters:
  • power_supply_pv

  • electricity_demand_household

  • seconds_per_timestep

Returns:

regulate_gas_heater(temperatures_in_tank: Any, previous_state: float, runtime_counter: int, seconds_per_timestep: int) Any

Regulate gas heater.

components.advanced_heat_pump_hplib module

components.advanced_stratified_water_storage module

components.air_conditioner module

components.building module

components.configuration module

Configuration module.

class components.configuration.AdvElectrolyzerConfig

Bases: object

Adv electrolyzer config class.

max_hydrogen_production_rate = 1.3888888888888888
max_hydrogen_production_rate_hour = 5000
max_power = 24000
max_power_percent = 100
min_hydrogen_production_rate = 0.08333333333333333
min_hydrogen_production_rate_hour = 300
min_power = 1400
min_power_percent = 60
pressure_hydrogen_output = 30

The production rate can be converted to an efficiency. eff_electrolyzer = (production_rate_hour * hydrogen_specific_heat_capacity_per_kg[kWh/kg]) / (Power_this_timestep[kWh] * hydrogen_specific_volume [m³kg])

in the component electrolyzer: hydrogen_output = Power_this_timestep[kWh] * eff_electrolyzer / hydrogen_specific_heat_capacity_per_kg[kWh/kg]

I think its overengineering because the providers give the needed information and we try to calculate it back and forth

–> Solution: efficiency of the electrolyzer is calculated and is an Output

waste_energy = 400
class components.configuration.CHPControllerConfig

Bases: object

Chp controller config.

The CHP controller is used to implement an on and off hysteresis Decide if its heat- or electricity-led

Two temperature sensors in the tank are giving the needed information. They can be set at a height percentage in the tank. =% is the top, 100 % s the bottom of the tank. If the T at the upper sensor is below temperature_switch_on the chp will run until the lower sensor is above temperature_switch_off. A minimum runtime in minutes can be defined for the chp.

If the chp is electric-led, ths is not needed and the electricity demand is provided directly to the chp

height_lower_sensor = 60
height_upper_sensor = 20
heights_in_tank = [0, 20, 40, 60, 80, 100]
method_of_operation = 'heat'
minimum_runtime_minutes = 4000
temperature_switch_off = 65
temperature_switch_on = 60
class components.configuration.ElectricityDemandConfig

Bases: object

Electricity demand config class.

demand_factor = 6.0
kwh_per_year = 6000
class components.configuration.EmissionFactorsAndCostsForDevicesConfig(technical_lifetime_in_years: float, maintenance_costs_as_percentage_of_investment_per_year: float, subsidy_as_percentage_of_investment_costs: float, investment_costs_in_euro_per_kw: float | None = None, investment_costs_in_euro_per_kwh: float | None = None, investment_costs_in_euro_per_liter: float | None = None, investment_costs_in_euro_per_m2: float | None = None, investment_costs_in_euro: float | None = None, co2_footprint_in_kg_per_kw: float | None = None, co2_footprint_in_kg_per_kwh: float | None = None, co2_footprint_in_kg_per_liter: float | None = None, co2_footprint_in_kg_per_m2: float | None = None, co2_footprint_in_kg: float | None = None)

Bases: object

Emission factors and costs for devices config class.

co2_footprint_in_kg: float | None = None
co2_footprint_in_kg_per_kw: float | None = None
co2_footprint_in_kg_per_kwh: float | None = None
co2_footprint_in_kg_per_liter: float | None = None
co2_footprint_in_kg_per_m2: float | None = None
classmethod from_dict(kvs: dict | list | str | int | float | bool | None, *, infer_missing=False) A
classmethod from_json(s: str | bytes | bytearray, *, parse_float=None, parse_int=None, parse_constant=None, infer_missing=False, **kw) A
classmethod get_values_for_year(year: int, device: ComponentType, country: str) EmissionFactorsAndCostsForDevicesConfig

Get emission factors and costs for a given year and device.

investment_costs_in_euro: float | None = None
investment_costs_in_euro_per_kw: float | None = None
investment_costs_in_euro_per_kwh: float | None = None
investment_costs_in_euro_per_liter: float | None = None
investment_costs_in_euro_per_m2: float | None = None
maintenance_costs_as_percentage_of_investment_per_year: float
classmethod schema(*, infer_missing: bool = False, only=None, exclude=(), many: bool = False, context=None, load_only=(), dump_only=(), partial: bool = False, unknown=None) SchemaF[A]
subsidy_as_percentage_of_investment_costs: float
technical_lifetime_in_years: float
to_dict(encode_json=False) Dict[str, dict | list | str | int | float | bool | None]
to_json(*, skipkeys: bool = False, ensure_ascii: bool = True, check_circular: bool = True, allow_nan: bool = True, indent: int | str | None = None, separators: Tuple[str, str] | None = None, default: Callable | None = None, sort_keys: bool = False, **kw) str
class components.configuration.EmissionFactorsAndCostsForFuelsConfig(electricity_costs_in_euro_per_kwh: float, electricity_footprint_in_kg_per_kwh: float, electricity_to_grid_revenue_in_euro_per_kwh: float, gas_costs_in_euro_per_kwh: float, gas_footprint_in_kg_per_kwh: float, oil_costs_in_euro_per_l: float, oil_footprint_in_kg_per_l: float, diesel_costs_in_euro_per_l: float, diesel_footprint_in_kg_per_l: float, pellet_costs_in_euro_per_t: float, pellet_footprint_in_kg_per_kwh: float, wood_chip_costs_in_euro_per_t: float, wood_chip_footprint_in_kg_per_kwh: float, district_heating_costs_in_euro_per_kwh: float, district_heating_footprint_in_kg_per_kwh: float, green_hydrogen_gas_costs_in_euro_per_kwh: float, green_hydrogen_gas_footprint_in_kg_per_kwh: float)

Bases: object

Emission factors and costs for fuels config class.

diesel_costs_in_euro_per_l: float
diesel_footprint_in_kg_per_l: float
district_heating_costs_in_euro_per_kwh: float
district_heating_footprint_in_kg_per_kwh: float
electricity_costs_in_euro_per_kwh: float
electricity_footprint_in_kg_per_kwh: float
electricity_to_grid_revenue_in_euro_per_kwh: float
classmethod from_dict(kvs: dict | list | str | int | float | bool | None, *, infer_missing=False) A
classmethod from_json(s: str | bytes | bytearray, *, parse_float=None, parse_int=None, parse_constant=None, infer_missing=False, **kw) A
gas_costs_in_euro_per_kwh: float
gas_footprint_in_kg_per_kwh: float
classmethod get_values_for_year(year: int, country: str) EmissionFactorsAndCostsForFuelsConfig

Get emission factors and fuel costs for certain year.

green_hydrogen_gas_costs_in_euro_per_kwh: float
green_hydrogen_gas_footprint_in_kg_per_kwh: float
oil_costs_in_euro_per_l: float
oil_footprint_in_kg_per_l: float
pellet_costs_in_euro_per_t: float
pellet_footprint_in_kg_per_kwh: float
classmethod schema(*, infer_missing: bool = False, only=None, exclude=(), many: bool = False, context=None, load_only=(), dump_only=(), partial: bool = False, unknown=None) SchemaF[A]
to_dict(encode_json=False) Dict[str, dict | list | str | int | float | bool | None]
to_json(*, skipkeys: bool = False, ensure_ascii: bool = True, check_circular: bool = True, allow_nan: bool = True, indent: int | str | None = None, separators: Tuple[str, str] | None = None, default: Callable | None = None, sort_keys: bool = False, **kw) str
wood_chip_costs_in_euro_per_t: float
wood_chip_footprint_in_kg_per_kwh: float
class components.configuration.ExtendedControllerConfig(building_name: str, name: str, chp: bool, gas_heater: bool, electrolyzer: bool, chp_mode: str, chp_power_states_possible: int, maximum_autarky: bool)

Bases: ConfigBase

Extended controller config class.

building_name: str
chp: bool
chp_mode: str
chp_power_states_possible: int
electrolyzer: bool
classmethod from_dict(kvs: dict | list | str | int | float | bool | None, *, infer_missing=False) A

Converts a Python dictionary object to a dataclass instance.

Iterates over each dataclass field recursively; lists, dicts, and nested dataclasses will likewise be initialized as expected.

When directly invoking this function, an optional Meta configuration for the dataclass can be specified via LoadMeta; by default, this will apply recursively to any nested dataclasses. Here’s a sample usage of this below:

>>> LoadMeta(key_transform='CAMEL').bind_to(MyClass)
>>> fromdict(MyClass, {"myStr": "value"})
classmethod from_json(s: str | bytes | bytearray, *, parse_float=None, parse_int=None, parse_constant=None, infer_missing=False, **kw) A
gas_heater: bool
classmethod get_default_config(building_name: str = 'BUI1') Any

Gets a default ExtendedControllerConfig.

maximum_autarky: bool
name: str
classmethod schema(*, infer_missing: bool = False, only=None, exclude=(), many: bool = False, context=None, load_only=(), dump_only=(), partial: bool = False, unknown=None) SchemaF[A]
to_dict(encode_json=False) Dict[str, dict | list | str | int | float | bool | None]

Return the fields of a dataclass instance as a new dictionary mapping field names to field values.

Example usage:

@dataclass class C:

x: int y: int

c = C(1, 2) assert asdict(c) == {‘x’: 1, ‘y’: 2}

When directly invoking this function, an optional Meta configuration for the dataclass can be specified via DumpMeta; by default, this will apply recursively to any nested dataclasses. Here’s a sample usage of this below:

>>> DumpMeta(key_transform='CAMEL').bind_to(MyClass)
>>> asdict(MyClass(my_str="value"))

If given, ‘dict_factory’ will be used instead of built-in dict. The function applies recursively to field values that are dataclass instances. This will also look into built-in containers: tuples, lists, and dicts.

to_json(*, skipkeys: bool = False, ensure_ascii: bool = True, check_circular: bool = True, allow_nan: bool = True, indent: int | str | None = None, separators: Tuple[str, str] | None = None, default: Callable | None = None, sort_keys: bool = False, **kw) str
class components.configuration.GasControllerConfig

Bases: object

Gas controller config class.

This controller works like the CHP controller, but switches on later so the CHP is used more often. Gas heater is used as a backup if the CHP power is not high enough. If the minimum_runtime is smaller than the timestep, the minimum_runtime is 1 timestep –> generic_gas_heater.py

height_lower_sensor = 80
height_upper_sensor = 20
minimum_runtime_minutes = 7000
temperature_switch_off = 70
temperature_switch_on = 55
class components.configuration.GasHeaterConfig

Bases: object

Gas heater config class.

P_th_max = 12000
P_th_min = 1000
delta_temperature = 25
eff_th_max = 0.9
eff_th_min = 0.6
is_modulating = True
mass_flow_max = 0.11483253588516747
temperature_max = 80
class components.configuration.HouseholdWarmWaterDemandConfig

Bases: object

Household warm water demand config.

demand_factor = 2.0
freshwater_temperature = 10
heat_exchanger_losses = 0
kwh_per_year = 2000
temperature_difference_cold = 6
temperature_difference_hot = 5
ww_temperature_demand = 45
class components.configuration.HydrogenStorageConfig

Bases: object

Hydrogen storage config class.

energy_for_charge = 0
energy_for_discharge = 0
loss_factor_per_day = 0
max_capacity = 500
max_charging_rate = 0.0005555555555555556
max_charging_rate_hour = 2
max_discharging_rate = 0.0005555555555555556
max_discharging_rate_hour = 2
min_capacity = 0
starting_fill = 400
class components.configuration.LoadConfig

Bases: object

Load config.

delta_temperature = 20
demand_factor = 20.201
kwh_per_year = 20201
possible_massflows_load = [0.1, 0.2, 0.3, 0.4]
temperature_returnflow_minimum = 30
class components.configuration.PVConfig

Bases: object

PV config class.

peak_power = 20000
class components.configuration.PhysicsConfig(density_in_kg_per_m3: float, lower_heating_value_in_joule_per_m3: float, higher_heating_value_in_joule_per_m3: float, specific_heat_capacity_in_joule_per_kg_per_kelvin: float)

Bases: object

Physics config class.

Returns physical and chemical properties of different energy carries.

Sources: Schmidt 2020: Wasserstofftechnik S.170ff https://gammel.de/de/lexikon/heizwert—brennwert/4838. Values are taken at standard conditions (25°C) https://energyfaculty.com/physical-and-thermal-properties/

Brennwert: Higher heating value gross caloric value, Heizwert: Lower heating value or net caloric value.

density_in_kg_per_m3: float
classmethod from_dict(kvs: dict | list | str | int | float | bool | None, *, infer_missing=False) A
classmethod from_json(s: str | bytes | bytearray, *, parse_float=None, parse_int=None, parse_constant=None, infer_missing=False, **kw) A
classmethod get_properties_for_energy_carrier(energy_carrier: LoadTypes) PhysicsConfig

Get physical and chemical properties from specific energy carrier.

higher_heating_value_in_joule_per_kg: float
higher_heating_value_in_joule_per_m3: float
lower_heating_value_in_joule_per_kg: float
lower_heating_value_in_joule_per_m3: float
classmethod schema(*, infer_missing: bool = False, only=None, exclude=(), many: bool = False, context=None, load_only=(), dump_only=(), partial: bool = False, unknown=None) SchemaF[A]
specific_heat_capacity_in_joule_per_kg_per_kelvin: float
specific_heat_capacity_in_watthour_per_kg_per_kelvin: float
specific_volume_in_m3_per_kg: float
to_dict(encode_json=False) Dict[str, dict | list | str | int | float | bool | None]
to_json(*, skipkeys: bool = False, ensure_ascii: bool = True, check_circular: bool = True, allow_nan: bool = True, indent: int | str | None = None, separators: Tuple[str, str] | None = None, default: Callable | None = None, sort_keys: bool = False, **kw) str
class components.configuration.WarmWaterStorageConfig(building_name: str, name: str, tank_diameter: float, tank_height: float, tank_start_temperature: float, temperature_difference: float, tank_u_value: float, slice_height_minimum: float)

Bases: ConfigBase

Warm water storage config class.

building_name: str
classmethod from_dict(kvs: dict | list | str | int | float | bool | None, *, infer_missing=False) A

Converts a Python dictionary object to a dataclass instance.

Iterates over each dataclass field recursively; lists, dicts, and nested dataclasses will likewise be initialized as expected.

When directly invoking this function, an optional Meta configuration for the dataclass can be specified via LoadMeta; by default, this will apply recursively to any nested dataclasses. Here’s a sample usage of this below:

>>> LoadMeta(key_transform='CAMEL').bind_to(MyClass)
>>> fromdict(MyClass, {"myStr": "value"})
classmethod from_json(s: str | bytes | bytearray, *, parse_float=None, parse_int=None, parse_constant=None, infer_missing=False, **kw) A
classmethod get_default_config(building_name: str = 'BUI1') Any

Gets a default config.

name: str
classmethod schema(*, infer_missing: bool = False, only=None, exclude=(), many: bool = False, context=None, load_only=(), dump_only=(), partial: bool = False, unknown=None) SchemaF[A]
slice_height_minimum: float
tank_diameter: float
tank_height: float
tank_start_temperature: float
tank_u_value: float
temperature_difference: float
to_dict(encode_json=False) Dict[str, dict | list | str | int | float | bool | None]

Return the fields of a dataclass instance as a new dictionary mapping field names to field values.

Example usage:

@dataclass class C:

x: int y: int

c = C(1, 2) assert asdict(c) == {‘x’: 1, ‘y’: 2}

When directly invoking this function, an optional Meta configuration for the dataclass can be specified via DumpMeta; by default, this will apply recursively to any nested dataclasses. Here’s a sample usage of this below:

>>> DumpMeta(key_transform='CAMEL').bind_to(MyClass)
>>> asdict(MyClass(my_str="value"))

If given, ‘dict_factory’ will be used instead of built-in dict. The function applies recursively to field values that are dataclass instances. This will also look into built-in containers: tuples, lists, and dicts.

to_json(*, skipkeys: bool = False, ensure_ascii: bool = True, check_circular: bool = True, allow_nan: bool = True, indent: int | str | None = None, separators: Tuple[str, str] | None = None, default: Callable | None = None, sort_keys: bool = False, **kw) str

components.controller_l1_building_heating module

components.controller_l1_example_controller module

Controller l1 example module.

class components.controller_l1_example_controller.SimpleController(name: str, my_simulation_parameters: SimulationParameters, config: SimpleControllerConfig, my_display_config: DisplayConfig = DisplayConfig(pretty_name=None, display_in_webtool=False))

Bases: Component

Simple controller class.

GasHeaterPowerPercent = 'Gas Heater Power Level'
StorageFillLevel = 'Fill Level Percent'
i_restore_state() None

Restores the state.

i_save_state() None

Saves the state.

i_simulate(timestep: int, stsv: SingleTimeStepValues, force_convergence: bool) None

Simulates the component.

class components.controller_l1_example_controller.SimpleControllerConfig(building_name: str, name: str)

Bases: ConfigBase

Config class.

building_name: str
classmethod from_dict(kvs: dict | list | str | int | float | bool | None, *, infer_missing=False) A

Converts a Python dictionary object to a dataclass instance.

Iterates over each dataclass field recursively; lists, dicts, and nested dataclasses will likewise be initialized as expected.

When directly invoking this function, an optional Meta configuration for the dataclass can be specified via LoadMeta; by default, this will apply recursively to any nested dataclasses. Here’s a sample usage of this below:

>>> LoadMeta(key_transform='CAMEL').bind_to(MyClass)
>>> fromdict(MyClass, {"myStr": "value"})
classmethod from_json(s: str | bytes | bytearray, *, parse_float=None, parse_int=None, parse_constant=None, infer_missing=False, **kw) A
classmethod get_default_config(building_name: str = 'BUI1') Any

Returns default config.

classmethod get_main_classname()

Return the full class name of the base class.

name: str
classmethod schema(*, infer_missing: bool = False, only=None, exclude=(), many: bool = False, context=None, load_only=(), dump_only=(), partial: bool = False, unknown=None) SchemaF[A]
to_dict(encode_json=False) Dict[str, dict | list | str | int | float | bool | None]

Return the fields of a dataclass instance as a new dictionary mapping field names to field values.

Example usage:

@dataclass class C:

x: int y: int

c = C(1, 2) assert asdict(c) == {‘x’: 1, ‘y’: 2}

When directly invoking this function, an optional Meta configuration for the dataclass can be specified via DumpMeta; by default, this will apply recursively to any nested dataclasses. Here’s a sample usage of this below:

>>> DumpMeta(key_transform='CAMEL').bind_to(MyClass)
>>> asdict(MyClass(my_str="value"))

If given, ‘dict_factory’ will be used instead of built-in dict. The function applies recursively to field values that are dataclass instances. This will also look into built-in containers: tuples, lists, and dicts.

to_json(*, skipkeys: bool = False, ensure_ascii: bool = True, check_circular: bool = True, allow_nan: bool = True, indent: int | str | None = None, separators: Tuple[str, str] | None = None, default: Callable | None = None, sort_keys: bool = False, **kw) str

components.controller_l1_generic_ev_charge module

components.controller_l1_generic_runtime module

Generic runtime controller.

class components.controller_l1_generic_runtime.L1Config(building_name: str, name: str, source_weight: int, min_operation_time_in_seconds: int, min_idle_time_in_seconds: int)

Bases: ConfigBase

L1 Runtime Config.

building_name: str
classmethod from_dict(kvs: dict | list | str | int | float | bool | None, *, infer_missing=False) A

Converts a Python dictionary object to a dataclass instance.

Iterates over each dataclass field recursively; lists, dicts, and nested dataclasses will likewise be initialized as expected.

When directly invoking this function, an optional Meta configuration for the dataclass can be specified via LoadMeta; by default, this will apply recursively to any nested dataclasses. Here’s a sample usage of this below:

>>> LoadMeta(key_transform='CAMEL').bind_to(MyClass)
>>> fromdict(MyClass, {"myStr": "value"})
classmethod from_json(s: str | bytes | bytearray, *, parse_float=None, parse_int=None, parse_constant=None, infer_missing=False, **kw) A
static get_default_config(name: str, building_name: str = 'BUI1') Any

Default config.

static get_default_config_heatpump(name: str, building_name: str = 'BUI1') Any

Gets a default config for heat pumps.

min_idle_time_in_seconds: int
min_operation_time_in_seconds: int
name: str
classmethod schema(*, infer_missing: bool = False, only=None, exclude=(), many: bool = False, context=None, load_only=(), dump_only=(), partial: bool = False, unknown=None) SchemaF[A]
source_weight: int
to_dict(encode_json=False) Dict[str, dict | list | str | int | float | bool | None]

Return the fields of a dataclass instance as a new dictionary mapping field names to field values.

Example usage:

@dataclass class C:

x: int y: int

c = C(1, 2) assert asdict(c) == {‘x’: 1, ‘y’: 2}

When directly invoking this function, an optional Meta configuration for the dataclass can be specified via DumpMeta; by default, this will apply recursively to any nested dataclasses. Here’s a sample usage of this below:

>>> DumpMeta(key_transform='CAMEL').bind_to(MyClass)
>>> asdict(MyClass(my_str="value"))

If given, ‘dict_factory’ will be used instead of built-in dict. The function applies recursively to field values that are dataclass instances. This will also look into built-in containers: tuples, lists, and dicts.

to_json(*, skipkeys: bool = False, ensure_ascii: bool = True, check_circular: bool = True, allow_nan: bool = True, indent: int | str | None = None, separators: Tuple[str, str] | None = None, default: Callable | None = None, sort_keys: bool = False, **kw) str
class components.controller_l1_generic_runtime.L1GenericRuntimeController(my_simulation_parameters: SimulationParameters, config: L1Config, my_display_config: DisplayConfig = DisplayConfig(pretty_name=None, display_in_webtool=False))

Bases: Component

L1 Heat Pump Controller.

It takes care of the operation of the heat pump only in terms of running times. It gets inputs from an L2-heat controller.

Parameters

min_running_time: int, optional

Minimal running time of device, in seconds. The default is 3600 seconds.

min_idle_timeint, optional

Minimal off time of device, in seconds. The default is 900 seconds.

source_weightint, optional

Weight of component, relevant if there is more than one component of same type, defines hierachy in control. The default is 1.

component typestr, optional

Name of component to be controlled

L1DeviceSignal = 'L1DeviceSignal'
L1RunTimeSignal = 'L1RunTimeSignal'
L2DeviceSignal = 'l2_DeviceSignal'
get_default_connections_from_controller_l2_generic_heat_clever_simple() List[ComponentConnection]

Makes default connections to l2 smart controllers.

i_doublecheck(timestep: int, stsv: SingleTimeStepValues) None

For checking for problems.

i_prepare_simulation() None

Prepares the simulation.

i_restore_state() None

Restores the previous state.

i_save_state() None

Saves the current state for the next timestep.

i_simulate(timestep: int, stsv: SingleTimeStepValues, force_convergence: bool) None

Main simulation function.

write_to_report() List[str]

Writes config to report.

class components.controller_l1_generic_runtime.L1GenericRuntimeControllerState(on_off: int, activation_time_step: int = 0, deactivation_time_step: int = 0)

Bases: object

The data class saves the state of the controller.

activate(timestep: int) None

Activates the controller.

clone() Any

Generates a new state.

deactivate(timestep: int) None

Activates the controller.

i_prepare_simulation() None

Prepares the simulation.

components.controller_l1_heat_old module

Controller l1 heat old module.

class components.controller_l1_heat_old.ControllerHeat(my_simulation_parameters: SimulationParameters, config: ControllerHeatConfig, my_display_config: DisplayConfig = DisplayConfig(pretty_name=None, display_in_webtool=False))

Bases: Component

Controller heat.

Controlls energy flows for heat demand. Heat Demand will be controlled by the storage temperature. For this storage provides heat for a load profile or for the building. As well Heat Demand can be simulated without storage.

ControlSignalChooseStorage = 'ControlSignalChooseStorage'
ControlSignalChp = 'ControlSignalChp'
ControlSignalGasHeater = 'ControlSignalGasHeater'
ControlSignalHeatPump = 'ControlSignalHeatPump'
ResidenceTemperature = 'ResidenceTemperature'
StorageTemperatureHeatingWater = 'StorageTemperatureHeatingWater'
StorageTemperatureWarmWater = 'StorageTemperatureWarmWater'
ThermalDemandBuilding = 'ThermalDemandBuilding'
build(mode: Any) None

Build function.

i_doublecheck(timestep: int, stsv: SingleTimeStepValues) None

Doublechecks.

i_prepare_simulation() None

Prepares the simulation.

i_restore_state() None

Restores the state.

i_save_state() None

Saves the state.

i_simulate(timestep: int, stsv: SingleTimeStepValues, force_convergence: bool) None

Simulates the component.

simulate_storage(delta_temperature: float, stsv: SingleTimeStepValues, timestep: int, temperature_storage: float, temperature_storage_target: float, temperature_storage_target_hysteresis: float, temperature_storage_target_c: float, timestep_of_hysteresis: int) Any

Simulates the storage.

write_to_report()

Write to report.

class components.controller_l1_heat_old.ControllerHeatConfig(building_name: str, name: str, temperature_storage_target_warm_water: float, temperature_storage_target_heating_water: float, temperature_storage_target_hysteresis_ww: float, temperature_storage_target_hysteresis_hw: float)

Bases: ConfigBase

Configuration of the Controller Heat class.

building_name: str
classmethod from_dict(kvs: dict | list | str | int | float | bool | None, *, infer_missing=False) A

Converts a Python dictionary object to a dataclass instance.

Iterates over each dataclass field recursively; lists, dicts, and nested dataclasses will likewise be initialized as expected.

When directly invoking this function, an optional Meta configuration for the dataclass can be specified via LoadMeta; by default, this will apply recursively to any nested dataclasses. Here’s a sample usage of this below:

>>> LoadMeta(key_transform='CAMEL').bind_to(MyClass)
>>> fromdict(MyClass, {"myStr": "value"})
classmethod from_json(s: str | bytes | bytearray, *, parse_float=None, parse_int=None, parse_constant=None, infer_missing=False, **kw) A
classmethod get_default_controller_heat_l1(building_name: str = 'BUI1') Any

Get a default Building.

classmethod get_main_classname()

Return the full class name of the base class.

name: str
classmethod schema(*, infer_missing: bool = False, only=None, exclude=(), many: bool = False, context=None, load_only=(), dump_only=(), partial: bool = False, unknown=None) SchemaF[A]
temperature_storage_target_heating_water: float
temperature_storage_target_hysteresis_hw: float
temperature_storage_target_hysteresis_ww: float
temperature_storage_target_warm_water: float
to_dict(encode_json=False) Dict[str, dict | list | str | int | float | bool | None]

Return the fields of a dataclass instance as a new dictionary mapping field names to field values.

Example usage:

@dataclass class C:

x: int y: int

c = C(1, 2) assert asdict(c) == {‘x’: 1, ‘y’: 2}

When directly invoking this function, an optional Meta configuration for the dataclass can be specified via DumpMeta; by default, this will apply recursively to any nested dataclasses. Here’s a sample usage of this below:

>>> DumpMeta(key_transform='CAMEL').bind_to(MyClass)
>>> asdict(MyClass(my_str="value"))

If given, ‘dict_factory’ will be used instead of built-in dict. The function applies recursively to field values that are dataclass instances. This will also look into built-in containers: tuples, lists, and dicts.

to_json(*, skipkeys: bool = False, ensure_ascii: bool = True, check_circular: bool = True, allow_nan: bool = True, indent: int | str | None = None, separators: Tuple[str, str] | None = None, default: Callable | None = None, sort_keys: bool = False, **kw) str
class components.controller_l1_heat_old.ControllerState(control_signal_gas_heater: float, control_signal_chp: float, control_signal_heat_pump: float, temperature_storage_target_ww_c: float, temperature_storage_target_hw_c: float, timestep_of_hysteresis_ww: int, timestep_of_hysteresis_hw: int)

Bases: object

Controller state.

Save State if Heater Components were supposed to run in last timestep (Control_Signal). Saves timestep of hysteresis of storages and the changing target temperature of storages. The target temperature in states changes when target temperature of storage is reached.

clone() ControllerState

Clones the state.

components.controller_l1_heatpump module

Generic heating controller with ping pong control and optional input for energy management system.

Runtime and idle time also considered. This file contains Controller together with Configuration and State. The heat source is controlled accoring to four modes: (a) 0.5 * power when temperature is already above target and only runs due to minimal operation time, or temperature is between upper target and increased upper target from ESM (b) 0.75 * power when temperature is within tolerance range, (c) full power when temperature is below lower target, (d) off when temperature is already below target and only runs due to minimal idle time, or temperature is above upper target.

class components.controller_l1_heatpump.L1HeatPumpConfig(building_name: str, name: str, source_weight: int, t_min_heating_in_celsius: float, t_max_heating_in_celsius: float, cooling_considered: bool, day_of_heating_season_begin: int, day_of_heating_season_end: int, min_operation_time_in_seconds: int, min_idle_time_in_seconds: int)

Bases: ConfigBase

L1 Controller Config.

building_name: str
cooling_considered: bool
day_of_heating_season_begin: int
day_of_heating_season_end: int
classmethod from_dict(kvs: dict | list | str | int | float | bool | None, *, infer_missing=False) A

Converts a Python dictionary object to a dataclass instance.

Iterates over each dataclass field recursively; lists, dicts, and nested dataclasses will likewise be initialized as expected.

When directly invoking this function, an optional Meta configuration for the dataclass can be specified via LoadMeta; by default, this will apply recursively to any nested dataclasses. Here’s a sample usage of this below:

>>> LoadMeta(key_transform='CAMEL').bind_to(MyClass)
>>> fromdict(MyClass, {"myStr": "value"})
classmethod from_json(s: str | bytes | bytearray, *, parse_float=None, parse_int=None, parse_constant=None, infer_missing=False, **kw) A
static get_default_config_heat_source_controller(name: str = 'Controller', building_name: str = 'BUI1') L1HeatPumpConfig

Returns default configuration for the controller of building heating.

static get_default_config_heat_source_controller_buffer(name: str = 'Controller', building_name: str = 'BUI1') L1HeatPumpConfig

Returns default configuration for the controller of buffer heating.

static get_default_config_heat_source_controller_dhw(name: str = 'Controller', building_name: str = 'BUI1') L1HeatPumpConfig

Returns default configuration for the controller of a drain hot water storage.

classmethod get_main_classname()

Returns the full class name of the base class.

min_idle_time_in_seconds: int
min_operation_time_in_seconds: int
name: str

name of the device

classmethod schema(*, infer_missing: bool = False, only=None, exclude=(), many: bool = False, context=None, load_only=(), dump_only=(), partial: bool = False, unknown=None) SchemaF[A]
source_weight: int

priority of the device in hierachy: the higher the number the lower the priority

t_max_heating_in_celsius: float

upper set temperature of building, given in °C

t_min_heating_in_celsius: float

lower set temperature of building, given in °C

to_dict(encode_json=False) Dict[str, dict | list | str | int | float | bool | None]

Return the fields of a dataclass instance as a new dictionary mapping field names to field values.

Example usage:

@dataclass class C:

x: int y: int

c = C(1, 2) assert asdict(c) == {‘x’: 1, ‘y’: 2}

When directly invoking this function, an optional Meta configuration for the dataclass can be specified via DumpMeta; by default, this will apply recursively to any nested dataclasses. Here’s a sample usage of this below:

>>> DumpMeta(key_transform='CAMEL').bind_to(MyClass)
>>> asdict(MyClass(my_str="value"))

If given, ‘dict_factory’ will be used instead of built-in dict. The function applies recursively to field values that are dataclass instances. This will also look into built-in containers: tuples, lists, and dicts.

to_json(*, skipkeys: bool = False, ensure_ascii: bool = True, check_circular: bool = True, allow_nan: bool = True, indent: int | str | None = None, separators: Tuple[str, str] | None = None, default: Callable | None = None, sort_keys: bool = False, **kw) str
class components.controller_l1_heatpump.L1HeatPumpController(my_simulation_parameters: SimulationParameters, config: L1HeatPumpConfig, my_display_config: DisplayConfig = DisplayConfig(pretty_name=None, display_in_webtool=False))

Bases: Component

L1 building controller. Processes signals ensuring comfort temperature of building/buffer or boiler.

Gets available surplus electricity and the temperature of the storage or building to control as input, and outputs power signal for heat source based on comfort temperature limits and available electricity. In addition, run time control is considered, so that e. g. heat pumps do not continuosly turn on and off. It is optionally only activated during the heating season.

Components to connect to: (1) Building or Buffer Storage (generic_hot_water_storage_modular) (2) Energy Management System (controller_l2_energy_management_system) -> optional if set temperatures are increased when surplus is available.

HeatControllerTargetPercentage = 'HeatControllerTargetPercentage'
StorageTemperature = 'StorageTemperature'
StorageTemperatureModifier = 'StorageTemperatureModifier'
calc_percentage(t_storage: float) None

Calculate the heat pump target percentage.

calculate_state(timestep: int, stsv: SingleTimeStepValues) None

Calculate the heat pump state and activate / deactives.

get_component_kpi_entries(all_outputs: List, postprocessing_results: DataFrame) List[KpiEntry]

Calculates KPIs for the respective component and return all KPI entries as list.

static get_cost_capex(config: L1HeatPumpConfig, simulation_parameters: SimulationParameters) CapexCostDataClass

Returns investment cost, CO2 emissions and lifetime.

get_cost_opex(all_outputs: List, postprocessing_results: DataFrame) OpexCostDataClass

Calculate OPEX costs, consisting of electricity costs and revenues.

get_default_connections_from_energy_management_system()

Get default connections from energy management system.

get_default_connections_generic_hot_water_storage_modular()

Sets default connections for the boiler.

i_doublecheck(timestep: int, stsv: SingleTimeStepValues) None

For double checking results.

i_prepare_simulation() None

Prepares the simulation.

i_restore_state() None

Restores previous state.

i_save_state() None

Saves the state.

i_simulate(timestep: int, stsv: SingleTimeStepValues, force_convergence: bool) None

Core Simulation function.

minimum_resting_time_in_timesteps

Initializes the class.

write_to_report() List[str]

Writes the information of the current component to the report.

class components.controller_l1_heatpump.L1HeatPumpControllerState(on_off: int, activation_time_step: int, deactivation_time_step: int, percentage: float)

Bases: object

Data class that saves the state of the controller.

activate(timestep: int) None

Activates the heat pump and remembers the time step.

clone() L1HeatPumpControllerState

Copies the current instance.

deactivate(timestep: int) None

Deactivates the heat pump and remembers the time step.

i_prepare_simulation() None

Prepares the simulation.

components.controller_l2_energy_management_system module

components.controller_l2_generic_heat_clever_simple module

components.controller_l2_generic_heat_simple module

components.controller_l2_smart_controller module

components.csvloader module

Csvloader module.

class components.csvloader.CSVLoader(config: CSVLoaderConfig, my_simulation_parameters: SimulationParameters, my_display_config: DisplayConfig = DisplayConfig(pretty_name=None, display_in_webtool=False))

Bases: Component

Csvloader class.

Class component loads CSV file containing some load profile relevant to the applied setup function.

Parameters

name: str

Name of load profile from CSV file

csv_filename: str

Name of CSV filename containing the load profile data

column: int

Column number where the load profile data is stored inside of the CSV file

loadtype: LoadTypes,

Load type corresponded to the data loaded

unit: lt.Units

Units of data loaded

column_name: str

Name of column where the load profile data is stored inside of the CSV File

simulation_parameters: cp.SimulationParameters

Simulation parameters used by the setup function

sep: str

Separator used CSV file

decimal: str

Decimal indicator used in the CSV file

multiplier: float

Multiplication factor, in case an amplification of the data is required

Output1: str = 'CSV Profile'
i_doublecheck(timestep: int, stsv: SingleTimeStepValues) None

Doublechecks.

i_prepare_simulation() None

Prepare the simulation.

i_restore_state() None

Restores the state.

i_save_state() None

Saves the state.

i_simulate(timestep: int, stsv: SingleTimeStepValues, force_convergence: bool) None

Simulates the component.

write_to_report() List[str]

Writes a report.

class components.csvloader.CSVLoaderConfig(building_name: str, name: str, csv_filename: str, column: int, loadtype: LoadTypes, unit: Units, column_name: str, sep: str, decimal: str, multiplier: float, output_description: str)

Bases: ConfigBase

Csvloader config class.

building_name: str
column: int
column_name: str
csv_filename: str
decimal: str
classmethod from_dict(kvs: dict | list | str | int | float | bool | None, *, infer_missing=False) A

Converts a Python dictionary object to a dataclass instance.

Iterates over each dataclass field recursively; lists, dicts, and nested dataclasses will likewise be initialized as expected.

When directly invoking this function, an optional Meta configuration for the dataclass can be specified via LoadMeta; by default, this will apply recursively to any nested dataclasses. Here’s a sample usage of this below:

>>> LoadMeta(key_transform='CAMEL').bind_to(MyClass)
>>> fromdict(MyClass, {"myStr": "value"})
classmethod from_json(s: str | bytes | bytearray, *, parse_float=None, parse_int=None, parse_constant=None, infer_missing=False, **kw) A
classmethod get_main_classname()

Return the full class name of the base class.

loadtype: LoadTypes
multiplier: float
name: str
output_description: str
classmethod schema(*, infer_missing: bool = False, only=None, exclude=(), many: bool = False, context=None, load_only=(), dump_only=(), partial: bool = False, unknown=None) SchemaF[A]
sep: str
to_dict(encode_json=False) Dict[str, dict | list | str | int | float | bool | None]

Return the fields of a dataclass instance as a new dictionary mapping field names to field values.

Example usage:

@dataclass class C:

x: int y: int

c = C(1, 2) assert asdict(c) == {‘x’: 1, ‘y’: 2}

When directly invoking this function, an optional Meta configuration for the dataclass can be specified via DumpMeta; by default, this will apply recursively to any nested dataclasses. Here’s a sample usage of this below:

>>> DumpMeta(key_transform='CAMEL').bind_to(MyClass)
>>> asdict(MyClass(my_str="value"))

If given, ‘dict_factory’ will be used instead of built-in dict. The function applies recursively to field values that are dataclass instances. This will also look into built-in containers: tuples, lists, and dicts.

to_json(*, skipkeys: bool = False, ensure_ascii: bool = True, check_circular: bool = True, allow_nan: bool = True, indent: int | str | None = None, separators: Tuple[str, str] | None = None, default: Callable | None = None, sort_keys: bool = False, **kw) str
unit: Units

components.example_component module

Example Component.

class components.example_component.ExampleComponent(my_simulation_parameters: SimulationParameters, config: ExampleComponentConfig, my_display_config: DisplayConfig = DisplayConfig(pretty_name=None, display_in_webtool=False))

Bases: Component

Example Component class.

It supports multiple Example Component values for fictitious scenarios. The values passed to the constructor are taken as constants to build the load profile for the entire simulation duration.

Parameters

electricityfloat

Constant to define electricity output profile

heatfloat

Constant to define heat output profile

capacityfloat

Stored energy when starting the simulation

initial_temperaturefloat

Initial temperature when starting the simulation

sim_params: cp.SimulationParameters

Simulation parameters used by the setup function:

ElectricityOutput = 'ElectricityOutput'
StoredEnergy = 'StoredEnergy'
TemperatureMean = 'Residence Temperature'
ThermalEnergyDelivered = 'ThermalEnergyDelivered'
build(electricity: float | None, capacity: float | None, initial_temperature: float | None) None

Build load profile for entire simulation duration.

i_doublecheck(timestep: int, stsv: SingleTimeStepValues) None

Doublechecks.

i_restore_state() None

Restores previous state of the temperature.

i_save_state() None

Saves the current state of the temperature.

i_simulate(timestep: int, stsv: SingleTimeStepValues, force_convergence: bool) None

Simulates the component.

write_to_report() List[str]

Writes a report.

class components.example_component.ExampleComponentConfig(building_name: str, name: str, loadtype: LoadTypes, unit: Units, electricity: float | None, capacity: float | None, initial_temperature: float | None)

Bases: ConfigBase

Configuration of the Example Component.

building_name: str
capacity: float | None
electricity: float | None
classmethod from_dict(kvs: dict | list | str | int | float | bool | None, *, infer_missing=False) A

Converts a Python dictionary object to a dataclass instance.

Iterates over each dataclass field recursively; lists, dicts, and nested dataclasses will likewise be initialized as expected.

When directly invoking this function, an optional Meta configuration for the dataclass can be specified via LoadMeta; by default, this will apply recursively to any nested dataclasses. Here’s a sample usage of this below:

>>> LoadMeta(key_transform='CAMEL').bind_to(MyClass)
>>> fromdict(MyClass, {"myStr": "value"})
classmethod from_json(s: str | bytes | bytearray, *, parse_float=None, parse_int=None, parse_constant=None, infer_missing=False, **kw) A
classmethod get_default_example_component(building_name: str = 'BUI1') Any

Gets a default Example Component.

classmethod get_main_classname()

Returns the full class name of the base class.

initial_temperature: float | None
loadtype: LoadTypes
name: str
classmethod schema(*, infer_missing: bool = False, only=None, exclude=(), many: bool = False, context=None, load_only=(), dump_only=(), partial: bool = False, unknown=None) SchemaF[A]
to_dict(encode_json=False) Dict[str, dict | list | str | int | float | bool | None]

Return the fields of a dataclass instance as a new dictionary mapping field names to field values.

Example usage:

@dataclass class C:

x: int y: int

c = C(1, 2) assert asdict(c) == {‘x’: 1, ‘y’: 2}

When directly invoking this function, an optional Meta configuration for the dataclass can be specified via DumpMeta; by default, this will apply recursively to any nested dataclasses. Here’s a sample usage of this below:

>>> DumpMeta(key_transform='CAMEL').bind_to(MyClass)
>>> asdict(MyClass(my_str="value"))

If given, ‘dict_factory’ will be used instead of built-in dict. The function applies recursively to field values that are dataclass instances. This will also look into built-in containers: tuples, lists, and dicts.

to_json(*, skipkeys: bool = False, ensure_ascii: bool = True, check_circular: bool = True, allow_nan: bool = True, indent: int | str | None = None, separators: Tuple[str, str] | None = None, default: Callable | None = None, sort_keys: bool = False, **kw) str
unit: Units

components.example_storage module

Example Storage.

class components.example_storage.ExampleStorageState(min_val: float, max_val: float)

Bases: object

A class to simulate the Example Storage State.

store(val: float) float

Returns how much is put in the storage.

withdraw(val: float) float

Returns how much is taken out of the storage.

class components.example_storage.SimpleStorage(my_simulation_parameters: SimulationParameters, config: SimpleStorageConfig, my_display_config: DisplayConfig = DisplayConfig(pretty_name=None, display_in_webtool=False))

Bases: Component

A class to simulate the Simple Storage.

ActualStorageDelta = 'Actual Storage Delta'
ChargingAmount = 'Charging Amount'
CurrentFillLevel = 'Current Fill Level Absolute'
CurrentFillLevelPercent = 'Current Fill Level Percent'
DischargingAmount = 'Discharging Amount'
i_restore_state() None

Restores the previous state of the storage.

i_save_state() None

Saves the current state of the storage.

i_simulate(timestep: int, stsv: SingleTimeStepValues, force_convergence: bool) None

Simulates the storage.

class components.example_storage.SimpleStorageConfig(building_name: str, name: str, loadtype: LoadTypes, unit: Units, capacity: float)

Bases: ConfigBase

Configuration of the Simple Storage.

building_name: str
capacity: float
classmethod from_dict(kvs: dict | list | str | int | float | bool | None, *, infer_missing=False) A

Converts a Python dictionary object to a dataclass instance.

Iterates over each dataclass field recursively; lists, dicts, and nested dataclasses will likewise be initialized as expected.

When directly invoking this function, an optional Meta configuration for the dataclass can be specified via LoadMeta; by default, this will apply recursively to any nested dataclasses. Here’s a sample usage of this below:

>>> LoadMeta(key_transform='CAMEL').bind_to(MyClass)
>>> fromdict(MyClass, {"myStr": "value"})
classmethod from_json(s: str | bytes | bytearray, *, parse_float=None, parse_int=None, parse_constant=None, infer_missing=False, **kw) A
classmethod get_default_thermal_storage(building_name: str = 'BUI1') Any

Gets a default Simple Storage.

classmethod get_main_classname()

Returns the full class name of the base class.

loadtype: LoadTypes
name: str
classmethod schema(*, infer_missing: bool = False, only=None, exclude=(), many: bool = False, context=None, load_only=(), dump_only=(), partial: bool = False, unknown=None) SchemaF[A]
to_dict(encode_json=False) Dict[str, dict | list | str | int | float | bool | None]

Return the fields of a dataclass instance as a new dictionary mapping field names to field values.

Example usage:

@dataclass class C:

x: int y: int

c = C(1, 2) assert asdict(c) == {‘x’: 1, ‘y’: 2}

When directly invoking this function, an optional Meta configuration for the dataclass can be specified via DumpMeta; by default, this will apply recursively to any nested dataclasses. Here’s a sample usage of this below:

>>> DumpMeta(key_transform='CAMEL').bind_to(MyClass)
>>> asdict(MyClass(my_str="value"))

If given, ‘dict_factory’ will be used instead of built-in dict. The function applies recursively to field values that are dataclass instances. This will also look into built-in containers: tuples, lists, and dicts.

to_json(*, skipkeys: bool = False, ensure_ascii: bool = True, check_circular: bool = True, allow_nan: bool = True, indent: int | str | None = None, separators: Tuple[str, str] | None = None, default: Callable | None = None, sort_keys: bool = False, **kw) str
unit: Units

components.example_template module

The template module.

It serves as a template for creating new component modules. It shows with a simplified example which steps are necessary to create a new component. Additionally it contains examples for doc strings according to the sphinx format.

class components.example_template.ComponentName(my_simulation_parameters: SimulationParameters, config: ComponentNameConfig, my_display_config: DisplayConfig = DisplayConfig(pretty_name=None, display_in_webtool=False))

Bases: Component

Some instructions to document a class.

First write a summary of the class that is as accurate as possible. It should contain information about what functionalities the class has and what its purpose is in the HiSim project.

This is an example class. It can be used as a template for creating new component modules. Its functionalities serve no further purpose for HiSim.

Parameters

component_namestr

Passed to initialize Component.

loadtypeLoadType

A LoadTypes object that represents the type of the loaded data.

unit: LoadTypes.Units

A Units object that represents the unit of the loaded data.

InputFromOtherComponent = 'InputFromState'
OutputWithState = 'OutputWithState'
OutputWithoutState = 'OutputWithoutState'
i_doublecheck(timestep: int, stsv: SingleTimeStepValues) None

Doublechecks.

i_restore_state() None

Restores previous state.

i_save_state() None

Saves the current state.

i_simulate(timestep: int, stsv: SingleTimeStepValues, force_convergence: bool) None

Simulates the component.

class components.example_template.ComponentNameConfig(building_name: str, name: str, loadtype: LoadTypes, unit: Units)

Bases: ConfigBase

Configuration of the ComponentName.

building_name: str
classmethod from_dict(kvs: dict | list | str | int | float | bool | None, *, infer_missing=False) A

Converts a Python dictionary object to a dataclass instance.

Iterates over each dataclass field recursively; lists, dicts, and nested dataclasses will likewise be initialized as expected.

When directly invoking this function, an optional Meta configuration for the dataclass can be specified via LoadMeta; by default, this will apply recursively to any nested dataclasses. Here’s a sample usage of this below:

>>> LoadMeta(key_transform='CAMEL').bind_to(MyClass)
>>> fromdict(MyClass, {"myStr": "value"})
classmethod from_json(s: str | bytes | bytearray, *, parse_float=None, parse_int=None, parse_constant=None, infer_missing=False, **kw) A
classmethod get_default_template_component(building_name: str = 'BUI1') Any

Gets a default ComponentName.

classmethod get_main_classname()

Returns the full class name of the base class.

loadtype: LoadTypes
name: str
classmethod schema(*, infer_missing: bool = False, only=None, exclude=(), many: bool = False, context=None, load_only=(), dump_only=(), partial: bool = False, unknown=None) SchemaF[A]
to_dict(encode_json=False) Dict[str, dict | list | str | int | float | bool | None]

Return the fields of a dataclass instance as a new dictionary mapping field names to field values.

Example usage:

@dataclass class C:

x: int y: int

c = C(1, 2) assert asdict(c) == {‘x’: 1, ‘y’: 2}

When directly invoking this function, an optional Meta configuration for the dataclass can be specified via DumpMeta; by default, this will apply recursively to any nested dataclasses. Here’s a sample usage of this below:

>>> DumpMeta(key_transform='CAMEL').bind_to(MyClass)
>>> asdict(MyClass(my_str="value"))

If given, ‘dict_factory’ will be used instead of built-in dict. The function applies recursively to field values that are dataclass instances. This will also look into built-in containers: tuples, lists, and dicts.

to_json(*, skipkeys: bool = False, ensure_ascii: bool = True, check_circular: bool = True, allow_nan: bool = True, indent: int | str | None = None, separators: Tuple[str, str] | None = None, default: Callable | None = None, sort_keys: bool = False, **kw) str
unit: Units
class components.example_template.ComponentNameState(output_with_state: float = 0)

Bases: object

The data class saves the state of the simulation results.

Parameters

output_with_state : int Stores the state of the output_with_state value from ComponentName.

output_with_state: float = 0

components.example_transformer module

Example Transformer.

class components.example_transformer.ExampleTransformer(my_simulation_parameters: SimulationParameters, config: ExampleTransformerConfig, my_display_config: DisplayConfig = DisplayConfig(pretty_name=None, display_in_webtool=False))

Bases: Component

The Example Transformer class.

It is used to modify input values and return them as new output values.

Parameters

component_namestr

Passed to initialize Component.

loadtypeLoadType

A LoadTypes object that represents the type of the loaded data.

unit: LoadTypes.Units

A Units object that represents the unit of the loaded data.

TransformerInput = 'Input1'
TransformerInput2 = 'Optional Input1'
TransformerOutput = 'MyTransformerOutput'
TransformerOutput2 = 'MyTransformerOutput2'
i_doublecheck(timestep: int, stsv: SingleTimeStepValues) None

Doublechecks.

i_prepare_simulation() None

Prepares the simulation.

i_restore_state() None

Restores previous state.

i_save_state() None

Saves the current state.

i_simulate(timestep: int, stsv: SingleTimeStepValues, force_convergence: bool) None

Simulates the transformer.

write_to_report() List[str]

Writes a report.

class components.example_transformer.ExampleTransformerConfig(building_name: str, name: str, loadtype: LoadTypes, unit: Units)

Bases: ConfigBase

Configuration of the Example Transformer.

building_name: str
classmethod from_dict(kvs: dict | list | str | int | float | bool | None, *, infer_missing=False) A

Converts a Python dictionary object to a dataclass instance.

Iterates over each dataclass field recursively; lists, dicts, and nested dataclasses will likewise be initialized as expected.

When directly invoking this function, an optional Meta configuration for the dataclass can be specified via LoadMeta; by default, this will apply recursively to any nested dataclasses. Here’s a sample usage of this below:

>>> LoadMeta(key_transform='CAMEL').bind_to(MyClass)
>>> fromdict(MyClass, {"myStr": "value"})
classmethod from_json(s: str | bytes | bytearray, *, parse_float=None, parse_int=None, parse_constant=None, infer_missing=False, **kw) A
classmethod get_default_transformer(building_name: str = 'BUI1') Any

Gets a default Transformer.

classmethod get_main_classname()

Returns the full class name of the base class.

loadtype: LoadTypes
name: str
classmethod schema(*, infer_missing: bool = False, only=None, exclude=(), many: bool = False, context=None, load_only=(), dump_only=(), partial: bool = False, unknown=None) SchemaF[A]
to_dict(encode_json=False) Dict[str, dict | list | str | int | float | bool | None]

Return the fields of a dataclass instance as a new dictionary mapping field names to field values.

Example usage:

@dataclass class C:

x: int y: int

c = C(1, 2) assert asdict(c) == {‘x’: 1, ‘y’: 2}

When directly invoking this function, an optional Meta configuration for the dataclass can be specified via DumpMeta; by default, this will apply recursively to any nested dataclasses. Here’s a sample usage of this below:

>>> DumpMeta(key_transform='CAMEL').bind_to(MyClass)
>>> asdict(MyClass(my_str="value"))

If given, ‘dict_factory’ will be used instead of built-in dict. The function applies recursively to field values that are dataclass instances. This will also look into built-in containers: tuples, lists, and dicts.

to_json(*, skipkeys: bool = False, ensure_ascii: bool = True, check_circular: bool = True, allow_nan: bool = True, indent: int | str | None = None, separators: Tuple[str, str] | None = None, default: Callable | None = None, sort_keys: bool = False, **kw) str
unit: Units

components.generic_CHP module

components.generic_battery module

Generic battery.

class components.generic_battery.BatteryController(my_simulation_parameters: SimulationParameters, config: BatteryControllerConfig, my_display_config: DisplayConfig = DisplayConfig(pretty_name=None, display_in_webtool=False))

Bases: Component

Battery Controller class.

ElectricityInput = 'ElectricityInput'
State = 'State'
i_doublecheck(timestep: int, stsv: SingleTimeStepValues) None

Doublechecks.

i_prepare_simulation() None

Prepares the simulation.

i_restore_state() None

Restores the state.

i_save_state() None

Saves the state.

i_simulate(timestep: int, stsv: SingleTimeStepValues, force_convergence: bool) None

Simulates the component.

class components.generic_battery.BatteryControllerConfig(building_name: str, name: str)

Bases: ConfigBase

Configuration of the Generic Battery Controller.

building_name: str
classmethod from_dict(kvs: dict | list | str | int | float | bool | None, *, infer_missing=False) A

Converts a Python dictionary object to a dataclass instance.

Iterates over each dataclass field recursively; lists, dicts, and nested dataclasses will likewise be initialized as expected.

When directly invoking this function, an optional Meta configuration for the dataclass can be specified via LoadMeta; by default, this will apply recursively to any nested dataclasses. Here’s a sample usage of this below:

>>> LoadMeta(key_transform='CAMEL').bind_to(MyClass)
>>> fromdict(MyClass, {"myStr": "value"})
classmethod from_json(s: str | bytes | bytearray, *, parse_float=None, parse_int=None, parse_constant=None, infer_missing=False, **kw) A
classmethod get_default_config(building_name: str = 'BUI1') Any

Gets a default config.

classmethod get_main_classname()

Returns the full class name of the base class.

name: str
classmethod schema(*, infer_missing: bool = False, only=None, exclude=(), many: bool = False, context=None, load_only=(), dump_only=(), partial: bool = False, unknown=None) SchemaF[A]
to_dict(encode_json=False) Dict[str, dict | list | str | int | float | bool | None]

Return the fields of a dataclass instance as a new dictionary mapping field names to field values.

Example usage:

@dataclass class C:

x: int y: int

c = C(1, 2) assert asdict(c) == {‘x’: 1, ‘y’: 2}

When directly invoking this function, an optional Meta configuration for the dataclass can be specified via DumpMeta; by default, this will apply recursively to any nested dataclasses. Here’s a sample usage of this below:

>>> DumpMeta(key_transform='CAMEL').bind_to(MyClass)
>>> asdict(MyClass(my_str="value"))

If given, ‘dict_factory’ will be used instead of built-in dict. The function applies recursively to field values that are dataclass instances. This will also look into built-in containers: tuples, lists, and dicts.

to_json(*, skipkeys: bool = False, ensure_ascii: bool = True, check_circular: bool = True, allow_nan: bool = True, indent: int | str | None = None, separators: Tuple[str, str] | None = None, default: Callable | None = None, sort_keys: bool = False, **kw) str
class components.generic_battery.GenericBattery(my_simulation_parameters: SimulationParameters, config: GenericBatteryConfig, my_display_config: DisplayConfig = DisplayConfig(pretty_name=None, display_in_webtool=False))

Bases: Component

Generic Battery class.

ElectricityInput = 'ElectricityInput'
ElectricityOutput = 'ElectricityOutput'
State = 'State'
StateOfCharge = 'StateOfCharge'
StoredEnergy = 'StoredEnergy'
build(manufacturer, model, base)

Build function.

i_doublecheck(timestep: int, stsv: SingleTimeStepValues) None

Doublechecks.

i_prepare_simulation() None

Prepares the simulation.

i_restore_state() None

Restores the state.

i_save_state() None

Saves the state.

i_simulate(timestep: int, stsv: SingleTimeStepValues, force_convergence: bool) None

Simulates the component.

write_to_report()

Writes to report.

class components.generic_battery.GenericBatteryConfig(building_name: str, name: str, manufacturer: str, model: str, soc: float, base: bool, predictive: bool)

Bases: ConfigBase

Configuration of the Generic Battery.

base: bool
building_name: str
classmethod from_dict(kvs: dict | list | str | int | float | bool | None, *, infer_missing=False) A

Converts a Python dictionary object to a dataclass instance.

Iterates over each dataclass field recursively; lists, dicts, and nested dataclasses will likewise be initialized as expected.

When directly invoking this function, an optional Meta configuration for the dataclass can be specified via LoadMeta; by default, this will apply recursively to any nested dataclasses. Here’s a sample usage of this below:

>>> LoadMeta(key_transform='CAMEL').bind_to(MyClass)
>>> fromdict(MyClass, {"myStr": "value"})
classmethod from_json(s: str | bytes | bytearray, *, parse_float=None, parse_int=None, parse_constant=None, infer_missing=False, **kw) A
classmethod get_default_config(building_name: str = 'BUI1') Any

Gets a default config.

classmethod get_main_classname()

Returns the full class name of the base class.

manufacturer: str
model: str
name: str
predictive: bool
classmethod schema(*, infer_missing: bool = False, only=None, exclude=(), many: bool = False, context=None, load_only=(), dump_only=(), partial: bool = False, unknown=None) SchemaF[A]
soc: float
to_dict(encode_json=False) Dict[str, dict | list | str | int | float | bool | None]

Return the fields of a dataclass instance as a new dictionary mapping field names to field values.

Example usage:

@dataclass class C:

x: int y: int

c = C(1, 2) assert asdict(c) == {‘x’: 1, ‘y’: 2}

When directly invoking this function, an optional Meta configuration for the dataclass can be specified via DumpMeta; by default, this will apply recursively to any nested dataclasses. Here’s a sample usage of this below:

>>> DumpMeta(key_transform='CAMEL').bind_to(MyClass)
>>> asdict(MyClass(my_str="value"))

If given, ‘dict_factory’ will be used instead of built-in dict. The function applies recursively to field values that are dataclass instances. This will also look into built-in containers: tuples, lists, and dicts.

to_json(*, skipkeys: bool = False, ensure_ascii: bool = True, check_circular: bool = True, allow_nan: bool = True, indent: int | str | None = None, separators: Tuple[str, str] | None = None, default: Callable | None = None, sort_keys: bool = False, **kw) str
class components.generic_battery.GenericBatteryState(init_stored_energy=0, max_stored_energy=None, min_stored_energy=None, max_var_stored_energy=None, min_var_stored_energy=None)

Bases: object

Generic battery state class.

charge(energy)

Charge.

discharge(energy)

Discharge.

components.generic_car module

components.generic_electrolyzer module

Simple implementation of an electrolyzer.

The electrolyzer can moderate in a certain range,but the efficiency changes only linarly. Recovery heat is not considered so far.

class components.generic_electrolyzer.ElectrolyzerState(hydrogen: float = 0, electricity: float = 0)

Bases: object

Saves the state of the electrolyzer.

clone() ElectrolyzerState

Return a second instance of this class with same attributes.

class components.generic_electrolyzer.GenericElectrolyzer(my_simulation_parameters: SimulationParameters, config: GenericElectrolyzerConfig, my_display_config: DisplayConfig = DisplayConfig(pretty_name=None, display_in_webtool=False))

Bases: Component

Generic electrolyzer component.

The electrolyzer converts electrical energy [kWh] into hydrogen [kg]. It can work in a certain range from x to 100% or be switched off = 0%. The conversion rate is given by the supplier and is directly used. Maybe a change to efficiency can be made but its just making things more complex with no benefit. Between the given values, the values are calculated by an interpolation. If the load curve is linear a fixed factor could be calculated. Therefore it has an operational state. All the min values and all the max values are connected and the electrolyzer can operate between them. The waste energy in electolyzers is not used to provide heat for the households demand. Output pressure may be used in the future.

Components to connect to: (1) Electrolyzer controller (controller_l1_electrolyzer).

AvailableElectricity = 'AvailbaleElectricity'
ElectricityOutput = 'ElectricityOutput'
HydrogenOutput = 'HydrogenOutput'
get_default_connections_from_l1_generic_electrolyzer_controller() List[ComponentConnection]

Sets default connections of the controller in the Electroylzer.

i_doublecheck(timestep: int, stsv: SingleTimeStepValues) None

Doublecheck.

i_prepare_simulation() None

Prepares the simulation.

i_restore_state() None

Restore state.

i_save_state() None

Save state.

i_simulate(timestep: int, stsv: SingleTimeStepValues, force_convergence: bool) None

Simulate.

write_to_report()

Writes the information of the current component to the report.

class components.generic_electrolyzer.GenericElectrolyzerConfig(building_name: str, name: str, source_weight: int, min_power: float, max_power: float, min_hydrogen_production_rate: float, max_hydrogen_production_rate: float)

Bases: ConfigBase

Generic electrolyzer config.

building_name: str
classmethod from_dict(kvs: dict | list | str | int | float | bool | None, *, infer_missing=False) A

Converts a Python dictionary object to a dataclass instance.

Iterates over each dataclass field recursively; lists, dicts, and nested dataclasses will likewise be initialized as expected.

When directly invoking this function, an optional Meta configuration for the dataclass can be specified via LoadMeta; by default, this will apply recursively to any nested dataclasses. Here’s a sample usage of this below:

>>> LoadMeta(key_transform='CAMEL').bind_to(MyClass)
>>> fromdict(MyClass, {"myStr": "value"})
classmethod from_json(s: str | bytes | bytearray, *, parse_float=None, parse_int=None, parse_constant=None, infer_missing=False, **kw) A
static get_default_config(p_el: float, building_name: str = 'BUI1') GenericElectrolyzerConfig

Returns the default configuration of an electrolyzer.

max_hydrogen_production_rate: float

maximal hydrogen production rate (at maximal electrical power) in kg / s

max_power: float

maximal operating power in Watt (electrical power)

min_hydrogen_production_rate: float

minimal hydrogen production rate (at minimal electrical power) in kg / s

min_power: float

minimal operating power in Watt (electrical power)

name: str

name of the electrolyer

classmethod schema(*, infer_missing: bool = False, only=None, exclude=(), many: bool = False, context=None, load_only=(), dump_only=(), partial: bool = False, unknown=None) SchemaF[A]
source_weight: int

priority of the component in hierachy: the higher the number the lower the priority

to_dict(encode_json=False) Dict[str, dict | list | str | int | float | bool | None]

Return the fields of a dataclass instance as a new dictionary mapping field names to field values.

Example usage:

@dataclass class C:

x: int y: int

c = C(1, 2) assert asdict(c) == {‘x’: 1, ‘y’: 2}

When directly invoking this function, an optional Meta configuration for the dataclass can be specified via DumpMeta; by default, this will apply recursively to any nested dataclasses. Here’s a sample usage of this below:

>>> DumpMeta(key_transform='CAMEL').bind_to(MyClass)
>>> asdict(MyClass(my_str="value"))

If given, ‘dict_factory’ will be used instead of built-in dict. The function applies recursively to field values that are dataclass instances. This will also look into built-in containers: tuples, lists, and dicts.

to_json(*, skipkeys: bool = False, ensure_ascii: bool = True, check_circular: bool = True, allow_nan: bool = True, indent: int | str | None = None, separators: Tuple[str, str] | None = None, default: Callable | None = None, sort_keys: bool = False, **kw) str

components.generic_electrolyzer_and_h2_storage module

Generic electrolyzer and h2 storage module.

class components.generic_electrolyzer_and_h2_storage.AdvancedElectrolyzer(my_simulation_parameters: SimulationParameters, config: ElectrolyzerWithStorageConfig, my_display_config: DisplayConfig = DisplayConfig(pretty_name=None, display_in_webtool=False))

Bases: Component

Advanced Electrolyzer class.

ElectricityInput = 'Electricity Input'
ElectricityRealNeeded = 'ElectricityRealNeeded'
ElectrolyzerEfficiency = 'Electrolyzer Efficiency'
EnergyLosses = 'Energy Losses'
HydrogenNotStored = 'HydrogenNotStored'
HydrogenOutput = 'Hydrogen Output'
OxygenOutput = 'Oxygen Output'
PowerLevel = 'Power Level'
UnusedPower = 'Unused Power'
WaterDemand = 'Water Demand'
i_doublecheck(timestep: int, stsv: SingleTimeStepValues) None

Doublechecks.

i_prepare_simulation() None

Prepares the simulation.

i_restore_state()

Restores the state.

i_save_state()

Saves the state.

i_simulate(timestep: int, stsv: SingleTimeStepValues, force_convergence: bool) None

Simulates the component.

write_to_report()

Write to report.

class components.generic_electrolyzer_and_h2_storage.ElectrolyzerSimulation(waste_energy: float, min_power: float, max_power: float, min_power_percent: float, max_power_percent: float, min_hydrogen_production_rate: float, max_hydrogen_production_rate: float, pressure_hydrogen_output: float)

Bases: object

Electrolyzer simulation class.

convert_electricity(electricity_input, hydrogen_not_stored)

Convert electricity.

Electricity from electricity distributor (combination of PV, Grid, CHP and demand) will be converted to hydrogen

Check if electricity input is inside the power range of electrolyzer and eventually subtract the unusable power. Calculate the current power level of the electrolyzer in this timestep Calculate the current hydrogen output in liter Conversion to kg_H2 calculate the Oxygen output by mass fraction in the water molecule

Parameters:

electricity_input – Electricity from electricity distributor [W]

Returns:

hydrogen_output [kg] Amount of produced hydrogen oxygen_output [kg] Amount of produced oxygen unused_power [W] Unused power if electricity_input is outside the operation range

class components.generic_electrolyzer_and_h2_storage.ElectrolyzerWithHydrogenStorageConfig(building_name: str, name: str, min_capacity: float, max_capacity: float, starting_fill: float, max_charging_rate_hour: float, max_discharging_rate_hour: float, energy_for_charge: float, energy_for_discharge: float, loss_factor_per_day: float)

Bases: ConfigBase

Electrolyzer with hydrogen storage config class.

building_name: str
energy_for_charge: float
energy_for_discharge: float
classmethod from_dict(kvs: dict | list | str | int | float | bool | None, *, infer_missing=False) A

Converts a Python dictionary object to a dataclass instance.

Iterates over each dataclass field recursively; lists, dicts, and nested dataclasses will likewise be initialized as expected.

When directly invoking this function, an optional Meta configuration for the dataclass can be specified via LoadMeta; by default, this will apply recursively to any nested dataclasses. Here’s a sample usage of this below:

>>> LoadMeta(key_transform='CAMEL').bind_to(MyClass)
>>> fromdict(MyClass, {"myStr": "value"})
classmethod from_json(s: str | bytes | bytearray, *, parse_float=None, parse_int=None, parse_constant=None, infer_missing=False, **kw) A
classmethod get_default_config(building_name: str = 'BUI1') Any

Get default config.

classmethod get_main_classname()

Returns the full class name of the base class.

loss_factor_per_day: float
max_capacity: float
max_charging_rate_hour: float
max_discharging_rate_hour: float
min_capacity: float
name: str
classmethod schema(*, infer_missing: bool = False, only=None, exclude=(), many: bool = False, context=None, load_only=(), dump_only=(), partial: bool = False, unknown=None) SchemaF[A]
starting_fill: float
to_dict(encode_json=False) Dict[str, dict | list | str | int | float | bool | None]

Return the fields of a dataclass instance as a new dictionary mapping field names to field values.

Example usage:

@dataclass class C:

x: int y: int

c = C(1, 2) assert asdict(c) == {‘x’: 1, ‘y’: 2}

When directly invoking this function, an optional Meta configuration for the dataclass can be specified via DumpMeta; by default, this will apply recursively to any nested dataclasses. Here’s a sample usage of this below:

>>> DumpMeta(key_transform='CAMEL').bind_to(MyClass)
>>> asdict(MyClass(my_str="value"))

If given, ‘dict_factory’ will be used instead of built-in dict. The function applies recursively to field values that are dataclass instances. This will also look into built-in containers: tuples, lists, and dicts.

to_json(*, skipkeys: bool = False, ensure_ascii: bool = True, check_circular: bool = True, allow_nan: bool = True, indent: int | str | None = None, separators: Tuple[str, str] | None = None, default: Callable | None = None, sort_keys: bool = False, **kw) str
class components.generic_electrolyzer_and_h2_storage.ElectrolyzerWithStorageConfig(building_name: str, name: str, waste_energy: float, min_power: float, max_power: float, min_power_percent: float, max_power_percent: float, min_hydrogen_production_rate_hour: float, max_hydrogen_production_rate_hour: float, pressure_hydrogen_output: float)

Bases: ConfigBase

Electrolyzer wit storage config class.

building_name: str
classmethod from_dict(kvs: dict | list | str | int | float | bool | None, *, infer_missing=False) A

Converts a Python dictionary object to a dataclass instance.

Iterates over each dataclass field recursively; lists, dicts, and nested dataclasses will likewise be initialized as expected.

When directly invoking this function, an optional Meta configuration for the dataclass can be specified via LoadMeta; by default, this will apply recursively to any nested dataclasses. Here’s a sample usage of this below:

>>> LoadMeta(key_transform='CAMEL').bind_to(MyClass)
>>> fromdict(MyClass, {"myStr": "value"})
classmethod from_json(s: str | bytes | bytearray, *, parse_float=None, parse_int=None, parse_constant=None, infer_missing=False, **kw) A
classmethod get_default_config(building_name: str = 'BUI1') Any

Get default config.

classmethod get_main_classname()

Returns the full class name of the base class.

max_hydrogen_production_rate_hour: float
max_power: float
max_power_percent: float
min_hydrogen_production_rate_hour: float
min_power: float
min_power_percent: float
name: str
pressure_hydrogen_output: float
classmethod schema(*, infer_missing: bool = False, only=None, exclude=(), many: bool = False, context=None, load_only=(), dump_only=(), partial: bool = False, unknown=None) SchemaF[A]
to_dict(encode_json=False) Dict[str, dict | list | str | int | float | bool | None]

Return the fields of a dataclass instance as a new dictionary mapping field names to field values.

Example usage:

@dataclass class C:

x: int y: int

c = C(1, 2) assert asdict(c) == {‘x’: 1, ‘y’: 2}

When directly invoking this function, an optional Meta configuration for the dataclass can be specified via DumpMeta; by default, this will apply recursively to any nested dataclasses. Here’s a sample usage of this below:

>>> DumpMeta(key_transform='CAMEL').bind_to(MyClass)
>>> asdict(MyClass(my_str="value"))

If given, ‘dict_factory’ will be used instead of built-in dict. The function applies recursively to field values that are dataclass instances. This will also look into built-in containers: tuples, lists, and dicts.

to_json(*, skipkeys: bool = False, ensure_ascii: bool = True, check_circular: bool = True, allow_nan: bool = True, indent: int | str | None = None, separators: Tuple[str, str] | None = None, default: Callable | None = None, sort_keys: bool = False, **kw) str
waste_energy: float
class components.generic_electrolyzer_and_h2_storage.HydrogenStorage(my_simulation_parameters: SimulationParameters, config: ElectrolyzerWithHydrogenStorageConfig, my_display_config: DisplayConfig = DisplayConfig(pretty_name=None, display_in_webtool=False))

Bases: Component

Hydrogen storage class.

ChargingHydrogenAmount = 'Charging Hydrogen Amount'
CurrentHydrogenFillLevel = 'Current Hydrogen Fill Level Absolute'
CurrentHydrogenFillLevelPercent = 'Current Hydrogen Fill Level Percent'
DischargingHydrogenAmountReal = 'Discharging Hydrogen Amount Real'
DischargingHydrogenAmountTarget = 'DischargingHydrogenAmountTarget'
HydrogenLosses = 'Hydrogen Losses'
HydrogenNotReleased = 'Hydrogen Not Released'
HydrogenNotStored = 'Hydrogen Not Stored'
HydrogenStorageEnergyDemand = 'Hydrogen Storage Energy Demand'
StorageDelta = 'Storage Delta'
i_doublecheck(timestep: int, stsv: SingleTimeStepValues) None

Doublechecks.

i_prepare_simulation() None

Prepares the simulation.

i_restore_state()

Restores the state.

i_save_state()

Saves the state.

i_simulate(timestep: int, stsv: SingleTimeStepValues, force_convergence: bool) None

Simulates the component.

write_to_report() List[str]

Write to report.

class components.generic_electrolyzer_and_h2_storage.HydrogenStorageSimulation(fill: float, max_capacity: float, min_capacity: float, max_charging_rate: float, max_discharging_rate: float, energy_to_charge: float, energy_to_discharge: float, loss_factor: float)

Bases: object

Hydrogen storage simulation class.

Hydrogen storage to store hydrogen which is produced by the electrolyzer. The charging and sometimes discharging of the tank is connected with an electricity (energy) consumption. (Compressor, cooling,…). This energy is given by a fixed value which is not related to the actual fill level. Losses are related to the fill level and are given in lost%/24h.

storage_losses(seconds_per_timestep)

Storage losses.

How much hydrogen is lost in the time period: Liquid tanks: evaporation Pressure tanks: leakages metalhydride: suppliers say there are no losses (??)

The losses per day are given in %. This means a full tank has more losses compared to a half full tank. First, the given loss factor is converted into the losses in the timestep. Loses this timestep are calculated and subtracted from the hydrogen storage :param seconds_per_timestep: Seconds in this timestep [s] :return: losses in this timestep in kg

store(hydrogen_input: float, seconds_per_timestep: int) Any

Store.

Notice: Write return statement and the function goes back to to the caller method immediately Storage function: The maximum possible charging amount is calculated. The hydrogen inflow is restricted by this. If its too high the delta cant be stored.

Calculate the new fill level. Possible restrictions due to a full tank.

Nothing can be loaded Parts of the hydrogen inflow can be loaded.

Calculate the energy consumption which is needed for the process.

Parameters:
  • hydrogen_input – Hydrogen to the tank [kg_H2]

  • seconds_per_timestep – Seconds in this timestep [s]

Returns:

hydrogen_input [kg] Amount of hydrogen which was stored in this timestep energy_demand [W] Consumed Energy for storing delta_not_stored [kg] Amount of hydrogen which was not stored in this timestep

withdraw(hydrogen_output: float, seconds_per_timestep: int) Any

Withdraw.

Discharging function. Functionality its the reverse of the store function. :param hydrogen_output: Demand on hydrogen [kg_H2] :param seconds_per_timestep: Seconds in this timestep [s] :return: hydrogen_output [kg] Amount of hydrogen which was released in this timestep

energy_demand [W] Consumed Energy for release delta_not_released [kg] Amount of hydrogen which couldn’t be released in this timestep

components.generic_ev_charger module

Generic ev charger module.

class components.generic_ev_charger.EVCharger(my_simulation_parameters: SimulationParameters, config: EVChargerConfig, my_display_config: DisplayConfig = DisplayConfig(pretty_name=None, display_in_webtool=False))

Bases: Component

Electric Vehicle Charger Component.

Parameters

manufacturer : str name : str electric_vehicle : Vehicle_Pure sim_params : cp.SimulationParameters

AfterStoredEnergy = 'AfterStoredEnergy'
AtChargingStation = 'AtChargingStation'
Driving = 'Driving'
EVChargerMode = 'EVChargerMode'
EVChargerState = 'EVChargerState'
ElectricityInput = 'ElectricityInput'
ElectricityOutput = 'ElectricityOutput'
MinimumStateOfCharge = 'MinimumStateOfCharge'
StateOfCharge = 'StateOfCharge'
build(manufacturer: str, name: str, electric_vehicle: Any, sim_params: SimulationParameters) None

Build function.

charge_only_electricity_surplus(to_be_charged, max_capacity, capacity)

Charge only electricity surplus.

charge_only_from_the_grid(max_capacity, capacity)

Charge only from the grid.

i_doublecheck(timestep: int, stsv: SingleTimeStepValues) None

Doubelchecks.

i_restore_state() None

Restores the state.

i_save_state() None

Saves the state.

i_simulate(timestep: int, stsv: SingleTimeStepValues, force_convergence: bool) None

Simulates the component.

operate_on_vehicle_to_grid(to_be_charged: float, max_capacity: float, min_capacity: float, capacity: float) Any

Operate o vehicle to grid.

write_to_report() List[str]

Write to resport.

class components.generic_ev_charger.EVChargerConfig(building_name: str, name: str, manufacturer: str, charger_name: str, electric_vehicle: Any)

Bases: ConfigBase

Electrical vehicle config class.

building_name: str
charger_name: str
electric_vehicle: Any
classmethod from_dict(kvs: dict | list | str | int | float | bool | None, *, infer_missing=False) A

Converts a Python dictionary object to a dataclass instance.

Iterates over each dataclass field recursively; lists, dicts, and nested dataclasses will likewise be initialized as expected.

When directly invoking this function, an optional Meta configuration for the dataclass can be specified via LoadMeta; by default, this will apply recursively to any nested dataclasses. Here’s a sample usage of this below:

>>> LoadMeta(key_transform='CAMEL').bind_to(MyClass)
>>> fromdict(MyClass, {"myStr": "value"})
classmethod from_json(s: str | bytes | bytearray, *, parse_float=None, parse_int=None, parse_constant=None, infer_missing=False, **kw) A
classmethod get_default_config(building_name: str = 'BUI1') Any

Gets a default config.

classmethod get_main_classname()

Returns the full class name of the base class.

manufacturer: str
name: str
classmethod schema(*, infer_missing: bool = False, only=None, exclude=(), many: bool = False, context=None, load_only=(), dump_only=(), partial: bool = False, unknown=None) SchemaF[A]
to_dict(encode_json=False) Dict[str, dict | list | str | int | float | bool | None]

Return the fields of a dataclass instance as a new dictionary mapping field names to field values.

Example usage:

@dataclass class C:

x: int y: int

c = C(1, 2) assert asdict(c) == {‘x’: 1, ‘y’: 2}

When directly invoking this function, an optional Meta configuration for the dataclass can be specified via DumpMeta; by default, this will apply recursively to any nested dataclasses. Here’s a sample usage of this below:

>>> DumpMeta(key_transform='CAMEL').bind_to(MyClass)
>>> asdict(MyClass(my_str="value"))

If given, ‘dict_factory’ will be used instead of built-in dict. The function applies recursively to field values that are dataclass instances. This will also look into built-in containers: tuples, lists, and dicts.

to_json(*, skipkeys: bool = False, ensure_ascii: bool = True, check_circular: bool = True, allow_nan: bool = True, indent: int | str | None = None, separators: Tuple[str, str] | None = None, default: Callable | None = None, sort_keys: bool = False, **kw) str
class components.generic_ev_charger.EVChargerController(my_simulation_parameters: SimulationParameters, config: EVChargerControllerConfig, my_display_config: DisplayConfig = DisplayConfig(pretty_name=None, display_in_webtool=False))

Bases: Component

Electricle vehicle controller class.

Imports data from Load Profile Generator and uses as a Component Class in hisim.

EVChargerMode = 'EVChargerMode'
EVChargerState = 'EVChargerState'
ElectricityInput = 'ElectricityInput'
MinimumStateOfCharge = 'MinimumStateOfCharge'
StateOfCharge = 'StateOfCharge'
i_doublecheck(timestep: int, stsv: SingleTimeStepValues) None

Doublechecks.

i_restore_state() None

Restores the state.

i_save_state() None

Saves the state.

i_simulate(timestep: int, stsv: SingleTimeStepValues, force_convergence: bool) None

Simulates the component.

write_to_report()

Write to report.

class components.generic_ev_charger.EVChargerControllerConfig(building_name: str, name: str, mode: int)

Bases: ConfigBase

Electrical vehicle charger controller config class.

building_name: str
classmethod from_dict(kvs: dict | list | str | int | float | bool | None, *, infer_missing=False) A

Converts a Python dictionary object to a dataclass instance.

Iterates over each dataclass field recursively; lists, dicts, and nested dataclasses will likewise be initialized as expected.

When directly invoking this function, an optional Meta configuration for the dataclass can be specified via LoadMeta; by default, this will apply recursively to any nested dataclasses. Here’s a sample usage of this below:

>>> LoadMeta(key_transform='CAMEL').bind_to(MyClass)
>>> fromdict(MyClass, {"myStr": "value"})
classmethod from_json(s: str | bytes | bytearray, *, parse_float=None, parse_int=None, parse_constant=None, infer_missing=False, **kw) A
classmethod get_default_config(building_name: str = 'BUI1') Any

Gets a default config.

classmethod get_main_classname()

Returns the full class name of the base class.

mode: int
name: str
classmethod schema(*, infer_missing: bool = False, only=None, exclude=(), many: bool = False, context=None, load_only=(), dump_only=(), partial: bool = False, unknown=None) SchemaF[A]
to_dict(encode_json=False) Dict[str, dict | list | str | int | float | bool | None]

Return the fields of a dataclass instance as a new dictionary mapping field names to field values.

Example usage:

@dataclass class C:

x: int y: int

c = C(1, 2) assert asdict(c) == {‘x’: 1, ‘y’: 2}

When directly invoking this function, an optional Meta configuration for the dataclass can be specified via DumpMeta; by default, this will apply recursively to any nested dataclasses. Here’s a sample usage of this below:

>>> DumpMeta(key_transform='CAMEL').bind_to(MyClass)
>>> asdict(MyClass(my_str="value"))

If given, ‘dict_factory’ will be used instead of built-in dict. The function applies recursively to field values that are dataclass instances. This will also look into built-in containers: tuples, lists, and dicts.

to_json(*, skipkeys: bool = False, ensure_ascii: bool = True, check_circular: bool = True, allow_nan: bool = True, indent: int | str | None = None, separators: Tuple[str, str] | None = None, default: Callable | None = None, sort_keys: bool = False, **kw) str
class components.generic_ev_charger.SimpleStorageState(max_var_val: float, min_var_val: float, stored_energy: float = 0.0, time_correction_factor: float | None = None, seconds_per_timestep: int | None = None)

Bases: object

Simple Storage State class.

Simplistic implementation for any type of energy state storage. Relevant for battery, electric vehicles, etc, to store or withdraw certain amount of energy of a predefined storage.

Parameters

max_var_val: float

Maximum variation energy, i.e., maximum power

min_var_val: float

Minimum variation energy, i.e., minimum power

stored_energyfloat

Initial storage energy

time_correction_factorfloat

Time correction factor to convert power into energy the time step duration used in the simulation. This factor is equivalent of the invert of seconds per time step.

seconds_per_timestepint

Duration in seconds of one time step.

force_store(max_capacity: float, current_capacity: float) Any

Force store.

keep_state(capacity: float) Any

Keep state.

store(max_capacity: float, current_capacity: float, val: float, efficiency: float = 1.0) Any

Store.

withdraw(min_capacity: float, current_capacity: float, val: float, efficiency: float = 1.0) Any

Withdraw.

class components.generic_ev_charger.Vehicle(my_simulation_parameters: SimulationParameters, config: VehicleConfig, my_display_config: DisplayConfig = DisplayConfig(pretty_name=None, display_in_webtool=False))

Bases: Component

Electric Vehicle Component.

This is a alternative implementation, not fully working, to be used in future releases.

Parameters

manufacturerstr

Electric vehicle Manufacturer

modelstr

Electric vehicle model

socfloat

Initial state of charge of battery before simulation

AfterCapacity = 'AfterCapacity'
BeforeCapacity = 'BeforeCapacity'
Discharge = 'Discharge'
MaxCapacity = 'MaxCapacity'
build(manufacturer: str, model: str, soc: float) None

Build function.

i_doublecheck(timestep: int, stsv: SingleTimeStepValues) None

Doubelchecks.

i_restore_state() None

Restores the state.

i_save_state() None

Saves the state.

i_simulate(timestep: int, stsv: SingleTimeStepValues, force_convergence: bool) None

Simulates the component.

class components.generic_ev_charger.VehicleConfig(building_name: str, name: str, manufacturer: str, model: str, soc: float)

Bases: ConfigBase

Vehicle config class.

building_name: str
classmethod from_dict(kvs: dict | list | str | int | float | bool | None, *, infer_missing=False) A

Converts a Python dictionary object to a dataclass instance.

Iterates over each dataclass field recursively; lists, dicts, and nested dataclasses will likewise be initialized as expected.

When directly invoking this function, an optional Meta configuration for the dataclass can be specified via LoadMeta; by default, this will apply recursively to any nested dataclasses. Here’s a sample usage of this below:

>>> LoadMeta(key_transform='CAMEL').bind_to(MyClass)
>>> fromdict(MyClass, {"myStr": "value"})
classmethod from_json(s: str | bytes | bytearray, *, parse_float=None, parse_int=None, parse_constant=None, infer_missing=False, **kw) A
classmethod get_default_config(building_name: str = 'BUI1') Any

Gets a default config.

classmethod get_main_classname()

Returns the full class name of the base class.

manufacturer: str
model: str
name: str
classmethod schema(*, infer_missing: bool = False, only=None, exclude=(), many: bool = False, context=None, load_only=(), dump_only=(), partial: bool = False, unknown=None) SchemaF[A]
soc: float
to_dict(encode_json=False) Dict[str, dict | list | str | int | float | bool | None]

Return the fields of a dataclass instance as a new dictionary mapping field names to field values.

Example usage:

@dataclass class C:

x: int y: int

c = C(1, 2) assert asdict(c) == {‘x’: 1, ‘y’: 2}

When directly invoking this function, an optional Meta configuration for the dataclass can be specified via DumpMeta; by default, this will apply recursively to any nested dataclasses. Here’s a sample usage of this below:

>>> DumpMeta(key_transform='CAMEL').bind_to(MyClass)
>>> asdict(MyClass(my_str="value"))

If given, ‘dict_factory’ will be used instead of built-in dict. The function applies recursively to field values that are dataclass instances. This will also look into built-in containers: tuples, lists, and dicts.

to_json(*, skipkeys: bool = False, ensure_ascii: bool = True, check_circular: bool = True, allow_nan: bool = True, indent: int | str | None = None, separators: Tuple[str, str] | None = None, default: Callable | None = None, sort_keys: bool = False, **kw) str
class components.generic_ev_charger.VehiclePure(my_simulation_parameters: SimulationParameters, config: VehiclePureConfig, my_display_config: DisplayConfig = DisplayConfig(pretty_name=None, display_in_webtool=False))

Bases: Component

Vehicle component class.

Parameters

manufacturerstr

Electric vehicle Manufacturer

modelstr

Electric vehicle model

socfloat

Initial state of charge of battery before simulation

profilestr

Family profile imported from LPG. The family denomination defines the electric vehicle usage throughout the simulation duration

build() None

Build function.

i_doublecheck(timestep: int, stsv: SingleTimeStepValues) None

Doublechecks.

i_restore_state() None

Restores the state.

i_save_state() None

Saves the state.

i_simulate(timestep: int, stsv: SingleTimeStepValues, force_convergence: bool) None

Simulates the component.

class components.generic_ev_charger.VehiclePureConfig(building_name: str, name: str, manufacturer: str, model: str, soc: float, profile: str)

Bases: ConfigBase

Vehicle Pure Config class.

building_name: str
classmethod from_dict(kvs: dict | list | str | int | float | bool | None, *, infer_missing=False) A

Converts a Python dictionary object to a dataclass instance.

Iterates over each dataclass field recursively; lists, dicts, and nested dataclasses will likewise be initialized as expected.

When directly invoking this function, an optional Meta configuration for the dataclass can be specified via LoadMeta; by default, this will apply recursively to any nested dataclasses. Here’s a sample usage of this below:

>>> LoadMeta(key_transform='CAMEL').bind_to(MyClass)
>>> fromdict(MyClass, {"myStr": "value"})
classmethod from_json(s: str | bytes | bytearray, *, parse_float=None, parse_int=None, parse_constant=None, infer_missing=False, **kw) A
classmethod get_default_config(building_name: str = 'BUI1') Any

Gets a default config.

classmethod get_main_classname()

Returns the full class name of the base class.

manufacturer: str
model: str
name: str
profile: str
classmethod schema(*, infer_missing: bool = False, only=None, exclude=(), many: bool = False, context=None, load_only=(), dump_only=(), partial: bool = False, unknown=None) SchemaF[A]
soc: float
to_dict(encode_json=False) Dict[str, dict | list | str | int | float | bool | None]

Return the fields of a dataclass instance as a new dictionary mapping field names to field values.

Example usage:

@dataclass class C:

x: int y: int

c = C(1, 2) assert asdict(c) == {‘x’: 1, ‘y’: 2}

When directly invoking this function, an optional Meta configuration for the dataclass can be specified via DumpMeta; by default, this will apply recursively to any nested dataclasses. Here’s a sample usage of this below:

>>> DumpMeta(key_transform='CAMEL').bind_to(MyClass)
>>> asdict(MyClass(my_str="value"))

If given, ‘dict_factory’ will be used instead of built-in dict. The function applies recursively to field values that are dataclass instances. This will also look into built-in containers: tuples, lists, and dicts.

to_json(*, skipkeys: bool = False, ensure_ascii: bool = True, check_circular: bool = True, allow_nan: bool = True, indent: int | str | None = None, separators: Tuple[str, str] | None = None, default: Callable | None = None, sort_keys: bool = False, **kw) str

components.generic_gas_heater module

components.generic_gas_heater_with_controller module

components.generic_heat_pump module

components.generic_heat_pump_modular module

Modular Heat Pump Class together with Configuration and State.

class components.generic_heat_pump_modular.HeatPumpConfig(building_name: str, name: str, source_weight: int, manufacturer: str, device_name: str, power_th: float, water_vs_heating: InandOutputType, device_category: HeatingSystems, device_co2_footprint_in_kg: float | None, investment_costs_in_euro: float | None, lifetime_in_years: float | None, maintenance_costs_in_euro_per_year: float | None, subsidy_as_percentage_of_investment_costs: float | None)

Bases: ConfigBase

Configuration of a HeatPump.

building_name: str
device_category: HeatingSystems

category of the heat pump: either heat pump or heating rod

device_co2_footprint_in_kg: float | None

CO2 footprint of investment in kg

device_name: str

device name to search heat pump in data base

classmethod from_dict(kvs: dict | list | str | int | float | bool | None, *, infer_missing=False) A

Converts a Python dictionary object to a dataclass instance.

Iterates over each dataclass field recursively; lists, dicts, and nested dataclasses will likewise be initialized as expected.

When directly invoking this function, an optional Meta configuration for the dataclass can be specified via LoadMeta; by default, this will apply recursively to any nested dataclasses. Here’s a sample usage of this below:

>>> LoadMeta(key_transform='CAMEL').bind_to(MyClass)
>>> fromdict(MyClass, {"myStr": "value"})
classmethod from_json(s: str | bytes | bytearray, *, parse_float=None, parse_int=None, parse_constant=None, infer_missing=False, **kw) A
static get_default_config_heating(building_name: str = 'BUI1') HeatPumpConfig

Returns default configuration of a heat pump used for heating.

static get_default_config_heating_electric(building_name: str = 'BUI1') HeatPumpConfig

Returns default configuartion of simple electrical heating system with a COP of one.

static get_default_config_waterheating(building_name: str = 'BUI1') HeatPumpConfig

Returns default configuration of a heat pump used for water heating.

static get_default_config_waterheating_electric(building_name: str = 'BUI1') HeatPumpConfig

Returns default configuration of electrical heating rod for boiler.

classmethod get_main_classname()

Returns the full class name of the base class.

classmethod get_scaled_waterheating_to_number_of_apartments(number_of_apartments: float, default_power_in_watt: float = 3000, name: str = 'DHWHeatPump', building_name: str = 'BUI1') HeatPumpConfig

Gets a default heat pump with scaling according to number of apartments.

investment_costs_in_euro: float | None

cost for investment in Euro

lifetime_in_years: float | None

lifetime in years

maintenance_costs_in_euro_per_year: float | None
manufacturer: str

manufacturer to search heat pump in data base

name: str

name of the device

power_th: float

maximal thermal power of heat pump in W

classmethod schema(*, infer_missing: bool = False, only=None, exclude=(), many: bool = False, context=None, load_only=(), dump_only=(), partial: bool = False, unknown=None) SchemaF[A]
source_weight: int

priority of the device in energy management system: the higher the number the lower the priority

subsidy_as_percentage_of_investment_costs: float | None
to_dict(encode_json=False) Dict[str, dict | list | str | int | float | bool | None]

Return the fields of a dataclass instance as a new dictionary mapping field names to field values.

Example usage:

@dataclass class C:

x: int y: int

c = C(1, 2) assert asdict(c) == {‘x’: 1, ‘y’: 2}

When directly invoking this function, an optional Meta configuration for the dataclass can be specified via DumpMeta; by default, this will apply recursively to any nested dataclasses. Here’s a sample usage of this below:

>>> DumpMeta(key_transform='CAMEL').bind_to(MyClass)
>>> asdict(MyClass(my_str="value"))

If given, ‘dict_factory’ will be used instead of built-in dict. The function applies recursively to field values that are dataclass instances. This will also look into built-in containers: tuples, lists, and dicts.

to_json(*, skipkeys: bool = False, ensure_ascii: bool = True, check_circular: bool = True, allow_nan: bool = True, indent: int | str | None = None, separators: Tuple[str, str] | None = None, default: Callable | None = None, sort_keys: bool = False, **kw) str
water_vs_heating: InandOutputType

usage of the heatpump: either for heating or for water heating

class components.generic_heat_pump_modular.ModularHeatPump(config: HeatPumpConfig, my_simulation_parameters: SimulationParameters, my_display_config: DisplayConfig = DisplayConfig(pretty_name=None, display_in_webtool=False))

Bases: Component

Heat pump implementation.

The generic_heatpump_modular differs to generic_heatpump in the sense that the minimal runtime is not in the component, but in the related controller. This implementation does not consider cooling of building_names.

Components to connect to: (1) Weather (2) Heat Pump Controller (controller_l1_heatpump)

ElectricityOutput = 'ElectricityOutput'
HeatControllerTargetPercentage = 'HeatControllerTargetPercentage'
PowerModifier = 'PowerModifier'
TemperatureOutside = 'TemperatureOutside'
ThermalPowerDelivered = 'ThermalPowerDelivered'
build()

Initialization function of Modular Heat Pump.

cal_cop(t_out: float) float

Returns coefficient of performance of selected heat pump.

get_component_kpi_entries(all_outputs: List, postprocessing_results: DataFrame) List[KpiEntry]

Calculates KPIs for the respective component and return all KPI entries as list.

static get_cost_capex(config: HeatPumpConfig, simulation_parameters: SimulationParameters) CapexCostDataClass

Returns investment cost, CO2 emissions and lifetime.

get_cost_opex(all_outputs: List, postprocessing_results: DataFrame) OpexCostDataClass

Calculate OPEX costs, consisting of maintenance costs snd write total energy consumption to component-config.

No electricity costs for components except for Electricity Meter, because part of electricity consumption is feed by PV

get_default_connections_from_controller_l1_heatpump()

Sets default connections of heat pump controller.

get_default_connections_from_weather()

Sets default connections of Weather.

i_doublecheck(timestep: int, stsv: SingleTimeStepValues) None

Doublechecks.

i_prepare_simulation() None

Prepares the simulation.

i_restore_state() None

Restores the state.

i_save_state() None

Saves the state.

i_simulate(timestep: int, stsv: SingleTimeStepValues, force_convergence: bool) None

Iteration of heat pump simulation.

write_to_report() List[str]

Writes relevant data to report.

class components.generic_heat_pump_modular.ModularHeatPumpState(state: int = 0)

Bases: object

Modular heat pump state saves the state of the heat pump.

clone() ModularHeatPumpState

Creates copy of state.

components.generic_heat_source module

components.generic_heat_water_storage module

Generic heat water storage module.

class components.generic_heat_water_storage.HeatStorage(my_simulation_parameters: SimulationParameters, config: HeatStorageConfig, my_display_config: DisplayConfig = DisplayConfig(pretty_name=None, display_in_webtool=False))

Bases: Component

Heat Storage class.

This is a combined storage: buffer storage for heating, and hot water storage for hot water demand. It needs, hot water demand, heating demand, building temperature and a control signal choosing which of the two storages to heat as inputs. In addition it relies on Outside Temperature, and ThermalInputs of up to 5 heat sources. Based on this it evaluates the temperature in the storages based on the energy balance.

BuildingTemperature = 'BuildingTemperature'
ControlSignalChooseStorage = 'ControlSignalChooseStorage'
OutsideTemperature = 'OutsideTemperature'
RealHeatForBuilding = 'RealHeatForBuilding'
StorageEnergyLoss = 'StorageEnergyLoss'
ThermalDemandHeatingWater = 'ThermalDemandHeatingWater'
ThermalDemandWarmWater = 'ThermalDemandHeating'
ThermalInputPower1 = 'ThermalInputPower1'
ThermalInputPower2 = 'ThermalInputPower2'
ThermalInputPower3 = 'ThermalInputPower3'
ThermalInputPower4 = 'ThermalInputPower4'
ThermalInputPower5 = 'ThermalInputPower5'
WaterOutputStorageforHeaters = 'WaterOutputStorageforHeaters'
WaterOutputTemperatureHeatingWater = 'WaterOutputTemperatureHeatingWater'
WaterOutputTemperatureWarmWater = 'WaterOutputTemperatureWarmWater'
adding_all_possible_mass_flows(stsv: SingleTimeStepValues) Any

Adding all possible mass flows.

calculate_new_storage_temperature(seconds_per_timestep: int, temperature_sp: float, production: float, last: float, c_w: float, volume_sp: float) Any

Calculate new storage temperature.

i_doublecheck(timestep: int, stsv: SingleTimeStepValues) None

Doublechecks.

i_prepare_simulation() None

Prepares the simulation.

i_restore_state() None

Restores the state.

i_save_state() None

Saves the state.

i_simulate(timestep: int, stsv: SingleTimeStepValues, force_convergence: bool) None

Simulates the component.

write_to_report() List[str]

Write to report.

class components.generic_heat_water_storage.HeatStorageConfig(building_name: str, name: str, volume_sp_heating_water: float, volume_sp_warm_water: float, temperature_of_warm_water_extraction: float, ambient_temperature: float, temperature_sp_ww: float, temperature_sp_hw: float)

Bases: ConfigBase

Heat Storage Config class.

ambient_temperature: float
building_name: str
classmethod from_dict(kvs: dict | list | str | int | float | bool | None, *, infer_missing=False) A

Converts a Python dictionary object to a dataclass instance.

Iterates over each dataclass field recursively; lists, dicts, and nested dataclasses will likewise be initialized as expected.

When directly invoking this function, an optional Meta configuration for the dataclass can be specified via LoadMeta; by default, this will apply recursively to any nested dataclasses. Here’s a sample usage of this below:

>>> LoadMeta(key_transform='CAMEL').bind_to(MyClass)
>>> fromdict(MyClass, {"myStr": "value"})
classmethod from_json(s: str | bytes | bytearray, *, parse_float=None, parse_int=None, parse_constant=None, infer_missing=False, **kw) A
classmethod get_default_heat_storage_config(building_name: str = 'BUI1') Any

Get default config.

classmethod get_main_classname()

Return the full class name of the base class.

name: str
classmethod schema(*, infer_missing: bool = False, only=None, exclude=(), many: bool = False, context=None, load_only=(), dump_only=(), partial: bool = False, unknown=None) SchemaF[A]
temperature_of_warm_water_extraction: float
temperature_sp_hw: float
temperature_sp_ww: float
to_dict(encode_json=False) Dict[str, dict | list | str | int | float | bool | None]

Return the fields of a dataclass instance as a new dictionary mapping field names to field values.

Example usage:

@dataclass class C:

x: int y: int

c = C(1, 2) assert asdict(c) == {‘x’: 1, ‘y’: 2}

When directly invoking this function, an optional Meta configuration for the dataclass can be specified via DumpMeta; by default, this will apply recursively to any nested dataclasses. Here’s a sample usage of this below:

>>> DumpMeta(key_transform='CAMEL').bind_to(MyClass)
>>> asdict(MyClass(my_str="value"))

If given, ‘dict_factory’ will be used instead of built-in dict. The function applies recursively to field values that are dataclass instances. This will also look into built-in containers: tuples, lists, and dicts.

to_json(*, skipkeys: bool = False, ensure_ascii: bool = True, check_circular: bool = True, allow_nan: bool = True, indent: int | str | None = None, separators: Tuple[str, str] | None = None, default: Callable | None = None, sort_keys: bool = False, **kw) str
volume_sp_heating_water: float
volume_sp_warm_water: float
class components.generic_heat_water_storage.HeatStorageController(my_simulation_parameters: SimulationParameters, config: HeatStorageControllerConfig, my_display_config: DisplayConfig = DisplayConfig(pretty_name=None, display_in_webtool=False))

Bases: Component

HeatStorageController class.

Calculates on base of the maximal Building Thermal Demand and the TemperatureHeatingStorage and Building Tempreature the real thermal demand for the Heating Storage. This Output is called “RealThermalDemandHeatingWater”.

Parameters

sim_paramsSimulator

Simulator object used to carry the simulation using this class

BuildingTemperature = 'BuildingTemperature'
RealHeatBuildingDemand = 'RealHeatBuildingDemand'
RealThermalDemandHeatingWater = 'RealThermalDemandHeatingWater'
TemperatureHeatingStorage = 'TemperatureHeatingStorage'
build()

Build function.

i_doublecheck(timestep: int, stsv: SingleTimeStepValues) None

Doublechecks.

i_prepare_simulation() None

Prepares the simulation.

i_restore_state() None

Restores the state.

i_save_state() None

Saves the state.

i_simulate(timestep: int, stsv: SingleTimeStepValues, force_convergence: bool) None

Simulates the component.

write_to_report() List[str]

Write to report.

class components.generic_heat_water_storage.HeatStorageControllerConfig(building_name: str, name: str, initial_temperature_building: float, initial_temperature_heating_storage: float, heating_load_of_building_in_watt: float)

Bases: ConfigBase

Heat Storage Controller Config.

building_name: str
classmethod from_dict(kvs: dict | list | str | int | float | bool | None, *, infer_missing=False) A

Converts a Python dictionary object to a dataclass instance.

Iterates over each dataclass field recursively; lists, dicts, and nested dataclasses will likewise be initialized as expected.

When directly invoking this function, an optional Meta configuration for the dataclass can be specified via LoadMeta; by default, this will apply recursively to any nested dataclasses. Here’s a sample usage of this below:

>>> LoadMeta(key_transform='CAMEL').bind_to(MyClass)
>>> fromdict(MyClass, {"myStr": "value"})
classmethod from_json(s: str | bytes | bytearray, *, parse_float=None, parse_int=None, parse_constant=None, infer_missing=False, **kw) A
classmethod get_default_heat_storage_controller_config(heating_load_of_building_in_watt: float, building_name: str = 'BUI1') Any

Get default config.

classmethod get_main_classname()

Return the full class name of the base class.

heating_load_of_building_in_watt: float
initial_temperature_building: float
initial_temperature_heating_storage: float
name: str
classmethod schema(*, infer_missing: bool = False, only=None, exclude=(), many: bool = False, context=None, load_only=(), dump_only=(), partial: bool = False, unknown=None) SchemaF[A]
to_dict(encode_json=False) Dict[str, dict | list | str | int | float | bool | None]

Return the fields of a dataclass instance as a new dictionary mapping field names to field values.

Example usage:

@dataclass class C:

x: int y: int

c = C(1, 2) assert asdict(c) == {‘x’: 1, ‘y’: 2}

When directly invoking this function, an optional Meta configuration for the dataclass can be specified via DumpMeta; by default, this will apply recursively to any nested dataclasses. Here’s a sample usage of this below:

>>> DumpMeta(key_transform='CAMEL').bind_to(MyClass)
>>> asdict(MyClass(my_str="value"))

If given, ‘dict_factory’ will be used instead of built-in dict. The function applies recursively to field values that are dataclass instances. This will also look into built-in containers: tuples, lists, and dicts.

to_json(*, skipkeys: bool = False, ensure_ascii: bool = True, check_circular: bool = True, allow_nan: bool = True, indent: int | str | None = None, separators: Tuple[str, str] | None = None, default: Callable | None = None, sort_keys: bool = False, **kw) str
class components.generic_heat_water_storage.HeatStorageState(temperature_sp_ww: float, temperature_sp_hw: float)

Bases: object

Heat Storage State class.

clone() Any

Clones the state.

components.generic_hot_water_storage_modular module

components.generic_hydrogen_storage module

Generic hydrogen storage module.

class components.generic_hydrogen_storage.GenericHydrogenStorage(my_simulation_parameters: SimulationParameters, config: GenericHydrogenStorageConfig, my_display_config: DisplayConfig = DisplayConfig(pretty_name=None, display_in_webtool=False))

Bases: Component

Generic hydrogen storage is a simple implementation of a hydrogen storage.

Components to connect to: (1) Fuel cell (generic_CHP) (2) Electrolyzer (generic_electrolyzer)

HydrogenInput = 'HydrogenInput'
HydrogenOutput = 'HydrogenOutput'
HydrogenSOC = 'HydrogenSOC'
get_default_connections_from_generic_chp() List[ComponentConnection]

Get default connections from generic chp.

get_default_connections_from_generic_electrolyzer() List[ComponentConnection]

Get default connections from generic electrolyzer.

i_doublecheck(timestep: int, stsv: SingleTimeStepValues) None

Doublechecks.

i_prepare_simulation() None

Prepares the simulation.

i_restore_state() None

Restores the state.

i_save_state() None

Saves the state.

i_simulate(timestep: int, stsv: SingleTimeStepValues, force_convergence: bool) None

Simulates the component.

storage_losses() None

Storage losses.

store(charging_rate: float) Tuple[float, float, float]

Store.

withdraw(discharging_rate: float) Tuple[float, float, float]

Withdraw.

write_to_report()

Writes the information of the current component to the report.

class components.generic_hydrogen_storage.GenericHydrogenStorageConfig(building_name: str, name: str, source_weight: int, min_capacity: float, max_capacity: float, max_charging_rate: float, max_discharging_rate: float, energy_for_charge: float, energy_for_discharge: float, loss_factor_per_day: float)

Bases: ConfigBase

Generic hydrogen storage config class.

building_name: str
energy_for_charge: float

energy demand for the charging process in Wh/kg

energy_for_discharge: float

energy demand for the discharging process in Wh/kg

classmethod from_dict(kvs: dict | list | str | int | float | bool | None, *, infer_missing=False) A

Converts a Python dictionary object to a dataclass instance.

Iterates over each dataclass field recursively; lists, dicts, and nested dataclasses will likewise be initialized as expected.

When directly invoking this function, an optional Meta configuration for the dataclass can be specified via LoadMeta; by default, this will apply recursively to any nested dataclasses. Here’s a sample usage of this below:

>>> LoadMeta(key_transform='CAMEL').bind_to(MyClass)
>>> fromdict(MyClass, {"myStr": "value"})
classmethod from_json(s: str | bytes | bytearray, *, parse_float=None, parse_int=None, parse_constant=None, infer_missing=False, **kw) A
static get_default_config(capacity: float = 200, max_charging_rate: float = 0.0005555555555555556, max_discharging_rate: float = 0.0005555555555555556, source_weight: int = 1, building_name: str = 'BUI1') Any

Returns default configuration for hydrogen storage.

loss_factor_per_day: float

permanent hydrogen loss in % per day

max_capacity: float

maximal capacity of the hydrogen storage in kg of hydrogen

max_charging_rate: float

maximal charge rate of the hydrgoen storage in kg/s

max_discharging_rate: float

maximal discharge rate of the hydrgoen storage in kg/s

min_capacity: float

minimal fill state of the hydrogen storage in kg of hydrogen

name: str

name of the device

classmethod schema(*, infer_missing: bool = False, only=None, exclude=(), many: bool = False, context=None, load_only=(), dump_only=(), partial: bool = False, unknown=None) SchemaF[A]
source_weight: int

priority of the device in hierachy: the higher the number the lower the priority

to_dict(encode_json=False) Dict[str, dict | list | str | int | float | bool | None]

Return the fields of a dataclass instance as a new dictionary mapping field names to field values.

Example usage:

@dataclass class C:

x: int y: int

c = C(1, 2) assert asdict(c) == {‘x’: 1, ‘y’: 2}

When directly invoking this function, an optional Meta configuration for the dataclass can be specified via DumpMeta; by default, this will apply recursively to any nested dataclasses. Here’s a sample usage of this below:

>>> DumpMeta(key_transform='CAMEL').bind_to(MyClass)
>>> asdict(MyClass(my_str="value"))

If given, ‘dict_factory’ will be used instead of built-in dict. The function applies recursively to field values that are dataclass instances. This will also look into built-in containers: tuples, lists, and dicts.

to_json(*, skipkeys: bool = False, ensure_ascii: bool = True, check_circular: bool = True, allow_nan: bool = True, indent: int | str | None = None, separators: Tuple[str, str] | None = None, default: Callable | None = None, sort_keys: bool = False, **kw) str
class components.generic_hydrogen_storage.GenericHydrogenStorageState(fill: float = 0)

Bases: object

Generic hydrogen storage state that saves the state of the hydrogen storage.

clone() Any

Clones the state.

components.generic_price_signal module

Dummy class and configuration returning electricity prices (from grid) and returns (injection) in each time step.

class components.generic_price_signal.PriceSignal(my_simulation_parameters: SimulationParameters, config: PriceSignalConfig, my_display_config: DisplayConfig = DisplayConfig(pretty_name=None, display_in_webtool=False))

Bases: Component

Price Signal class.

Class component that provides price for electricity. Outputs: Price for injection: cents/kWh, Price for purchase: cents/kWh

PriceInjection = 'PriceInjection'
PricePurchase = 'PricePurchase'
Price_Injection_Forecast_24h = 'Price_Injection_Forecast_24h'
Price_Purchase_Forecast_24h = 'Price_Purchase_Forecast_24h'
build_dummy(start: int, end: int) None

Initialization of information if step function is used for prices.

i_doublecheck(timestep: int, stsv: SingleTimeStepValues) None

Doublechecks.

i_prepare_simulation() None

Prepares the simulation.

i_restore_state() None

Restores the state.

i_save_state() None

Saves the state.

i_simulate(timestep: int, stsv: SingleTimeStepValues, force_convergence: bool) None

Outputs price signal of time step.

write_to_report() List[str]

Writes relevant information to report.

class components.generic_price_signal.PriceSignalConfig(building_name: str, name: str, country: str, pricing_scheme: str, installed_capacity: float, price_signal_type: str, fixed_price: list, static_tou_price: list, price_injection: float, predictive_control: bool, prediction_horizon: int | None)

Bases: ConfigBase

Price Signal config class.

building_name: str
country: str
fixed_price: list
classmethod from_dict(kvs: dict | list | str | int | float | bool | None, *, infer_missing=False) A

Converts a Python dictionary object to a dataclass instance.

Iterates over each dataclass field recursively; lists, dicts, and nested dataclasses will likewise be initialized as expected.

When directly invoking this function, an optional Meta configuration for the dataclass can be specified via LoadMeta; by default, this will apply recursively to any nested dataclasses. Here’s a sample usage of this below:

>>> LoadMeta(key_transform='CAMEL').bind_to(MyClass)
>>> fromdict(MyClass, {"myStr": "value"})
classmethod from_json(s: str | bytes | bytearray, *, parse_float=None, parse_int=None, parse_constant=None, infer_missing=False, **kw) A
classmethod get_default_price_signal_config(building_name: str = 'BUI1') Any

Default configuration for price signal.

classmethod get_main_classname()

Return the full class name of the base class.

installed_capacity: float
name: str

name of the price signal

prediction_horizon: int | None
predictive_control: bool
price_injection: float
price_signal_type: str
pricing_scheme: str
classmethod schema(*, infer_missing: bool = False, only=None, exclude=(), many: bool = False, context=None, load_only=(), dump_only=(), partial: bool = False, unknown=None) SchemaF[A]
static_tou_price: list
to_dict(encode_json=False) Dict[str, dict | list | str | int | float | bool | None]

Return the fields of a dataclass instance as a new dictionary mapping field names to field values.

Example usage:

@dataclass class C:

x: int y: int

c = C(1, 2) assert asdict(c) == {‘x’: 1, ‘y’: 2}

When directly invoking this function, an optional Meta configuration for the dataclass can be specified via DumpMeta; by default, this will apply recursively to any nested dataclasses. Here’s a sample usage of this below:

>>> DumpMeta(key_transform='CAMEL').bind_to(MyClass)
>>> asdict(MyClass(my_str="value"))

If given, ‘dict_factory’ will be used instead of built-in dict. The function applies recursively to field values that are dataclass instances. This will also look into built-in containers: tuples, lists, and dicts.

to_json(*, skipkeys: bool = False, ensure_ascii: bool = True, check_circular: bool = True, allow_nan: bool = True, indent: int | str | None = None, separators: Tuple[str, str] | None = None, default: Callable | None = None, sort_keys: bool = False, **kw) str

components.generic_pv_system module

PV system module.

class components.generic_pv_system.PVLibModuleAndInverterEnum(value)

Bases: Enum

Module and inverter database options.

Class to determine what pvlib database for phtotovoltaic modules and inverters should be used.

https://pvlib-python.readthedocs.io/en/v0.9.0/generated/pvlib.pvsystem.retrieve_sam.html.

ANTON_DRIESSE_INVERTER_DATABASE = 5
CEC_INVERTER_DATABASE = 4
CEC_MODULE_DATABASE = 3
SANDIA_INVERTER_DATABASE = 2
SANDIA_MODULE_DATABASE = 1
class components.generic_pv_system.PVSystem(my_simulation_parameters: SimulationParameters, config: PVSystemConfig, my_display_config: DisplayConfig = DisplayConfig(pretty_name=None, display_in_webtool=True))

Bases: Component

Simulates PV Output based on weather data and peak power.

Parameters

timeint, optional

Simulation timeline. The default is 2019.

locationstr, optional

Object Location with temperature and solar data. The default is “Aachen”.

powerfloat, optional

Power in kWp to be provided by the PV System. The default is 10E3.

load_module_databool

Access the PV data base (True) or not (False). The default is False

module_namestr, optional

The default is “Trina Solar TSM-435NE09RC.05”

integrate_inverter, bool, optional

Consider inverter efficiency in the calculation (True) or not (False). The default is True.

inverter_namestr, optional

The default is “Enphase Energy Inc : IQ8P-3P-72-E-DOM-US [208V]”.

azimuthfloat, optional

Panel azimuth from north in °. The default is 180°.

tiltfloat, optional

Panel tilt from horizontal. The default is 90°.

source_weightint, optional

Weight of component, relevant if there is more than one PV System, defines hierachy in control. The default is 1.

namestr, optional

Name of pv panel within simulation. The default is ‘PVSystem’

ApparentZenith = 'ApparentZenith'
Azimuth = 'Azimuth'
DiffuseHorizontalIrradiance = 'DiffuseHorizontalIrradiance'
DirectNormalIrradiance = 'DirectNormalIrradiance'
DirectNormalIrradianceExtra = 'DirectNormalIrradianceExtra'
ElectricityEnergyOutput = 'ElectricityEnergyOutput'
ElectricityOutput = 'ElectricityOutput'
GlobalHorizontalIrradiance = 'GlobalHorizontalIrradiance'
TemperatureOutside = 'TemperatureOutside'
WindSpeed = 'WindSpeed'
get_component_kpi_entries(all_outputs: List, postprocessing_results: DataFrame) List[KpiEntry]

PV System KPIs.

Calculates KPIs for the respective component and return all KPI entries as list.

static get_cost_capex(config: PVSystemConfig, simulation_parameters: SimulationParameters) CapexCostDataClass

Returns investment cost, CO2 emissions and lifetime.

get_cost_opex(all_outputs: List, postprocessing_results: DataFrame) OpexCostDataClass

Calculate OPEX costs, consisting of maintenance costs for PV.

static get_default_config(power_in_watt: float = 10000.0, source_weight: int = 1, share_of_maximum_pv_potential: float = 1.0, building_name: str = 'BUI1') Any

Get default config.

get_default_connections_from_weather()

Get default connections from weather.

get_inverters_from_database(inverter_database: Any, load_module_data: bool, inverter_name: str) Any

Get inverters from pvlib module database.

get_modules_from_database(module_database: Any, load_module_data: bool, module_name: str) Any

Get modules from pvlib module database.

i_doublecheck(timestep: int, stsv: SingleTimeStepValues) None

Doublechecks.

i_prepare_simulation() None

Prepares the component for the simulation.

i_restore_state() None

Restores the state.

i_save_state() None

Saves the state.

i_simulate(timestep: int, stsv: SingleTimeStepValues, force_convergence: bool) None

Simulate the component.

interpolate(pd_database: Any, year: Any) Any

Interpolates.

simulate_cec(dni_extra=None, dni=None, dhi=None, ghi=None, azimuth=None, apparent_zenith=None, temperature=None, wind_speed=None, surface_tilt=30.0, surface_azimuth=180.0, albedo=0.2)

Simulates a defined PV array using the single-diode model.

This simulation works with data from the CEC database. The implementation is done in accordance with following tutorial: https://github.com/pvlib/pvlib-python/blob/master/docs/tutorials/tmy_to_power.ipynb https://pvlib-python.readthedocs.io/en/stable/reference/generated/pvlib.pvsystem.sapm.html#pvlib.pvsystem.sapm

Parameters

surface_tilt: int or float, optional (default:30)

Tilt angle of of the array in degree.

surface_azimuth: int or float, optional (default:180)

Azimuth angle of of the array in degree. 180 degree means south, 90 degree east and 270 west.

albedo: float, optional (default: 0.2)

Reflection coefficient of the surrounding area.

apparent_zenith: Any

Apparent zenith.

azimuth: int, float

Azimuth.

dni: Any

direct normal irradiance.

ghi: Any

global horizontal irradiance.

dhi: Any

direct horizontal irradiance.

dni_extra: Any

direct normal irradiance extra.

temperature: Any

tempertaure.

wind_speed: Any

wind_speed.

Returns

ac_power: Any

ac power

simulate_sandia(dni_extra=None, dni=None, dhi=None, ghi=None, azimuth=None, apparent_zenith=None, temperature=None, wind_speed=None, surface_tilt=30.0, surface_azimuth=180.0, albedo=0.2)

Simulates with the Sandia PV Array Performance Model.

The implementation is done in accordance with following tutorial: https://github.com/pvlib/pvlib-python/blob/master/docs/tutorials/tmy_to_power.ipynb https://pvlib-python.readthedocs.io/en/stable/reference/generated/pvlib.pvsystem.sapm.html#pvlib.pvsystem.sapm

Based on the tsib project @[tsib-kotzur] (Check header)

Parameters

surface_tilt: int or float, optional (default:30)

Tilt angle of of the array in degree.

surface_azimuth: int or float, optional (default:180)

Azimuth angle of of the array in degree. 180 degree means south, 90 degree east and 270 west.

albedo: float, optional (default: 0.2)

Reflection coefficient of the surrounding area.

apparent_zenith: Any

Apparent zenith.

azimuth: int, float

Azimuth.

dni: Any

direct normal irradiance.

ghi: Any

global horizontal irradiance.

dhi: Any

direct horizontal irradiance.

dni_extra: Any

direct normal irradiance extra.

temperature: Any

tempertaure.

wind_speed: Any

wind_speed.

Returns

ac_power: Any

ac power

write_to_report()

Write to the report.

class components.generic_pv_system.PVSystemConfig(building_name: str, name: str, time: int, location: str, module_name: str, integrate_inverter: bool, inverter_name: str, module_database: PVLibModuleAndInverterEnum, inverter_database: PVLibModuleAndInverterEnum, power_in_watt: float, azimuth: float, tilt: float, share_of_maximum_pv_potential: float, load_module_data: bool, source_weight: int, device_co2_footprint_in_kg: float | None, investment_costs_in_euro: float | None, lifetime_in_years: float | None, maintenance_costs_in_euro_per_year: float | None, subsidy_as_percentage_of_investment_costs: float | None, predictive: bool, predictive_control: bool, prediction_horizon: int | None)

Bases: ConfigBase

PVSystemConfig class.

azimuth: float
building_name: str
device_co2_footprint_in_kg: float | None

CO2 footprint of investment in kg

classmethod from_dict(kvs: dict | list | str | int | float | bool | None, *, infer_missing=False) A

Converts a Python dictionary object to a dataclass instance.

Iterates over each dataclass field recursively; lists, dicts, and nested dataclasses will likewise be initialized as expected.

When directly invoking this function, an optional Meta configuration for the dataclass can be specified via LoadMeta; by default, this will apply recursively to any nested dataclasses. Here’s a sample usage of this below:

>>> LoadMeta(key_transform='CAMEL').bind_to(MyClass)
>>> fromdict(MyClass, {"myStr": "value"})
classmethod from_json(s: str | bytes | bytearray, *, parse_float=None, parse_int=None, parse_constant=None, infer_missing=False, **kw) A
classmethod get_default_pv_system(name: str = 'PVSystem', power_in_watt: float = 10000.0, source_weight: int = 0, share_of_maximum_pv_potential: float = 1.0, location: str = 'Aachen', building_name: str = 'BUI1', module_name: str = 'Trina Solar TSM-435NE09RC.05', module_database: PVLibModuleAndInverterEnum = PVLibModuleAndInverterEnum.CEC_MODULE_DATABASE, inverter_name: str = 'Enphase Energy Inc : IQ8P-3P-72-E-DOM-US [208V]', inverter_database: PVLibModuleAndInverterEnum = PVLibModuleAndInverterEnum.CEC_INVERTER_DATABASE) PVSystemConfig

Gets a default PV system.

classmethod get_main_classname()

Returns the full class name of the base class.

classmethod get_scaled_pv_system(rooftop_area_in_m2: float, name: str = 'PVSystem', share_of_maximum_pv_potential: float = 1.0, module_name: str = 'Trina Solar TSM-435NE09RC.05', module_database: PVLibModuleAndInverterEnum = PVLibModuleAndInverterEnum.CEC_MODULE_DATABASE, inverter_name: str = 'Enphase Energy Inc : IQ8P-3P-72-E-DOM-US [208V]', inverter_database: PVLibModuleAndInverterEnum = PVLibModuleAndInverterEnum.CEC_INVERTER_DATABASE, location: str = 'Aachen', building_name: str = 'BUI1', load_module_data: bool = False) PVSystemConfig

Gets a default PV system with scaling according to rooftop area.

integrate_inverter: bool
inverter_database: PVLibModuleAndInverterEnum
inverter_name: str
investment_costs_in_euro: float | None

cost for investment in Euro

lifetime_in_years: float | None

lifetime in years

load_module_data: bool
location: str
maintenance_costs_in_euro_per_year: float | None
module_database: PVLibModuleAndInverterEnum
module_name: str
name: str
power_in_watt: float
prediction_horizon: int | None
predictive: bool
predictive_control: bool
classmethod schema(*, infer_missing: bool = False, only=None, exclude=(), many: bool = False, context=None, load_only=(), dump_only=(), partial: bool = False, unknown=None) SchemaF[A]
share_of_maximum_pv_potential: float
classmethod size_pv_system(rooftop_area_in_m2: float, share_of_maximum_pv_potential: float, module_name: str, module_database: PVLibModuleAndInverterEnum) float

Size PV system.

Size the pv system according to the rooftop area and the share of the maximum pv power that should be used.

source_weight: int
subsidy_as_percentage_of_investment_costs: float | None
tilt: float
time: int
to_dict(encode_json=False) Dict[str, dict | list | str | int | float | bool | None]

Return the fields of a dataclass instance as a new dictionary mapping field names to field values.

Example usage:

@dataclass class C:

x: int y: int

c = C(1, 2) assert asdict(c) == {‘x’: 1, ‘y’: 2}

When directly invoking this function, an optional Meta configuration for the dataclass can be specified via DumpMeta; by default, this will apply recursively to any nested dataclasses. Here’s a sample usage of this below:

>>> DumpMeta(key_transform='CAMEL').bind_to(MyClass)
>>> asdict(MyClass(my_str="value"))

If given, ‘dict_factory’ will be used instead of built-in dict. The function applies recursively to field values that are dataclass instances. This will also look into built-in containers: tuples, lists, and dicts.

to_json(*, skipkeys: bool = False, ensure_ascii: bool = True, check_circular: bool = True, allow_nan: bool = True, indent: int | str | None = None, separators: Tuple[str, str] | None = None, default: Callable | None = None, sort_keys: bool = False, **kw) str

components.generic_smart_device module

Implementation of shiftable household devices like washing machines, dish washers or dryers.

Takes load profiles and time windows, where the activation can be shifted within from LoadProfileGenerator and activates the device when surplus from PV is available. The device is activated at the end of the time window when no surplus was available. This file contains the class SmartDevice and SmartDevice State, the configuration is automatically adopted from the information provided by the LPG.

class components.generic_smart_device.SmartDevice(my_simulation_parameters: SimulationParameters, config: SmartDeviceConfig, my_display_config: DisplayConfig = DisplayConfig(pretty_name=None, display_in_webtool=False))

Bases: Component

Smart device class.

Class component that provides availablity and profiles of flexible smart devices like shiftable (in time) washing machines and dishwashers. Data provided or based on LPG exports.

ElectricityOutput = 'ElectricityOutput'
ElectricityTarget = 'ElectricityTarget'
L3DeviceActivation = 'l3_DeviceActivation'
build(identifier: str, source_weight: int, seconds_per_timestep: int = 60) None

Initialization of Smart Device information.

Parameters:
  • identifier (str) – name of smart device in LPG

  • source_weight (int) – priority of smart device in Energy Management System

  • seconds_per_timestep (int, optional) – time step size, defaults to 60

Raises:
  • NameError – _description_

  • TypeError – _description_

get_cost_opex(all_outputs: List, postprocessing_results: DataFrame) OpexCostDataClass

Get opex costs.

i_doublecheck(timestep: int, stsv: SingleTimeStepValues) None

Doublechecks.

i_prepare_simulation() None

Prepares the simulation.

i_restore_state() None

Restores the state.

i_save_state() None

Saves the state.

i_simulate(timestep: int, stsv: SingleTimeStepValues, force_convergence: bool) None

Iteration in smart appliance like washing mashine, dish washer or dryer.

Parameters:
  • timestep (int) – timestep of simulation

  • stsv (cp.SingleTimeStepValues) – _description_

  • force_convergence (bool) – _description_

write_to_report() List[str]

Writes relevant information to report.

class components.generic_smart_device.SmartDeviceConfig(building_name: str, name: str, identifier: str, source_weight: int, smart_devices_included: bool)

Bases: ConfigBase

Configuration of the smart device.

building_name: str
classmethod from_dict(kvs: dict | list | str | int | float | bool | None, *, infer_missing=False) A

Converts a Python dictionary object to a dataclass instance.

Iterates over each dataclass field recursively; lists, dicts, and nested dataclasses will likewise be initialized as expected.

When directly invoking this function, an optional Meta configuration for the dataclass can be specified via LoadMeta; by default, this will apply recursively to any nested dataclasses. Here’s a sample usage of this below:

>>> LoadMeta(key_transform='CAMEL').bind_to(MyClass)
>>> fromdict(MyClass, {"myStr": "value"})
classmethod from_json(s: str | bytes | bytearray, *, parse_float=None, parse_int=None, parse_constant=None, infer_missing=False, **kw) A
classmethod get_default_config(building_name: str = 'BUI1') Any

Gets a default config.

classmethod get_main_classname()

Returns the full class name of the base class.

identifier: str
name: str
classmethod schema(*, infer_missing: bool = False, only=None, exclude=(), many: bool = False, context=None, load_only=(), dump_only=(), partial: bool = False, unknown=None) SchemaF[A]
smart_devices_included: bool
source_weight: int
to_dict(encode_json=False) Dict[str, dict | list | str | int | float | bool | None]

Return the fields of a dataclass instance as a new dictionary mapping field names to field values.

Example usage:

@dataclass class C:

x: int y: int

c = C(1, 2) assert asdict(c) == {‘x’: 1, ‘y’: 2}

When directly invoking this function, an optional Meta configuration for the dataclass can be specified via DumpMeta; by default, this will apply recursively to any nested dataclasses. Here’s a sample usage of this below:

>>> DumpMeta(key_transform='CAMEL').bind_to(MyClass)
>>> asdict(MyClass(my_str="value"))

If given, ‘dict_factory’ will be used instead of built-in dict. The function applies recursively to field values that are dataclass instances. This will also look into built-in containers: tuples, lists, and dicts.

to_json(*, skipkeys: bool = False, ensure_ascii: bool = True, check_circular: bool = True, allow_nan: bool = True, indent: int | str | None = None, separators: Tuple[str, str] | None = None, default: Callable | None = None, sort_keys: bool = False, **kw) str
class components.generic_smart_device.SmartDeviceState(actual_power: float = 0, timestep_of_activation: int = -999, time_to_go: int = 0, position: int = 0)

Bases: object

State representing smart appliance.

clone() SmartDeviceState

Copy state efficiently.

run(timestep: int, electricity_profile: List[float]) None

Check device state based on previous time step.

Parameters:
  • timestep (int) – timestep of simulation

  • electricity_profile (List[float]) – load profile of device for actual or next activation

components.heat_distribution_system module

components.loadprofilegenerator_connector module

components.loadprofilegenerator_utsp_connector module

components.random_numbers module

Module for generating random numbers.

class components.random_numbers.RandomNumbers(config: RandomNumbersConfig, my_simulation_parameters: SimulationParameters, my_display_config: DisplayConfig = DisplayConfig(pretty_name=None, display_in_webtool=False))

Bases: Component

Random number class.

RandomOutput: str = 'Random Numbers'
i_doublecheck(timestep: int, stsv: SingleTimeStepValues) None

Doublechecks.

i_prepare_simulation() None

Prepares the simulation.

i_restore_state() None

Restores the state.

i_save_state() None

Saves the state.

i_simulate(timestep: int, stsv: SingleTimeStepValues, force_convergence: bool) None

Simulates the component.

write_to_report() List[str]

Write to report.

class components.random_numbers.RandomNumbersConfig(building_name: str, name: str, timesteps: int, minimum: float, maximum: float)

Bases: ConfigBase

Configuration of the Random Numbers.

building_name: str
classmethod from_dict(kvs: dict | list | str | int | float | bool | None, *, infer_missing=False) A

Converts a Python dictionary object to a dataclass instance.

Iterates over each dataclass field recursively; lists, dicts, and nested dataclasses will likewise be initialized as expected.

When directly invoking this function, an optional Meta configuration for the dataclass can be specified via LoadMeta; by default, this will apply recursively to any nested dataclasses. Here’s a sample usage of this below:

>>> LoadMeta(key_transform='CAMEL').bind_to(MyClass)
>>> fromdict(MyClass, {"myStr": "value"})
classmethod from_json(s: str | bytes | bytearray, *, parse_float=None, parse_int=None, parse_constant=None, infer_missing=False, **kw) A
classmethod get_default_config()

Gets a default config.

classmethod get_main_classname()

Returns the full class name of the base class.

maximum: float
minimum: float
name: str
classmethod schema(*, infer_missing: bool = False, only=None, exclude=(), many: bool = False, context=None, load_only=(), dump_only=(), partial: bool = False, unknown=None) SchemaF[A]
timesteps: int
to_dict(encode_json=False) Dict[str, dict | list | str | int | float | bool | None]

Return the fields of a dataclass instance as a new dictionary mapping field names to field values.

Example usage:

@dataclass class C:

x: int y: int

c = C(1, 2) assert asdict(c) == {‘x’: 1, ‘y’: 2}

When directly invoking this function, an optional Meta configuration for the dataclass can be specified via DumpMeta; by default, this will apply recursively to any nested dataclasses. Here’s a sample usage of this below:

>>> DumpMeta(key_transform='CAMEL').bind_to(MyClass)
>>> asdict(MyClass(my_str="value"))

If given, ‘dict_factory’ will be used instead of built-in dict. The function applies recursively to field values that are dataclass instances. This will also look into built-in containers: tuples, lists, and dicts.

to_json(*, skipkeys: bool = False, ensure_ascii: bool = True, check_circular: bool = True, allow_nan: bool = True, indent: int | str | None = None, separators: Tuple[str, str] | None = None, default: Callable | None = None, sort_keys: bool = False, **kw) str

components.sumbuilder module

Contains functions to sum up multiple inputs.

class components.sumbuilder.CalculateOperation(config: SumBuilderConfig, my_simulation_parameters: SimulationParameters, my_display_config: DisplayConfig = DisplayConfig(pretty_name=None, display_in_webtool=False))

Bases: Component

Arbitrary mathematical operations.

Output = 'Output'
add_numbered_input() ComponentInput

Adds a numbered input.

add_operation(operation: str) Any

Adds the operation.

connect_arbitrary_input(src_object_name: str, src_field_name: str) None

Connect arbitrary inputs.

i_doublecheck(timestep: int, stsv: SingleTimeStepValues) None

Double checks the results.

i_restore_state() None

Restores the state.

i_save_state() None

Saves the state.

i_simulate(timestep: int, stsv: SingleTimeStepValues, force_convergence: bool) None

Simulates.

operations_available = ['Sum', 'Subtract', 'Multiply', 'Divide']
class components.sumbuilder.SumBuilderConfig(building_name: str, name: str, loadtype: LoadTypes, unit: Units)

Bases: ConfigBase

Electricity Grid Config.

building_name: str
classmethod from_dict(kvs: dict | list | str | int | float | bool | None, *, infer_missing=False) A

Converts a Python dictionary object to a dataclass instance.

Iterates over each dataclass field recursively; lists, dicts, and nested dataclasses will likewise be initialized as expected.

When directly invoking this function, an optional Meta configuration for the dataclass can be specified via LoadMeta; by default, this will apply recursively to any nested dataclasses. Here’s a sample usage of this below:

>>> LoadMeta(key_transform='CAMEL').bind_to(MyClass)
>>> fromdict(MyClass, {"myStr": "value"})
classmethod from_json(s: str | bytes | bytearray, *, parse_float=None, parse_int=None, parse_constant=None, infer_missing=False, **kw) A
classmethod get_main_classname()

Returns the full class name of the base class.

classmethod get_sumbuilder_default_config()

Gets a default Sumbuilder.

loadtype: LoadTypes
name: str
classmethod schema(*, infer_missing: bool = False, only=None, exclude=(), many: bool = False, context=None, load_only=(), dump_only=(), partial: bool = False, unknown=None) SchemaF[A]
to_dict(encode_json=False) Dict[str, dict | list | str | int | float | bool | None]

Return the fields of a dataclass instance as a new dictionary mapping field names to field values.

Example usage:

@dataclass class C:

x: int y: int

c = C(1, 2) assert asdict(c) == {‘x’: 1, ‘y’: 2}

When directly invoking this function, an optional Meta configuration for the dataclass can be specified via DumpMeta; by default, this will apply recursively to any nested dataclasses. Here’s a sample usage of this below:

>>> DumpMeta(key_transform='CAMEL').bind_to(MyClass)
>>> asdict(MyClass(my_str="value"))

If given, ‘dict_factory’ will be used instead of built-in dict. The function applies recursively to field values that are dataclass instances. This will also look into built-in containers: tuples, lists, and dicts.

to_json(*, skipkeys: bool = False, ensure_ascii: bool = True, check_circular: bool = True, allow_nan: bool = True, indent: int | str | None = None, separators: Tuple[str, str] | None = None, default: Callable | None = None, sort_keys: bool = False, **kw) str
unit: Units
class components.sumbuilder.SumBuilderForThreeInputs(config: SumBuilderConfig, my_simulation_parameters: SimulationParameters, my_display_config: DisplayConfig = DisplayConfig(pretty_name=None, display_in_webtool=False))

Bases: Component

Sum builder for three inputs.

SumInput1 = 'Input 1'
SumInput2 = 'Input 2'
SumInput3 = 'Input 3'
SumOutput = 'Sum'
i_doublecheck(timestep: int, stsv: SingleTimeStepValues) None

For double checking results.

i_restore_state() None

Restores a state.

i_save_state() None

Saves the current state.

i_simulate(timestep: int, stsv: SingleTimeStepValues, force_convergence: bool) None

Performs the addition of the values.

class components.sumbuilder.SumBuilderForTwoInputs(config: SumBuilderConfig, my_simulation_parameters: SimulationParameters, my_display_config: DisplayConfig = DisplayConfig(pretty_name=None, display_in_webtool=False))

Bases: Component

Adds two outputs.

SumInput1 = 'Input 1'
SumInput2 = 'Input 2'
SumOutput = 'Sum'
i_doublecheck(timestep: int, stsv: SingleTimeStepValues) None

For double checking results.

i_prepare_simulation() None

Prepares the simulation.

i_restore_state() None

Restores state.

i_save_state() None

For saving state.

i_simulate(timestep: int, stsv: SingleTimeStepValues, force_convergence: bool) None

Adds the two values.

write_to_report() List[str]

Writes information to the report.

components.weather module

Handles all the weather data processing.

class components.weather.LocationEnum(value)

Bases: Enum

contains all the locations and their corresponding directories.

AACHEN = ('Aachen', 'test-reference-years_1995-2012_1-location', 'data_processed', 'aachen_center', WeatherDataSourceEnum.DWD_TRY)
AT = ('Viena', 'NSRDB_15min', 'Viena', '902141_48.21_16.38_2019.csv', WeatherDataSourceEnum.NSRDB_15MIN)
ATHENS = ('Athens', 'NSRDB', 'Athens', 'Athens', WeatherDataSourceEnum.NSRDB)
BAD_MARIENBURG = ('06Bad Marienburg', 'test-reference-years_2015-2045_15-locations', 'data_processed', 'weather_region_06', WeatherDataSourceEnum.DWD_TRY)
BE = ('Uccle', 'NSRDB_15min', 'Uccle', '454992_50.81_4.34_2019.csv', WeatherDataSourceEnum.NSRDB_15MIN)
BELGRADE = ('Belgrade', 'NSRDB', 'Belgrade', 'Belgrade', WeatherDataSourceEnum.NSRDB)
BG = ('Sofia', 'NSRDB_15min', 'Sofia', '1267064_42.69_23.30_2019.csv', WeatherDataSourceEnum.NSRDB_15MIN)
BRAUNLAGE = ('08Braunlage', 'test-reference-years_2015-2045_15-locations', 'data_processed', 'weather_region_08', WeatherDataSourceEnum.DWD_TRY)
BREMERHAVEN = ('01_Bremerhaven', 'test-reference-years_2015-2045_15-locations', 'data_processed', 'weather_region_01', WeatherDataSourceEnum.DWD_TRY)
CHEMNITZ = ('09Chemnitz', 'test-reference-years_2015-2045_15-locations', 'data_processed', 'weather_region_09', WeatherDataSourceEnum.DWD_TRY)
CY = ('Nicosia', 'NSRDB_15min', 'Nicosia', '1809004_35.17_33.38_2019.csv', WeatherDataSourceEnum.NSRDB_15MIN)
CYPRUS = ('Cyprus', 'NSRDB', 'Cyprus', 'Cyprus', WeatherDataSourceEnum.NSRDB)
CZ = ('Prague', 'NSRDB_15min', 'Prague', '804583_50.09_14.42_2019.csv', WeatherDataSourceEnum.NSRDB_15MIN)
DE = ('Potsdam', 'NSRDB_15min', 'Potsdam', '742114_52.41_13.06_2019.csv', WeatherDataSourceEnum.NSRDB_15MIN)
DK = ('Copenhagen', 'NSRDB_15min', 'Copenhagen', '721796_55.69_12.58_2019.csv', WeatherDataSourceEnum.NSRDB_15MIN)
ES = ('Malaga', 'NSRDB_15min', 'Malaga', '213028_36.73_-4.42_2019.csv', WeatherDataSourceEnum.NSRDB_15MIN)
ESSEN = ('05Essen', 'test-reference-years_2015-2045_15-locations', 'data_processed', 'weather_region_05', WeatherDataSourceEnum.DWD_TRY)
FICHTELBERG = ('11Fichtelberg', 'test-reference-years_2015-2045_15-locations', 'data_processed', 'weather_region_11', WeatherDataSourceEnum.DWD_TRY)
FR = ('Paris', 'NSRDB_15min', 'Paris', '403286_48.85_2.34_2019.csv', WeatherDataSourceEnum.NSRDB_15MIN)
GARMISCH_PARTENKIRCHEN = ('15Garmisch Partenkirchen', 'test-reference-years_2015-2045_15-locations', 'data_processed', 'weather_region_15', WeatherDataSourceEnum.DWD_TRY)
GB = ('London', 'NSRDB_15min', 'London', '337089_51.49_-0.10_2019.csv', WeatherDataSourceEnum.NSRDB_15MIN)
GR = ('Athens', 'NSRDB_15min', 'Athens', '1291832_37.97_23.74_2019.csv', WeatherDataSourceEnum.NSRDB_15MIN)
HAMBURG = ('03Hamburg', 'test-reference-years_2015-2045_15-locations', 'data_processed', 'weather_region_03', WeatherDataSourceEnum.DWD_TRY)
HOF = ('10Hof', 'test-reference-years_2015-2045_15-locations', 'data_processed', 'weather_region_10', WeatherDataSourceEnum.DWD_TRY)
HU = ('Budapest', 'NSRDB_15min', 'Budapest', '1035927_47.49_19.06_2019.csv', WeatherDataSourceEnum.NSRDB_15MIN)
IE = ('Dublin', 'NSRDB_15min', 'Dublin', '165308_53.37_-6.26_2019.csv', WeatherDataSourceEnum.NSRDB_15MIN)
IT = ('Rome', 'NSRDB_15min', 'Rome', '718838_41.89_12.50_2019.csv', WeatherDataSourceEnum.NSRDB_15MIN)
KASSEL = ('07Kassel', 'test-reference-years_2015-2045_15-locations', 'data_processed', 'weather_region_07', WeatherDataSourceEnum.DWD_TRY)
LJUBLIANA = ('Ljubljana', 'NSRDB', 'Ljubljana', 'Ljubljana', WeatherDataSourceEnum.NSRDB)
MADRID = ('Madrid', 'NSRDB', 'Madrid', 'Madrid', WeatherDataSourceEnum.NSRDB)
MANNHEIM = ('12Mannheim', 'test-reference-years_2015-2045_15-locations', 'data_processed', 'weather_region_12', WeatherDataSourceEnum.DWD_TRY)
MILAN = ('Milan', 'NSRDB', 'Milan', 'Milan', WeatherDataSourceEnum.NSRDB)
MUEHLDORF = ('13Muehldorf', 'test-reference-years_2015-2045_15-locations', 'data_processed', 'weather_region_13', WeatherDataSourceEnum.DWD_TRY)
NL = ('Amsterdam', 'NSRDB_15min', 'Amsterdam', '469536_52.37_4.90_2019.csv', WeatherDataSourceEnum.NSRDB_15MIN)
NO = ('Oslo', 'NSRDB_15min', 'Oslo', '653025_59.93_10.74_2019.csv', WeatherDataSourceEnum.NSRDB_15MIN)
PL = ('Warsaw', 'NSRDB_15min', 'Warsaw', '1138443_52.25_21.02_2019.csv', WeatherDataSourceEnum.NSRDB_15MIN)
POTSDAM = ('04Potsdam', 'test-reference-years_2015-2045_15-locations', 'data_processed', 'weather_region_04', WeatherDataSourceEnum.DWD_TRY)
ROSTOCK = ('02_Rostock', 'test-reference-years_2015-2045_15-locations', 'data_processed', 'weather_region_02', WeatherDataSourceEnum.DWD_TRY)
RS = ('Belgrad', 'NSRDB_15min', 'Belgrad', '1108363_44.77_20.46_2019.csv', WeatherDataSourceEnum.NSRDB_15MIN)
SARAJEVO = ('Sarajevo', 'NSRDB', 'Sarajevo', 'Sarajevo', WeatherDataSourceEnum.NSRDB)
SE = ('Stockholm', 'NSRDB_15min', 'Stockholm', '984998_59.33_18.06_2019.csv', WeatherDataSourceEnum.NSRDB_15MIN)
SEVILLE = ('Seville', 'NSRDB', 'Seville', 'Seville', WeatherDataSourceEnum.NSRDB)
SI = ('Ljubljana', 'NSRDB_15min', 'Ljubljana', '808557_46.05_14.50_2019.csv', WeatherDataSourceEnum.NSRDB_15MIN)
STOETTEN = ('14Stoetten', 'test-reference-years_2015-2045_15-locations', 'data_processed', 'weather_region_14', WeatherDataSourceEnum.DWD_TRY)
VRANJE = ('Vranje', 'NSRDB', 'Vranje', 'Vranje', WeatherDataSourceEnum.NSRDB)
class components.weather.Weather(my_simulation_parameters: SimulationParameters, config: WeatherConfig, my_display_config: DisplayConfig = DisplayConfig(pretty_name=None, display_in_webtool=False))

Bases: Component

Provide thermal and solar conditions of local weather.

Altitude = 'Altitude'
ApparentZenith = 'ApparentZenith'
Azimuth = 'Azimuth'
DailyAverageOutsideTemperatures = 'DailyAverageOutsideTemperatures'
DiffuseHorizontalIrradiance = 'DiffuseHorizontalIrradiance'
DirectNormalIrradiance = 'DirectNormalIrradiance'
DirectNormalIrradianceExtra = 'DirectNormalIrradianceExtra'
GlobalHorizontalIrradiance = 'GlobalHorizontalIrradiance'
Pressure = 'Pressure'
TemperatureOutside = 'TemperatureOutside'
Weather_Temperature_Forecast_24h = 'Weather_Temperature_Forecast_24h'
Weather_WindSpeed_yearly_forecast = 'Weather_WindSpeed_yearly_forecast'
WindSpeed = 'WindSpeed'
calc_sun_position(latitude_deg, longitude_deg, year, hoy)

Calculates the Sun Position for a specific hour and location.

Parameters:
  • latitude_deg (float) – Geographical Latitude in Degrees

  • longitude_deg (float) – Geographical Longitude in Degrees

  • year (int) – year

  • hoy (int) – Hour of the year from the start. The first hour of January is 1

Returns:

altitude, azimuth: Sun position in altitude and azimuth degrees [degrees]

Return type:

tuple

calc_sun_position2(hoy: Any) Any

Calculates the sun position.

calculate_daily_average_outside_temperature(temperaturelist: List[float], seconds_per_timestep: int) List[float]

Calculate the daily average outside temperatures.

get_component_kpi_entries(all_outputs: List, postprocessing_results: DataFrame) List[KpiEntry]

Calculates KPIs for the respective component and return all KPI entries as list.

static get_cost_capex(config: WeatherConfig, simulation_parameters: SimulationParameters) CapexCostDataClass

Returns investment cost, CO2 emissions and lifetime.

get_cost_opex(all_outputs: List, postprocessing_results: DataFrame) OpexCostDataClass

Calculate OPEX costs, consisting of electricity costs and revenues.

i_doublecheck(timestep: int, stsv: SingleTimeStepValues) None

Double chekc.

i_prepare_simulation() None

Generates the lists to be used later.

i_restore_state() None

Restores the previous state. Not needed for weather.

i_save_state() None

Saves the current state.

i_simulate(timestep: int, stsv: SingleTimeStepValues, force_convergence: bool) None

Performs the simulation.

interpolate(pd_database: Any, year: int) Any

Interpolates a time series.

write_to_report()

Write configuration to the report.

class components.weather.WeatherConfig(building_name: str, name: str, location: str, source_path: str, data_source: WeatherDataSourceEnum, predictive_control: bool)

Bases: ConfigBase

Configuration class for Weather.

building_name: str
data_source: WeatherDataSourceEnum
classmethod get_default(location_entry: Any, name: str = 'Weather', building_name: str = 'BUI1', weather_direct_filepath: str | None = None, weather_direct_data_source: WeatherDataSourceEnum | None = None) Any

Gets the default configuration for a given location.

classmethod get_main_classname()

Get the name of the main class.

location: str
name: str
predictive_control: bool
source_path: str
class components.weather.WeatherDataSourceEnum(value)

Bases: Enum

Describes where the weather data is from. Used to choose the correct reading function.

DWD_10MIN = 4
DWD_15MIN = 6
DWD_TRY = 1
ERA5 = 5
NSRDB = 2
NSRDB_15MIN = 3
components.weather.calculate_direct_normal_radiation(direct_horizontal_irradation: Series, lon: float, lat: float, zenith_tol: float = 87.0) Series

Calculates the direct NORMAL irradiance from the direct horizontal irradiance with the help of the PV lib.

Based on the tsib project @[tsib-kotzur] (Check header)

Parameters

direct_horizontal_irradation: pd.Series with time index

Direct horizontal irradiance

lon: float

Longitude of the location

lat: float

Latitude of the location

zenith_tol: float, optional

Avoid cosines of values above a certain zenith angle of in order to avoid division by zero.

Returns

dni: pd.Series

components.weather.get_coordinates(filepath: str, source_enum: WeatherDataSourceEnum) Any

Reads a test reference year file and gets the GHI, DHI and DNI from it.

Based on the tsib project @[tsib-kotzur] (Check header)

components.weather.read_dwd_10min_data(filepath: str, year: int) DataFrame

Reads a set of DWD data in 10 min resolution.

https://github.com/earthobservations/wetterdienst/tree/main

components.weather.read_dwd_15min_data(filepath: str, simulation_parameters: SimulationParameters) DataFrame

Reads a set of DWD data in 15 min resolution.

https://github.com/earthobservations/wetterdienst/tree/main

components.weather.read_dwd_try_data(filepath: str, year: int) DataFrame

Reads the DWD Test Reference Year (TRY) data.

components.weather.read_era5_data(filepath: str, year: int) DataFrame

Reads a set of era5 in 60 min resolution.

https://cds.climate.copernicus.eu/cdsapp#!/dataset/reanalysis-era5-single-levels?tab=overview

components.weather.read_nsrdb_15min_data(filepath: str, year: int) DataFrame

Reads a set of NSRDB data in 15 min resolution.

components.weather.read_nsrdb_data(filepath: str, year: int) DataFrame

Reads a set of NSRDB data.

components.weather.read_test_reference_year_data(weatherconfig: WeatherConfig, simulation_parameters: SimulationParameters) Any

Reads a test reference year file and gets the GHI, DHI and DNI from it.

Based on the tsib project @[tsib-kotzur] (Check header)