2021-03-16 20:14:40 -04:00
|
|
|
"""
|
|
|
|
ExportsFactory export a city into several formats
|
|
|
|
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 guillermo.gutierrezmorote@concordia.ca
|
2021-03-16 20:14:40 -04:00
|
|
|
"""
|
2021-08-26 13:27:43 -04:00
|
|
|
|
2021-03-16 20:14:40 -04:00
|
|
|
import uuid
|
2021-03-26 12:53:27 -04:00
|
|
|
import datetime
|
2021-03-17 09:23:48 -04:00
|
|
|
from pathlib import Path
|
2021-08-26 13:27:43 -04:00
|
|
|
import xmltodict
|
2021-05-25 13:34:57 -04:00
|
|
|
import helpers.constants as cte
|
2021-03-16 20:14:40 -04:00
|
|
|
|
|
|
|
|
|
|
|
class EnergyAde:
|
2021-08-26 13:27:43 -04:00
|
|
|
"""
|
|
|
|
Export the city to citygml + energy ade
|
|
|
|
"""
|
2021-03-16 20:14:40 -04:00
|
|
|
def __init__(self, city, path):
|
|
|
|
self._city = city
|
|
|
|
self._path = path
|
2021-04-01 09:25:39 -04:00
|
|
|
self._surface_members = None
|
2021-03-16 20:14:40 -04:00
|
|
|
self._export()
|
|
|
|
|
|
|
|
def _export(self):
|
|
|
|
energy_ade = {
|
|
|
|
'core:CityModel': {
|
2021-08-26 13:27:43 -04:00
|
|
|
'@xmlns:brid': 'http://www.opengis.net/citygml/bridge/2.0',
|
|
|
|
'@xmlns:tran': 'http://www.opengis.net/citygml/transportation/2.0',
|
|
|
|
'@xmlns:frn': 'http://www.opengis.net/citygml/cityfurniture/2.0',
|
|
|
|
'@xmlns:wtr': 'http://www.opengis.net/citygml/waterbody/2.0',
|
|
|
|
'@xmlns:sch': 'http://www.ascc.net/xml/schematron',
|
|
|
|
'@xmlns:veg': 'http://www.opengis.net/citygml/vegetation/2.0',
|
|
|
|
'@xmlns:xlink': 'http://www.w3.org/1999/xlink',
|
|
|
|
'@xmlns:tun': 'http://www.opengis.net/citygml/tunnel/2.0',
|
|
|
|
'@xmlns:tex': 'http://www.opengis.net/citygml/texturedsurface/2.0',
|
|
|
|
'@xmlns:gml': 'http://www.opengis.net/gml',
|
|
|
|
'@xmlns:genobj': 'http://www.opengis.net/citygml/generics/2.0',
|
|
|
|
'@xmlns:dem': 'http://www.opengis.net/citygml/relief/2.0',
|
|
|
|
'@xmlns:app': 'http://www.opengis.net/citygml/appearance/2.0',
|
|
|
|
'@xmlns:luse': 'http://www.opengis.net/citygml/landuse/2.0',
|
|
|
|
'@xmlns:xAL': 'urn:oasis:names:tc:ciq:xsdschema:xAL:2.0',
|
|
|
|
'@xmlns:xsi': 'http://www.w3.org/2001/XMLSchema-instance',
|
|
|
|
'@xmlns:smil20lang': 'http://www.w3.org/2001/SMIL20/Language',
|
|
|
|
'@xmlns:pbase': 'http://www.opengis.net/citygml/profiles/base/2.0',
|
2021-03-16 20:14:40 -04:00
|
|
|
'@xmlns:smil20': 'http://www.w3.org/2001/SMIL20/',
|
2021-08-26 13:27:43 -04:00
|
|
|
'@xmlns:bldg': 'http://www.opengis.net/citygml/building/2.0',
|
2021-03-26 12:53:27 -04:00
|
|
|
'@xmlns:energy': "http://www.sig3d.org/citygml/2.0/energy/1.0",
|
2021-08-26 13:27:43 -04:00
|
|
|
'@xmlns:core': 'http://www.opengis.net/citygml/2.0',
|
|
|
|
'@xmlns:grp': 'http://www.opengis.net/citygml/cityobjectgroup/2.0',
|
2021-03-16 20:14:40 -04:00
|
|
|
'gml:boundedBy': {
|
|
|
|
'gml:Envelope': {
|
|
|
|
'@srsName': self._city.srs_name,
|
|
|
|
'@srsDimension': 3,
|
|
|
|
'gml:lowerCorner': ' '.join([str(e) for e in self._city.lower_corner]),
|
|
|
|
'gml:upperCorner': ' '.join([str(e) for e in self._city.upper_corner])
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
buildings = []
|
|
|
|
for building in self._city.buildings:
|
|
|
|
building_dic = {
|
|
|
|
'bldg:Building': {
|
2021-03-26 12:53:27 -04:00
|
|
|
'@gml:id': building.name,
|
|
|
|
'gml:description': f'Building {building.name} at {self._city.name}',
|
|
|
|
'gml:name': f'{building.name}',
|
|
|
|
'core:creationDate': datetime.datetime.now().strftime('%Y-%m-%d')
|
2021-03-16 20:14:40 -04:00
|
|
|
}
|
|
|
|
}
|
2021-03-25 09:11:30 -04:00
|
|
|
building_dic = EnergyAde._measures(building, building_dic)
|
2021-04-01 09:25:39 -04:00
|
|
|
building_dic = self._building_geometry(building, building_dic, self._city)
|
2021-03-26 12:53:27 -04:00
|
|
|
building_dic['bldg:Building']['energy:volume'] = {
|
|
|
|
'energy:VolumeType': {
|
2021-08-26 13:27:43 -04:00
|
|
|
'energy:type': 'grossVolume',
|
2021-03-26 12:53:27 -04:00
|
|
|
'energy:value': {
|
|
|
|
'@uom': 'm3',
|
|
|
|
'energy:value': building.volume
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
building_dic['bldg:Building']['energy:referencePoint'] = {
|
|
|
|
'gml:Point': {
|
|
|
|
'@srsName': self._city.srs_name,
|
|
|
|
'@gml:id': f'GML_{uuid.uuid4()}',
|
2021-08-26 13:27:43 -04:00
|
|
|
'gml:Pos': f'{" ".join(map(str, building.centroid))}'
|
2021-03-26 12:53:27 -04:00
|
|
|
}
|
|
|
|
}
|
2021-08-26 13:27:43 -04:00
|
|
|
building_dic['bldg:Building']['energy:thermalZone'] = self._thermal_zones(building, self._city)
|
2021-03-16 20:14:40 -04:00
|
|
|
buildings.append(building_dic)
|
|
|
|
|
2021-03-17 09:23:48 -04:00
|
|
|
energy_ade['core:CityModel']['core:cityObjectMember'] = buildings
|
2021-04-07 11:46:44 -04:00
|
|
|
|
2021-03-17 09:23:48 -04:00
|
|
|
file_name = self._city.name + '_ade.gml'
|
|
|
|
file_path = Path(self._path / file_name).resolve()
|
2021-08-26 13:27:43 -04:00
|
|
|
with open(file_path, 'w') as file:
|
|
|
|
file.write(xmltodict.unparse(energy_ade, pretty=True, short_empty_elements=True))
|
2021-03-16 20:14:40 -04:00
|
|
|
|
|
|
|
@staticmethod
|
2021-03-25 09:11:30 -04:00
|
|
|
def _measures(building, building_dic):
|
2021-08-26 13:27:43 -04:00
|
|
|
# todo: this method is only for year and insel need to be generalized
|
2021-03-16 20:14:40 -04:00
|
|
|
measures = []
|
2021-05-25 13:34:57 -04:00
|
|
|
measure = EnergyAde._measure(building.heating, cte.YEAR, 'Energy demand heating', 'INSEL')
|
2021-03-16 20:14:40 -04:00
|
|
|
if measure is not None:
|
|
|
|
measures.append(measure)
|
2021-05-25 13:34:57 -04:00
|
|
|
measure = EnergyAde._measure(building.cooling, cte.YEAR, 'Energy demand cooling', 'INSEL')
|
2021-03-16 20:14:40 -04:00
|
|
|
if measure is not None:
|
|
|
|
measures.append(measure)
|
|
|
|
if len(measures) != 0:
|
2021-03-26 12:53:27 -04:00
|
|
|
building_dic['bldg:Building']['genobj:measureAttribute'] = measures
|
2021-03-16 20:14:40 -04:00
|
|
|
|
2021-03-26 12:53:27 -04:00
|
|
|
demands = []
|
2021-03-16 20:14:40 -04:00
|
|
|
for key in building.heating:
|
2021-05-25 13:34:57 -04:00
|
|
|
if key != cte.YEAR:
|
2021-03-26 12:53:27 -04:00
|
|
|
demand = EnergyAde._demand(building.heating, key, 'Heating energy', 'INSEL')
|
|
|
|
demands.append(demand)
|
2021-03-16 20:14:40 -04:00
|
|
|
|
|
|
|
for key in building.cooling:
|
2021-05-25 13:34:57 -04:00
|
|
|
if key != cte.YEAR:
|
2021-03-26 12:53:27 -04:00
|
|
|
demand = EnergyAde._demand(building.cooling, key, 'Cooling energy', 'INSEL')
|
|
|
|
demands.append(demand)
|
|
|
|
if len(demands) != 0:
|
|
|
|
building_dic['bldg:Building']['energy:demands'] = demands
|
2021-03-16 20:14:40 -04:00
|
|
|
|
|
|
|
return building_dic
|
|
|
|
|
|
|
|
@staticmethod
|
2021-03-25 09:11:30 -04:00
|
|
|
def _measure(measure_dict, key_value, name, source):
|
2021-03-16 20:14:40 -04:00
|
|
|
measure = None
|
|
|
|
if key_value in measure_dict:
|
|
|
|
measure = {
|
|
|
|
'@name': name,
|
|
|
|
'genobj:value': {
|
2021-08-26 13:27:43 -04:00
|
|
|
'@uom': 'kWh',
|
|
|
|
'#text': ' '.join([str(e / 1000) for e in measure_dict[key_value][source]])
|
2021-03-16 20:14:40 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return measure
|
|
|
|
|
|
|
|
@staticmethod
|
2021-03-26 12:53:27 -04:00
|
|
|
def _demand(measure_dict, key_value, description, source):
|
|
|
|
demand = {
|
|
|
|
'energy:EnergyDemand': {
|
|
|
|
'@gml:id': f'GML_{uuid.uuid4()}',
|
|
|
|
'energy:energyAmount': {
|
|
|
|
'energy:RegularTimeSeries': {
|
|
|
|
'energy:variableProperties': {
|
|
|
|
'energy:TimeValuesProperties': {
|
|
|
|
'energy:acquisitionMethod': 'simulation',
|
|
|
|
'energy:source': source,
|
|
|
|
'energy:thematicDescription': description,
|
|
|
|
},
|
|
|
|
'energy:timeInterval': {
|
|
|
|
'@unit': key_value,
|
|
|
|
'#text': '1',
|
|
|
|
},
|
|
|
|
'energy:values': {
|
|
|
|
'@uom': 'kWh',
|
|
|
|
'#text': ' '.join([str(float(e) / 1000) for e in measure_dict[key_value][source]])
|
|
|
|
}
|
2021-03-16 20:14:40 -04:00
|
|
|
}
|
|
|
|
}
|
2021-03-26 12:53:27 -04:00
|
|
|
},
|
|
|
|
'energy:endUse': 'spaceHeating'
|
2021-03-16 20:14:40 -04:00
|
|
|
}
|
|
|
|
}
|
2021-03-26 12:53:27 -04:00
|
|
|
return demand
|
2021-03-25 09:11:30 -04:00
|
|
|
|
2021-04-01 09:25:39 -04:00
|
|
|
def _building_geometry(self, building, building_dic, city):
|
2021-03-25 09:11:30 -04:00
|
|
|
|
2021-03-26 12:53:27 -04:00
|
|
|
building_dic['bldg:Building']['bldg:function'] = building.function
|
2022-12-06 15:28:59 -05:00
|
|
|
building_dic['bldg:Building']['bldg:usage'] = ', '.join([u.name for u in building.usages])
|
2021-03-26 12:53:27 -04:00
|
|
|
building_dic['bldg:Building']['bldg:yearOfConstruction'] = building.year_of_construction
|
|
|
|
building_dic['bldg:Building']['bldg:roofType'] = building.roof_type
|
|
|
|
building_dic['bldg:Building']['bldg:measuredHeight'] = {
|
2021-03-25 09:11:30 -04:00
|
|
|
'@uom': 'm',
|
|
|
|
'#text': f'{building.max_height}'
|
|
|
|
}
|
2021-03-26 12:53:27 -04:00
|
|
|
building_dic['bldg:Building']['bldg:storeysAboveGround'] = building.storeys_above_ground
|
2021-04-07 11:46:44 -04:00
|
|
|
|
2021-03-25 09:11:30 -04:00
|
|
|
if building.lod == 1:
|
2021-04-01 09:25:39 -04:00
|
|
|
building_dic = self._lod1(building, building_dic, city)
|
2021-03-25 09:11:30 -04:00
|
|
|
elif building.lod == 2:
|
2021-04-01 09:25:39 -04:00
|
|
|
building_dic = self._lod2(building, building_dic, city)
|
2021-03-25 09:11:30 -04:00
|
|
|
else:
|
|
|
|
raise NotImplementedError('Only lod 1 and 2 can be exported')
|
|
|
|
return building_dic
|
|
|
|
|
2021-04-01 09:25:39 -04:00
|
|
|
def _lod1(self, building, building_dic, city):
|
2021-03-25 09:11:30 -04:00
|
|
|
raise NotImplementedError('Only lod 1 and 2 can be exported')
|
2021-04-01 09:25:39 -04:00
|
|
|
|
|
|
|
def _lod2(self, building, building_dic, city):
|
|
|
|
self._surface_members = []
|
2021-03-25 09:11:30 -04:00
|
|
|
boundaries = [{
|
|
|
|
'gml:Envelope': {
|
2021-08-26 13:27:43 -04:00
|
|
|
'@srsName': city.srs_name,
|
|
|
|
'@srsDimension': 3,
|
|
|
|
'gml:lowerCorner': ' '.join([str(e) for e in city.lower_corner]),
|
|
|
|
'gml:upperCorner': ' '.join([str(e) for e in city.upper_corner])
|
|
|
|
}}]
|
2021-03-25 09:11:30 -04:00
|
|
|
for surface in building.surfaces:
|
2021-08-26 13:27:43 -04:00
|
|
|
surface_member = {'@xlink:href': f'#PolyId{surface.name}'}
|
2021-04-01 09:25:39 -04:00
|
|
|
self._surface_members.append(surface_member)
|
2021-03-25 09:11:30 -04:00
|
|
|
if surface.type == 'Wall':
|
|
|
|
surface_type = 'bldg:WallSurface'
|
|
|
|
elif surface.type == 'Ground':
|
|
|
|
surface_type = 'bldg:GroundSurface'
|
|
|
|
else:
|
|
|
|
surface_type = 'bldg:RoofSurface'
|
|
|
|
surface_dic = {
|
2021-08-26 13:27:43 -04:00
|
|
|
surface_type: {
|
2021-03-25 09:11:30 -04:00
|
|
|
'@gml:id': f'GML_{uuid.uuid4()}',
|
|
|
|
'gml:name': f'{surface.name} ({surface.type})',
|
|
|
|
'gml:boundedBy': {
|
|
|
|
'gml:Envelope': {
|
|
|
|
'@srsName': city.srs_name,
|
2021-06-09 14:23:45 -04:00
|
|
|
'gml:lowerCorner': f'{surface.lower_corner[0]} {surface.lower_corner[1]}'
|
|
|
|
f' {surface.lower_corner[2]}',
|
|
|
|
'gml:upperCorner': f'{surface.upper_corner[0]} {surface.upper_corner[1]}'
|
|
|
|
f' {surface.upper_corner[2]}'
|
2021-03-25 09:11:30 -04:00
|
|
|
}
|
|
|
|
},
|
|
|
|
'bldg:lod2MultiSurface': {
|
|
|
|
'gml:MultiSurface': {
|
|
|
|
'@srsName': city.srs_name,
|
|
|
|
'@gml:id': f'GML_{uuid.uuid4()}',
|
|
|
|
'surfaceMember': {
|
|
|
|
'gml:Polygon': {
|
|
|
|
'@srsName': city.srs_name,
|
2021-03-26 12:53:27 -04:00
|
|
|
'@gml:id': f'PolyId{surface.name}',
|
2021-03-25 09:11:30 -04:00
|
|
|
'gml:exterior': {
|
|
|
|
'gml:LinearRing': {
|
2021-03-26 12:53:27 -04:00
|
|
|
'@gml:id': f'PolyId{surface.name}_0',
|
2021-03-25 09:11:30 -04:00
|
|
|
'gml:posList': {
|
|
|
|
'@srsDimension': '3',
|
2021-06-22 13:16:17 -04:00
|
|
|
'@count': len(surface.solid_polygon.coordinates) + 1,
|
2021-04-01 15:51:09 -04:00
|
|
|
'#text': f'{" ".join(map(str, surface.solid_polygon.points_list))} '
|
2021-06-22 13:16:17 -04:00
|
|
|
f'{" ".join(map(str, surface.solid_polygon.coordinates[0]))}'
|
2021-03-25 09:11:30 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
boundaries.append(surface_dic)
|
2021-03-26 12:53:27 -04:00
|
|
|
building_dic['bldg:Building']['bldg:lod2Solid'] = {
|
2021-03-25 09:11:30 -04:00
|
|
|
'gml:Solid': {
|
|
|
|
'@gml:id': f'GML_{uuid.uuid4()}',
|
|
|
|
'gml:exterior': {
|
|
|
|
'gml:CompositeSurface': {
|
|
|
|
'@srsName': city.srs_name,
|
|
|
|
'@gml:id': f'GML_{uuid.uuid4()}',
|
2021-04-01 09:25:39 -04:00
|
|
|
'gml:surfaceMember': self._surface_members
|
2021-03-25 09:11:30 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-03-26 12:53:27 -04:00
|
|
|
building_dic['bldg:Building']['gml:boundedBy'] = boundaries
|
|
|
|
return building_dic
|
|
|
|
|
2021-04-01 09:25:39 -04:00
|
|
|
def _thermal_zones(self, building, city):
|
2021-03-26 12:53:27 -04:00
|
|
|
thermal_zones = []
|
|
|
|
for index, thermal_zone in enumerate(building.thermal_zones):
|
|
|
|
usage_zones = []
|
2022-12-06 15:28:59 -05:00
|
|
|
for usage_zone in thermal_zone.usages:
|
2021-03-26 12:53:27 -04:00
|
|
|
usage_zones.append({'@xlink:href': f'#GML_{usage_zone.id}'})
|
|
|
|
thermal_zone_dic = {
|
|
|
|
'energy:ThermalZone': {
|
|
|
|
'@gml:id': f'GML_{thermal_zone.id}',
|
|
|
|
'gml:name': f'Thermal zone {index} in {building.name} building',
|
|
|
|
'energy:contains': [],
|
|
|
|
'energy:floorArea': {
|
2021-08-26 13:27:43 -04:00
|
|
|
'energy:FloorArea': {
|
2021-03-26 12:53:27 -04:00
|
|
|
'energy:type': 'grossFloorArea',
|
|
|
|
'energy:value': {
|
|
|
|
'@uom': 'm2',
|
2022-04-26 18:39:42 -04:00
|
|
|
'#text': f'{thermal_zone.footprint_area}'
|
2021-03-26 12:53:27 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
'energy:volume': {
|
|
|
|
'energy:VolumeType': {
|
|
|
|
'energy:type': 'grossVolume',
|
|
|
|
'energy:value': {
|
|
|
|
'@uom': 'm3',
|
2021-08-26 13:27:43 -04:00
|
|
|
# todo: for now we have just one thermal zone, therefore is the building volume, this need to be changed
|
2021-03-26 12:53:27 -04:00
|
|
|
'#text': f'{building.volume}'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
'energy:isCooled': f'{thermal_zone.is_cooled}',
|
|
|
|
'energy:isHeated': f'{thermal_zone.is_heated}',
|
2021-04-01 09:25:39 -04:00
|
|
|
'energy:volumeGeometry': {
|
|
|
|
'gml:Solid': {
|
|
|
|
'@gml:id': f'GML_{uuid.uuid4()}',
|
|
|
|
'gml:exterior': {
|
|
|
|
'gml:CompositeSurface': {
|
|
|
|
'@srsName': f'{city.srs_name}',
|
|
|
|
'@gml:id': f'GML_{uuid.uuid4()}',
|
|
|
|
'gml:surfaceMember': self._surface_members
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
'energy:boundedBy': self._thermal_boundaries(city, thermal_zone)
|
2021-03-26 12:53:27 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
thermal_zone_dic['energy:ThermalZone']['energy:contains'] = usage_zones
|
|
|
|
thermal_zones.append(thermal_zone_dic)
|
2021-04-01 09:25:39 -04:00
|
|
|
return thermal_zones
|
|
|
|
|
|
|
|
def _thermal_boundaries(self, city, thermal_zone):
|
|
|
|
thermal_boundaries = []
|
2021-08-26 11:00:59 -04:00
|
|
|
for thermal_boundary in thermal_zone.thermal_boundaries:
|
2021-04-01 09:25:39 -04:00
|
|
|
thermal_boundary_dic = {
|
|
|
|
'@gml:id': f'GML_{uuid.uuid4()}',
|
|
|
|
'gml:name': f'{thermal_boundary.construction_name}',
|
|
|
|
'energy:thermalBoundaryType': thermal_boundary.type,
|
|
|
|
'energy:azumuth': {
|
|
|
|
'@uom': 'rad',
|
|
|
|
'#text': f'{thermal_boundary.azimuth}'
|
|
|
|
},
|
|
|
|
'energy:inclination': {
|
|
|
|
'@uom': 'rad',
|
|
|
|
'#text': f'{thermal_boundary.inclination}'
|
|
|
|
},
|
|
|
|
'energy:area': {
|
|
|
|
'@uom': 'm2',
|
2022-03-08 19:19:52 -05:00
|
|
|
'#text': f'{thermal_boundary.opaque_area}'
|
2021-04-01 09:25:39 -04:00
|
|
|
},
|
|
|
|
'energy:surfaceGeometry': {
|
|
|
|
'gml:MultiSurface': {
|
|
|
|
'@srsName': city.srs_name,
|
|
|
|
'@gml:id': f'GML_{uuid.uuid4()}',
|
|
|
|
'gml:surfaceMember': {
|
|
|
|
'gml:Polygon': {
|
|
|
|
'@srsName': city.srs_name,
|
|
|
|
'@gml:id': f'GML_{uuid.uuid4()}',
|
|
|
|
'gml:exterior': {
|
|
|
|
'gml:LinearRing': {
|
|
|
|
'@gml:id': f'GML_{uuid.uuid4()}',
|
|
|
|
'gml:posList': {
|
|
|
|
'@srsDimension': '3',
|
2021-06-22 13:16:17 -04:00
|
|
|
'@count': len(thermal_boundary.surface.solid_polygon.coordinates) + 1,
|
2021-04-01 15:51:09 -04:00
|
|
|
'#text': f'{" ".join(map(str, thermal_boundary.surface.solid_polygon.points_list))} '
|
2021-06-22 13:16:17 -04:00
|
|
|
f'{" ".join(map(str, thermal_boundary.surface.solid_polygon.coordinates[0]))}'
|
2021-04-01 09:25:39 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-04-07 14:33:08 -04:00
|
|
|
construction = []
|
|
|
|
opening_construction = []
|
2021-04-01 10:35:22 -04:00
|
|
|
if thermal_boundary.layers is not None:
|
2021-04-07 14:33:08 -04:00
|
|
|
construction.append(uuid.uuid4())
|
2021-04-06 18:06:19 -04:00
|
|
|
thermal_boundary_dic['energy:construction'] = {
|
2021-04-07 14:33:08 -04:00
|
|
|
'@xlink:href': f'#GML_{construction[0]}'
|
2021-04-06 18:06:19 -04:00
|
|
|
}
|
2021-04-01 10:35:22 -04:00
|
|
|
if thermal_boundary.thermal_openings is not None:
|
2021-04-06 18:06:19 -04:00
|
|
|
for opening in thermal_boundary.thermal_openings:
|
2021-04-07 14:33:08 -04:00
|
|
|
opening_construction.append(uuid.uuid4())
|
2021-04-06 18:06:19 -04:00
|
|
|
thermal_boundary_dic['energy:contains'] = {
|
|
|
|
'energy:ThermalOpening': {
|
|
|
|
'@gml:id': f'GML_{uuid.uuid4()}',
|
|
|
|
'energy:construction': f'#GML_{opening_construction}',
|
2021-04-07 14:33:08 -04:00
|
|
|
'energy:surfaceGeometry': {
|
|
|
|
|
2021-08-26 13:27:43 -04:00
|
|
|
}
|
2021-04-06 18:06:19 -04:00
|
|
|
}
|
2021-04-07 14:33:08 -04:00
|
|
|
}
|
2021-04-01 09:25:39 -04:00
|
|
|
thermal_boundaries.append(thermal_boundary_dic)
|
2021-08-26 13:27:43 -04:00
|
|
|
return thermal_boundaries
|