diff --git a/catalogs/catalog.py b/catalogs/catalog.py index 1aff80af..67de9fda 100644 --- a/catalogs/catalog.py +++ b/catalogs/catalog.py @@ -6,27 +6,27 @@ Copyright © 2022 Project Author Guille Gutierrez guillermo.gutierrezmorote@conc class Catalog: """ - Catalog name + Catalogs base class not implemented instance of the Catalog base class, catalogs will inherit from this class. """ @property - def names(self): + def names(self, category=None): """ Base property to return the catalog entries names - :return: not implemented error + :return: Catalog names filter by category if provided """ raise NotImplementedError def entries(self, category=None): """ Base property to return the catalog entries - :return: not implemented error + :return: Catalog content filter by category if provided """ raise NotImplementedError def get_entry(self, name): """ Base property to return the catalog entry matching the given name - :return: not implemented error + :return: Catalog entry with the matching name """ raise NotImplementedError diff --git a/catalogs/greenery_catalog_factory.py b/catalogs/greenery_catalog_factory.py index 3b70687a..905f1602 100644 --- a/catalogs/greenery_catalog_factory.py +++ b/catalogs/greenery_catalog_factory.py @@ -5,8 +5,9 @@ Copyright © 2022 Project Author Guille Gutierrez guillermo.gutierrezmorote@conc """ from pathlib import Path +from typing import TypeVar from catalogs.greenery.greenery_catalog import GreeneryCatalog - +Catalog = TypeVar('Catalog') class GreeneryCatalogFactory: """ @@ -19,25 +20,17 @@ class GreeneryCatalogFactory: self._path = base_path @property - def _nrel(self) -> GreeneryCatalog: + def _nrel(self): """ - Return a greenery catalog using ecore as datasource + Return a greenery catalog based in NREL using ecore as datasource :return: GreeneryCatalog """ return GreeneryCatalog((self._path / 'ecore_greenery_catalog.xml').resolve()) @property - def catalog(self) -> GreeneryCatalog: + def catalog(self) -> Catalog: """ Enrich the city given to the class using the class given handler - :return: City + :return: Catalog """ return getattr(self, self._file_type, lambda: None) - - @property - def catalog_debug(self) -> GreeneryCatalog: - """ - Enrich the city given to the class using the class given handler - :return: City - """ - return GreeneryCatalog((self._path / 'ecore_greenery_catalog.xml').resolve()) diff --git a/city_model_structure/attributes/polygon.py b/city_model_structure/attributes/polygon.py index 126e9ae4..4064ad81 100644 --- a/city_model_structure/attributes/polygon.py +++ b/city_model_structure/attributes/polygon.py @@ -104,7 +104,6 @@ class Polygon: if module != 0: angle = abs(np.arcsin(scalar_product / module)) angle_sum += angle - print(angle_sum) return abs(angle_sum - math.pi*2) < cte.EPSILON def contains_polygon(self, polygon): @@ -112,13 +111,10 @@ class Polygon: Determines if the given polygon is contained by the current polygon :return: boolean """ - print('contains') - for point in polygon.points: - print(point.coordinates, self.contains_point(point)) + for point in polygon.points: if not self.contains_point(point): return False - print('Belong!') return True @property diff --git a/city_model_structure/building_demand/thermal_opening.py b/city_model_structure/building_demand/thermal_opening.py index 101dcffc..ae695187 100644 --- a/city_model_structure/building_demand/thermal_opening.py +++ b/city_model_structure/building_demand/thermal_opening.py @@ -31,6 +31,7 @@ class ThermalOpening: self._inside_emissivity = None self._alpha_coefficient = None self._radiative_coefficient = None + self._construction_name = None @property def id(self): @@ -290,3 +291,17 @@ class ThermalOpening: """ if value is not None: self._radiative_coefficient = float(value) + + @property + def construction_name(self): + """ + Get thermal opening construction name + """ + return self._construction_name + + @construction_name.setter + def construction_name(self, value): + """ + Set thermal opening construction name + """ + self._construction_name = value diff --git a/city_model_structure/city.py b/city_model_structure/city.py index 780d8e35..b0e19e81 100644 --- a/city_model_structure/city.py +++ b/city_model_structure/city.py @@ -8,8 +8,9 @@ from __future__ import annotations import sys import pickle import math -from typing import List, Union +import copy import pyproj +from typing import List, Union from pyproj import Transformer from pathlib import Path @@ -18,6 +19,7 @@ from city_model_structure.city_object import CityObject from city_model_structure.city_objects_cluster import CityObjectsCluster from city_model_structure.buildings_cluster import BuildingsCluster from city_model_structure.fuel import Fuel +from city_model_structure.iot.station import Station from city_model_structure.machine import Machine from city_model_structure.parts_consisting_building import PartsConsistingBuilding from city_model_structure.subway_entrance import SubwayEntrance @@ -433,3 +435,9 @@ class City: return lca_material return None + @property + def copy(self) -> City: + """ + Get a copy of the current city + """ + return copy.deepcopy(self) diff --git a/city_model_structure/city_object.py b/city_model_structure/city_object.py index d71e3cea..5604f6e0 100644 --- a/city_model_structure/city_object.py +++ b/city_model_structure/city_object.py @@ -44,6 +44,14 @@ class CityObject: """ return self._name + @name.setter + def name(self, value): + """ + Set building name + :return: str + """ + self._name = value + @property def lod(self) -> int: """ diff --git a/city_model_structure/iot/concordia_energy_sensor.py b/city_model_structure/iot/concordia_energy_sensor.py deleted file mode 100644 index afc7b930..00000000 --- a/city_model_structure/iot/concordia_energy_sensor.py +++ /dev/null @@ -1,45 +0,0 @@ -""" -Energy Sensor module -SPDX - License - Identifier: LGPL - 3.0 - or -later -Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca -""" - -import pandas as pd -from city_model_structure.iot.sensor import Sensor - - -class ConcordiaEnergySensor(Sensor): - """ - Concordia energy sensor. - """ - - def __init__(self, name): - super().__init__() - self._name = name - self._interval = 5 - self._interval_units = 'minutes' - self._type = 'ConcordiaEnergySensor' - self._units = 'kW' - self._measures = pd.DataFrame(columns=["Date time", "Energy consumption"]) - - @property - def measures(self) -> pd.DataFrame: - """ - Get sensor measures [yyyy-mm-dd, hh:mm:ss kW] - :return: DataFrame["Date time", "Energy consumption"] - """ - return self._measures - - @measures.deleter - def measures(self): - """ - Delete sensor measures - """ - self._measures.drop = None - - def add_period(self, measures): - """ - Add or update a period measures to the dataframe - """ - measures = self._measures.append(measures, ignore_index=True) - self._measures = measures.drop_duplicates('Date time', keep='last') diff --git a/city_model_structure/iot/concordia_gas_flow_sensor.py b/city_model_structure/iot/concordia_gas_flow_sensor.py deleted file mode 100644 index 86da31bd..00000000 --- a/city_model_structure/iot/concordia_gas_flow_sensor.py +++ /dev/null @@ -1,45 +0,0 @@ -""" -Gas Flow Sensor module -SPDX - License - Identifier: LGPL - 3.0 - or -later -Copyright © 2020 Project Author Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca -""" - -import pandas as pd -from city_model_structure.iot.sensor import Sensor - - -class ConcordiaGasFlowSensor(Sensor): - """ - Concordia gas flow sensor. - """ - - def __init__(self, name): - super().__init__() - self._name = name - self._interval = 5 - self._interval_units = 'minutes' - self._type = 'ConcordiaGasFlowSensor' - self._units = 'm3' - self._measures = pd.DataFrame(columns=["Date time", "Gas Flow Cumulative Monthly"]) - - @property - def measures(self) -> pd.DataFrame: - """ - Get sensor measures [yyyy-mm-dd, hh:mm:ss m3] - :return: DataFrame["Date time", "Gas Flow Cumulative Monthly"] - """ - return self._measures - - @measures.deleter - def measures(self): - """ - Delete sensor measures - """ - self._measures.drop = None - - def add_period(self, measures): - """ - Add or update a period measures to the dataframe - """ - measures = self._measures.append(measures, ignore_index=True) - self._measures = measures.drop_duplicates('Date time', keep='last') diff --git a/city_model_structure/iot/concordia_temperature_sensor.py b/city_model_structure/iot/concordia_temperature_sensor.py deleted file mode 100644 index 9ae6079c..00000000 --- a/city_model_structure/iot/concordia_temperature_sensor.py +++ /dev/null @@ -1,45 +0,0 @@ -""" -Temperature Sensor module -SPDX - License - Identifier: LGPL - 3.0 - or -later -Copyright © 2020 Project Author Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca -""" - -import pandas as pd -from city_model_structure.iot.sensor import Sensor - - -class ConcordiaTemperatureSensor(Sensor): - """ - Concordia temperature sensor. - """ - - def __init__(self, name): - super().__init__() - self._name = name - self._interval = 5 - self._interval_units = 'minutes' - self._type = 'ConcordiaTemperatureSensor' - self._units = 'Celsius' - self._measures = pd.DataFrame(columns=["Date time", "Temperature"]) - - @property - def measures(self) -> pd.DataFrame: - """ - Get sensor measures [yyyy-mm-dd, hh:mm:ss Celsius] - :return: DataFrame["Date time", "Temperature"] - """ - return self._measures - - @measures.deleter - def measures(self): - """ - Delete sensor measures - """ - self._measures.drop = None - - def add_period(self, measures): - """ - Add or update a period measures to the dataframe - """ - measures = self._measures.append(measures, ignore_index=True) - self._measures = measures.drop_duplicates('Date time', keep='last') diff --git a/city_model_structure/iot/sensor.py b/city_model_structure/iot/sensor.py index 4eceafd1..5855d85b 100644 --- a/city_model_structure/iot/sensor.py +++ b/city_model_structure/iot/sensor.py @@ -5,6 +5,8 @@ Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@conc """ from helpers.location import Location +from city_model_structure.iot.sensor_measure import SensorMeasure +from city_model_structure.iot.sensor_type import SensorType class Sensor: @@ -37,7 +39,7 @@ class Sensor: self._name = str(value) @property - def type(self): + def type(self) -> SensorType: """ Get sensor type :return: str @@ -69,7 +71,7 @@ class Sensor: self._location = value @property - def measures(self): + def measures(self) -> [SensorMeasure]: """ Raises not implemented error """ diff --git a/data/life_cycle_assessment/lca_data.xml b/data/life_cycle_assessment/lca_data.xml index 29bb356d..c2a55e20 100644 --- a/data/life_cycle_assessment/lca_data.xml +++ b/data/life_cycle_assessment/lca_data.xml @@ -1,559 +1,559 @@ - - 0.32 + + 0.32 - - 0.4 + + 0.4 - - 0.4 + + 0.4 - - 0.5 + + 0.5 - - 0.18 + + 0.18 - - 0.39 + + 0.39 - - 0.27 + + 0.27 - - 4.16 + + 4.16 - - 2.24 + + 2.24 - - 0.2 + + 0.2 - - 3.19 + + 3.19 - - 3.53 + + 3.53 - - 0.27 + + 0.27 - - 0.21 + + 0.21 - - 1.69 + + 1.69 - - 0.21 + + 0.21 - - 0.35 + + 0.35 - - 0.18 + + 0.18 - - 0.81 + + 0.81 - - 1.21 + + 1.21 - - 1.61 + + 1.61 - - 0.11 + + 0.11 - - 0.3 + + 0.3 - - 1.16 + + 1.16 - - 0.61 + + 0.61 - + - - 0.347 - 16.5 - 0.918 + + 0.347 + 16.5 + 0.918 - - 0.033 - 25.2 - 4.16 + + 0.033 + 25.2 + 4.16 - - 0.027 - 16.8 - 2.239 + + 0.027 + 16.8 + 2.239 - - 0.023 - 16.8 - 2.239 + + 0.023 + 16.8 + 2.239 - - 0.109 - 25.2 - 2.239 + + 0.109 + 25.2 + 2.239 - - 0.003 - 16.4 - 4.16 + + 0.003 + 16.4 + 4.16 - - 0.002 - 11 - 0.918 + + 0.002 + 11 + 0.918 - - 0.002 - 90 - 0.918 + + 0.002 + 90 + 0.918 - - 0.002 - 10 - 0.918 + + 0.002 + 10 + 0.918 - - 0.002 - 11 - 0.918 + + 0.002 + 11 + 0.918 - - 0.002 - 132 - 0.918 + + 0.002 + 132 + 0.918 - - 0.002 - 15 - 0.918 + + 0.002 + 15 + 0.918 - - 0.002 - 5.5 - 0.918 + + 0.002 + 5.5 + 0.918 - - 0.002 - 22.5 - 0.918 + + 0.002 + 22.5 + 0.918 - + - - 0.0123 - 2.239 + + 0.0123 + 2.239 - - 0.042 - 0.918 + + 0.042 + 0.918 - - 0.01 - 1.00000 + + 0.01 + 1.00000 - - 1.3 - 1.00000 + + 1.3 + 1.00000 - + - - 1.8 - 560 - 0.8 - 0.3 - 0.7 - 0.2 - .... + + 1.8 + 560 + 0.8 + 0.3 + 0.7 + 0.2 + 0.1 - - 1.2 - 310 - 0.8 - 0.3 - 0.7 - 0.2 - .... + + 1.2 + 310 + 0.8 + 0.3 + 0.7 + 0.2 + 0.1 - - 2 - 3080 - 0.8 - 0.3 - 0.7 - 0.2 - .... + + 2 + 3080 + 0.8 + 0.3 + 0.7 + 0.2 + 0.1 - - 1.4 - 300 - 0.8 - 0.3 - 0.7 - 0.2 - .... + + 1.4 + 300 + 0.8 + 0.3 + 0.7 + 0.2 + 0.1 - - 1.6 - 900 - 0.8 - 0 - 1 - 0.2 - .... + + 1.6 + 900 + 0.8 + 0 + 1 + 0.2 + 0.1 - - 1.6 - 2340 - 0.8 - 0 - 1 - 0.2 - .... + + 1.6 + 2340 + 0.8 + 0 + 1 + 0.2 + 0.1 - - 1.6 - 1570 - 0.8 - 0 - 1 - 0.2 - .... + + 1.6 + 1570 + 0.8 + 0 + 1 + 0.2 + 0.1 - - 1.4 - 1840 - 0.8 - 0 - 1 - 0.2 - .... + + 1.4 + 1840 + 0.8 + 0 + 1 + 0.2 + 0.1 - - 1.3 - 410 - 0.8 - 0 - 1 - 0.2 - .... + + 1.3 + 410 + 0.8 + 0 + 1 + 0.2 + 0.1 - - 2.3 - 160 - 0.8 - 0 - 1 - 0.2 - .... + + 2.3 + 160 + 0.8 + 0 + 1 + 0.2 + 0.1 - - 2.3 - 170 - 0.8 - 0 - 1 - 0.2 - .... + + 2.3 + 170 + 0.8 + 0 + 1 + 0.2 + 0.1 - - 2.3 - 230 - 0.8 - 0 - 1 - 0.2 - .... + + 2.3 + 230 + 0.8 + 0 + 1 + 0.2 + 0.1 - - 2.4 - 240 - 0.8 - 0 - 1 - 0.2 - .... + + 2.4 + 240 + 0.8 + 0 + 1 + 0.2 + 0.1 - - 2.4 - 280 - 0.8 - 0 - 1 - 0.2 - .... + + 2.4 + 280 + 0.8 + 0 + 1 + 0.2 + 0.1 - - 2.3 - 170 - 0.8 - 0 - 1 - 0.2 - .... + + 2.3 + 170 + 0.8 + 0 + 1 + 0.2 + 0.1 - - 1.2 - 440 - 0.8 - 0 - 1 - 0.2 - .... + + 1.2 + 440 + 0.8 + 0 + 1 + 0.2 + 0.1 - - 2.58 - 2660 - 0.95 - 0 - 1 - 0.05 - .... - - - 2.58 - 5260 - 0.95 - 0 - 1 - 0.05 - .... - - - 0.06 - 1760 - 0.9 - 0 - 1 - 0.1 - .... - - - 0.122 - 3080 - 0.9 - 0 - 1 - 0.1 - .... - - - 0.028 - 3180 - 0.9 - 0 - 1 - 0.1 - .... - - - 0.024 - 5140 - 0.9 - 0 - 1 - 0.1 - .... - - - 0.1 - 6040 - 0.9 - 0 - 1 - 0.1 - .... - - - 0.3 - 5380 - 0.9 - 0 - 1 - 0.1 - .... - - - 0.032 - 2150 - 0.9 - 0 - 1 - 0.1 - .... - - - 0.9 - 3420 - 0.6 - 0 - 1 - 0.4 - .... - - - 0.7 - 1430 - 0.6 - 0 - 1 - 0.4 - .... - - - 0.65 - 2780 - 0.6 - 0 - 1 - 0.4 - .... - - - 0.72 - 2190 - 0.6 - 0 - 1 - 0.4 - .... - - - 1.43 - 1070 - 0 - 0 - 0 - 1 - .... - - - 1.43 - 240 - 0 - 0 - 0 - 1 - .... - - - 1.43 - 430 - 0 - 0 - 0 - 1 - .... - - - 1.43 - 340 - 0 - 0 - 0 - 1 - .... - - - 1.2 - 440 - 0.8 - 0 - 1 - 0.2 - .... - - - 2.1 - 1410 - 0.8 - 0 - 1 - 0.2 - .... - - - 1.43 - 250 - 0 - 0 - 0 - 1 - .... - - - 1.44 - 1480 - 0.8 - 0 - 1 - 0.2 - .... - - - 1.44 - 2220 - 0.8 - 0 - 1 - 0.2 - .... - - - 1.27 - 3960 - 0.8 - 0 - 1 - 0.2 - .... - - - 1.15 - 760 - 0.8 - 0 - 1 - 0.2 - .... - - - 8 - 3160 - 0.98 - 0 - 1 - 0.02 - .... - - - 2.7 - 5370 - 0.98 - 0 - 1 - 0.02 - .... - - - 7.85 - 3910 - 0.98 - 0 - 1 - 0.02 - .... + + 2.58 + 2660 + 0.95 + 0 + 1 + 0.05 + 0.1 + + 2.58 + 5260 + 0.95 + 0 + 1 + 0.05 + 0.1 + + + 0.06 + 1760 + 0.9 + 0 + 1 + 0.1 + 0.1 + + + 0.122 + 3080 + 0.9 + 0 + 1 + 0.1 + 0.1 + + + 0.028 + 3180 + 0.9 + 0 + 1 + 0.1 + 0.1 + + + 0.024 + 5140 + 0.9 + 0 + 1 + 0.1 + 0.1 + + + 0.1 + 6040 + 0.9 + 0 + 1 + 0.1 + 0.1 + + + 0.3 + 5380 + 0.9 + 0 + 1 + 0.1 + 0.1 + + + 0.032 + 2150 + 0.9 + 0 + 1 + 0.1 + 0.1 + + + 0.9 + 3420 + 0.6 + 0 + 1 + 0.4 + 0.1 + + + 0.7 + 1430 + 0.6 + 0 + 1 + 0.4 + 0.1 + + + 0.65 + 2780 + 0.6 + 0 + 1 + 0.4 + 0.1 + + + 0.72 + 2190 + 0.6 + 0 + 1 + 0.4 + 0.1 + + + 1.43 + 1070 + 0 + 0 + 0 + 1 + 0.1 + + + 1.43 + 240 + 0 + 0 + 0 + 1 + 0.1 + + + 1.43 + 430 + 0 + 0 + 0 + 1 + 0.1 + + + 1.43 + 340 + 0 + 0 + 0 + 1 + 0.1 + + + 1.2 + 440 + 0.8 + 0 + 1 + 0.2 + 0.1 + + + 2.1 + 1410 + 0.8 + 0 + 1 + 0.2 + 0.1 + + + 1.43 + 250 + 0 + 0 + 0 + 1 + 0.1 + + + 1.44 + 1480 + 0.8 + 0 + 1 + 0.2 + 0.1 + + + 1.44 + 2220 + 0.8 + 0 + 1 + 0.2 + 0.1 + + + 1.27 + 3960 + 0.8 + 0 + 1 + 0.2 + 0.1 + + + 1.15 + 760 + 0.8 + 0 + 1 + 0.2 + 0.1 + + + 8 + 3160 + 0.98 + 0 + 1 + 0.02 + 0.1 + + + 2.7 + 5370 + 0.98 + 0 + 1 + 0.02 + 0.1 + + + 7.85 + 3910 + 0.98 + 0 + 1 + 0.02 + 0.1 + \ No newline at end of file diff --git a/exports/energy_systems/__init__.py b/exports/energy_systems/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/imports/construction/data_classes/thermal_opening_archetype.py b/imports/construction/data_classes/thermal_opening_archetype.py index e1966267..fc729769 100644 --- a/imports/construction/data_classes/thermal_opening_archetype.py +++ b/imports/construction/data_classes/thermal_opening_archetype.py @@ -12,7 +12,8 @@ class ThermalOpeningArchetype: def __init__(self, conductivity=None, frame_ratio=None, g_value=None, thickness=None, back_side_solar_transmittance_at_normal_incidence=None, front_side_solar_transmittance_at_normal_incidence=None, overall_u_value=None, - openable_ratio=None, inside_emissivity=None, alpha_coefficient=None, radiative_coefficient=None): + openable_ratio=None, inside_emissivity=None, alpha_coefficient=None, radiative_coefficient=None, + construction_name=None): self._conductivity = conductivity self._frame_ratio = frame_ratio self._g_value = g_value @@ -24,6 +25,7 @@ class ThermalOpeningArchetype: self._inside_emissivity = inside_emissivity self._alpha_coefficient = alpha_coefficient self._radiative_coefficient = radiative_coefficient + self._construction_name = construction_name @property def conductivity(self): @@ -112,3 +114,17 @@ class ThermalOpeningArchetype: :return: float """ return self._radiative_coefficient + + @property + def construction_name(self): + """ + Get thermal opening construction name + """ + return self._construction_name + + @construction_name.setter + def construction_name(self, value): + """ + Set thermal opening construction name + """ + self._construction_name = value diff --git a/imports/construction/nrel_physics_interface.py b/imports/construction/nrel_physics_interface.py index db716bd7..8bc37419 100644 --- a/imports/construction/nrel_physics_interface.py +++ b/imports/construction/nrel_physics_interface.py @@ -109,6 +109,7 @@ class NrelPhysicsInterface: if 'window' in construction and construction['window'] is not None: window_ratio = construction['window_ratio']['#text'] w_lib = self._search_construction_type('window', construction['window']) + window_construction_name = w_lib['@name'] frame_ratio = w_lib['frame_ratio']['#text'] if 'conductivity' in w_lib: conductivity = w_lib['conductivity']['#text'] @@ -128,7 +129,8 @@ class NrelPhysicsInterface: thickness=thickness, back_side_solar_transmittance_at_normal_incidence= back_side_solar_transmittance_at_normal_incidence, front_side_solar_transmittance_at_normal_incidence= - front_side_solar_transmittance_at_normal_incidence) + front_side_solar_transmittance_at_normal_incidence, + construction_name=window_construction_name) else: overall_u_value = w_lib['overall_u_value']['#text'] units = w_lib['overall_u_value']['@units'] diff --git a/imports/construction/us_physics_parameters.py b/imports/construction/us_physics_parameters.py index 7a23b318..9673d921 100644 --- a/imports/construction/us_physics_parameters.py +++ b/imports/construction/us_physics_parameters.py @@ -99,6 +99,7 @@ class UsPhysicsParameters(NrelPhysicsInterface): for thermal_opening in thermal_boundary.thermal_openings: if thermal_boundary_archetype.thermal_opening_archetype is not None: thermal_opening_archetype = thermal_boundary_archetype.thermal_opening_archetype + thermal_opening.construction_name = thermal_opening_archetype.construction_name thermal_opening.frame_ratio = thermal_opening_archetype.frame_ratio thermal_opening.g_value = thermal_opening_archetype.g_value thermal_opening.conductivity = thermal_opening_archetype.conductivity diff --git a/imports/construction_factory.py b/imports/construction_factory.py index c315c455..e65d5552 100644 --- a/imports/construction_factory.py +++ b/imports/construction_factory.py @@ -28,7 +28,7 @@ class ConstructionFactory: def _nrcan(self): """ Enrich the city by using NRCAN information - :alert: NRCAN handler only contains simplified construction information + :alert: NRCAN handler only contains simplified construction information (residential) """ CaPhysicsParameters(self._city, self._base_path).enrich_buildings() diff --git a/imports/geometry/rhino.py b/imports/geometry/rhino.py index b9007ecb..1d0b63c0 100644 --- a/imports/geometry/rhino.py +++ b/imports/geometry/rhino.py @@ -4,8 +4,9 @@ SPDX - License - Identifier: LGPL - 3.0 - or -later Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca """ from numpy import inf -#from rhino3dm import * -#from rhino3dm._rhino3dm import MeshType +from rhino3dm import * +from rhino3dm._rhino3dm import MeshType + from city_model_structure.attributes.point import Point import numpy as np @@ -14,7 +15,6 @@ from city_model_structure.attributes.polygon import Polygon from city_model_structure.building import Building from city_model_structure.city import City from city_model_structure.building_demand.surface import Surface as LibsSurface -from helpers.constants import EPSILON from imports.geometry.helpers.geometry_helper import GeometryHelper @@ -29,7 +29,6 @@ class Rhino: @staticmethod def _in_perimeter(wall, corner): res = wall.contains_point(Point(corner)) - print(f'belong: {res} wall:({wall.coordinates}) corner: ({corner})') return res @staticmethod @@ -96,7 +95,6 @@ class Rhino: windows.append(Polygon(surface.perimeter_polygon.inverse)) else: buildings.append(rhino_object) - print(f'windows: {len(windows)}') # todo: this method will be pretty inefficient for hole in windows: corner = hole.coordinates[0] diff --git a/imports/life_cycle_assessment/lca_material.py b/imports/life_cycle_assessment/lca_material.py index 5044b315..88253871 100644 --- a/imports/life_cycle_assessment/lca_material.py +++ b/imports/life_cycle_assessment/lca_material.py @@ -6,7 +6,7 @@ Contributor Mohammad Reza mohammad.seyedabadi@mail.concordia.ca """ import xmltodict from pathlib import Path -from city_model_structure.building_demand.material import Material +from city_model_structure.lca_material import LcaMaterial as LMaterial class LcaMaterial: def __init__(self, city, base_path): @@ -15,14 +15,14 @@ class LcaMaterial: self._lca = None def enrich(self): - self._city.materials = [] + self._city.lca_materials = [] path = Path(self._base_path / 'lca_data.xml').resolve() with open(path) as xml: self._lca = xmltodict.parse(xml.read()) for material in self._lca["library"]["building_materials"]['material']: - _material = Material() + _material = LMaterial() _material.type = material['@type'] _material.id = material['@id'] _material.name = material['@name'] @@ -37,4 +37,4 @@ class LcaMaterial: _material.cost=material['cost']['#text'] _material._cost_unit=material['cost']['@unit'] - self._city.materials.append(_material) + self._city.lca_materials.append(_material) diff --git a/imports/sensors_factory.py b/imports/sensors_factory.py index 3060d1a2..98fbb809 100644 --- a/imports/sensors_factory.py +++ b/imports/sensors_factory.py @@ -5,9 +5,6 @@ Copyright © 2021 Project Author Guille Gutierrez guillermo.gutierrezmorote@conc Contributors Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca """ from pathlib import Path -from imports.sensors.concordia_energy_consumption import ConcordiaEnergyConsumption -from imports.sensors.concordia_gas_flow import ConcordiaGasFlow -from imports.sensors.concordia_temperature import ConcordiaTemperature class SensorsFactory: @@ -26,19 +23,19 @@ class SensorsFactory: """ Enrich the city by using concordia energy consumption sensors as data source """ - ConcordiaEnergyConsumption(self._city, self._end_point, self._base_path) + raise NotImplementedError('need to be reimplemented') def _cgf(self): """ Enrich the city by using concordia gas flow sensors as data source """ - ConcordiaGasFlow(self._city, self._end_point, self._base_path) + raise NotImplementedError('need to be reimplemented') def _ct(self): """ Enrich the city by using concordia temperature sensors as data source """ - ConcordiaTemperature(self._city, self._end_point, self._base_path) + raise NotImplementedError('need to be reimplemented') def enrich(self): """ diff --git a/unittests/test_sensors_factory.py b/unittests/test_sensors_factory.py deleted file mode 100644 index 55b13e01..00000000 --- a/unittests/test_sensors_factory.py +++ /dev/null @@ -1,58 +0,0 @@ -""" -TestSensorsFactory test and validate the city model structure schedules -SPDX - License - Identifier: LGPL - 3.0 - or -later -Copyright © 2021 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca -""" -from pathlib import Path -from unittest import TestCase -from city_model_structure.building import Building -from city_model_structure.buildings_cluster import BuildingsCluster -from city_model_structure.city import City -from imports.sensors_factory import SensorsFactory - - -class TestSensorsFactory(TestCase): - """ - TestSchedulesFactory TestCase - """ - - def setUp(self) -> None: - """ - Configure test environment - :return: - """ - self._city = TestSensorsFactory._mockup_city() - self._end_point = (Path(__file__).parent / - 'tests_data/EV-GM energy demand weekly report_01-26-20_04-30.csv').resolve() - - @staticmethod - def _mockup_city(): - lower_corner = [0, 0, 0] - upper_corner = [10, 10, 10] - srs_name = 'Mockup_city' - buildings = [] - lod = 2 - surfaces = [] - year_of_construction = 2021 - function = "office" - city = City(lower_corner, upper_corner, srs_name) - buildings.append(Building("EV", lod, surfaces, year_of_construction, function, lower_corner)) - buildings.append(Building("GM", lod, surfaces, year_of_construction, function, lower_corner)) - buildings.append(Building("MB", lod, surfaces, year_of_construction, function, lower_corner)) - for building in buildings: - city.add_city_object(building) - buildings_cluster = BuildingsCluster("GM_MB_EV", buildings) - city.add_city_objects_cluster(buildings_cluster) - return city - - def test_city_with_sensors(self): - """ - Load concordia sensors and verify it - """ - SensorsFactory('cec', self._city, self._end_point).enrich() - SensorsFactory('cgf', self._city, self._end_point).enrich() - SensorsFactory('ct', self._city, self._end_point).enrich() - for city_object in self._city.city_objects: - print(city_object.name, len(city_object.sensors)) - for sensor in city_object.sensors: - print(sensor.name)