2021-09-16 13:45:27 -04:00
|
|
|
"""
|
|
|
|
Building test
|
|
|
|
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
2022-04-08 09:35:33 -04:00
|
|
|
Copyright © 2022 Concordia CERC group
|
|
|
|
Project Coder Guille Gutierrez Morote Guillermo.GutierrezMorote@concordia.ca
|
2021-09-16 13:45:27 -04:00
|
|
|
"""
|
|
|
|
from pathlib import Path
|
|
|
|
from unittest import TestCase
|
|
|
|
from imports.geometry_factory import GeometryFactory
|
|
|
|
from imports.usage_factory import UsageFactory
|
|
|
|
from imports.construction_factory import ConstructionFactory
|
|
|
|
from exports.exports_factory import ExportsFactory
|
|
|
|
|
|
|
|
|
|
|
|
class TestBuildings(TestCase):
|
|
|
|
"""
|
|
|
|
TestBuilding TestCase 1
|
|
|
|
"""
|
|
|
|
def setUp(self) -> None:
|
|
|
|
"""
|
|
|
|
Test setup
|
|
|
|
:return: None
|
|
|
|
"""
|
|
|
|
self._city_gml = None
|
|
|
|
self._example_path = (Path(__file__).parent / 'tests_data').resolve()
|
|
|
|
|
|
|
|
def test_doe_idf(self):
|
2022-04-26 19:41:00 -04:00
|
|
|
city_file = "../unittests/tests_data/one_building_in_kelowna.gml"
|
2021-09-16 13:45:27 -04:00
|
|
|
output_path = Path('../unittests/tests_outputs/').resolve()
|
2022-11-21 13:53:58 -05:00
|
|
|
city = GeometryFactory('citygml', path=city_file).city
|
2022-04-26 19:14:12 -04:00
|
|
|
for building in city.buildings:
|
|
|
|
building.year_of_construction = 2006
|
2021-09-16 13:45:27 -04:00
|
|
|
ConstructionFactory('nrel', city).enrich()
|
2022-04-06 16:06:55 -04:00
|
|
|
UsageFactory('comnet', city).enrich()
|
2021-09-16 13:45:27 -04:00
|
|
|
ExportsFactory('idf', city, output_path).export()
|
2022-04-26 19:41:00 -04:00
|
|
|
self.assertEqual(1, len(city.buildings))
|
2021-09-16 13:45:27 -04:00
|
|
|
for building in city.buildings:
|
2022-03-24 16:51:01 -04:00
|
|
|
for internal_zone in building.internal_zones:
|
|
|
|
self.assertTrue(len(internal_zone.usage_zones) > 0)
|
|
|
|
for usage_zone in internal_zone.usage_zones:
|
|
|
|
self.assertIsNot(len(usage_zone.occupancy.occupancy_schedules), 0, 'no occupancy schedules defined')
|
|
|
|
for schedule in usage_zone.occupancy.occupancy_schedules:
|
|
|
|
self.assertIsNotNone(schedule.type)
|
|
|
|
self.assertIsNotNone(schedule.values)
|
|
|
|
self.assertIsNotNone(schedule.data_type)
|
|
|
|
self.assertIsNotNone(schedule.time_step)
|
|
|
|
self.assertIsNotNone(schedule.time_range)
|
|
|
|
self.assertIsNotNone(schedule.day_types)
|
|
|
|
self.assertIsNot(len(usage_zone.lighting.schedules), 0, 'no lighting schedules defined')
|
|
|
|
for schedule in usage_zone.lighting.schedules:
|
|
|
|
self.assertIsNotNone(schedule.type)
|
|
|
|
self.assertIsNotNone(schedule.values)
|
|
|
|
self.assertIsNotNone(schedule.data_type)
|
|
|
|
self.assertIsNotNone(schedule.time_step)
|
|
|
|
self.assertIsNotNone(schedule.time_range)
|
|
|
|
self.assertIsNotNone(schedule.day_types)
|