diff --git a/hub/city_model_structure/building.py b/hub/city_model_structure/building.py index 8d8b5ea3..2ef73469 100644 --- a/hub/city_model_structure/building.py +++ b/hub/city_model_structure/building.py @@ -744,15 +744,18 @@ class Building(CityObject): if self.energy_systems is None: return None for energy_system in self.energy_systems: + generation_systems = energy_system.generation_system for demand_type in energy_system.demand_types: if demand_type.lower() == consumption_type.lower(): if consumption_type in (cte.HEATING, cte.DOMESTIC_HOT_WATER): - coefficient_of_performance = energy_system.generation_system.generic_generation_system.heat_efficiency + for generation_system in generation_systems: + coefficient_of_performance = generation_system.generic_generation_system.heat_efficiency elif consumption_type == cte.COOLING: - coefficient_of_performance = energy_system.generation_system.generic_generation_system.cooling_efficiency + for generation_system in generation_systems: + coefficient_of_performance = generation_system.generic_generation_system.cooling_efficiency elif consumption_type == cte.ELECTRICITY: - coefficient_of_performance = \ - energy_system.generation_system.generic_generation_system.electricity_efficiency + for generation_system in generation_systems: + coefficient_of_performance = generation_system.generic_generation_system.electricity_efficiency if coefficient_of_performance == 0: values = [0]*len(demand) final_energy_consumed = values diff --git a/tests/test_systems_factory.py b/tests/test_systems_factory.py index 92625adf..4dd70998 100644 --- a/tests/test_systems_factory.py +++ b/tests/test_systems_factory.py @@ -161,16 +161,20 @@ class TestSystemsFactory(TestCase): _building_distribution_system = DistributionSystem() _building_distribution_system.generic_distribution_system = ( - copy.deepcopy(_generic_building_energy_system.distribution_systems) + copy.deepcopy(_generic_building_energy_system.distribution_system) ) _building_emission_system = EmissionSystem() _building_emission_system.generic_emission_system = ( - copy.deepcopy(_generic_building_energy_system.emission_systems) + copy.deepcopy(_generic_building_energy_system.emission_system) ) _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.energy_storage_system) + if cte.HEATING in _building_energy_equipment.demand_types: _building_generation_system.heat_power = building.heating_peak_load[cte.YEAR][0] if cte.COOLING in _building_energy_equipment.demand_types: