diff --git a/costs/co2_emission.py b/costs/co2_emission.py deleted file mode 100644 index 12e04f8..0000000 --- a/costs/co2_emission.py +++ /dev/null @@ -1,80 +0,0 @@ -""" -CO2 emission module -SPDX - License - Identifier: LGPL - 3.0 - or -later -Copyright © 2023 Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca -""" - -from hub.city_model_structure.building import Building -import hub.helpers.constants as cte - - -class Co2Emission: - """ - Cost class - """ - - def __init__(self, building: Building, emissions_factor=None): - if emissions_factor is None: - emissions_factor = {cte.GAS: 1, - cte.ELECTRICITY: 1, - cte.WOOD: 1, - cte.DIESEL: 1, - cte.RENEWABLE: 0} - self._emissions_factor = emissions_factor - self._building = building - - @property - def building(self) -> Building: - """ - Get current building. - """ - return self._building - - @property - def operational_co2(self) -> dict: - """ - Get operational_co2 - :return: dict - """ - results = {} - for energy_system in self._building.energy_systems: - fuel_type = energy_system.generation_system.generic_generation_system.fuel_type - for demand_type in energy_system.demand_types: - results_by_time_period = {} - if str(demand_type).lower() == str(cte.HEATING).lower(): - for time_period in self._building.heating_consumption: - values = [] - for value in self._building.heating_consumption[time_period]: - values.append(value * self._emissions_factor[fuel_type]) - results_by_time_period[time_period] = values - if demand_type == cte.COOLING: - for time_period in self._building.cooling_consumption: - values = [] - for value in self._building.cooling_consumption[time_period]: - values.append(value * self._emissions_factor[fuel_type]) - results_by_time_period[time_period] = values - if demand_type == cte.DOMESTIC_HOT_WATER: - for time_period in self._building.domestic_hot_water_consumption: - values = [] - for value in self._building.domestic_hot_water_consumption[time_period]: - values.append(value * self._emissions_factor[fuel_type]) - results_by_time_period[time_period] = values - results[demand_type] = results_by_time_period - - results_by_time_period = {} - for time_period in self._building.lighting_electrical_demand: - values = [] - for value in self._building.lighting_electrical_demand[time_period]: - values.append(value * self._emissions_factor[cte.ELECTRICITY]) - results_by_time_period[time_period] = values - results[cte.LIGHTING] = results_by_time_period - - results_by_time_period = {} - for time_period in self._building.appliances_electrical_demand: - values = [] - for value in self._building.appliances_electrical_demand[time_period]: - values.append(value * self._emissions_factor[cte.ELECTRICITY]) - results_by_time_period[time_period] = values - results[cte.APPLIANCES] = results_by_time_period - - return results diff --git a/tests/unit_tests.py b/tests/unit_tests.py index 2ee80a5..259b426 100644 --- a/tests/unit_tests.py +++ b/tests/unit_tests.py @@ -17,7 +17,7 @@ from hub.helpers.dictionaries import Dictionaries from costs.cost import Cost from costs.constants import SKIN_RETROFIT, SKIN_RETROFIT_AND_SYSTEM_RETROFIT_AND_PV, SYSTEM_RETROFIT_AND_PV -from costs.co2_emission import Co2Emission + class Initialize: @@ -82,10 +82,6 @@ class UnitTests(unittest.TestCase): result = Cost(building, retrofit_scenario=SKIN_RETROFIT_AND_SYSTEM_RETROFIT_AND_PV).life_cycle self.assertIsNotNone(result) - def test_co2_emission(self): - for building in self.init.city.buildings: - result = Co2Emission(building).operational_co2 - self.assertIsNotNone(result) def tearDown(self): files = glob.glob('output/[!.]*')