From cab4df33dbf4c0fe698c2d7ca8d5ea474bd42806 Mon Sep 17 00:00:00 2001 From: Soroush Samareh Abolhassani Date: Wed, 11 Aug 2021 16:16:15 -0400 Subject: [PATCH] Fine tuning the idf export --- exports/exports_factory.py | 2 +- exports/formats/idf.py | 19 +++++++++++++------ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/exports/exports_factory.py b/exports/exports_factory.py index 69919cc2..0f386d37 100644 --- a/exports/exports_factory.py +++ b/exports/exports_factory.py @@ -68,7 +68,7 @@ class ExportsFactory: :return: """ # todo: this need to be generalized - data_path = Path('./test/data').resolve() + data_path = Path('../libs_Final/tests/tests_data').resolve() return Idf(self._city, self._path, (data_path / f'minimal.idf').resolve(), (data_path / f'energy+.idd').resolve(), (data_path / f'montreal.epw').resolve()) diff --git a/exports/formats/idf.py b/exports/formats/idf.py index c1d337df..f4c40893 100644 --- a/exports/formats/idf.py +++ b/exports/formats/idf.py @@ -4,7 +4,7 @@ SPDX - License - Identifier: LGPL - 3.0 - or -later Copyright © 2020 Project Author Soroush Samareh Abolhassani - soroush.samarehabolhassani@mail.concordia.ca """ from geomeppy import IDF - +from pathlib import Path class Idf: _THERMOSTAT = 'HVACTEMPLATE:THERMOSTAT' _IDEAL_LOAD_AIR_SYSTEM = 'HVACTEMPLATE:ZONE:IDEALLOADSAIRSYSTEM' @@ -34,12 +34,14 @@ class Idf: def __init__(self, city, output_path, idf_file_path, idd_file_path, epw_file_path): self._city = city - self._output_path = str(output_path) + self._output_path = str(output_path.resolve()) + print(self._output_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) IDF.setiddname(self._idd_file_path) self._idf = IDF(self._idf_file_path, self._epw_file_path) + self._export() @staticmethod def _matrix_to_list(points): @@ -87,7 +89,7 @@ class Idf: ) def _add_schedule(self, usage_zone, schedule_type): - for schedule in self._idf.idfobjects[schedule_type]: + for schedule in self._idf.idfobjects[self._HOURLY_SCHEDULE]: if schedule.Name == f'{schedule_type} schedules {usage_zone.usage}': return schedule = self._idf.newidfobject(self._HOURLY_SCHEDULE) @@ -123,6 +125,7 @@ class Idf: for construction in self._idf.idfobjects[self._CONSTRUCTION]: if construction.Name == thermal_boundary.construction_name: return + for layer in thermal_boundary.layers: self._add_material(layer) layers = thermal_boundary.layers @@ -191,24 +194,28 @@ class Idf: Velocity_Squared_Term_Coefficient=0.0000000E+00 # todo: change it from usage catalog ) - def export(self, city, export_type="Surfaces"): + def _export(self, export_type="Surfaces"): """ Export the idf file into the given path export type = "Surfaces|Block" """ - for building in city.buildings: + print("called") + for building in self._city.buildings: + print('add building') for usage_zone in building.usage_zones: self._add_schedule(usage_zone, "Infiltration") self._add_schedule(usage_zone, "Lights") self._add_schedule(usage_zone, "Occupancy") self._add_zone(usage_zone) self._add_heating_system(usage_zone) - self._add_equipment(usage_zone) self._add_construction(usage_zone) + print('zone construction') + print('add surfaces') if export_type == "Surfaces": self._add_surfaces(building) else: self._add_block(building) + print(' =out path', str(self._output_path)) self._idf.saveas(str(self._output_path)) def _add_block(self, building):