Convert instances of cost to co2 emission

This commit is contained in:
Koa Wells 2023-07-28 13:16:45 -04:00
parent 6410a9d2e5
commit 18d829b38a
17 changed files with 53 additions and 66 deletions

View File

@ -0,0 +1,19 @@
# Cerc co2 emission
Uses the cerc-hub as a base for co2_emission calculation, it's intended to be used after executing the complete monthly energy
balance workflow called building by building
This module processes the object-oriented generalization to be used the co2 emission workflow
# installation
> $ pip install cerc-co2_emission
# usage
> from costs.co2_emission import Co2Emission
>
> Co2Emission(building, emissions_factor).co2_emission
>
The available scenarios are defined in the constant class as an enum

View File

@ -1,9 +1,9 @@
Metadata-Version: 2.1
Name: cerc-costs
Name: cerc-co2-emission
Version: 0.1.0.0
Summary: CERC costs contains the basic cost calculation per CERC-Hub building
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 costs contains the basic cost calculation per CERC-Hub building
CERC co2 emission contains the basic co2 emission calculation per CERC-Hub building

View File

@ -1,20 +1,12 @@
README.md
pyproject.toml
requirements.txt
setup.py
cerc_costs.egg-info/PKG-INFO
cerc_costs.egg-info/SOURCES.txt
cerc_costs.egg-info/dependency_links.txt
cerc_costs.egg-info/requires.txt
cerc_costs.egg-info/top_level.txt
costs/__init__.py
costs/__main__.py
costs/capital_costs.py
costs/configuration.py
costs/constants.py
costs/cost.py
costs/cost_base.py
costs/end_of_life_costs.py
costs/total_maintenance_costs.py
costs/total_operational_costs.py
costs/total_operational_incomes.py
costs/version.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

View File

@ -1,4 +1,2 @@
numpy_financial
cerc_hub
pandas
setuptools

View File

@ -1 +1 @@
costs
co2_emission

View File

@ -1,12 +1,8 @@
"""
Cost workflow initialization
Co2 emission workflow initialization
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2023 Project Coder Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
Code contributor Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
Code contributor Oriol Gavalda Torrellas oriol.gavalda@concordia.ca
"""
from .capital_costs import CapitalCosts
from .end_of_life_costs import EndOfLifeCosts
from .total_maintenance_costs import TotalMaintenanceCosts
from .total_operational_costs import TotalOperationalCosts
from .total_operational_incomes import TotalOperationalIncomes

Binary file not shown.

Binary file not shown.

View File

@ -1,5 +1,5 @@
"""
CO2 emission module
Co2 emission module
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2023 Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
"""
@ -10,7 +10,7 @@ import hub.helpers.constants as cte
class Co2Emission:
"""
Cost class
Co2Emission class
"""
def __init__(self, building: Building, emissions_factor=None):

8
co2_emission/version.py Normal file
View File

@ -0,0 +1,8 @@
"""
Co2 emission version number
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2023 Project Coder Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
Code contributor Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
Code contributor Oriol Gavalda Torrellas oriol.gavalda@concordia.ca
"""
__version__ = '0.1.0.0'

BIN
dist/cerc-co2-emission-0.1.0.0.tar.gz vendored Normal file

Binary file not shown.

Binary file not shown.

View File

@ -5,4 +5,4 @@ requires = ["setuptools>=61.0.0", "wheel"]
build-backend = "setuptools.build_meta"
[options.packages.find_namespace]
where = "costs"
where = "co2_emission"

View File

@ -1,3 +1 @@
numpy_financial
cerc_hub
pandas
cerc_hub

View File

@ -12,25 +12,25 @@ with pathlib.Path('requirements.txt').open() as r:
install_requires.append('setuptools')
main_ns = {}
version = convert_path('costs/version.py')
version = convert_path('co2_emission/version.py')
with open(version) as f:
exec(f.read(), main_ns)
setup(
name='cerc-costs',
name='cerc-co2-emission',
version=main_ns['__version__'],
description="CERC costs contains the basic cost calculation per CERC-Hub building",
long_description="CERC costs contains the basic cost calculation per CERC-Hub building",
description="CERC co2 emission contains the basic co2 emission calculation per CERC-Hub building",
long_description="CERC co2 emission contains the basic co2 emission calculation per CERC-Hub building",
classifiers=[
"License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
],
include_package_data=True,
packages=['costs'],
packages=['co2_emission'],
setup_requires=install_requires,
install_requires=install_requires,
data_files=[
('costs', glob.glob('requirements.txt'))
('co2_emission', glob.glob('requirements.txt'))
]
)

Binary file not shown.

View File

@ -15,9 +15,7 @@ from hub.imports.results_factory import ResultFactory
from hub.imports.usage_factory import UsageFactory
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
from co2_emission.co2_emission import Co2Emission
class Initialize:
@ -60,28 +58,6 @@ class Initialize:
class UnitTests(unittest.TestCase):
init = Initialize()
def test_current_status(self):
for building in self.init.city.buildings:
result = Cost(building).life_cycle
self.assertIsNotNone(result)
self.assertEqual(0, result.values[0])
def test_scenario_1(self):
for building in self.init.city.buildings:
result = Cost(building, retrofit_scenario=SKIN_RETROFIT).life_cycle
self.assertIsNotNone(result)
def test_scenario_2(self):
for building in self.init.city.buildings:
result = Cost(building, retrofit_scenario=SYSTEM_RETROFIT_AND_PV).life_cycle
self.assertIsNotNone(result)
self.assertEqual(0, result.values[0])
def test_scenario_3(self):
for building in self.init.city.buildings:
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