diff --git a/city_model_structure/attributes/polygon.py b/city_model_structure/attributes/polygon.py index 7705a575..dcfa5dd7 100644 --- a/city_model_structure/attributes/polygon.py +++ b/city_model_structure/attributes/polygon.py @@ -19,42 +19,19 @@ class Polygon: Polygon class """ -# def __init__(self, points): def __init__(self, coordinates): self._area = None -# self._points = points self._points = None self._points_list = None self._normal = None self._inverse = None self._edges = None -# self._coordinates = None self._coordinates = coordinates self._triangles = None self._vertices = None self._faces = None -# @property -# def points(self) -> List[Point]: -# """ -# List of points belonging to the polygon [[x, y, z],...] -# :return: List[Point] -# """ -# return self._points -# -# @property -# def coordinates(self) -> List[np.ndarray]: -# """ -# List of points in the shape of its coordinates belonging to the polygon [[x, y, z],...] -# :return: np.array -# """ -# if self._coordinates is None: -# self._coordinates = [] -# for point in self.points: -# self._coordinates.append(np.array(point.coordinates)) -# return self._coordinates -# @property def points(self) -> List[Point]: """ diff --git a/exports/formats/idf.py b/exports/formats/idf.py index 335d453c..988905a3 100644 --- a/exports/formats/idf.py +++ b/exports/formats/idf.py @@ -127,6 +127,7 @@ class Idf: for construction in self._idf.idfobjects[self._CONSTRUCTION]: if construction.Name == thermal_boundary.construction_name: return + if thermal_boundary.layers is None: for material in self._idf.idfobjects[self._MATERIAL]: if material.Name == "DefaultMaterial": @@ -153,7 +154,7 @@ class Idf: def _add_thermostat(self, usage_zone): thermostat_name = f'Thermostat {usage_zone.usage}' for thermostat in self._idf.idfobjects[self._THERMOSTAT]: - if thermostat == thermostat_name: + if thermostat.Name == thermostat_name: return thermostat return self._idf.newidfobject(self._THERMOSTAT, Name=thermostat_name, @@ -161,6 +162,9 @@ class Idf: Constant_Cooling_Setpoint=usage_zone.cooling_setpoint) def _add_heating_system(self, usage_zone): + for air_system in self._idf.idfobjects[self._IDEAL_LOAD_AIR_SYSTEM]: + if air_system.Zone_Name == usage_zone.id: + return thermostat = self._add_thermostat(usage_zone) # todo: doesn't the air system have name? self._idf.newidfobject(self._IDEAL_LOAD_AIR_SYSTEM, @@ -248,6 +252,6 @@ class Idf: surface = self._idf.newidfobject(self._SURFACE, Name=f'{boundary.surface.name}', Surface_Type=idf_surface, Zone_Name=usage_zone.id, Construction_Name=boundary.construction_name) - coordinates = self._matrix_to_list(boundary.surface.coordinates) + coordinates = self._matrix_to_list(boundary.surface.solid_polygon.coordinates) surface.setcoords(coordinates) self._idf.intersect_match() diff --git a/imports/construction/us_physics_parameters.py b/imports/construction/us_physics_parameters.py index ea6d7bf8..2ef2d344 100644 --- a/imports/construction/us_physics_parameters.py +++ b/imports/construction/us_physics_parameters.py @@ -68,6 +68,7 @@ class UsPhysicsParameters(NrelPhysicsInterface): thermal_boundary.outside_visible_absorptance = thermal_boundary_archetype.outside_visible_absorptance thermal_boundary.construction_name = thermal_boundary_archetype.construction_name thermal_boundary.window_ratio = thermal_boundary_archetype.window_ratio + thermal_boundary.layers = [] for layer_archetype in thermal_boundary_archetype.layers: layer = Layer() layer.thickness = layer_archetype.thickness @@ -82,6 +83,7 @@ class UsPhysicsParameters(NrelPhysicsInterface): material.visible_absorptance = layer_archetype.visible_absorptance material.thermal_resistance = layer_archetype.thermal_resistance layer.material = material + thermal_boundary.layers.append(layer) for thermal_opening in thermal_boundary.thermal_openings: if thermal_boundary_archetype.thermal_opening is not None: thermal_opening_archetype = thermal_boundary_archetype.thermal_opening diff --git a/imports/construction_factory.py b/imports/construction_factory.py index 186710ad..e68dc4a9 100644 --- a/imports/construction_factory.py +++ b/imports/construction_factory.py @@ -38,4 +38,4 @@ class ConstructionFactory: Enrich the city with the construction information :return: None """ - self._nrcan() + self._nrel() diff --git a/imports/usage_factory.py b/imports/usage_factory.py index 9b604ded..ce943098 100644 --- a/imports/usage_factory.py +++ b/imports/usage_factory.py @@ -7,6 +7,8 @@ from pathlib import Path from imports.usage.hft_usage_parameters import HftUsageParameters from imports.usage.ca_usage_parameters import CaUsageParameters +# todo: handle missing lambda and rise error. + class UsageFactory: """