forked from s_ranjbar/city_retrofit
Fine tuning the idf export
This commit is contained in:
parent
92d35d8c8a
commit
cab4df33db
|
@ -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())
|
||||
|
||||
|
|
|
@ -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):
|
||||
|
|
Loading…
Reference in New Issue
Block a user