Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

System setup for district #353

Closed
wants to merge 98 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
98 commits
Select commit Hold shift + click to select a range
3e23dae
some improvements:
Hoppe-J Jul 3, 2024
bd019c2
code fixing
Hoppe-J Jul 3, 2024
856067d
edit log warning for electricity meter
Hoppe-J Jul 4, 2024
1baadc5
fixing code quality
Hoppe-J Jul 4, 2024
2ab0c63
preperation of ems controller fur usage in districts
Hoppe-J Jul 4, 2024
7e001c5
ems controller with parallel distribution of surplus on components
Hoppe-J Jul 5, 2024
df60361
Merge branch 'improvements-in-kpi-calculation' into ems-strategies-fo…
Hoppe-J Jul 5, 2024
cf97484
improve function for parallel distribution
Hoppe-J Jul 10, 2024
307ef22
delete print and reimport of model in kpis
Hoppe-J Jul 10, 2024
c2c9f92
fixing kpi calculation with advanced hp --> missing output in hp for …
Hoppe-J Jul 11, 2024
35d101c
calculation of parallel distribution of surplus
Hoppe-J Jul 11, 2024
b72a7bb
fixing code issues, todo: check energy from grid
Hoppe-J Jul 12, 2024
c618503
restructuring dicts and inputs
Hoppe-J Jul 15, 2024
e8b2cc2
change number of loops to number of componentes with same source weights
Hoppe-J Jul 16, 2024
a66571c
Merge branch 'main' into ems-strategies-for-building-and-district
Hoppe-J Jul 16, 2024
0419d18
fix code quali, some renaming
Hoppe-J Jul 16, 2024
1332829
- some restructuring
Hoppe-J Jul 17, 2024
3e9052a
correction of output values in while iteration when demand >0
Hoppe-J Jul 18, 2024
1222cef
- new function for parallel distribution of surplus
Hoppe-J Jul 22, 2024
6cf82ee
restructuring code to for-loop, not while-loop anymore due to runtime
Hoppe-J Jul 23, 2024
38d49e6
Merge branch 'main' into ems-strategies-for-building-and-district
Hoppe-J Jul 24, 2024
cf1a1c3
- some renaming
Hoppe-J Jul 24, 2024
46bbb2b
fix code quality
Hoppe-J Jul 24, 2024
83b33bc
- additional outputs for usage in district ems
Hoppe-J Jul 25, 2024
fe855e2
- renaming
Hoppe-J Jul 25, 2024
8210a06
add special case, if there is no electricity demand but more than 1 c…
Hoppe-J Jul 25, 2024
2abff4b
Merge branch 'ems-strategies-for-building-and-district' into compute-…
Hoppe-J Aug 5, 2024
75804cb
- calculate kpis for single houses and districts
Hoppe-J Aug 5, 2024
1c92da3
fixing problem in kpi preparation
Hoppe-J Aug 5, 2024
5820423
change in component name for opex calculation
Hoppe-J Aug 6, 2024
370d739
changes in components for opex calculation
Hoppe-J Aug 6, 2024
35c18bd
changes for compute postprocessing with multiple households in districts
Hoppe-J Aug 6, 2024
d720de6
fix errors in dataframe with str types
Hoppe-J Aug 7, 2024
9576c6e
fix errors in dataframe with str types
Hoppe-J Aug 7, 2024
1545108
fix code quali
Hoppe-J Aug 7, 2024
96fdf7c
first changes in components to make name flexible --> necessary for d…
Hoppe-J Aug 7, 2024
ecf490b
implement additional parameter "building" as string in components -->…
Hoppe-J Aug 8, 2024
b0e0346
fixing codestyle
Hoppe-J Aug 8, 2024
27ed08a
fixing codestyle
Hoppe-J Aug 8, 2024
12362dd
fixing codestyle
Hoppe-J Aug 8, 2024
e1faadc
fix pylint
Hoppe-J Aug 8, 2024
363c51c
fix pylint
Hoppe-J Aug 8, 2024
68c8914
fix tests
Hoppe-J Aug 8, 2024
e16ec03
some renaming
Hoppe-J Aug 8, 2024
3b97522
fix errors
Hoppe-J Aug 8, 2024
73f7baa
renaming and fix errors
Hoppe-J Aug 8, 2024
6b80cd4
fixing tests
Hoppe-J Aug 8, 2024
cec4ff8
fixing pylint error, edit opex function in some components
Hoppe-J Aug 8, 2024
52bb39a
fixing test problems
Hoppe-J Aug 9, 2024
66f8e52
- fixing test problems
Hoppe-J Aug 9, 2024
34f7420
fix pytest
Hoppe-J Aug 9, 2024
202dbc4
fix codequali
Hoppe-J Aug 9, 2024
a2c3b85
fix tests
Hoppe-J Aug 9, 2024
4eac775
change in surplus strategy for districts --> modify set temperatures …
Hoppe-J Aug 9, 2024
0b959ca
improvements in sorted output list --> no duplicates and correct order
Hoppe-J Aug 12, 2024
5c64aad
delete print
Hoppe-J Aug 12, 2024
8b74283
put variable "consumption" for opex in opex function and not in config
Hoppe-J Aug 13, 2024
ab7491f
fix code quali
Hoppe-J Aug 13, 2024
64ce05d
fix code quali
Hoppe-J Aug 13, 2024
86a4be0
prepare heat source for opex/capex --> heat source model could be ear…
Hoppe-J Aug 13, 2024
249f2f2
Merge branch 'main' into compute-kpis-for-buildings-in-district
Hoppe-J Aug 14, 2024
b6a0497
resolve merge conflicts
Hoppe-J Aug 14, 2024
baaf06c
fixing test, shorter name für result json because path is too long
Hoppe-J Aug 14, 2024
7625f94
additional output of dhw inlet temperature
Hoppe-J Aug 15, 2024
04847e4
restructuring
Hoppe-J Aug 15, 2024
0183c00
-new dhw storage due to problems with generic hot water storage modul…
Hoppe-J Aug 15, 2024
f38c80e
fix pylint, make comparision with household 1e and 1b
Hoppe-J Aug 15, 2024
d9552e2
fix pylint
Hoppe-J Aug 15, 2024
2712136
- add Joule to units
Hoppe-J Aug 16, 2024
0f69950
fix mypy
Hoppe-J Aug 16, 2024
2f8dbd7
add default connections
Hoppe-J Aug 16, 2024
051c552
accidentally deleted output filed name --> now back to how it was bef…
Hoppe-J Aug 16, 2024
5e12da8
Merge branch 'compute-kpis-for-buildings-in-district' into dhw-storage
Hoppe-J Aug 16, 2024
6e448be
some additional outputs for kpi calculation in districts
Hoppe-J Aug 19, 2024
bd3d509
- some additional outputs for kpi calculation in districts
Hoppe-J Aug 21, 2024
0f77dea
fix pylint
Hoppe-J Aug 21, 2024
c815804
some renaming
Hoppe-J Aug 21, 2024
3bf4f38
- new compoment: heating meter
Hoppe-J Aug 21, 2024
66f7d06
fix test, pylint
Hoppe-J Aug 21, 2024
90c47ae
fix code quali
Hoppe-J Aug 21, 2024
3e50342
some more kpi and opex/capex for districts
Hoppe-J Aug 22, 2024
5a73fc7
improvements in simple heat source for kpis/opex
Hoppe-J Aug 22, 2024
1fabb7b
print progress in weather data import
Hoppe-J Aug 22, 2024
1472980
add heat source for cost calculation without heatpump
Hoppe-J Aug 22, 2024
57657a5
add heating meter
Hoppe-J Aug 22, 2024
5261be7
some outputs for kpi calculation in districts
Hoppe-J Aug 23, 2024
a0a0ea6
some more kpi for districts
Hoppe-J Aug 23, 2024
03866f5
some more kpi for districts
Hoppe-J Aug 23, 2024
2b1cb7a
some more kpi for districts
Hoppe-J Aug 26, 2024
becec65
some more kpi for districts
Hoppe-J Aug 27, 2024
4eac4cf
some more kpis for contracting in districts
Hoppe-J Aug 27, 2024
cdd8327
some changes in requirements due to errors in tests with newest numpy…
Hoppe-J Aug 28, 2024
347129f
fix mypy error
Hoppe-J Aug 28, 2024
2083f98
make enum in for weather data request and some changes due to new ver…
Hoppe-J Aug 28, 2024
441850c
fix system setup
Hoppe-J Aug 28, 2024
1970d50
new system setup for districts
Hoppe-J Aug 28, 2024
87531e7
fix pylint
Hoppe-J Aug 28, 2024
bd2f39e
fix mypy
Hoppe-J Aug 28, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ notes-rgx=
[REFACTORING]

