test c40 added

This commit is contained in:
Pilar 2021-08-11 12:25:52 -04:00
parent 2f86f6c8d4
commit 900651d771

View File

@ -0,0 +1,45 @@
"""
C40 test
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2020 Project Author Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
"""
from pathlib import Path
from unittest import TestCase
from imports.geometry_factory import GeometryFactory
from imports.construction_factory import ConstructionFactory
from imports.weather_factory import WeatherFactory
# from exports.exports_factory import ExportsFactory
class MyTestCase(TestCase):
"""
C40 TestCase 1
"""
def setUp(self) -> None:
"""
Test setup
:return: None
"""
self._city_gml = None
self._example_path = (Path(__file__).parent / 'tests_data').resolve()
def _get_citygml(self, file):
if self._city_gml is None:
file_path = (self._example_path / file).resolve()
self._city_gml = GeometryFactory('citygml', file_path).city
self.assertIsNotNone(self._city_gml, 'city is none')
return self._city_gml
def test_c40_enrichment(self):
file = 'C40_Final.gml'
city = self._get_citygml(file)
for building in city.buildings:
building.storeys_above_ground = 1
ConstructionFactory('nrel', city).enrich()
for building in city.buildings:
print(building.name, building.function, len(building.surfaces))
for thermal_zone in building.thermal_zones:
print(thermal_zone.volume)
# WeatherFactory('epw', city).enrich()
# ExportsFactory('idf', city, 'c:\Documents\idf').export()