From b914c9e7bf84d71bdc6602a4662c06b07d44d8ac Mon Sep 17 00:00:00 2001 From: Saeed Ranjbar Date: Mon, 2 Oct 2023 12:39:30 -0400 Subject: [PATCH] made final changes to north_america_custom_energy_system_parameters.py --- ...america_custom_energy_system_parameters.py | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/hub/imports/energy_systems/north_america_custom_energy_system_parameters.py b/hub/imports/energy_systems/north_america_custom_energy_system_parameters.py index 13a70928..43d339a9 100644 --- a/hub/imports/energy_systems/north_america_custom_energy_system_parameters.py +++ b/hub/imports/energy_systems/north_america_custom_energy_system_parameters.py @@ -63,6 +63,8 @@ class NorthAmericaCustomEnergySystemParameters: city.energy_systems_connection_table = _energy_systems_connection_table city.generic_energy_systems = _generic_energy_systems + self._associate_energy_systems(city) + @staticmethod def _search_archetypes(catalog, name): archetypes = catalog.entries('archetypes') @@ -125,3 +127,40 @@ class NorthAmericaCustomEnergySystemParameters: _generic_energy_systems[archetype.name] = building_systems return _energy_systems_connection_table, _generic_energy_systems + + @staticmethod + def _associate_energy_systems(city): + energy_systems_connection = city.energy_systems_connection_table + for building in city.buildings: + _building_energy_systems = [] + energy_systems = energy_systems_connection['Energy System Type'][ + energy_systems_connection['Building'] == building.name] + for energy_system in energy_systems: + if str(energy_system) == 'nan': + break + _generic_building_energy_systems = city.generic_energy_systems[energy_system] + for _generic_building_energy_system in _generic_building_energy_systems: + _building_energy_equipment = EnergySystem() + _building_energy_equipment.name = _generic_building_energy_system.name + _building_energy_equipment.demand_types = _generic_building_energy_system.demand_types + + _building_distribution_system = DistributionSystem() + _building_distribution_system.generic_distribution_system = \ + copy.deepcopy(_generic_building_energy_system.distribution_systems) + _building_emission_system = EmissionSystem() + _building_emission_system.generic_emission_system = \ + copy.deepcopy(_generic_building_energy_system.emission_systems) + _building_generation_system = GenerationSystem() + _building_generation_system.generic_generation_system = \ + copy.deepcopy(_generic_building_energy_system.generation_system) + _building_storage_system = ThermalStorageSystem() + _building_storage_system.generic_storage_system = \ + copy.deepcopy(_generic_building_energy_system.storage_system) + + _building_energy_equipment.generation_system = _building_generation_system + _building_energy_equipment.distribution_system = _building_distribution_system + _building_energy_equipment.emission_system = _building_emission_system + _building_energy_equipment.energy_storage_system = _building_storage_system + + _building_energy_systems.append(_building_energy_equipment) + building.energy_systems = _building_energy_systems