This commit is contained in:
Guille Gutierrez 2024-10-29 21:52:38 +01:00
parent 6020964899
commit ddf4631c59
2 changed files with 12 additions and 11 deletions

View File

@ -1,4 +1,5 @@
import logging
from copy import copy
import hub.exports.building_energy.idf_helper as idf_cte
import hub.helpers.constants as cte
@ -6,7 +7,6 @@ from hub.exports.building_energy.idf_helper.idf_base import IdfBase
class IdfWindow(IdfBase):
@staticmethod
def _to_window_surface(self, surface):
window_ratio = surface.associated_thermal_boundaries[0].window_ratio
@ -20,14 +20,18 @@ class IdfWindow(IdfBase):
distance = (max_z - min_z) * window_ratio
new_max_z = middle + distance / 2
new_min_z = middle - distance / 2
window_coordinates = []
for index, coordinate in enumerate(coordinates):
if coordinate[z] == max_z:
coordinates[index] = (coordinate[x], coordinate[y], new_max_z)
new_coordinate = (coordinate[x], coordinate[y], new_max_z)
elif coordinate[z] == min_z:
coordinates[index] = (coordinate[x], coordinate[y], new_min_z)
new_coordinate = (coordinate[x], coordinate[y], new_min_z)
else:
logging.warning('Z coordinate not in top or bottom during window creation')
return coordinates
new_coordinate = (coordinate[x], coordinate[y], coordinate[z])
logging.info('error')
window_coordinates.insert(0, new_coordinate) # store in inverted order
return window_coordinates
@staticmethod
def add(self, building):

View File

@ -128,31 +128,28 @@ class TestExports(TestCase):
"""
export to IDF
"""
file = '1588_v1.geojson'
# file = 'test.geojson'
# file = '1588_v1.geojson'
file = 'test.geojson'
file_path = (self._example_path / file).resolve()
"""
city = GeometryFactory('geojson',
path=file_path,
height_field='citygml_me',
year_of_construction_field='ANNEE_CONS',
function_field='CODE_UTILI',
function_to_hub=Dictionaries().montreal_function_to_hub_function).city
"""
"""=-043
"name": "01043081",
"address": "avenue de l' H\u00f4tel-de-Ville (MTL) 3751",
"function": "6911",
"height": 21,
"year_of_construction": 1964,
"""
city = GeometryFactory('geojson',
path=file_path,
height_field='height',
year_of_construction_field='year_of_construction',
function_field='function',
function_to_hub=Dictionaries().montreal_function_to_hub_function).city
# """
"""
self.assertIsNotNone(city, 'city is none')
#EnergyBuildingsExportsFactory('idf', city, self._output_path).export()
ConstructionFactory('nrcan', city).enrich()