From 44c4f666d2b0d1cb2ce6457812246df96a75d390 Mon Sep 17 00:00:00 2001 From: Pilar Date: Tue, 31 Aug 2021 12:17:42 -0400 Subject: [PATCH] added id to thermal_boundary.py and thermal_opening.py erased \r from files generators added generator of auxiliary files for dynamic model --- .../building_demand/thermal_boundary.py | 12 ++++++++++++ .../building_demand/thermal_opening.py | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/city_model_structure/building_demand/thermal_boundary.py b/city_model_structure/building_demand/thermal_boundary.py index 878a9124..a705c018 100644 --- a/city_model_structure/building_demand/thermal_boundary.py +++ b/city_model_structure/building_demand/thermal_boundary.py @@ -4,6 +4,7 @@ SPDX - License - Identifier: LGPL - 3.0 - or -later Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca Contributors Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca """ +import uuid from typing import List, TypeVar, Union from city_model_structure.building_demand.layer import Layer from city_model_structure.building_demand.thermal_opening import ThermalOpening @@ -19,6 +20,7 @@ class ThermalBoundary: """ def __init__(self, surface): self._surface = surface + self._id = None self._thermal_zones = None # ToDo: up to at least LOD2 will be just one thermal opening per Thermal boundary only if window_ratio > 0, # review for LOD3 and LOD4 @@ -41,6 +43,16 @@ class ThermalBoundary: self._alpha_coefficient = None self._radiative_coefficient = None + @property + def id(self): + """ + Get thermal zone id, an universally unique identifier randomly generated + :return: str + """ + if self._id is None: + self._id = uuid.uuid4() + return self._id + @property def surface(self) -> Surface: """ diff --git a/city_model_structure/building_demand/thermal_opening.py b/city_model_structure/building_demand/thermal_opening.py index 9897820c..83b85148 100644 --- a/city_model_structure/building_demand/thermal_opening.py +++ b/city_model_structure/building_demand/thermal_opening.py @@ -4,6 +4,7 @@ SPDX - License - Identifier: LGPL - 3.0 - or -later Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca Contributors Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca """ +import uuid from typing import TypeVar Polygon = TypeVar('Polygon') @@ -14,6 +15,7 @@ class ThermalOpening: ThermalOpening class """ def __init__(self): + self._id = None self._area = None self._openable_ratio = None self._conductivity = None @@ -30,6 +32,16 @@ class ThermalOpening: self._alpha_coefficient = None self._radiative_coefficient = None + @property + def id(self): + """ + Get thermal zone id, an universally unique identifier randomly generated + :return: str + """ + if self._id is None: + self._id = uuid.uuid4() + return self._id + @property def area(self): """