2020-10-21 15:23:06 -04:00
|
|
|
"""
|
|
|
|
TestOccupancyFactory test and validate the city model structure occupancy parameters
|
|
|
|
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
|
|
|
Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
|
|
|
|
"""
|
|
|
|
from pathlib import Path
|
|
|
|
from unittest import TestCase
|
2020-10-26 13:33:03 -04:00
|
|
|
from geomeppy import IDF
|
2020-10-21 15:23:06 -04:00
|
|
|
from geometry.geometry_factory import GeometryFactory
|
2020-10-22 07:30:34 -04:00
|
|
|
from helpers.idf_helper import IdfHelper
|
2020-10-21 15:23:06 -04:00
|
|
|
|
|
|
|
|
|
|
|
class TestIdf(TestCase):
|
|
|
|
"""
|
|
|
|
Test IDF Class
|
|
|
|
"""
|
|
|
|
|
|
|
|
def setUp(self) -> None:
|
|
|
|
"""
|
|
|
|
Test setup
|
|
|
|
:return: None
|
|
|
|
"""
|
|
|
|
self._city_gml = None
|
|
|
|
self._example_path = (Path(__file__).parent.parent / 'tests_data').resolve()
|
|
|
|
|
|
|
|
def _get_citygml(self):
|
|
|
|
if self._city_gml is None:
|
|
|
|
file_path = (self._example_path / 'buildings.gml').resolve()
|
|
|
|
self._city_gml = GeometryFactory('citygml', file_path).city
|
|
|
|
self.assertIsNotNone(self._city_gml, 'city is none')
|
|
|
|
return self._city_gml
|
|
|
|
|
|
|
|
def test_idf_run(self):
|
|
|
|
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()
|
2020-10-26 13:47:10 -04:00
|
|
|
_idf = IdfHelper(idf_file_path, idd_file_path, epw_file_path)
|
2020-10-21 15:23:06 -04:00
|
|
|
city = self._get_citygml()
|
|
|
|
for building in city.buildings:
|
2020-10-26 10:00:42 -04:00
|
|
|
_idf.add_block(building)
|
2020-10-26 13:33:03 -04:00
|
|
|
|
2020-10-26 10:00:42 -04:00
|
|
|
# _idf.add_surfaces(building)
|
|
|
|
# for surface in building.surfaces:
|
|
|
|
# _idf.add_surface(surface, building.name)
|
2020-10-26 13:33:03 -04:00
|
|
|
|
|
|
|
_idf.run(output_directory="ep_outputs")
|
2020-10-26 13:47:10 -04:00
|
|
|
IdfHelper.read_eso((Path(__file__).parent / 'ep_outputs/eplusout.eso'))
|
2020-10-26 10:00:42 -04:00
|
|
|
self.assertTrue(True)
|
|
|
|
|