diff --git a/helpers/idf.py b/helpers/idf_helper.py similarity index 73% rename from helpers/idf.py rename to helpers/idf_helper.py index a73ff238..ee9ce579 100644 --- a/helpers/idf.py +++ b/helpers/idf_helper.py @@ -1,22 +1,22 @@ """ TestOccupancyFactory test and validate the city model structure occupancy parameters SPDX - License - Identifier: LGPL - 3.0 - or -later -Copyright © 2020 Project Author Sourush .... +Copyright © 2020 Project Author Soroush Samareh Abolhassani - soroush.samarehabolhassani@mail.concordia.ca """ from geomeppy import IDF import esoreader from pathlib import Path -class Idf: +class IdfHelper: def __init__(self, idf_file_path, idd_file_path, epw_file_path, eso_file_path): self._idd_file_path = str(idd_file_path) self._idf_file_path = str(idf_file_path) self._epw_file_path = str(epw_file_path) self._eso_file_path = str(eso_file_path) - IDF.setiddname(idd_file_path) - self._idf = IDF(idf_file_path) + IDF.setiddname(self._idd_file_path) + self._idf = IDF(self._idf_file_path) self._idf.epw = epw_file_path self._eso_file_path = str((Path.cwd() / 'eplusout.eso').resolve()) @@ -25,9 +25,10 @@ class Idf: 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, + self._idf.newidfobject('BUILDINGSURFACE:DETAILED', Name=surface.name, Surface_Type=surface.type, Zone_Name=building_name,) - self.wall.setcoords(surface.points_list.toList()) + # Why is this thing here? + # self.wall.setcoords(surface.points_list.toList()) def run(self, window_ratio=0.35): self._idf.set_default_constructions() @@ -35,12 +36,15 @@ class Idf: self._idf.set_wwr(window_ratio) self._idf.translate_to_origin() self._idf.view_model() - self._idf.newidfobject("HVACTEMPLATE:THERMOSTAT", Name="Zone Stat", Constant_Heating_Setpoint=20, Constant_Cooling_Setpoint=24,) + self._idf.newidfobject("HVACTEMPLATE:THERMOSTAT", Name="Zone Stat", Constant_Heating_Setpoint=20, + Constant_Cooling_Setpoint=24,) for zone in self._idf.idfobjects["ZONE"]: - self._idf.newidfobject("HVACTEMPLATE:ZONE:IDEALLOADSAIRSYSTEM", Zone_Name=zone.Name, Template_Thermostat_Name=stat.Name, Outdoor_Air_Method="DetailedSpecification",) + self._idf.newidfobject("HVACTEMPLATE:ZONE:IDEALLOADSAIRSYSTEM", Zone_Name=zone.Name, + Template_Thermostat_Name='', Outdoor_Air_Method="DetailedSpecification",) # Run self._idf.run() dd, data = esoreader.read(self._eso_file_path) 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]] + return heating, cooling diff --git a/requirements.txt b/requirements.txt index ba603773..cd23681e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -50,4 +50,6 @@ pyrsistent~=0.16.0 cycler~=0.10.0 kiwisolver~=1.2.0 zipp~=3.1.0 -requests~=2.24.0 \ No newline at end of file +requests~=2.24.0 +esoreader~=1.2.3 +geomeppy~=0.11.8 \ No newline at end of file diff --git a/tests/test_idf.py b/tests/test_idf.py index dbd68197..bc30987b 100644 --- a/tests/test_idf.py +++ b/tests/test_idf.py @@ -3,12 +3,11 @@ TestOccupancyFactory test and validate the city model structure occupancy parame SPDX - License - Identifier: LGPL - 3.0 - or -later Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca """ -import os from pathlib import Path from unittest import TestCase from geometry.geometry_factory import GeometryFactory -from helpers.idf import Idf +from helpers.idf_helper import IdfHelper class TestIdf(TestCase): @@ -35,7 +34,7 @@ class TestIdf(TestCase): idd_file_path = (self._example_path / 'energy+.idd').resolve() idf_file_path = (self._example_path / 'minimal.idf').resolve() epw_file_path = (self._example_path / 'montreal.epw').resolve() - _idf = Idf(idf_file_path, idd_file_path, epw_file_path, self._example_path) + _idf = IdfHelper(idf_file_path, idd_file_path, epw_file_path, self._example_path) city = self._get_citygml() for building in city.buildings: _idf.add_zone(building.name)