diff --git a/hub/city_model_structure/building.py b/hub/city_model_structure/building.py index 67f2add3..d8fb88b7 100644 --- a/hub/city_model_structure/building.py +++ b/hub/city_model_structure/building.py @@ -388,6 +388,42 @@ class Building(CityObject): """ self._domestic_hot_water_heat_demand = value + @property + def lighting_peak_load(self) -> Union[None, dict]: + """ + Get lighting peak load in W + :return: dict{[float]} + """ + results = {} + peak_lighting = 0 + for thermal_zone in self.thermal_zones: + lighting = thermal_zone.lighting + for schedule in lighting.schedules: + peak = max(schedule.values) * lighting.density * thermal_zone.total_floor_area + if peak > peak_lighting: + peak_lighting = peak + results[cte.MONTH] = [peak for _ in range(0, 12)] + results[cte.YEAR] = [peak] + return results + + @property + def appliances_peak_load(self) -> Union[None, dict]: + """ + Get appliances peak load in W + :return: dict{[float]} + """ + results = {} + peak_appliances = 0 + for thermal_zone in self.thermal_zones: + appliances = thermal_zone.appliances + for schedule in appliances.schedules: + peak = max(schedule.values) * appliances.density * thermal_zone.total_floor_area + if peak > peak_appliances: + peak_appliances = peak + results[cte.MONTH] = [peak for _ in range(0, 12)] + results[cte.YEAR] = [peak] + return results + @property def heating_peak_load(self) -> Union[None, dict]: """ diff --git a/tests/test_db_factory.py b/tests/test_db_factory.py index 1b85a5ff..bf1dcab6 100644 --- a/tests/test_db_factory.py +++ b/tests/test_db_factory.py @@ -221,6 +221,10 @@ TestDBFactory yearly_cooling_peak_load = building.cooling_peak_load[cte.YEAR] monthly_heating_peak_load = building.heating_peak_load[cte.MONTH] yearly_heating_peak_load = building.heating_peak_load[cte.YEAR] + monthly_lighting_peak_load = building.lighting_peak_load[cte.MONTH] + yearly_lighting_peak_load = building.lighting_peak_load[cte.YEAR] + monthly_appliances_peak_load = building.appliances_peak_load[cte.MONTH] + yearly_appliances_peak_load = building.appliances_peak_load[cte.YEAR] monthly_cooling_demand = building.cooling_demand[cte.MONTH][cte.INSEL_MEB] yearly_cooling_demand = building.cooling_demand[cte.YEAR][cte.INSEL_MEB] monthly_heating_demand = building.heating_demand[cte.MONTH][cte.INSEL_MEB] @@ -248,6 +252,10 @@ TestDBFactory {'yearly_cooling_peak_load': yearly_cooling_peak_load}, {'monthly_heating_peak_load': monthly_heating_peak_load}, {'yearly_heating_peak_load': yearly_heating_peak_load}, + {'monthly_lighting_peak_load': monthly_lighting_peak_load}, + {'yearly_lighting_peak_load': yearly_lighting_peak_load}, + {'monthly_appliances_peak_load': monthly_appliances_peak_load}, + {'yearly_appliances_peak_load': yearly_appliances_peak_load}, {'monthly_cooling_demand': monthly_cooling_demand.tolist()}, {'yearly_cooling_demand': yearly_cooling_demand.tolist()}, {'monthly_heating_demand': monthly_heating_demand.tolist()}, diff --git a/tests/test_results_import.py b/tests/test_results_import.py index a9e0959c..090eb2f1 100644 --- a/tests/test_results_import.py +++ b/tests/test_results_import.py @@ -69,6 +69,10 @@ class TestResultsImport(TestCase): self.assertIsNotNone(building.cooling_demand[cte.MONTH][cte.INSEL_MEB]) self.assertIsNotNone(building.heating_demand[cte.YEAR][cte.INSEL_MEB]) self.assertIsNotNone(building.cooling_demand[cte.YEAR][cte.INSEL_MEB]) + self.assertIsNotNone(building.lighting_peak_load[cte.MONTH]) + self.assertIsNotNone(building.lighting_peak_load[cte.YEAR]) + self.assertIsNotNone(building.appliances_peak_load[cte.MONTH]) + self.assertIsNotNone(building.appliances_peak_load[cte.YEAR]) def test_peak_loads(self): # todo: this is not technically a import diff --git a/tests/tests_data/pickle_path.bz2 b/tests/tests_data/pickle_path.bz2 index 76ab2ba6..4c23c0f7 100644 Binary files a/tests/tests_data/pickle_path.bz2 and b/tests/tests_data/pickle_path.bz2 differ