Devices

This module represents the energy systems.

The hardware interface should orient at the base classes of the devices. The simulation in server.forecasting.systems is also based on these classes.

class BaseDevice(device_id, env)[source]

Represents a general interface to the energy-systems.

class BaseEnvironment(initial_time=None, step_size=120, demomode=False, forecast=False)[source]

This class manages the environment of the devices holds the simulated time as well as the mode, the devices are running in. All connected devices share one BaseEnvironment

demo_mode = None
forecast | demo_mode True False
True forecast of simulated devices forecast of real devices
False demo simulation real device (env not defined)
forecast = None

see demo_mode

get_day_of_year()[source]

Returns an int value of the current simulated day of the year

initial_date = None

a unix timestamp representing the start of simulation if initial_time is None the current time is used

is_demo_simulation()[source]

Returns, if this is the demo_simulation

step_size = None

int value of seconds how often the simulated devices calculate their state

class CogenerationUnit(device_id, env)[source]

Represents a basic interface to a cogeneration unit. The configuration is read from the database and can be set from the frontend. The following parameters are available:

Parameters:
  • max_gas_input (float) – in kW
  • thermal_efficiency (float) – in percent between 0 and 1 calculated by the maximal thermal power and gas input
  • electrical_efficiency (float) – in percent between 0 and 1 calculated by the maximal electrical power and gas input
  • minimal_workload (float) – in percent between 0 and 1 used for modulation
  • minimal_off_time (float) – minimal time between to power-ons in seconds
  • purchase_price (float) – in Euro
  • purchase_date (date) – to calculate armotization
  • maintenance_interval_hours (int) – operating hours until maintenance is necessary
  • maintenance_interval_powerons (int) – maximal power-ons until maintenance is necessary
connected()[source]

The device needs a PowerMeter and a HeatStorage to operate properly.

current_electrical_production = None

kW

current_gas_consumption = None

kW

current_thermal_production = None

kWh

gas_costs = None

default 0.0655 Euro per kWh

get_operating_costs()[source]

Calculated by the consumed gas and maintenance costs (0.05 Euro per electric produced kWh).

total_electrical_production = None

kWh

total_gas_consumption = None

kWh

total_thermal_production = None

kWh

workload(workload=None)[source]

Getter and setter for the workload.

Parameters:workload (float) – between 0-100, if None nothing is set
Returns:current workload in percent [0,100]
class PeakLoadBoiler(device_id, env)[source]

Represents a basic interface to a cogeneration unit. The configuration is read from the database and can be set from the frontend. The following parameters are available:

Parameters:
  • max_gas_input (float) – in kW
  • thermal_efficiency (float) – in percent between 0 and 1 calculated by the maximal thermal power and gas input
connected()[source]

The device needs a HeatStorage to operate properly.

current_gas_consumption = None

kW

current_thermal_production = None

kWh

gas_costs = None

default 0.0655 Euro

get_operating_costs()[source]

Calculated by the consumed gas.

total_gas_consumption = None

kWh

total_thermal_production = None

kWh

workload_percent(workload=None)[source]

Getter and setter for the workload.

Parameters:workload (float) – between 0-100, if None nothing is set
Returns:current workload in [0,100]
class CogenerationUnit(device_id, env)[source]

Represents a basic interface to a cogeneration unit. The configuration is read from the database and can be set from the frontend. The following parameters are available:

Parameters:
  • max_gas_input (float) – in kW
  • thermal_efficiency (float) – in percent between 0 and 1 calculated by the maximal thermal power and gas input
  • electrical_efficiency (float) – in percent between 0 and 1 calculated by the maximal electrical power and gas input
  • minimal_workload (float) – in percent between 0 and 1 used for modulation
  • minimal_off_time (float) – minimal time between to power-ons in seconds
  • purchase_price (float) – in Euro
  • purchase_date (date) – to calculate armotization
  • maintenance_interval_hours (int) – operating hours until maintenance is necessary
  • maintenance_interval_powerons (int) – maximal power-ons until maintenance is necessary
connected()[source]

The device needs a PowerMeter and a HeatStorage to operate properly.

current_electrical_production = None

kW

current_gas_consumption = None

kW

current_thermal_production = None

kWh

gas_costs = None

default 0.0655 Euro per kWh

get_operating_costs()[source]

Calculated by the consumed gas and maintenance costs (0.05 Euro per electric produced kWh).

total_electrical_production = None

kWh

total_gas_consumption = None

kWh

total_thermal_production = None

kWh

workload(workload=None)[source]

Getter and setter for the workload.

Parameters:workload (float) – between 0-100, if None nothing is set
Returns:current workload in percent [0,100]
class PeakLoadBoiler(device_id, env)[source]

Represents a basic interface to a cogeneration unit. The configuration is read from the database and can be set from the frontend. The following parameters are available:

Parameters:
  • max_gas_input (float) – in kW
  • thermal_efficiency (float) – in percent between 0 and 1 calculated by the maximal thermal power and gas input
connected()[source]

The device needs a HeatStorage to operate properly.

current_gas_consumption = None

kW

current_thermal_production = None

kWh

gas_costs = None

default 0.0655 Euro

get_operating_costs()[source]

Calculated by the consumed gas.

total_gas_consumption = None

kWh

total_thermal_production = None

kWh

workload_percent(workload=None)[source]

Getter and setter for the workload.

Parameters:workload (float) – between 0-100, if None nothing is set
Returns:current workload in [0,100]
class ThermalConsumer(device_id, env)[source]

This class represents the thermal consume of the house. The demand is calculated by the necessary heating power and the required warm water. The house parameters are read from the database and can be set from the frontend. The following parameters are available:

Parameters:
  • apartments (int) – number of apartments in the house
  • avg_rooms_per_apartment (int) – average number of rooms
  • avg_windows_per_room (int) – average number of windows
  • type_of_windows (int) – isolation value between MISSING
  • total_living_area (int) – in square meters
  • type_of_housing (int) – isolation value between MISSING
  • residents (int) –
  • type_of_residents (int) – used to classify thermal demand MISSING RANGE
  • target_temperature (int) – requested temperature of the rooms in degree Celsius
  • avg_thermal_consumption (int) – in kWh
connected()[source]

The device needs a HeatStorage to operate properly.

daily_demand = None

list of 24 values representing target_temperature per hour

room_height = None

constant room height

temperature_warmwater = None

temperature of warm water 40 degrees Celsius by default

class ElectricalConsumer(device_id, env)[source]

This class represents the electrical consume of the house. The demand is calculated by the forecasting in :mod:server.forecasting.forecasting The house parameters are read from the database and can be set from the frontend. The following parameters are available:

Parameters:
  • apartments (int) – number of apartments in the house
  • residents (int) –
  • type_of_residents (int) – used to classify thermal demand MISSING RANGE
  • avg_electrical_consumption (int) – in kWh
connected()[source]

The device needs a PowerMeter to operate properly.

class HeatStorage(device_id, env)[source]

Represents a heat storage necessary to supply heating and warm water demand. The temperatures of the storage are as average and measured in degree Celsius. The configuration is read from the database and can be set from the frontend. The following parameters are available:

Parameters:
  • capacity (int) – in liters
  • min_temperature (float) – below this temperature the PeakLoadBoiler will turn on
  • target_temperature (float) – the HS schould always have this temperature
  • critical_temperature (float) – above this temperature all production devices are turned off
base_temperature = None

assume no lower temperature

specific_heat_capacity = None

specific heat capacity of water 4.19 J/(g*K)

class PowerMeter(device_id, env)[source]

Represents the power meter of the whole building. Measures the purchased and fed in electricity in kWh

add_energy(energy)[source]

This counts up the produced energy.

Parameters:energy (float) – in kWh
consume_energy(energy)[source]

This counts up the consumed energy.

Parameters:energy (float) – in kWh
electrical_costs = None

costs in Euro to purchase 1 kW/h from external supplier (default 0.283)

energy_consumed = None

set by consumer devices with consume_energy

energy_produced = None

set by producer devices with add_energy

fed_in_electricity = None

since last step

feed_in_reward = None

reward in Euro for feed in 1 kW/h to public grid (default 0.0917)

get_costs()[source]

Calculated by overall purchased electricity and default costs of 0.283 Euro per kWh

get_reward()[source]

Calculated by overall fed in electricity and the default reward of 0.0917 Euro per kWh. Sale to tenants is not considered here.

purchased = None

since last step

get_initialized_scenario()[source]

The function returns a list of energy systems based on the configuration in the database

Returns:list of objects from server.forecasting.systems
get_user_function(devices, code=None)[source]

Builds a method with the users code from the programming-interface.

Parameters:
  • systemslist of devices from :func:get_initialized_scenario:
  • codestring with the user-code
Returns:

callable user-function expecting a pointer to a systems list as argument

perform_configuration(data)[source]

Saves a systems configuration to the database.

Parameters:datajson with configuration values for energy systems