# Maximum number of nested blocks for function / method body
max-nested-blocks=5
max-nested-blocks=6

# Complete name of functions that never returns. When checking for
# inconsistent-return-statements if a never returning function is called then
Expand Down
4 changes: 3 additions & 1 deletion hisim/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,12 @@ class ConfigBase(JSONWizard):

"""Base class for all configurations."""

building_name: str
name: str

def __init__(self, name: str):
def __init__(self, building_name: str, name: str):
"""Initializes."""
self.building_name = building_name
self.name = name

@classmethod
Expand Down
25 changes: 16 additions & 9 deletions hisim/components/advanced_battery_bslib.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,15 @@
@dataclass_json
@dataclass
class BatteryConfig(ConfigBase):

"""Battery Configuration."""

@classmethod
def get_main_classname(cls):
"""Return the full class name of the base class."""
return Battery.get_full_classname()

#: building_name in which component is
building_name: str
#: name of the device
name: str
#: priority of the device in hierachy: the higher the number the lower the priority
Expand All @@ -70,13 +71,14 @@ def get_main_classname(cls):
maintenance_cost_as_percentage_of_investment: float

@classmethod
def get_default_config(cls) -> "BatteryConfig":
def get_default_config(cls, building_name: str = "BUI1", name: str = "Battery") -> "BatteryConfig":
"""Returns default configuration of battery."""
custom_battery_capacity_generic_in_kilowatt_hour = (
10 # size/capacity of battery should be approx. the same as default pv power
)
config = BatteryConfig(
name="Battery",
building_name=building_name,
name=name,
# https://www.energieinstitut.at/die-richtige-groesse-von-batteriespeichern/
custom_battery_capacity_generic_in_kilowatt_hour=custom_battery_capacity_generic_in_kilowatt_hour,
custom_pv_inverter_power_generic_in_watt=10 * 0.5 * 1e3, # c-rate is 0.5C (0.5/h) here
Expand All @@ -95,14 +97,17 @@ def get_default_config(cls) -> "BatteryConfig":
return config

@classmethod
def get_scaled_battery(cls, total_pv_power_in_watt_peak: float) -> "BatteryConfig":
def get_scaled_battery(
cls, total_pv_power_in_watt_peak: float, building_name: str = "BUI1", name: str = "Battery"
) -> "BatteryConfig":
"""Returns scaled configuration of battery according to pv power."""
custom_battery_capacity_generic_in_kilowatt_hour = (
total_pv_power_in_watt_peak * 1e-3
) # size/capacity of battery should be approx. the same as default pv power
c_rate = 0.5 # 0.5C corresponds to 0.5/h for fully charging or discharging
config = BatteryConfig(
name="Battery",
building_name=building_name,
name=name,
# https://www.energieinstitut.at/die-richtige-groesse-von-batteriespeichern/
custom_battery_capacity_generic_in_kilowatt_hour=custom_battery_capacity_generic_in_kilowatt_hour,
custom_pv_inverter_power_generic_in_watt=custom_battery_capacity_generic_in_kilowatt_hour * c_rate * 1e3,
Expand All @@ -123,7 +128,6 @@ def get_scaled_battery(cls, total_pv_power_in_watt_peak: float) -> "BatteryConfi


class Battery(Component):

"""Battery class.

Simulate state of charge and realized power of a ac coupled battery
Expand Down Expand Up @@ -151,7 +155,11 @@ def __init__(
"""Loads the parameters of the specified battery storage."""
self.battery_config = config
super().__init__(
name=self.battery_config.name + "_w" + str(self.battery_config.source_weight),
name=self.battery_config.building_name
+ "_"
+ self.battery_config.name
+ "_w"
+ str(self.battery_config.source_weight),
my_simulation_parameters=my_simulation_parameters,
my_config=config,
my_display_config=my_display_config,
Expand Down Expand Up @@ -281,7 +289,7 @@ def get_cost_opex(
for index, output in enumerate(all_outputs):
if (
output.postprocessing_flag is not None
and output.component_name == self.battery_config.name + "_w" + str(self.battery_config.source_weight)
and output.component_name == self.component_name
):
if InandOutputType.CHARGE_DISCHARGE in output.postprocessing_flag:
self.battery_config.charge_in_kwh = round(
Expand Down Expand Up @@ -329,7 +337,6 @@ def get_battery_aging_information(

@dataclass
class BatteryState:

"""Battery state class."""

#: state of charge of the battery
Expand Down
14 changes: 7 additions & 7 deletions hisim/components/advanced_ev_battery_bslib.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,10 @@
@dataclass_json
@dataclass
class CarBatteryConfig(ConfigBase):

"""Configuration of a Car Battery."""

#: building_name in which component is
building_name: str
#: name of the device
name: str
#: priority of the device in hierachy: the higher the number the lower the priority
Expand All @@ -62,10 +63,11 @@ def get_main_classname(cls):
return CarBattery.get_full_classname()

@classmethod
def get_default_config(cls) -> "CarBatteryConfig":
def get_default_config(cls, building_name: str = "BUI1", name: str = "CarBattery") -> "CarBatteryConfig":
"""Returns default configuration of a Car Battery."""
config = CarBatteryConfig(
name="CarBattery",
building_name=building_name,
name=name,
system_id="SG1",
p_inv_custom=1e4,
e_bat_custom=30,
Expand All @@ -77,7 +79,6 @@ def get_default_config(cls) -> "CarBatteryConfig":


class CarBattery(Component):

"""Car Battery class.

Simulate state of charge and realized power of a ac coupled battery
Expand Down Expand Up @@ -105,7 +106,7 @@ def __init__(
"""Loads the parameters of the specified battery storage."""
self.battery_config = config
super().__init__(
name=config.name + "_w" + str(config.source_weight),
name=self.battery_config.building_name + "_" + config.name + "_w" + str(config.source_weight),
my_simulation_parameters=my_simulation_parameters,
my_config=config,
my_display_config=my_display_config,
Expand Down Expand Up @@ -259,7 +260,7 @@ def get_cost_opex(
for index, output in enumerate(all_outputs):
if (
output.postprocessing_flag is not None
and output.component_name == self.battery_config.name + "_w" + str(self.battery_config.source_weight)
and output.component_name == self.component_name
):
if InandOutputType.CHARGE_DISCHARGE in output.postprocessing_flag:
self.battery_config.charge = round(
Expand Down Expand Up @@ -290,7 +291,6 @@ def get_cost_opex(

@dataclass
class EVBatteryState:

"""Electric vehicle battery state class."""

# state of charge of the battery
Expand Down
13 changes: 7 additions & 6 deletions hisim/components/advanced_fuel_cell.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@
@dataclass_json
@dataclass
class CHPConfig(ConfigBase):

"""CHP Config class."""

@classmethod
def get_main_classname(cls):
"""Return the full class name of the base class."""
return CHP.get_full_classname()

building_name: str
name: str
min_operation_time: float
min_idle_time: float
Expand All @@ -59,9 +59,13 @@ def get_main_classname(cls):
delta_temperature: float

@classmethod
def get_default_config(cls) -> Any:
def get_default_config(
cls,
building_name: str = "BUI1",
) -> Any:
"""Get default config."""
config = CHPConfig(
building_name=building_name,
name="CHP",
min_operation_time=60,
min_idle_time=15,
Expand All @@ -84,7 +88,6 @@ def get_default_config(cls) -> Any:


class CHPConfigAdvanced:

"""CHP config advanced class."""

def __init__(self) -> None:
Expand Down Expand Up @@ -131,7 +134,6 @@ def __init__(self) -> None:


class CHPState:

"""CHP state class."""

def __init__(self, start_timestep=None, electricity_output=0.0, cycle_number=None):
Expand All @@ -148,7 +150,6 @@ def __init__(self, start_timestep=None, electricity_output=0.0, cycle_number=Non


class CHP(Component):

"""CHP class.

Simulate chp efficiency (cop) as well as electrical (p_el) &
Expand Down Expand Up @@ -180,7 +181,7 @@ def __init__(
"""Initialize the class."""
self.chp_config = config
super().__init__(
name=self.chp_config.name,
name=self.chp_config.building_name + "_" + self.chp_config.name,
my_simulation_parameters=my_simulation_parameters,
my_config=config,
my_display_config=my_display_config,
Expand Down
4 changes: 1 addition & 3 deletions hisim/components/advanced_fuel_cell_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@


class ExtendedControllerSimulation:

"""Extended Controller Simulation."""

def __init__(self, config: ExtendedControllerConfig):
Expand Down Expand Up @@ -259,7 +258,6 @@ def power_distribution_to_electrolyzer(self, power_from_or_to_grid: Any) -> Any:


class ExtendedController(Component):

"""Extended Controller class."""

# inputs
Expand Down Expand Up @@ -292,7 +290,7 @@ def __init__(
) -> None:
"""Initialize the class."""
super().__init__(
name=component_name,
name=config.building_name + "_" + component_name,
my_simulation_parameters=my_simulation_parameters,
my_config=config,
my_display_config=my_display_config,
Expand Down
Loading
Loading