In building.py: added property storeys and corrected two bugs. In city_object.py, added property polyhedron. In polyhedron.py added documentation. In test_geometry_factory.py added new unittest test_divide_mesh_by_plane.

This commit is contained in:
Pilar 2021-03-01 16:42:03 -05:00
parent 2ef357b5d9
commit 090e70a3d0
12 changed files with 389 additions and 315 deletions

View File

@ -21,6 +21,7 @@ class Polyhedron:
self._surfaces = list(surfaces)
self._polygons = [s.polygon for s in surfaces]
self._polyhedron = None
self._triangulated_polyhedron = None
self._volume = None
self._faces = None
self._vertices = None
@ -68,6 +69,11 @@ class Polyhedron:
return coordinates[0], coordinates[1], coordinates[2]
def _triangulate(self, surface):
"""
triangulates a polygon following the ear clipping methodology
:param surface: surface
:return: list[triangles]
"""
points_list = surface.points_list
normal = surface.normal
# are points concave or convex?
@ -116,6 +122,19 @@ class Polyhedron:
def _if_concave_change_status(self, normal, points_list, convex_point, total_points_list,
concave_points, convex_points, point_in_list):
"""
checks whether an convex specific point change its status to concave after removing one ear in the polygon
returning the new convex and concave points lists together with a flag advising that the list of total points
already 3 and, therefore, the triangulation must be finished.
:param normal: normal
:param points_list: points_list
:param convex_point: int
:param total_points_list: [point]
:param concave_points: [point]
:param convex_points: [point]
:param point_in_list: int
:return: list[points], list[points], boolean
"""
end_loop = False
point = points_list[point_in_list * 3:(point_in_list + 1) * 3]
pointer = total_points_list.index(point_in_list) - 1
@ -140,6 +159,13 @@ class Polyhedron:
return concave_points, convex_points, end_loop
def _starting_lists(self, points_list, normal):
"""
creates the list of vertices (points) that define the polygon (total_points_list), together with other two lists
separating points between convex and concave
:param points_list: points_list
:param normal: normal
:return: list[point], list[point], list[point]
"""
concave_points = []
convex_points = []
# lists of concave and convex points
@ -178,6 +204,14 @@ class Polyhedron:
@staticmethod
def _point_is_concave(normal, point, previous_point, next_point) -> bool:
"""
returns whether a point is concave
:param normal: normal
:param point: point
:param previous_point: point
:param next_point: point
:return: boolean
"""
is_concave = False
accepted_error = 0.1
points = ' '.join(str(e) for e in [*previous_point[:], *point[:], *next_point[:]])
@ -190,6 +224,13 @@ class Polyhedron:
return is_concave
def _triangle(self, points_list, total_points_list, point_position):
"""
creates a triangular polygon out of three points
:param points_list: points_list
:param total_points_list: [point]
:param point_position: int
:return: polygon
"""
index = point_position * 3
previous_point_index, next_point_index = self._enveloping_points_indices(point_position, total_points_list)
points = ' '.join(str(e) for e in [*points_list[previous_point_index:previous_point_index + 3],
@ -200,6 +241,13 @@ class Polyhedron:
@staticmethod
def _enveloping_points_indices(point_position, total_points_list):
"""
due to the fact that the lists are not circular, a method to find the previous and next points
of an specific one is needed
:param point_position: int
:param total_points_list: [point]
:return: int, int
"""
previous_point_index = None
next_point_index = None
if point_position == total_points_list[0]:
@ -216,6 +264,13 @@ class Polyhedron:
@staticmethod
def _enveloping_points(point_to_remove, total_points_list):
"""
due to the fact that the lists are not circular, a method to find the previous and next points
of an specific one is needed
:param point_to_remove: point
:param total_points_list: [point]
:return: point, point
"""
index = total_points_list.index(point_to_remove)
if index == 0:
previous_point_in_list = total_points_list[len(total_points_list) - 1]
@ -228,9 +283,14 @@ class Polyhedron:
next_point_in_list = total_points_list[index + 1]
return previous_point_in_list, next_point_in_list
@staticmethod
def _is_ear(ear, points) -> bool:
"""
finds whether a triangle is an ear of the polygon
:param ear: surface
:param points: [point]
:return: boolean
"""
area_ear = ear.area
for point in points:
area_points = 0
@ -256,7 +316,7 @@ class Polyhedron:
def faces(self) -> [[int]]:
"""
Polyhedron faces
Polyhedron triangular faces
:return: [[int]]
"""
@ -284,7 +344,7 @@ class Polyhedron:
return self._faces
@property
def _polyhedron_mesh(self):
def polyhedron_trimesh(self):
if self._mesh is None:
self._mesh = Trimesh(vertices=self.vertices, faces=self.faces)
return self._mesh
@ -296,10 +356,10 @@ class Polyhedron:
:return: float
"""
if self._volume is None:
if not self._polyhedron_mesh.is_volume:
if not self.polyhedron_trimesh.is_volume:
self._volume = np.inf
else:
self._volume = self._polyhedron_mesh.volume
self._volume = self.polyhedron_trimesh.volume
return self._volume
@property
@ -402,7 +462,7 @@ class Polyhedron:
:param full_path: str
:return: None
"""
self._polyhedron_mesh.export(full_path, 'stl_ascii')
self.polyhedron_trimesh.export(full_path, 'stl_ascii')
def obj_export(self, full_path):
"""
@ -410,7 +470,7 @@ class Polyhedron:
:param full_path: str
:return: None
"""
self._polyhedron_mesh.export(full_path, 'obj')
self.polyhedron_trimesh.export(full_path, 'obj')
def show(self):
self._polyhedron_mesh.show()
self.polyhedron_trimesh.show()

View File

@ -13,7 +13,7 @@ class UsageZone:
"""
UsageZone class
"""
def __init__(self, min_air_change):
def __init__(self):
self._usage = None
self._internal_gains = None
self._heating_setpoint = None
@ -25,9 +25,7 @@ class UsageZone:
self._dhw_average_volume_pers_day = None
self._dhw_preparation_temperature = None
self._electrical_app_average_consumption_sqm_year = None
# todo: mechanical_air_change must come from library, talk to Rabeeh
# todo: check to clean code and un-used attributes
self._mechanical_air_change = min_air_change
self._mechanical_air_change = None
self._occupancy = None
self._schedules = None
self._heating_schedule = None

View File

@ -19,6 +19,7 @@ from city_model_structure.attributes.thermal_zone import ThermalZone
from city_model_structure.attributes.usage_zone import UsageZone
from city_model_structure.city_object import CityObject
from city_model_structure.building_unit import BuildingUnit
from helpers.geometry_helper import GeometryHelper as gh
class Building(CityObject):
@ -33,6 +34,7 @@ class Building(CityObject):
self._terrains = terrains
self._year_of_construction = year_of_construction
self._function = function
# todo: this name is not clear. Is it lower corner of the building or lower corner of te city??
self._lower_corner = lower_corner
self._heated = heated
self._cooled = cooled
@ -53,7 +55,7 @@ class Building(CityObject):
# ToDo: Check this for LOD4
self._thermal_zones = []
if self.lod < 8:
if self.lod < 4:
# for lod under 4 is just one thermal zone
self._thermal_zones.append(ThermalZone(self.surfaces, self._heated, self._cooled))
@ -125,7 +127,7 @@ class Building(CityObject):
:param value: Boolean
:return: None
"""
self._attic_heated = value
self._basement_heated = value
@property
def name(self):
@ -376,3 +378,25 @@ class Building(CityObject):
:param value: dict{DataFrame(float)}
"""
self._beam = value
@property
def storeys(self):
storeys = []
# todo: these values are not read yet from the files
# number_of_storeys = self.storeys_above_ground
# height = self.average_storey_height
number_of_storeys = 4
height = 1.5
mesh = self.polyhedron.polyhedron_trimesh
normal_plane = [0, 0, -1]
rest_mesh = mesh
for n in range(0, number_of_storeys - 1):
# todo: I need the lower corner of the building!!
# point_plane = [self._lower_corner[0], self._lower_corner[1], self._lower_corner[2] + height]
point_plane = [self._lower_corner[0] + 0.5, self._lower_corner[1] + 0.5, self._lower_corner[2] + height * (n + 1)]
meshes = gh.divide_mesh_by_plane(rest_mesh, normal_plane, point_plane)
storey = meshes[0]
rest_mesh = meshes[1]
storeys.append(storey)
storeys.append(rest_mesh)
return storeys

View File

@ -8,6 +8,7 @@ from typing import List, Union
from city_model_structure.attributes.surface import Surface
from helpers.geometry_helper import GeometryHelper
from city_model_structure.attributes.polyhedron import Polyhedron
import math
class CityObject:
@ -27,7 +28,8 @@ class CityObject:
City object level of detail 1, 2, 3 or 4
:return: int
"""
return self._lod
lod = math.log(self._lod, 2) + 1
return lod
@property
def volume(self):
@ -35,9 +37,17 @@ class CityObject:
City object volume in cubic meters
:return: float
"""
return self.polyhedron.volume
@property
def polyhedron(self):
"""
City object polyhedron
:return: Polyhedron
"""
if self._polyhedron is None:
self._polyhedron = Polyhedron(self.surfaces)
return self._polyhedron.volume
return self._polyhedron
@property
def surfaces(self) -> List[Surface]:

View File

@ -1,171 +1,147 @@
<?xml version="1.0" encoding="utf-8"?>
<archetypes reference_library_building_type="us_library" >
<archetypes reference_library_building_type="us_library">
<archetype id="1" function="residential" periodOfConstruction="2011-2020">
<constructions>
<construction id="1" type="roof" >
</construction>
<construction id="9" type="wall" >
<window_ratio units="-">0.11</window_ratio>
<construction id="1" type="roof"/>
<construction id="9" type="wall">
<window_ratio units="-">0.13</window_ratio>
<window>33</window>
</construction>
<construction id="17" type="basement_wall" >
</construction>
<construction id="25" type="floor" >
</construction>
<construction id="17" type="basement_wall"/>
<construction id="25" type="floor"/>
</constructions>
<average_storey_height units="m">3.05</average_storey_height>
<average_storey_height units="m">3</average_storey_height>
<number_of_storeys units="-">1</number_of_storeys>
<thermal_capacity units="kJ/K m2">130</thermal_capacity>
<extra_loses_due_to_thermal_bridges units="W/K m2">0.15</extra_loses_due_to_thermal_bridges>
<indirect_heated_ratio units="-">0.15</indirect_heated_ratio>
<infiltration_rate_for_ventilation_system_off units="ACH">3.57</infiltration_rate_for_ventilation_system_off>
<thermal_capacity units="kJ/K m2">90</thermal_capacity>
<extra_loses_due_to_thermal_bridges units="W/K m2">0.1</extra_loses_due_to_thermal_bridges>
<indirect_heated_ratio units="-">0.25</indirect_heated_ratio>
<infiltration_rate_for_ventilation_system_off units="ACH">0.35</infiltration_rate_for_ventilation_system_off>
<infiltration_rate_for_ventilation_system_on units="ACH">0</infiltration_rate_for_ventilation_system_on>
</archetype>
<archetype id="2" function="residential" periodOfConstruction="2001-2010">
<constructions>
<construction id="2" type="roof" >
</construction>
<construction id="10" type="wall" >
<window_ratio units="-">0.11</window_ratio>
<window>34</window>
</construction>
<construction id="18" type="basement_wall" >
</construction>
<construction id="26" type="floor" >
<construction id="2" type="roof"/>
<construction id="10" type="wall">
<window_ratio units="-">0.13</window_ratio>
<window>34</window>
</construction>
<construction id="18" type="basement_wall"/>
<construction id="26" type="floor"/>
</constructions>
<average_storey_height units="m">3.05</average_storey_height>
<average_storey_height units="m">3</average_storey_height>
<number_of_storeys units="-">1</number_of_storeys>
<thermal_capacity units="kJ/K m2">130</thermal_capacity>
<extra_loses_due_to_thermal_bridges units="W/K m2">0.15</extra_loses_due_to_thermal_bridges>
<indirect_heated_ratio units="-">0.15</indirect_heated_ratio>
<infiltration_rate_for_ventilation_system_off units="ACH">3.57</infiltration_rate_for_ventilation_system_off>
<thermal_capacity units="kJ/K m2">90</thermal_capacity>
<extra_loses_due_to_thermal_bridges units="W/K m2">0.1</extra_loses_due_to_thermal_bridges>
<indirect_heated_ratio units="-">0.25</indirect_heated_ratio>
<infiltration_rate_for_ventilation_system_off units="ACH">0.35</infiltration_rate_for_ventilation_system_off>
<infiltration_rate_for_ventilation_system_on units="ACH">0</infiltration_rate_for_ventilation_system_on>
</archetype>
<archetype id="3" function="residential" periodOfConstruction="1996-2000">
<constructions>
<construction id="3" type="roof" >
</construction>
<construction id="11" type="wall" >
<window_ratio units="-">0.11</window_ratio>
<window>34</window>
</construction>
<construction id="19" type="basement_wall" >
</construction>
<construction id="27" type="floor" >
<construction id="3" type="roof"/>
<construction id="11" type="wall">
<window_ratio units="-">0.11</window_ratio>
<window>34</window>
</construction>
<construction id="19" type="basement_wall"/>
<construction id="27" type="floor"/>
</constructions>
<average_storey_height units="m">3.05</average_storey_height>
<average_storey_height units="m">3</average_storey_height>
<number_of_storeys units="-">1</number_of_storeys>
<thermal_capacity units="kJ/K m2">130</thermal_capacity>
<thermal_capacity units="kJ/K m2">90</thermal_capacity>
<extra_loses_due_to_thermal_bridges units="W/K m2">0.15</extra_loses_due_to_thermal_bridges>
<indirect_heated_ratio units="-">0.15</indirect_heated_ratio>
<infiltration_rate_for_ventilation_system_off units="ACH">4.55</infiltration_rate_for_ventilation_system_off>
<indirect_heated_ratio units="-">0.25</indirect_heated_ratio>
<infiltration_rate_for_ventilation_system_off units="ACH">0.45</infiltration_rate_for_ventilation_system_off>
<infiltration_rate_for_ventilation_system_on units="ACH">0</infiltration_rate_for_ventilation_system_on>
</archetype>
<archetype id="4" function="residential" periodOfConstruction="1984-1995">
<constructions>
<construction id="4" type="roof" >
</construction>
<construction id="12" type="wall" >
<window_ratio units="-">0.11</window_ratio>
<window>34</window>
</construction>
<construction id="20" type="basement_wall" >
</construction>
<construction id="28" type="floor" >
<construction id="4" type="roof"/>
<construction id="12" type="wall">
<window_ratio units="-">0.13</window_ratio>
<window>34</window>
</construction>
<construction id="20" type="basement_wall"/>
<construction id="28" type="floor"/>
</constructions>
<average_storey_height units="m">3.05</average_storey_height>
<average_storey_height units="m">3</average_storey_height>
<number_of_storeys units="-">1</number_of_storeys>
<thermal_capacity units="kJ/K m2">130</thermal_capacity>
<thermal_capacity units="kJ/K m2">90</thermal_capacity>
<extra_loses_due_to_thermal_bridges units="W/K m2">0.15</extra_loses_due_to_thermal_bridges>
<indirect_heated_ratio units="-">0.15</indirect_heated_ratio>
<infiltration_rate_for_ventilation_system_off units="ACH">4.55</infiltration_rate_for_ventilation_system_off>
<indirect_heated_ratio units="-">0.25</indirect_heated_ratio>
<infiltration_rate_for_ventilation_system_off units="ACH">0.45</infiltration_rate_for_ventilation_system_off>
<infiltration_rate_for_ventilation_system_on units="ACH">0</infiltration_rate_for_ventilation_system_on>
</archetype>
<archetype id="5" function="residential" periodOfConstruction="1978-1983">
<constructions>
<construction id="5" type="roof" >
</construction>
<construction id="13" type="wall" >
<window_ratio units="-">0.11</window_ratio>
<window>34</window>
</construction>
<construction id="21" type="basement_wall" >
</construction>
<construction id="29" type="floor" >
<construction id="5" type="roof"/>
<construction id="13" type="wall">
<window_ratio units="-">0.11</window_ratio>
<window>34</window>
</construction>
<construction id="21" type="basement_wall"/>
<construction id="29" type="floor"/>
</constructions>
<average_storey_height units="m">3.05</average_storey_height>
<average_storey_height units="m">3</average_storey_height>
<number_of_storeys units="-">1</number_of_storeys>
<thermal_capacity units="kJ/K m2">130</thermal_capacity>
<thermal_capacity units="kJ/K m2">90</thermal_capacity>
<extra_loses_due_to_thermal_bridges units="W/K m2">0.15</extra_loses_due_to_thermal_bridges>
<indirect_heated_ratio units="-">0.15</indirect_heated_ratio>
<infiltration_rate_for_ventilation_system_off units="ACH">4.55</infiltration_rate_for_ventilation_system_off>
<indirect_heated_ratio units="-">0.25</indirect_heated_ratio>
<infiltration_rate_for_ventilation_system_off units="ACH">0.45</infiltration_rate_for_ventilation_system_off>
<infiltration_rate_for_ventilation_system_on units="ACH">0</infiltration_rate_for_ventilation_system_on>
</archetype>
<archetype id="6" function="residential" periodOfConstruction="1961-1977">
<constructions>
<construction id="6" type="roof" >
</construction>
<construction id="14" type="wall" >
<window_ratio units="-">0.11</window_ratio>
<window>34</window>
</construction>
<construction id="22" type="basement_wall" >
</construction>
<construction id="30" type="floor" >
<construction id="6" type="roof"/>
<construction id="14" type="wall">
<window_ratio units="-">0.13</window_ratio>
<window>34</window>
</construction>
<construction id="22" type="basement_wall"/>
<construction id="30" type="floor"/>
</constructions>
<average_storey_height units="m">3.05</average_storey_height>
<average_storey_height units="m">3</average_storey_height>
<number_of_storeys units="-">1</number_of_storeys>
<thermal_capacity units="kJ/K m2">130</thermal_capacity>
<thermal_capacity units="kJ/K m2">90</thermal_capacity>
<extra_loses_due_to_thermal_bridges units="W/K m2">0.15</extra_loses_due_to_thermal_bridges>
<indirect_heated_ratio units="-">0.15</indirect_heated_ratio>
<infiltration_rate_for_ventilation_system_off units="ACH">4.55</infiltration_rate_for_ventilation_system_off>
<indirect_heated_ratio units="-">0.25</indirect_heated_ratio>
<infiltration_rate_for_ventilation_system_off units="ACH">0.45</infiltration_rate_for_ventilation_system_off>
<infiltration_rate_for_ventilation_system_on units="ACH">0</infiltration_rate_for_ventilation_system_on>
</archetype>
<archetype id="7" function="residential" periodOfConstruction="1946-1960">
<constructions>
<construction id="7" type="roof" >
</construction>
<construction id="15" type="wall" >
<window_ratio units="-">0.11</window_ratio>
<window>34</window>
</construction>
<construction id="23" type="basement_wall" >
</construction>
<construction id="31" type="floor" >
<construction id="7" type="roof"/>
<construction id="15" type="wall">
<window_ratio units="-">0.13</window_ratio>
<window>34</window>
</construction>
<construction id="23" type="basement_wall"/>
<construction id="31" type="floor"/>
</constructions>
<average_storey_height units="m">3.05</average_storey_height>
<average_storey_height units="m">3</average_storey_height>
<number_of_storeys units="-">1</number_of_storeys>
<thermal_capacity units="kJ/K m2">130</thermal_capacity>
<thermal_capacity units="kJ/K m2">90</thermal_capacity>
<extra_loses_due_to_thermal_bridges units="W/K m2">0.15</extra_loses_due_to_thermal_bridges>
<indirect_heated_ratio units="-">0.15</indirect_heated_ratio>
<infiltration_rate_for_ventilation_system_off units="ACH">4.55</infiltration_rate_for_ventilation_system_off>
<indirect_heated_ratio units="-">0.25</indirect_heated_ratio>
<infiltration_rate_for_ventilation_system_off units="ACH">0.45</infiltration_rate_for_ventilation_system_off>
<infiltration_rate_for_ventilation_system_on units="ACH">0</infiltration_rate_for_ventilation_system_on>
</archetype>
<archetype id="8" function="residential" periodOfConstruction="1900-1945">
<constructions>
<construction id="8" type="roof" >
</construction>
<construction id="16" type="wall" >
<window_ratio units="-">0.11</window_ratio>
<window>34</window>
</construction>
<construction id="24" type="basement_wall" >
</construction>
<construction id="32" type="floor" >
<construction id="8" type="roof"/>
<construction id="16" type="wall">
<window_ratio units="-">0.13</window_ratio>
<window>34</window>
</construction>
<construction id="24" type="basement_wall"/>
<construction id="32" type="floor"/>
</constructions>
<average_storey_height units="m">3.05</average_storey_height>
<average_storey_height units="m">3</average_storey_height>
<number_of_storeys units="-">1</number_of_storeys>
<thermal_capacity units="kJ/K m2">130</thermal_capacity>
<thermal_capacity units="kJ/K m2">90</thermal_capacity>
<extra_loses_due_to_thermal_bridges units="W/K m2">0.15</extra_loses_due_to_thermal_bridges>
<indirect_heated_ratio units="-">0.15</indirect_heated_ratio>
<infiltration_rate_for_ventilation_system_off units="ACH">4.55</infiltration_rate_for_ventilation_system_off>
<indirect_heated_ratio units="-">0.25</indirect_heated_ratio>
<infiltration_rate_for_ventilation_system_off units="ACH">0.45</infiltration_rate_for_ventilation_system_off>
<infiltration_rate_for_ventilation_system_on units="ACH">0</infiltration_rate_for_ventilation_system_on>
</archetype>
</archetypes>

View File

@ -1,185 +1,182 @@
<?xml version="1.0" encoding="utf-8"?>
<library name="us_library">
<windows>
<window type="window" id="33" name="global">
<shgc>0.46</shgc>
<g_value>0.5</g_value>
<frame_ratio units="-">0</frame_ratio>
<overall_u_value units="W/m2 K">0.555</overall_u_value>
</window>
<window type="window" id="34" name="global">
<shgc>0.52</shgc>
<g_value>0.5</g_value>
<frame_ratio units="-">0</frame_ratio>
<window type="window" id="33" name="global">
<shgc>0.46</shgc>
<g_value>0.5</g_value>
<frame_ratio units="-">0</frame_ratio>
<overall_u_value units="W/m2 K">1.8</overall_u_value>
</window>
<window type="window" id="34" name="global">
<shgc>0.52</shgc>
<g_value>0.5</g_value>
<frame_ratio units="-">0</frame_ratio>
<overall_u_value units="W/m2 K">2.702</overall_u_value>
</window>
</window>
</windows>
<constructions>
<construction type="roof" id="1" name="ceiling under attic_post 2010">
<overall_u_value units="W/m2 K">0.115</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
<construction type="roof" id="2" name="ceiling under attic_2001-2010">
<overall_u_value units="W/m2 K">0.157</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
<construction type="roof" id="3" name="ceiling under attic_1996-2000">
<overall_u_value units="W/m2 K">0.185</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
<construction type="roof" id="4" name="ceiling under attic_1984-1995">
<overall_u_value units="W/m2 K">0.199</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
<construction type="roof" id="5" name="ceiling under attic_1978-1983">
<overall_u_value units="W/m2 K">0.245</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
<construction type="roof" id="6" name="ceiling under attic_1961-1977">
<overall_u_value units="W/m2 K">0.256</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
<construction type="roof" id="7" name="ceiling under attic_1946-1960">
<overall_u_value units="W/m2 K">0.259</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
<construction type="roof" id="8" name="ceiling under attic_before 1946">
<overall_u_value units="W/m2 K">0.301</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
#wall above grade
<construction type="wall" id="9" name="wall above grade_post 2010">
<overall_u_value units="W/m2 K">0.324</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
<construction type="wall" id="10" name="wall above grade_2001-2010">
<overall_u_value units="W/m2 K">0.285</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
<construction type="wall" id="11" name="wall above grade_1996-2000">
<overall_u_value units="W/m2 K">0.355</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
<construction type="wall" id="12" name="wall above grade_1984-1995">
<overall_u_value units="W/m2 K">0.411</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
<construction type="wall" id="13" name="wall above grade_1978-1983">
<overall_u_value units="W/m2 K">0.546</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
<construction type="wall" id="14" name="wall above grade_1961-1977">
<overall_u_value units="W/m2 K">0.526</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
<construction type="wall" id="15" name="wall above grade_1946-1960">
<overall_u_value units="W/m2 K">0.579</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
<construction type="wall" id="16" name="wall above grade_before 1946">
<overall_u_value units="W/m2 K">0.664</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
#wall below grade
<construction type="basement_wall" id="17" name="wall below grade_post 2010">
<overall_u_value units="W/m2 K">0.335</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
<construction type="basement_wall" id="18" name="wall below grade_2001-2010">
<overall_u_value units="W/m2 K">0.312</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
<construction type="basement_wall" id="19" name="wall below grade_1996-2000">
<overall_u_value units="W/m2 K">0.408</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
<construction type="basement_wall" id="20" name="wall below grade_1984-1995">
<overall_u_value units="W/m2 K">0.510</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
<construction type="basement_wall" id="21" name="wall below grade_1978-1983">
<overall_u_value units="W/m2 K">0.645</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
<construction type="basement_wall" id="22" name="wall below grade_1961-1977">
<overall_u_value units="W/m2 K">1.369</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
<construction type="basement_wall" id="23" name="wall below grade_1946-1960">
<overall_u_value units="W/m2 K">1.449</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
<construction type="basement_wall" id="24" name="wall below grade_before 1946">
<overall_u_value units="W/m2 K">2.083</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
#slab on grade
<construction type="floor" id="25" name="slab on grade_post 2010">
<overall_u_value units="W/m2 K">0.510</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
<construction type="floor" id="26" name="slab on grade_2001-2010">
<overall_u_value units="W/m2 K">1.428</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
<construction type="floor" id="27" name="slab on grade_1996-2000">
<overall_u_value units="W/m2 K">1.428</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
<construction type="floor" id="28" name="slab on grade_1984-1995">
<overall_u_value units="W/m2 K">1.428</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
<construction type="floor" id="29" name="slab on grade_1978-1983">
<overall_u_value units="W/m2 K">1.428</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
<construction type="floor" id="30" name="slab on grade_1961-1977">
<overall_u_value units="W/m2 K">5</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
<construction type="floor" id="31" name="slab on grade_1946-1960">
<overall_u_value units="W/m2 K">5</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
<construction type="floor" id="32" name="slab on grade_before 1946">
<overall_u_value units="W/m2 K">5</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
<construction type="roof" id="1" name="ceiling under attic_post 2010">
<overall_u_value units="W/m2 K">0.11</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
<construction type="roof" id="2" name="ceiling under attic_2001-2010">
<overall_u_value units="W/m2 K">0.16</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
<construction type="roof" id="3" name="ceiling under attic_1996-2000">
<overall_u_value units="W/m2 K">0.19</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
<construction type="roof" id="4" name="ceiling under attic_1984-1995">
<overall_u_value units="W/m2 K">0.2</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
<construction type="roof" id="5" name="ceiling under attic_1978-1983">
<overall_u_value units="W/m2 K">0.25</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
<construction type="roof" id="6" name="ceiling under attic_1961-1977">
<overall_u_value units="W/m2 K">0.26</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
<construction type="roof" id="7" name="ceiling under attic_1946-1960">
<overall_u_value units="W/m2 K">0.26</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
<construction type="roof" id="8" name="ceiling under attic_before 1946">
<overall_u_value units="W/m2 K">0.301</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
#wall above grade
<construction type="wall" id="9" name="wall above grade_post 2010">
<overall_u_value units="W/m2 K">0.12</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
<construction type="wall" id="10" name="wall above grade_2001-2010">
<overall_u_value units="W/m2 K">0.29</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
<construction type="wall" id="11" name="wall above grade_1996-2000">
<overall_u_value units="W/m2 K">0.36</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
<construction type="wall" id="12" name="wall above grade_1984-1995">
<overall_u_value units="W/m2 K">0.41</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
<construction type="wall" id="13" name="wall above grade_1978-1983">
<overall_u_value units="W/m2 K">0.55</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
<construction type="wall" id="14" name="wall above grade_1961-1977">
<overall_u_value units="W/m2 K">0.53</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
<construction type="wall" id="15" name="wall above grade_1946-1960">
<overall_u_value units="W/m2 K">0.58</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
<construction type="wall" id="16" name="wall above grade_before 1946">
<overall_u_value units="W/m2 K">0.66</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
#wall below grade
<construction type="basement_wall" id="17" name="wall below grade_post 2010">
<overall_u_value units="W/m2 K">0.335</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
<construction type="basement_wall" id="18" name="wall below grade_2001-2010">
<overall_u_value units="W/m2 K">0.312</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
<construction type="basement_wall" id="19" name="wall below grade_1996-2000">
<overall_u_value units="W/m2 K">0.408</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
<construction type="basement_wall" id="20" name="wall below grade_1984-1995">
<overall_u_value units="W/m2 K">0.510</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
<construction type="basement_wall" id="21" name="wall below grade_1978-1983">
<overall_u_value units="W/m2 K">0.645</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
<construction type="basement_wall" id="22" name="wall below grade_1961-1977">
<overall_u_value units="W/m2 K">1.369</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
<construction type="basement_wall" id="23" name="wall below grade_1946-1960">
<overall_u_value units="W/m2 K">1.449</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
<construction type="basement_wall" id="24" name="wall below grade_before 1946">
<overall_u_value units="W/m2 K">2.083</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
#slab on grade
<construction type="floor" id="25" name="slab on grade_post 2010">
<overall_u_value units="W/m2 K">0.510</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
<construction type="floor" id="26" name="slab on grade_2001-2010">
<overall_u_value units="W/m2 K">1.428</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
<construction type="floor" id="27" name="slab on grade_1996-2000">
<overall_u_value units="W/m2 K">1.428</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
<construction type="floor" id="28" name="slab on grade_1984-1995">
<overall_u_value units="W/m2 K">1.428</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
<construction type="floor" id="29" name="slab on grade_1978-1983">
<overall_u_value units="W/m2 K">1.428</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
<construction type="floor" id="30" name="slab on grade_1961-1977">
<overall_u_value units="W/m2 K">2.66</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
<construction type="floor" id="31" name="slab on grade_1946-1960">
<overall_u_value units="W/m2 K">2.66</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
<construction type="floor" id="32" name="slab on grade_before 1946">
<overall_u_value units="W/m2 K">2.66</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
</constructions>
</library>

View File

@ -10,13 +10,13 @@
<occupancy>
<occupancyDensity>0.03</occupancyDensity>
<usageDaysPerYear>365</usageDaysPerYear>
<usageHoursPerDay>12</usageHoursPerDay>
<usageHoursPerDay>14</usageHoursPerDay>
<internGains>
<description>Persons and home appliances</description>
<averageInternGainPerSqm>4.2</averageInternGainPerSqm>
<convectiveFraction>0.3999999999999999</convectiveFraction>
<radiantFraction>0.5000000000000001</radiantFraction>
<latentFraction>0.10000000000000009</latentFraction>
<averageInternGainPerSqm>4.3</averageInternGainPerSqm>
<convectiveFraction>0.40</convectiveFraction>
<radiantFraction>0.50</radiantFraction>
<latentFraction>0.10</latentFraction>
</internGains>
</occupancy>
<appliance units="kWh/day">19.5</appliance>
@ -26,7 +26,7 @@
<heatingSetBackTemperature>18.0</heatingSetBackTemperature>
</space_heating>
<space_cooling>
<coolingSetPointTemperature>25.0</coolingSetPointTemperature>
<coolingSetPointTemperature>24.0</coolingSetPointTemperature>
</space_cooling>
<ventilation>
<mechanicalAirChangeRate>0</mechanicalAirChangeRate>

View File

@ -21,6 +21,10 @@ class GeometryFactory:
def _citygml(self):
return CityGml(self._path).city
@property
def _stl(self):
raise Exception('Not implemented')
@property
def _geojson(self):
raise Exception('Not implemented')

View File

@ -18,9 +18,6 @@ class UsNewYorkCityUsageParameters(HftUsageInterface):
def __init__(self, city, base_path):
super().__init__(base_path, 'de_library.xml')
self._city = city
# todo: this is a wrong location for self._min_air_change -> re-think where to place this info
# and where it comes from
self._min_air_change = 0
def enrich_buildings(self):
"""
@ -38,8 +35,7 @@ class UsNewYorkCityUsageParameters(HftUsageInterface):
mix_usage = False
if not mix_usage:
# just one usage_zone
min_air_change = self._min_air_change
usage_zone = UsageZone(min_air_change)
usage_zone = UsageZone()
self._assign_values(usage_zone, archetype)
building.usage_zones = [usage_zone]

View File

@ -128,6 +128,7 @@ class GeometryHelper:
@staticmethod
def _point_cloud_to_mesh(point_list, normal_list):
# todo @Guille: I think this method should be removed (and create_mesh??)
# Return a mesh composed only by triangles
pcd = o3d.geometry.PointCloud()
pcd.points = o3d.utility.Vector3dVector(point_list)
@ -184,7 +185,6 @@ class GeometryHelper:
mesh_1 = intersections.slice_mesh_plane(mesh, normal[i], point_plane)
mesh_1_segments = intersections.mesh_plane(mesh, normal[i], point_plane)
mesh.difference(mesh_1, engine='blender')
quit()
if len(mesh_1_segments) <= 0 or len(mesh_1.faces) == len(mesh.faces):
mesh_final.append(mesh)
break
@ -195,7 +195,6 @@ class GeometryHelper:
points_normals[j] = normal_opp[i]
mesh_2 = GeometryHelper._point_cloud_to_mesh(points, points_normals)
mesh_final.append(GeometryHelper._merge_meshes(mesh_1, mesh_2))
return mesh_final
@staticmethod

View File

@ -9,6 +9,7 @@ import esoreader
from pathlib import Path
import helpers.constants as cte
class IdfHelper:
_THERMOSTAT = 'HVACTEMPLATE:THERMOSTAT'
_IDEAL_LOAD_AIR_SYSTEM = 'HVACTEMPLATE:ZONE:IDEALLOADSAIRSYSTEM'

View File

@ -6,7 +6,7 @@ Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@conc
import os
from pathlib import Path
from unittest import TestCase
import math
from city_model_structure.city import City
from factories.geometry_factory import GeometryFactory
@ -226,12 +226,10 @@ class TestGeometryFactory(TestCase):
self.assertRaises(Exception, lambda: thermal_opening.u_value, 'thermal_opening u_value was initialized')
def test_stuttgart_gml(self):
file_path = (self._example_path / '20190815_mitte_out_MC_FloursurfaceADD.gml').resolve()
city = GeometryFactory('citygml', file_path).city
pickle_file = (self._example_path / '20190815_mitte_out_MC_FloursurfaceADD.pickle').resolve()
city.save(pickle_file)
counter = 0
for building in city.buildings:
if building.name != 'BLD121958':
@ -241,3 +239,14 @@ class TestGeometryFactory(TestCase):
counter += 1
building.stl_export(self._output_path)
print('total number of buildings with volume inf', counter)
def test_divide_mesh_by_plane(self):
file_path = (self._example_path / 'FZK-Haus-LoD-all-KIT-IAI-KHH-B36-V1.gml').resolve()
# todo @Guille: this file has 5 lods (0, 1, 2, 3 and 4), all as one single city_object.
# Only lod1 is read ans saved
city = GeometryFactory('citygml', file_path).city
for building in city.buildings:
print(building.name)
print(building.volume)
print(building.thermal_zones[0].floor_area)
print(len(building.storeys))