correct idf factory

This commit is contained in:
Guille Gutierrez 2021-08-11 15:38:07 -04:00
parent 06a8a397b3
commit 36553e0d0d
2 changed files with 8 additions and 2 deletions

View File

@ -9,6 +9,7 @@ from exports.formats.obj import Obj
from exports.formats.energy_ade import EnergyAde
from exports.formats.simplified_radiosity_algorithm import SimplifiedRadiosityAlgorithm
from exports.formats.idf import Idf
from pathlib import Path
class ExportsFactory:
@ -66,7 +67,10 @@ class ExportsFactory:
Export the city to Energy+ idf format
:return:
"""
return Idf(self._city, (self._path / f'{self._city.name}.idf'), (self._path / f'{self._city.name}.idd'),(self._path / f'{self._city.name}.epw'))
# todo: this need to be generalized
data_path = Path('../test/test/data').resolve()
return Idf(self._city, self._path, (data_path / f'minimal.idf'), (data_path / f'energy+.idd'),
(self._path / f'montreal.epw'))
@property
def _sra(self):

View File

@ -32,8 +32,9 @@ class Idf:
'residential': 'residential_building'
}
def __init__(self, city, idf_file_path, idd_file_path, epw_file_path):
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._idd_file_path = str(idd_file_path)
self._idf_file_path = str(idf_file_path)
self._epw_file_path = str(epw_file_path)
@ -208,6 +209,7 @@ class Idf:
self._add_surfaces(building)
else:
self._add_block(building)
self._idf.saveas(str(self._output_path))
def _add_block(self, building):
_points = self._matrix_to_2d_list(building.foot_print.coordinates)