2021-11-12 04:41:17 -05:00
|
|
|
"""
|
|
|
|
ConstructionFactory (before PhysicsFactory) retrieve the specific construction module for the given region
|
|
|
|
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
2022-04-08 09:35:33 -04:00
|
|
|
Copyright © 2022 Concordia CERC group
|
|
|
|
Project Coder Atiya atiya.atiya@mail.concordia.ca
|
2021-11-12 04:41:17 -05:00
|
|
|
"""
|
|
|
|
|
|
|
|
from pathlib import Path
|
2021-11-13 00:55:04 -05:00
|
|
|
from imports.life_cycle_assessment.lca_fuel import LcaFuel
|
|
|
|
from imports.life_cycle_assessment.lca_vehicle import LcaVehicle
|
|
|
|
from imports.life_cycle_assessment.lca_machine import LcaMachine
|
2021-11-15 08:24:03 -05:00
|
|
|
from imports.life_cycle_assessment.lca_material import LcaMaterial
|
2021-11-12 04:41:17 -05:00
|
|
|
|
|
|
|
|
2021-11-13 00:55:04 -05:00
|
|
|
class LifeCycleAssessment:
|
2021-11-12 04:41:17 -05:00
|
|
|
"""
|
|
|
|
Life cicle analize factory class
|
|
|
|
"""
|
|
|
|
def __init__(self, handler, city, base_path=None):
|
|
|
|
if base_path is None:
|
2021-11-13 00:55:04 -05:00
|
|
|
base_path = Path(Path(__file__).parent.parent / 'data/life_cycle_assessment')
|
2021-11-12 04:41:17 -05:00
|
|
|
self._handler = '_' + handler.lower().replace(' ', '_')
|
|
|
|
self._city = city
|
|
|
|
self._base_path = base_path
|
|
|
|
|
|
|
|
def _fuel(self):
|
|
|
|
"""
|
|
|
|
Enrich the city by adding the fuel carbon information
|
|
|
|
"""
|
|
|
|
LcaFuel(self._city, self._base_path).enrich()
|
|
|
|
|
2021-11-13 00:55:04 -05:00
|
|
|
def _vehicle(self):
|
|
|
|
"""
|
|
|
|
Enrich the city by adding the vehicle carbon information
|
|
|
|
"""
|
|
|
|
LcaVehicle(self._city, self._base_path).enrich()
|
|
|
|
|
|
|
|
def _machine(self):
|
|
|
|
"""
|
|
|
|
Enrich the city by adding the machine carbon information
|
|
|
|
"""
|
|
|
|
LcaMachine(self._city, self._base_path).enrich()
|
|
|
|
|
2021-11-15 08:24:03 -05:00
|
|
|
def _material(self):
|
|
|
|
"""
|
|
|
|
Enrich the city by adding the material carbon information
|
|
|
|
"""
|
|
|
|
LcaMaterial(self._city, self._base_path).enrich()
|
|
|
|
|
2021-11-12 04:41:17 -05:00
|
|
|
def enrich(self):
|
|
|
|
"""
|
|
|
|
Enrich the city given to the class using the class given handler
|
|
|
|
:return: None
|
|
|
|
"""
|
|
|
|
getattr(self, self._handler, lambda: None)()
|