Merge remote-tracking branch 'origin/master'

This commit is contained in:
Guille Gutierrez 2021-08-11 15:11:06 -04:00
commit 4dbf77fd11
3 changed files with 58 additions and 4 deletions

View File

@ -302,6 +302,7 @@ class Building(CityObject):
"""
number_of_storeys, height = self._calculate_number_storeys_and_height(self.average_storey_height, self.eave_height,
self.storeys_above_ground)
number_of_storeys = 1
if number_of_storeys == 0:
raise Exception(f'Number of storeys cannot be 0')

View File

@ -52,7 +52,7 @@
<window_ratio units="-">0.38</window_ratio>
<window>4</window>
</construction>
<construction id="18" type="interior slab">
<construction id="18" type="exterior slab">
<window_ratio units="-">0</window_ratio>
<window/>
</construction>
@ -259,7 +259,7 @@
<window_ratio units="-">0.3</window_ratio>
<window>4</window>
</construction>
<construction id="18" type="interior slab">
<construction id="18" type="exterior slab">
<window_ratio units="-">0</window_ratio>
<window/>
</construction>
@ -443,7 +443,7 @@
<window_ratio units="-">0.38</window_ratio>
<window>3</window>
</construction>
<construction id="1" type="interior slab">
<construction id="1" type="exterior slab">
<window_ratio units="-">0</window_ratio>
<window/>
</construction>
@ -650,7 +650,7 @@
<window_ratio units="-">0.3</window_ratio>
<window>3</window>
</construction>
<construction id="1" type="interior slab">
<construction id="1" type="exterior slab">
<window_ratio units="-">0</window_ratio>
<window/>
</construction>

View File

@ -0,0 +1,53 @@
"""
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'
base_path = (Path(__file__).parent.parent / 'data' / 'weather').resolve()
weather_file_name = 'CAN_PQ_Montreal.Intl.AP.716270_CWEC.epw'
city = self._get_citygml(file)
for building in city.buildings:
for tz in building.thermal_zones:
for tb in tz.bounded:
tb.hi = 10
tb.he = 25
for opening in tb.thermal_openings:
opening.hi = 10
opening.he = 25
building.function = 'residential'
ConstructionFactory('nrel', city).enrich()
for building in city.buildings:
print(building.name, building.function, len(building.surfaces))
print(building.volume)
WeatherFactory('epw', city, base_path=base_path, file_name=weather_file_name).enrich()
#ExportsFactory('idf', city, 'c:\Documents\idf').export()