Compare commits
13 Commits
Author | SHA1 | Date | |
---|---|---|---|
1e9ee7b795 | |||
96406c13fc | |||
|
1afdac3146 | ||
e9f135d616 | |||
71f4188957 | |||
b893798184 | |||
42d881dbb4 | |||
d23de74ed3 | |||
c991017504 | |||
64bafb299d | |||
9db261c548 | |||
128634fa25 | |||
4d3cdf6d8d |
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1 +1,3 @@
|
||||||
.idea
|
.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 Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
|
||||||
Code contributor Oriol Gavalda Torrellas oriol.gavalda@concordia.ca
|
Code contributor Oriol Gavalda Torrellas oriol.gavalda@concordia.ca
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -15,12 +15,15 @@ class Co2Emission:
|
||||||
|
|
||||||
def __init__(self, building: Building, emissions_factor=None):
|
def __init__(self, building: Building, emissions_factor=None):
|
||||||
if emissions_factor is None:
|
if emissions_factor is None:
|
||||||
emissions_factor = {cte.GAS: 0.2025,
|
# kgCO2 / J
|
||||||
cte.ELECTRICITY: 0.00113,
|
emissions_factor = {cte.GAS: 56.25480769E-9,
|
||||||
cte.DIESEL: 0.2683,
|
cte.ELECTRICITY: 0.313840909E-9,
|
||||||
|
cte.DIESEL: 74.52882883E-9,
|
||||||
cte.RENEWABLE: 0}
|
cte.RENEWABLE: 0}
|
||||||
self._emissions_factor = emissions_factor
|
self._emissions_factor = emissions_factor
|
||||||
self._building = building
|
self._building = building
|
||||||
|
self._year = [0]
|
||||||
|
self._month = [0 for _ in range(12)]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def building(self) -> Building:
|
def building(self) -> Building:
|
||||||
|
@ -37,45 +40,50 @@ class Co2Emission:
|
||||||
"""
|
"""
|
||||||
results = {}
|
results = {}
|
||||||
for energy_system in self._building.energy_systems:
|
for energy_system in self._building.energy_systems:
|
||||||
fuel_type = energy_system.generation_system.generic_generation_system.fuel_type
|
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:
|
for demand_type in energy_system.demand_types:
|
||||||
if demand_type == cte.ELECTRICITY:
|
if demand_type == cte.ELECTRICITY:
|
||||||
continue
|
continue
|
||||||
results_by_time_period = {}
|
results_by_time_period = {}
|
||||||
if demand_type == cte.HEATING:
|
if demand_type == cte.HEATING:
|
||||||
for time_period in self._building.heating_consumption:
|
for time_period in self._building.heating_consumption:
|
||||||
values = []
|
values = [v * emissions_factor for v in self._building.heating_consumption[time_period]]
|
||||||
for value in self._building.heating_consumption[time_period]:
|
|
||||||
values.append(value * self._emissions_factor[fuel_type])
|
|
||||||
results_by_time_period[time_period] = values
|
results_by_time_period[time_period] = values
|
||||||
if demand_type == cte.COOLING:
|
if demand_type == cte.COOLING:
|
||||||
for time_period in self._building.cooling_consumption:
|
for time_period in self._building.cooling_consumption:
|
||||||
values = []
|
values = [v * emissions_factor for v in self._building.cooling_consumption[time_period]]
|
||||||
for value in self._building.cooling_consumption[time_period]:
|
|
||||||
values.append(value * self._emissions_factor[fuel_type])
|
|
||||||
results_by_time_period[time_period] = values
|
results_by_time_period[time_period] = values
|
||||||
if demand_type == cte.DOMESTIC_HOT_WATER:
|
if demand_type == cte.DOMESTIC_HOT_WATER:
|
||||||
for time_period in self._building.domestic_hot_water_consumption:
|
for time_period in self._building.domestic_hot_water_consumption:
|
||||||
values = []
|
values = [v * emissions_factor for v in self._building.domestic_hot_water_consumption[time_period]]
|
||||||
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_by_time_period[time_period] = values
|
||||||
results[demand_type] = results_by_time_period
|
results[demand_type] = results_by_time_period
|
||||||
|
|
||||||
|
emission_factor = self._emissions_factor[cte.ELECTRICITY]
|
||||||
results_by_time_period = {}
|
results_by_time_period = {}
|
||||||
for time_period in self._building.lighting_electrical_demand:
|
for time_period in self._building.lighting_electrical_demand:
|
||||||
values = []
|
values = [v * emission_factor for v in self._building.lighting_electrical_demand[time_period]]
|
||||||
for value in self._building.lighting_electrical_demand[time_period]['insel meb']:
|
|
||||||
values.append(value * self._emissions_factor[cte.ELECTRICITY])
|
|
||||||
results_by_time_period[time_period] = values
|
results_by_time_period[time_period] = values
|
||||||
results[cte.LIGHTING] = results_by_time_period
|
results[cte.LIGHTING] = results_by_time_period
|
||||||
|
|
||||||
results_by_time_period = {}
|
results_by_time_period = {}
|
||||||
for time_period in self._building.appliances_electrical_demand:
|
for time_period in self._building.appliances_electrical_demand:
|
||||||
values = []
|
values = [v * emission_factor for v in self._building.appliances_electrical_demand[time_period]]
|
||||||
for value in self._building.appliances_electrical_demand[time_period]['insel meb']:
|
|
||||||
values.append(value * self._emissions_factor[cte.ELECTRICITY])
|
|
||||||
results_by_time_period[time_period] = values
|
results_by_time_period[time_period] = values
|
||||||
results[cte.APPLIANCES] = results_by_time_period
|
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
|
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 Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
|
||||||
Code contributor Oriol Gavalda Torrellas oriol.gavalda@concordia.ca
|
Code contributor Oriol Gavalda Torrellas oriol.gavalda@concordia.ca
|
||||||
"""
|
"""
|
||||||
__version__ = '0.1.0.1'
|
__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:
|
for building in self.init.city.buildings:
|
||||||
result = Co2Emission(building).operational_co2
|
result = Co2Emission(building).operational_co2
|
||||||
self.assertIsNotNone(result)
|
self.assertIsNotNone(result)
|
||||||
|
print(result)
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
files = glob.glob('output/[!.]*')
|
files = glob.glob('output/[!.]*')
|
||||||
|
|
Loading…
Reference in New Issue
Block a user