diff --git a/helpers/idf_helper.py b/helpers/idf_helper.py index d6353213..66b8d644 100644 --- a/helpers/idf_helper.py +++ b/helpers/idf_helper.py @@ -24,18 +24,27 @@ class IdfHelper: self._idf.newidfobject(key='ZONE', Name=building_name, Ceiling_Height='autocalculate', Volume='autocalculate', Floor_Area='autocalculate', Part_of_Total_Floor_Area='yes', ) - def add_surface(self, surface, building_name): - self._idf.newidfobject('BUILDINGSURFACE:DETAILED', Name=surface.name, Surface_Type=surface.type, - Zone_Name=building_name, ) - # Why is this thing here? - # self.wall.setcoords(surface.points_list.toList()) + @staticmethod + def _matrix_to_list(points): + points_list = [] + for point in points: + point_tuple = (point[0], point[1], point[2]) + points_list.append(point_tuple) + return points_list - def run(self, window_ratio=0.35): + def add_surface(self, surface, building_name): + wall = self._idf.newidfobject('BUILDINGSURFACE:DETAILED', Name=surface.name, Surface_Type=surface.type, + Zone_Name=building_name, ) + self._matrix_to_list(surface.points) + wall.setcoords(IdfHelper._matrix_to_list(surface.points)) + + def run(self, window_ratio=0.35, display_render=False): self._idf.set_default_constructions() self._idf.intersect_match() self._idf.set_wwr(window_ratio) self._idf.translate_to_origin() - self._idf.view_model() + if display_render: + self._idf.view_model() self._idf.newidfobject("HVACTEMPLATE:THERMOSTAT", Name="Zone Stat", Constant_Heating_Setpoint=20, Constant_Cooling_Setpoint=24, ) for zone in self._idf.idfobjects["ZONE"]: @@ -47,4 +56,5 @@ class IdfHelper: list_values = [v for v in data.values()] heating = [(float(x)) / 3600000.0 for x in list_values[0]] cooling = [(float(x)) / 3600000.0 for x in list_values[1]] + print("text") return heating, cooling diff --git a/tests/test_idf.py b/tests/test_idf.py index bc30987b..a7376baa 100644 --- a/tests/test_idf.py +++ b/tests/test_idf.py @@ -40,6 +40,5 @@ class TestIdf(TestCase): _idf.add_zone(building.name) for surface in building.surfaces: _idf.add_surface(surface, building.name) - _idf.run()