Idf factory can export now one building in kelowna

This commit is contained in:
Guille Gutierrez 2021-08-12 14:18:44 -04:00
parent 7772d807dc
commit 13eb9eaaa7
5 changed files with 11 additions and 26 deletions

View File

@ -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]:
"""

View File

@ -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()

View File

@ -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

View File

@ -38,4 +38,4 @@ class ConstructionFactory:
Enrich the city with the construction information
:return: None
"""
self._nrcan()
self._nrel()

View File

@ -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:
"""