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

Refs/heads/more prep for building sizer 3 #368

Merged
merged 53 commits into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
0c31523
Merge branch 'main' of https://github.com/FZJ-IEK3-VSA/HiSim into mor…
k-rieck Oct 2, 2024
433cf94
Merge branch 'main' of https://github.com/FZJ-IEK3-VSA/HiSim into mor…
k-rieck Oct 2, 2024
093e9df
split building sizer setups into two setups
k-rieck Oct 11, 2024
0ff54da
merge main
k-rieck Oct 11, 2024
24e0111
prepare two system setups for building sizer
k-rieck Oct 11, 2024
cab65cf
more households for building sizer
k-rieck Oct 18, 2024
634a49b
fix mypy and pytest
k-rieck Oct 18, 2024
84e731d
code qualy
k-rieck Oct 18, 2024
51206e4
code qualy
k-rieck Oct 18, 2024
06d6e35
code qualy+
k-rieck Oct 18, 2024
2a35ebe
black on system setups
k-rieck Oct 18, 2024
83fec20
put gas heater controller in gas heater component
k-rieck Oct 18, 2024
7306f1d
some fixing
k-rieck Oct 18, 2024
36e9b7d
some fixing
k-rieck Oct 18, 2024
881d784
some fixing
k-rieck Oct 18, 2024
aa75a4f
some fixing
k-rieck Oct 18, 2024
08fc142
some fixing
k-rieck Oct 18, 2024
ffb3c70
some fixing
k-rieck Oct 18, 2024
692c96c
some fixing
k-rieck Oct 18, 2024
5017686
some fixing
k-rieck Oct 18, 2024
418a7fe
make one default config for water heating for generic heat source
k-rieck Oct 18, 2024
e2122c3
fixing
k-rieck Oct 18, 2024
dbda290
fixing
k-rieck Oct 18, 2024
940fd04
fixing
k-rieck Oct 18, 2024
95007a7
more changes on generic heat source
k-rieck Oct 18, 2024
0e37fc1
kpis and opex/capex costs in generic_heat_source
k-rieck Oct 21, 2024
3ccf92c
code qualy
k-rieck Oct 21, 2024
776b887
some fixing
k-rieck Oct 21, 2024
c43829c
some fixing
k-rieck Oct 21, 2024
ce26b49
Merge branch 'main' of https://github.com/FZJ-IEK3-VSA/HiSim into mor…
k-rieck Oct 21, 2024
2a820e0
make generic oil heater
k-rieck Oct 21, 2024
072d60c
some more fixing
k-rieck Oct 21, 2024
7af83a3
Merge branch 'more_prep_for_building_sizer' of https://github.com/FZJ…
k-rieck Oct 21, 2024
ab670a7
add generic oil heater
k-rieck Oct 21, 2024
9bc0c98
add building sizer system setup oil
k-rieck Oct 21, 2024
704b5b1
add building sizer system setup oil
k-rieck Oct 21, 2024
787c9dd
fix oil demand kpis
k-rieck Oct 22, 2024
798801b
update physicsconfig with other energy carrier values for condensing …
k-rieck Oct 23, 2024
8c1a19a
some fixes
k-rieck Oct 23, 2024
f5ad59d
some fixes
k-rieck Oct 23, 2024
51691a6
generic_boier
k-rieck Oct 24, 2024
1beca7a
generic_boier
k-rieck Oct 24, 2024
8347426
Merge branch 'main' of https://github.com/FZJ-IEK3-VSA/HiSim into mor…
k-rieck Oct 24, 2024
1283b52
some fixing
k-rieck Oct 24, 2024
12565d7
some fixing
k-rieck Oct 24, 2024
bda9839
Merge branch 'more_prep_for_building_sizer_3' of https://github.com/F…
k-rieck Oct 24, 2024
e5c8eb0
more dev on boiler
k-rieck Oct 24, 2024
6476a7a
replace gas heater and oil heater by generic boiler
k-rieck Oct 24, 2024
fa55d9e
replacing generic gas heater step by setp by boiler
k-rieck Oct 24, 2024
8c5480e
replace gas heater and oil heater by generic boiler
k-rieck Oct 24, 2024
3158934
replace gas heater and oil heater by generic boiler
k-rieck Oct 24, 2024
b88c311
some fixing
k-rieck Oct 24, 2024
cfe8200
resolve merge conflicts
k-rieck Nov 6, 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
4 changes: 2 additions & 2 deletions hisim/components/advanced_fuel_cell.py
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,7 @@ def i_simulate(self, timestep: int, stsv: SingleTimeStepValues, force_convergenc
else:
if self.gas_type == "Hydrogen":
gas_demand_target = ((el_power / eff_el_real) + (th_power / eff_th_real)) / (
PhysicsConfig.hydrogen_specific_fuel_value_per_kg
PhysicsConfig.get_properties_for_energy_carrier(energy_carrier=lt.LoadTypes.HYDROGEN).lower_heating_value_in_joule_per_kg
)
if stsv.get_input_value(self.hydrogen_not_released_channel) == 0:
# Gas Demand can completly be charged from storage
Expand Down Expand Up @@ -598,7 +598,7 @@ def i_simulate(self, timestep: int, stsv: SingleTimeStepValues, force_convergenc
elif self.gas_type == "Methan":
gas_demand_target = (
(el_power / eff_el_real) + (th_power / eff_th_real)
) / PhysicsConfig.natural_gas_specific_fuel_value_per_kg
) / PhysicsConfig.get_properties_for_energy_carrier(energy_carrier=lt.LoadTypes.GAS).lower_heating_value_in_joule_per_kg
gas_demand_real_used = gas_demand_target
else:
raise Exception("No Gas chosen which is integrated in System")
Expand Down
120 changes: 99 additions & 21 deletions hisim/components/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
# clean

from typing import Any
from dataclasses import dataclass
from dataclasses import dataclass, field
from dataclasses_json import dataclass_json
from hisim.loadtypes import LoadTypes
from hisim.component import ConfigBase


Expand All @@ -23,10 +24,7 @@ class WarmWaterStorageConfig(ConfigBase):
slice_height_minimum: float # [m]

@classmethod
def get_default_config(
cls,
building_name: str = "BUI1",
) -> Any:
def get_default_config(cls, building_name: str = "BUI1",) -> Any:
"""Gets a default config."""
return WarmWaterStorageConfig(
building_name=building_name,
Expand Down Expand Up @@ -212,10 +210,7 @@ class ExtendedControllerConfig(ConfigBase):
maximum_autarky: bool

@classmethod
def get_default_config(
cls,
building_name: str = "BUI1",
) -> Any:
def get_default_config(cls, building_name: str = "BUI1",) -> Any:
"""Gets a default ExtendedControllerConfig."""
return ExtendedControllerConfig(
building_name=building_name,
Expand All @@ -232,28 +227,111 @@ def get_default_config(
)


@dataclass_json
@dataclass
class PhysicsConfig:
"""Physics config class."""
"""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.
"""

# Init
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

# Post-Init
specific_volume_in_m3_per_kg: float = field(init=False)
lower_heating_value_in_joule_per_kg: float = field(init=False)
higher_heating_value_in_joule_per_kg: float = field(init=False)
specific_heat_capacity_in_watthour_per_kg_per_kelvin: float = field(init=False)

def __post_init__(self):
"""Post init function.

These variables are calculated automatically based on init values.
"""

self.specific_volume_in_m3_per_kg = 1 / self.density_in_kg_per_m3
self.lower_heating_value_in_joule_per_kg = (
self.lower_heating_value_in_joule_per_m3 / self.density_in_kg_per_m3
)
self.higher_heating_value_in_joule_per_kg = (
self.higher_heating_value_in_joule_per_m3 / self.density_in_kg_per_m3
)
self.specific_heat_capacity_in_watthour_per_kg_per_kelvin = (
self.specific_heat_capacity_in_joule_per_kg_per_kelvin / 3600
)

@classmethod
def get_properties_for_energy_carrier(cls, energy_carrier: LoadTypes) -> "PhysicsConfig":
"""Get physical and chemical properties from specific energy carrier."""
if energy_carrier == LoadTypes.GAS:
# natural gas (here we use the values of methane because this is what natural gas for residential heating mostly consists of)
return PhysicsConfig(
density_in_kg_per_m3=0.71750,
lower_heating_value_in_joule_per_m3=35.895 * 1e6,
higher_heating_value_in_joule_per_m3=39.819 * 1e6,
specific_heat_capacity_in_joule_per_kg_per_kelvin=2190,
)
if energy_carrier == LoadTypes.HYDROGEN:
return PhysicsConfig(
density_in_kg_per_m3=0.08989,
lower_heating_value_in_joule_per_m3=10.783 * 1e6,
higher_heating_value_in_joule_per_m3=12.745 * 1e6,
specific_heat_capacity_in_joule_per_kg_per_kelvin=14200,
)
if energy_carrier == LoadTypes.OIL:
return PhysicsConfig(
density_in_kg_per_m3=0.83 * 1e3,
lower_heating_value_in_joule_per_m3=35.358 * 1e9,
higher_heating_value_in_joule_per_m3=37.682 * 1e9,
specific_heat_capacity_in_joule_per_kg_per_kelvin=1970,
)
if energy_carrier == LoadTypes.PELLETS:
# density here = bulk density (Schüttdichte)
# source: https://www.chemie.de/lexikon/Holzpellet.html
# higher heating value of pellets unknown -> set to lower heating value
return PhysicsConfig(
density_in_kg_per_m3=650,
lower_heating_value_in_joule_per_m3=11.7 * 1e3,
higher_heating_value_in_joule_per_m3=11.7 * 1e3,
specific_heat_capacity_in_joule_per_kg_per_kelvin=2500,
)
if energy_carrier == LoadTypes.WATER:
return PhysicsConfig(
density_in_kg_per_m3=1000,
lower_heating_value_in_joule_per_m3=0,
higher_heating_value_in_joule_per_m3=0,
specific_heat_capacity_in_joule_per_kg_per_kelvin=4180,
)

water_density = 1000 # [kg/m^3]
water_specific_heat_capacity_in_joule_per_kilogram_per_kelvin = 4180 # J/kgK
water_specific_heat_capacity_in_watthour_per_kilogramm_per_kelvin = 1.163 # Wh/kgK
raise ValueError(f"Energy carrier {energy_carrier} not implemented in PhysicsConfig yet.")

# Schmidt 2020: Wasserstofftechnik S.170ff
# fuel value H2: 10.782 MJ/m³ (S.172)
# density H2: 0.08989 kg/m³ (S. 23) -> standard conditions
hydrogen_density = 0.08989 # [kg/m³]
hydrogen_specific_volume = 1 / hydrogen_density # [m^3/kg]
hydrogen_specific_fuel_value_per_m_3 = 10.782 * 10**6 # [J/m³]
hydrogen_specific_fuel_value_per_kg = hydrogen_specific_fuel_value_per_m_3 / hydrogen_density # [J/kg]
# hydrogen_density_in_kg_per_m3 = 0.08989 # [kg/m³]
# hydrogen_specific_volume_in_m3_per_kg = 1 / hydrogen_density_in_kg_per_m3 # [m^3/kg]
# hydrogen_specific_fuel_value_in_joule_per_m3 = 10.782 * 10**6 # [J/m³]
# hydrogen_specific_fuel_value_in_joule_per_kg = hydrogen_specific_fuel_value_in_joule_per_m3 / hydrogen_density_in_kg_per_m3 # [J/kg]

# Schmidt 2020: Wasserstofftechnik S.170ff
# fuel value Methan: 35.894 MJ/m³ (S.172)
# density Methan: 0.71750 kg/m³ (S. 23) -> standard conditions
natural_gas_density = 0.71750 # [kg/m³]
natural_gas_specific_volume = 1 / hydrogen_density # [m^3/kg]
natural_gas_specific_fuel_value_per_m_3 = 35.894 * 10**6 # [J/m³]
natural_gas_specific_fuel_value_per_kg = natural_gas_specific_fuel_value_per_m_3 / natural_gas_density # [J/kg]
# natural_gas_density = 0.71750 # [kg/m³]
# natural_gas_specific_volume = 1 / hydrogen_density_in_kg_per_m3 # [m^3/kg]
# natural_gas_specific_fuel_value_per_m_3 = 35.894 * 10**6 # [J/m³]
# natural_gas_specific_fuel_value_per_kg = natural_gas_specific_fuel_value_per_m_3 / natural_gas_density # [J/kg]


@dataclass_json
Expand Down
10 changes: 5 additions & 5 deletions hisim/components/gas_meter.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,17 +159,17 @@ def get_default_connections_from_generic_gas_heater(
):
"""Get gas heater default connections."""

from hisim.components.generic_gas_heater import ( # pylint: disable=import-outside-toplevel
GasHeater,
from hisim.components.generic_boiler import ( # pylint: disable=import-outside-toplevel
GenericBoiler,
)

dynamic_connections = []
gas_heater_class_name = GasHeater.get_classname()
gas_heater_class_name = GenericBoiler.get_classname()
dynamic_connections.append(
dynamic_component.DynamicComponentConnection(
source_component_class=GasHeater,
source_component_class=GenericBoiler,
source_class_name=gas_heater_class_name,
source_component_field_name=GasHeater.GasDemand,
source_component_field_name=GenericBoiler.EnergyDemand,
source_load_type=lt.LoadTypes.GAS,
source_unit=lt.Units.WATT_HOUR,
source_tags=[lt.InandOutputType.GAS_CONSUMPTION_UNCONTROLLED],
Expand Down
Loading
Loading