Compare commits
11 Commits
Author | SHA1 | Date | |
---|---|---|---|
1e9ee7b795 | |||
96406c13fc | |||
|
1afdac3146 | ||
e9f135d616 | |||
71f4188957 | |||
b893798184 | |||
42d881dbb4 | |||
d23de74ed3 | |||
c991017504 | |||
64bafb299d | |||
9db261c548 |
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1 +1,3 @@
|
|||
.idea
|
||||
cerc_co2_emission.egg-info
|
||||
dist
|
|
@ -1,9 +0,0 @@
|
|||
Metadata-Version: 2.1
|
||||
Name: cerc-co2-emission
|
||||
Version: 0.1.0.0
|
||||
Summary: CERC co2 emission contains the basic co2 emission calculation per CERC-Hub building
|
||||
Classifier: License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)
|
||||
Classifier: Programming Language :: Python
|
||||
Classifier: Programming Language :: Python :: 3
|
||||
|
||||
CERC co2 emission contains the basic co2 emission calculation per CERC-Hub building
|
|
@ -1,12 +0,0 @@
|
|||
README.md
|
||||
pyproject.toml
|
||||
requirements.txt
|
||||
setup.py
|
||||
cerc_co2_emission.egg-info/PKG-INFO
|
||||
cerc_co2_emission.egg-info/SOURCES.txt
|
||||
cerc_co2_emission.egg-info/dependency_links.txt
|
||||
cerc_co2_emission.egg-info/requires.txt
|
||||
cerc_co2_emission.egg-info/top_level.txt
|
||||
co2_emission/__init__.py
|
||||
co2_emission/co2_emission.py
|
||||
co2_emission/version.py
|
|
@ -1 +0,0 @@
|
|||
|
|
@ -1,2 +0,0 @@
|
|||
cerc_hub
|
||||
setuptools
|
|
@ -1 +0,0 @@
|
|||
co2_emission
|
|
@ -5,4 +5,3 @@ Copyright © 2023 Project Coder Guille Gutierrez guillermo.gutierrezmorote@conco
|
|||
Code contributor Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
|
||||
Code contributor Oriol Gavalda Torrellas oriol.gavalda@concordia.ca
|
||||
"""
|
||||
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -22,6 +22,8 @@ class Co2Emission:
|
|||
cte.RENEWABLE: 0}
|
||||
self._emissions_factor = emissions_factor
|
||||
self._building = building
|
||||
self._year = [0]
|
||||
self._month = [0 for _ in range(12)]
|
||||
|
||||
@property
|
||||
def building(self) -> Building:
|
||||
|
@ -38,45 +40,50 @@ class Co2Emission:
|
|||
"""
|
||||
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:
|
||||
if demand_type == cte.ELECTRICITY:
|
||||
continue
|
||||
results_by_time_period = {}
|
||||
if demand_type == cte.HEATING:
|
||||
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
|
||||
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:
|
||||
values = []
|
||||
for value in self._building.lighting_electrical_demand[time_period]:
|
||||
values.append(value * self._emissions_factor[cte.ELECTRICITY])
|
||||
values = [v * emission_factor for v in self._building.lighting_electrical_demand[time_period]]
|
||||
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])
|
||||
values = [v * emission_factor for v in self._building.appliances_electrical_demand[time_period]]
|
||||
results_by_time_period[time_period] = values
|
||||
results[cte.APPLIANCES] = results_by_time_period
|
||||
|
||||
if cte.HEATING not in results:
|
||||
results[cte.HEATING] = {cte.YEAR: self._year, cte.MONTH: self._month}
|
||||
if cte.COOLING not in results:
|
||||
results[cte.COOLING] = {cte.YEAR: self._year, cte.MONTH: self._month}
|
||||
if cte.ELECTRICITY not in results:
|
||||
results[cte.ELECTRICITY] = {cte.YEAR: self._year, cte.MONTH: self._month}
|
||||
if cte.LIGHTING not in results:
|
||||
results[cte.LIGHTING] = {cte.YEAR: self._year, cte.MONTH: self._month}
|
||||
if cte.APPLIANCES not in results:
|
||||
results[cte.APPLIANCES] = {cte.YEAR: self._year, cte.MONTH: self._month}
|
||||
if cte.DOMESTIC_HOT_WATER not in results:
|
||||
results[cte.DOMESTIC_HOT_WATER] = {cte.YEAR: self._year, cte.MONTH: self._month}
|
||||
|
||||
return results
|
||||
|
|
|
@ -5,4 +5,4 @@ Copyright © 2023 Project Coder Guille Gutierrez guillermo.gutierrezmorote@conco
|
|||
Code contributor Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
|
||||
Code contributor Oriol Gavalda Torrellas oriol.gavalda@concordia.ca
|
||||
"""
|
||||
__version__ = '0.1.0.2'
|
||||
__version__ = '0.1.0.5'
|
||||
|
|
2
dist/.gitignore
vendored
2
dist/.gitignore
vendored
|
@ -1,2 +0,0 @@
|
|||
*
|
||||
!.gitignore
|
Binary file not shown.
|
@ -62,6 +62,7 @@ class UnitTests(unittest.TestCase):
|
|||
for building in self.init.city.buildings:
|
||||
result = Co2Emission(building).operational_co2
|
||||
self.assertIsNotNone(result)
|
||||
print(result)
|
||||
|
||||
def tearDown(self):
|
||||
files = glob.glob('output/[!.]*')
|
||||
|
|
Loading…
Reference in New Issue
Block a user