From 11fcd2792646aaeb9d6fe76fd8bc9eb49d8947e9 Mon Sep 17 00:00:00 2001 From: Guille Date: Thu, 22 Oct 2020 12:00:53 -0400 Subject: [PATCH] Correct idf_helper class --- helpers/idf_helper.py | 15 ++++++++++++--- tests/test_idf.py | 2 +- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/helpers/idf_helper.py b/helpers/idf_helper.py index d6353213..0aa17619 100644 --- a/helpers/idf_helper.py +++ b/helpers/idf_helper.py @@ -24,11 +24,19 @@ class IdfHelper: self._idf.newidfobject(key='ZONE', Name=building_name, Ceiling_Height='autocalculate', Volume='autocalculate', Floor_Area='autocalculate', Part_of_Total_Floor_Area='yes', ) + @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 add_surface(self, surface, building_name): - self._idf.newidfobject('BUILDINGSURFACE:DETAILED', Name=surface.name, Surface_Type=surface.type, + wall = 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()) + self._matrix_to_list(surface.points) + wall.setcoords(IdfHelper._matrix_to_list(surface.points)) def run(self, window_ratio=0.35): self._idf.set_default_constructions() @@ -47,4 +55,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 a7376baa..0ba69b32 100644 --- a/tests/test_idf.py +++ b/tests/test_idf.py @@ -40,5 +40,5 @@ class TestIdf(TestCase): _idf.add_zone(building.name) for surface in building.surfaces: _idf.add_surface(surface, building.name) - _idf.run() + print(_idf.run())