Skip to content

Commit

Permalink
Refs/heads/more prep for building sizer (#366)
Browse files Browse the repository at this point in the history
* split building sizer setups into two setups

* prepare two system setups for building sizer

* more households for building sizer

* fix mypy and pytest

* code qualy

* code qualy

* code qualy+

* black on system setups

* put gas heater controller in gas heater component

* some fixing

* some fixing

* some fixing

* some fixing

* some fixing

* some fixing

* some fixing

* some fixing

* make one default config for water heating for generic heat source

* fixing

* fixing

* fixing

* more changes on generic heat source

* kpis and opex/capex costs in generic_heat_source

* code qualy

* some fixing

* some fixing

* some more fixing
  • Loading branch information
k-rieck authored Oct 24, 2024
1 parent 2eaf9ac commit c976e55
Show file tree
Hide file tree
Showing 53 changed files with 2,921 additions and 1,778 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"energy_system_config_": {
"heating_system": "HeatPump",
"heating_system": "GasHeating",
"share_of_maximum_pv_potential": 1.0
},
"archetype_config_": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,29 @@ class ModularHouseholdConfig(SystemSetupConfigBase):
archetype_config_: Optional[archetype_config.ArcheTypeConfig] = None

@classmethod
def get_default(cls):
def get_default_config_for_household_gas(cls):
"""Get default ModularHouseholdConfig."""
energy_system_config_ = system_config.EnergySystemConfig()
energy_system_config_ = system_config.EnergySystemConfig.get_default_config_for_energy_system_gas()
archetype_config_ = archetype_config.ArcheTypeConfig()
household_config = ModularHouseholdConfig(
energy_system_config_=energy_system_config_, archetype_config_=archetype_config_
)
return household_config

@classmethod
def get_default_config_for_household_heatpump(cls):
"""Get default ModularHouseholdConfig."""
energy_system_config_ = system_config.EnergySystemConfig.get_default_config_for_energy_system_heatpump()
archetype_config_ = archetype_config.ArcheTypeConfig()
household_config = ModularHouseholdConfig(
energy_system_config_=energy_system_config_, archetype_config_=archetype_config_
)
return household_config

@classmethod
def get_default_config_for_household_district_heating(cls):
"""Get default ModularHouseholdConfig."""
energy_system_config_ = system_config.EnergySystemConfig.get_default_config_for_energy_system_district_heating()
archetype_config_ = archetype_config.ArcheTypeConfig()
household_config = ModularHouseholdConfig(
energy_system_config_=energy_system_config_, archetype_config_=archetype_config_
Expand All @@ -56,24 +76,22 @@ def write_config(config: ModularHouseholdConfig) -> None:
file.write(config.to_json()) # type: ignore


def read_in_configs(pathname: str) -> ModularHouseholdConfig:
def read_in_configs(pathname: str) -> Optional[ModularHouseholdConfig]:
"""Reads in ModularHouseholdConfig file and loads default if file cannot be found."""
# try to read modular household config from path
household_config: Optional[ModularHouseholdConfig]
try:
with open(pathname, encoding="utf8") as config_file:
household_config_dict = json.load(config_file) # type: ignore
household_config: ModularHouseholdConfig = ModularHouseholdConfig.from_dict(household_config_dict)
household_config = ModularHouseholdConfig.from_dict(household_config_dict)

log.information(f"Read modular household config from {pathname}")
assert household_config is not None
if (household_config.energy_system_config_ is None) and (household_config.archetype_config_ is None):
raise ValueError()
raise ValueError("Energy system and archetype configs are None.")

# get default modular household config
except Exception:
household_config = ModularHouseholdConfig()
log.warning(f"Could not read the modular household config from '{pathname}'. Using a default config instead.")

# set default configs
if household_config.energy_system_config_ is None:
household_config.energy_system_config_ = system_config.EnergySystemConfig()
if household_config.archetype_config_ is None:
household_config.archetype_config_ = archetype_config.ArcheTypeConfig()
household_config = None

return household_config
20 changes: 19 additions & 1 deletion hisim/building_sizer_utils/interface_configs/system_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,23 @@ class EnergySystemConfig:
# charging_station: JsonReference = field(
# default_factory=lambda: ChargingStationSets.Charging_At_Home_with_03_7_kW # type: ignore
# )
heating_system: HeatingSystems = HeatingSystems.HEAT_PUMP
heating_system: HeatingSystems = HeatingSystems.DISTRICT_HEATING
share_of_maximum_pv_potential: float = 1.0

@classmethod
def get_default_config_for_energy_system_gas(cls):
"""Get default energy system config."""
energy_system_config = EnergySystemConfig(heating_system=HeatingSystems.GAS_HEATING, share_of_maximum_pv_potential=1.0)
return energy_system_config

@classmethod
def get_default_config_for_energy_system_heatpump(cls):
"""Get default energy system config."""
energy_system_config = EnergySystemConfig(heating_system=HeatingSystems.HEAT_PUMP, share_of_maximum_pv_potential=1.0)
return energy_system_config

@classmethod
def get_default_config_for_energy_system_district_heating(cls):
"""Get default energy system config."""
energy_system_config = EnergySystemConfig(heating_system=HeatingSystems.DISTRICT_HEATING, share_of_maximum_pv_potential=1.0)
return energy_system_config
Loading

0 comments on commit c976e55

Please sign in to comment.