2020-06-09 14:07:47 -04:00
|
|
|
"""
|
2021-05-26 18:17:23 -04:00
|
|
|
ConstructionFactory (before PhysicsFactory) retrieve the specific construction module for the given region
|
2020-06-09 14:07:47 -04:00
|
|
|
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
2022-04-08 09:35:33 -04:00
|
|
|
Copyright © 2022 Concordia CERC group
|
|
|
|
Project Coder Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
|
2020-06-09 14:07:47 -04:00
|
|
|
"""
|
2021-08-26 13:27:43 -04:00
|
|
|
from pathlib import Path
|
2021-06-03 15:56:59 -04:00
|
|
|
from imports.construction.us_physics_parameters import UsPhysicsParameters
|
|
|
|
from imports.construction.ca_physics_parameters import CaPhysicsParameters
|
2020-05-18 13:25:08 -04:00
|
|
|
|
|
|
|
|
2021-05-26 18:17:23 -04:00
|
|
|
class ConstructionFactory:
|
2020-06-11 15:45:11 -04:00
|
|
|
"""
|
|
|
|
PhysicsFactor class
|
|
|
|
"""
|
2021-09-22 07:25:53 -04:00
|
|
|
def __init__(self, handler, city, base_path=None):
|
|
|
|
if base_path is None:
|
|
|
|
base_path = Path(Path(__file__).parent.parent / 'data/construction')
|
2020-06-11 15:45:11 -04:00
|
|
|
self._handler = '_' + handler.lower().replace(' ', '_')
|
2020-05-18 13:25:08 -04:00
|
|
|
self._city = city
|
2020-06-04 12:47:48 -04:00
|
|
|
self._base_path = base_path
|
2020-05-18 13:25:08 -04:00
|
|
|
|
2021-05-27 17:20:06 -04:00
|
|
|
def _nrel(self):
|
2021-09-22 07:25:53 -04:00
|
|
|
"""
|
|
|
|
Enrich the city by using NREL information
|
|
|
|
"""
|
2021-01-07 19:46:52 -05:00
|
|
|
UsPhysicsParameters(self._city, self._base_path).enrich_buildings()
|
2020-05-18 13:25:08 -04:00
|
|
|
|
2021-05-27 17:20:06 -04:00
|
|
|
def _nrcan(self):
|
2021-09-22 07:25:53 -04:00
|
|
|
"""
|
|
|
|
Enrich the city by using NRCAN information
|
2022-03-30 13:31:59 -04:00
|
|
|
:alert: NRCAN handler only contains simplified construction information (residential)
|
2021-09-22 07:25:53 -04:00
|
|
|
"""
|
2021-01-07 18:12:13 -05:00
|
|
|
CaPhysicsParameters(self._city, self._base_path).enrich_buildings()
|
2020-05-18 13:25:08 -04:00
|
|
|
|
2021-04-07 11:46:44 -04:00
|
|
|
def enrich(self):
|
2020-06-11 15:45:11 -04:00
|
|
|
"""
|
2021-09-22 07:25:53 -04:00
|
|
|
Enrich the city given to the class using the class given handler
|
2020-06-11 15:45:11 -04:00
|
|
|
:return: None
|
|
|
|
"""
|
2020-05-18 13:25:08 -04:00
|
|
|
getattr(self, self._handler, lambda: None)()
|
2021-08-12 11:58:24 -04:00
|
|
|
|
|
|
|
def _enrich_debug(self):
|
2021-08-12 14:18:44 -04:00
|
|
|
self._nrel()
|