From 1afdac3146fdce758ce8247aed76592fdc0c6ebb Mon Sep 17 00:00:00 2001 From: Connor Brackley Date: Wed, 6 Nov 2024 15:34:32 -0500 Subject: [PATCH] Remove generic_energy_system methods add loop for generation_systems --- co2_emission/co2_emission.py | 40 +++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/co2_emission/co2_emission.py b/co2_emission/co2_emission.py index afa250d..2064ff6 100644 --- a/co2_emission/co2_emission.py +++ b/co2_emission/co2_emission.py @@ -40,25 +40,27 @@ class Co2Emission: """ results = {} for energy_system in self._building.energy_systems: - fuel_type = energy_system.generation_system.generic_generation_system.fuel_type - emissions_factor = self._emissions_factor[fuel_type] - for demand_type in energy_system.demand_types: - if demand_type == cte.ELECTRICITY: - continue - results_by_time_period = {} - if demand_type == cte.HEATING: - for time_period in self._building.heating_consumption: - values = [v * emissions_factor for v in self._building.heating_consumption[time_period]] - results_by_time_period[time_period] = values - if demand_type == cte.COOLING: - for time_period in self._building.cooling_consumption: - values = [v * emissions_factor for v in self._building.cooling_consumption[time_period]] - 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 = [v * emissions_factor for v in self._building.domestic_hot_water_consumption[time_period]] - results_by_time_period[time_period] = values - results[demand_type] = results_by_time_period + for generation_system in energy_system.generation_systems: + fuel_type = generation_system.fuel_type + emissions_factor = self._emissions_factor[fuel_type] + for demand_type in energy_system.demand_types: + if demand_type == cte.ELECTRICITY: + continue + results_by_time_period = {} + if demand_type == cte.HEATING: + for time_period in self._building.heating_consumption: + values = [v * emissions_factor for v in self._building.heating_consumption[time_period]] + results_by_time_period[time_period] = values + if demand_type == cte.COOLING: + for time_period in self._building.cooling_consumption: + values = [v * emissions_factor for v in self._building.cooling_consumption[time_period]] + 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 = [v * emissions_factor for v in self._building.domestic_hot_water_consumption[time_period]] + results_by_time_period[time_period] = values + results[demand_type] = results_by_time_period + emission_factor = self._emissions_factor[cte.ELECTRICITY] results_by_time_period = {} for time_period in self._building.lighting_electrical_demand: -- 2.39.2