before behnam changes in libs

This commit is contained in:
Pilar 2021-03-23 10:13:01 -04:00
parent 413c302ed3
commit dbbe3d56fc
6 changed files with 105 additions and 109 deletions

View File

@ -15,6 +15,7 @@ from city_model_structure.building import Building
from city_model_structure.city_object import CityObject
from helpers.geometry_helper import GeometryHelper
import math
import time
class City:
@ -141,12 +142,6 @@ class City:
raise NotImplementedError(new_city_object.type)
if self._buildings is None:
self._buildings = []
for building in self.buildings:
if self._geometry.adjacent_locations(building.location, new_city_object.location):
for surface in building.surfaces:
for surface2 in new_city_object.surfaces:
surface.shared(surface2)
self._buildings.append(new_city_object)
@property
@ -194,7 +189,6 @@ class City:
"""
selected_region_lower_corner = [center[0] - radius, center[1] - radius, center[2] - radius]
selected_region_upper_corner = [center[0] + radius, center[1] + radius, center[2] + radius]
# todo, ask @Guille: does this create a new instance of city??
selected_region_city = City(selected_region_lower_corner, selected_region_upper_corner, srs_name=self.srs_name)
for city_object in self.city_objects:
location = city_object.location

View File

@ -14,8 +14,8 @@
<number_of_storeys units="-">1</number_of_storeys>
<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.176</infiltration_rate_for_ventilation_system_off>
<indirect_heated_ratio units="-">0.15</indirect_heated_ratio>
<infiltration_rate_for_ventilation_system_off units="ACH">0.5</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">
@ -32,8 +32,8 @@
<number_of_storeys units="-">1</number_of_storeys>
<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.19</infiltration_rate_for_ventilation_system_off>
<indirect_heated_ratio units="-">0.15</indirect_heated_ratio>
<infiltration_rate_for_ventilation_system_off units="ACH">0.5</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">
@ -51,7 +51,7 @@
<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.15</indirect_heated_ratio>
<infiltration_rate_for_ventilation_system_off units="ACH">0.22</infiltration_rate_for_ventilation_system_off>
<infiltration_rate_for_ventilation_system_off units="ACH">0.5</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">
@ -69,14 +69,14 @@
<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.15</indirect_heated_ratio>
<infiltration_rate_for_ventilation_system_off units="ACH">0.32</infiltration_rate_for_ventilation_system_off>
<infiltration_rate_for_ventilation_system_off units="ACH">0.5</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 id="13" type="wall">
<window_ratio units="-">0.11</window_ratio>
<window_ratio units="-">0.13</window_ratio>
<window>34</window>
</construction>
<construction id="21" type="basement_wall"/>
@ -103,9 +103,9 @@
<average_storey_height units="m">3</average_storey_height>
<number_of_storeys units="-">1</number_of_storeys>
<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>
<extra_loses_due_to_thermal_bridges units="W/K m2">0.05</extra_loses_due_to_thermal_bridges>
<indirect_heated_ratio units="-">0.15</indirect_heated_ratio>
<infiltration_rate_for_ventilation_system_off units="ACH">0.53</infiltration_rate_for_ventilation_system_off>
<infiltration_rate_for_ventilation_system_off units="ACH">0.3</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">
@ -121,9 +121,9 @@
<average_storey_height units="m">3</average_storey_height>
<number_of_storeys units="-">1</number_of_storeys>
<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>
<extra_loses_due_to_thermal_bridges units="W/K m2">0.05</extra_loses_due_to_thermal_bridges>
<indirect_heated_ratio units="-">0.15</indirect_heated_ratio>
<infiltration_rate_for_ventilation_system_off units="ACH">0.6</infiltration_rate_for_ventilation_system_off>
<infiltration_rate_for_ventilation_system_off units="ACH">0.3</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">
@ -139,9 +139,9 @@
<average_storey_height units="m">3</average_storey_height>
<number_of_storeys units="-">1</number_of_storeys>
<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>
<extra_loses_due_to_thermal_bridges units="W/K m2">0.05</extra_loses_due_to_thermal_bridges>
<indirect_heated_ratio units="-">0.15</indirect_heated_ratio>
<infiltration_rate_for_ventilation_system_off units="ACH">0.6</infiltration_rate_for_ventilation_system_off>
<infiltration_rate_for_ventilation_system_off units="ACH">0.3</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

@ -3,61 +3,61 @@
<windows>
<window type="window" id="33" name="global">
<shgc>0.46</shgc>
<g_value>0.5</g_value>
<g_value>0.46</g_value>
<frame_ratio units="-">0.3</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>
<g_value>0.52</g_value>
<frame_ratio units="-">0.3</frame_ratio>
<overall_u_value units="W/m2 K">2.702</overall_u_value>
<overall_u_value units="W/m2 K">2.7</overall_u_value>
</window>
</windows>
<constructions>
<construction type="roof" id="1" name="ceiling under attic_post 2010">
<overall_u_value units="W/m2 K">0.14</overall_u_value>
<outside_solar_absorptance units="-">0.7</outside_solar_absorptance>
<shortwave_reflectance units="-">0.3</shortwave_reflectance>
<overall_u_value units="W/m2 K">0.202</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.17</overall_u_value>
<outside_solar_absorptance units="-">0.7</outside_solar_absorptance>
<shortwave_reflectance units="-">0.3</shortwave_reflectance>
<overall_u_value units="W/m2 K">0.187</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.7</outside_solar_absorptance>
<shortwave_reflectance units="-">0.3</shortwave_reflectance>
<overall_u_value units="W/m2 K">0.217</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.7</outside_solar_absorptance>
<shortwave_reflectance units="-">0.3</shortwave_reflectance>
<overall_u_value units="W/m2 K">0.236</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.7</outside_solar_absorptance>
<shortwave_reflectance units="-">0.3</shortwave_reflectance>
<overall_u_value units="W/m2 K">0.253</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.7</outside_solar_absorptance>
<shortwave_reflectance units="-">0.3</shortwave_reflectance>
<overall_u_value units="W/m2 K">0.253</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.7</outside_solar_absorptance>
<shortwave_reflectance units="-">0.3</shortwave_reflectance>
<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.7</outside_solar_absorptance>
<shortwave_reflectance units="-">0.3</shortwave_reflectance>
<overall_u_value units="W/m2 K">0.282</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.25</overall_u_value>
<overall_u_value units="W/m2 K">0.3</overall_u_value>
<outside_solar_absorptance units="-">0.7</outside_solar_absorptance>
<shortwave_reflectance units="-">0.3</shortwave_reflectance>
</construction>
@ -77,106 +77,106 @@
<shortwave_reflectance units="-">0.3</shortwave_reflectance>
</construction>
<construction type="wall" id="13" name="wall above grade_1978-1983">
<overall_u_value units="W/m2 K">0.333</overall_u_value>
<overall_u_value units="W/m2 K">0.327</overall_u_value>
<outside_solar_absorptance units="-">0.7</outside_solar_absorptance>
<shortwave_reflectance units="-">0.3</shortwave_reflectance>
</construction>
<construction type="wall" id="14" name="wall above grade_1961-1977">
<overall_u_value units="W/m2 K">0.36</overall_u_value>
<overall_u_value units="W/m2 K">0.364</overall_u_value>
<outside_solar_absorptance units="-">0.7</outside_solar_absorptance>
<shortwave_reflectance units="-">0.3</shortwave_reflectance>
</construction>
<construction type="wall" id="15" name="wall above grade_1946-1960">
<overall_u_value units="W/m2 K">0.41</overall_u_value>
<overall_u_value units="W/m2 K">0.411</overall_u_value>
<outside_solar_absorptance units="-">0.7</outside_solar_absorptance>
<shortwave_reflectance units="-">0.3</shortwave_reflectance>
</construction>
<construction type="wall" id="16" name="wall above grade_before 1946">
<overall_u_value units="W/m2 K">0.48</overall_u_value>
<overall_u_value units="W/m2 K">0.411</overall_u_value>
<outside_solar_absorptance units="-">0.7</outside_solar_absorptance>
<shortwave_reflectance units="-">0.3</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.33</overall_u_value>
<outside_solar_absorptance units="-">0.7</outside_solar_absorptance>
<shortwave_reflectance units="-">0.3</shortwave_reflectance>
<overall_u_value units="W/m2 K">0.512</overall_u_value>
<outside_solar_absorptance units="-">0</outside_solar_absorptance>
<shortwave_reflectance units="-">0</shortwave_reflectance>
</construction>
<construction type="basement_wall" id="18" name="wall below grade_2001-2010">
<overall_u_value units="W/m2 K">0.6</overall_u_value>
<outside_solar_absorptance units="-">0.7</outside_solar_absorptance>
<shortwave_reflectance units="-">0.3</shortwave_reflectance>
<overall_u_value units="W/m2 K">0.512</overall_u_value>
<outside_solar_absorptance units="-">0</outside_solar_absorptance>
<shortwave_reflectance units="-">0</shortwave_reflectance>
</construction>
<construction type="basement_wall" id="19" name="wall below grade_1996-2000">
<overall_u_value units="W/m2 K">0.6</overall_u_value>
<outside_solar_absorptance units="-">0.7</outside_solar_absorptance>
<shortwave_reflectance units="-">0.3</shortwave_reflectance>
<overall_u_value units="W/m2 K">0.67</overall_u_value>
<outside_solar_absorptance units="-">0</outside_solar_absorptance>
<shortwave_reflectance units="-">0</shortwave_reflectance>
</construction>
<construction type="basement_wall" id="20" name="wall below grade_1984-1995">
<overall_u_value units="W/m2 K">0.37</overall_u_value>
<outside_solar_absorptance units="-">0.7</outside_solar_absorptance>
<shortwave_reflectance units="-">0.3</shortwave_reflectance>
<overall_u_value units="W/m2 K">0.848</overall_u_value>
<outside_solar_absorptance units="-">0</outside_solar_absorptance>
<shortwave_reflectance units="-">0</shortwave_reflectance>
</construction>
<construction type="basement_wall" id="21" name="wall below grade_1978-1983">
<overall_u_value units="W/m2 K">1.16</overall_u_value>
<outside_solar_absorptance units="-">0.7</outside_solar_absorptance>
<shortwave_reflectance units="-">0.3</shortwave_reflectance>
<overall_u_value units="W/m2 K">1.048</overall_u_value>
<outside_solar_absorptance units="-">0</outside_solar_absorptance>
<shortwave_reflectance units="-">0</shortwave_reflectance>
</construction>
<construction type="basement_wall" id="22" name="wall below grade_1961-1977">
<overall_u_value units="W/m2 K">0.60</overall_u_value>
<outside_solar_absorptance units="-">0.7</outside_solar_absorptance>
<shortwave_reflectance units="-">0.3</shortwave_reflectance>
<overall_u_value units="W/m2 K">1.154</overall_u_value>
<outside_solar_absorptance units="-">0</outside_solar_absorptance>
<shortwave_reflectance units="-">0</shortwave_reflectance>
</construction>
<construction type="basement_wall" id="23" name="wall below grade_1946-1960">
<overall_u_value units="W/m2 K">0.588</overall_u_value>
<outside_solar_absorptance units="-">0.7</outside_solar_absorptance>
<shortwave_reflectance units="-">0.3</shortwave_reflectance>
<overall_u_value units="W/m2 K">1.243</overall_u_value>
<outside_solar_absorptance units="-">0</outside_solar_absorptance>
<shortwave_reflectance units="-">0</shortwave_reflectance>
</construction>
<construction type="basement_wall" id="24" name="wall below grade_before 1946">
<overall_u_value units="W/m2 K">0.588</overall_u_value>
<outside_solar_absorptance units="-">0.7</outside_solar_absorptance>
<shortwave_reflectance units="-">0.3</shortwave_reflectance>
<overall_u_value units="W/m2 K">1.425</overall_u_value>
<outside_solar_absorptance units="-">0</outside_solar_absorptance>
<shortwave_reflectance units="-">0</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.3</overall_u_value>
<outside_solar_absorptance units="-">0.7</outside_solar_absorptance>
<shortwave_reflectance units="-">0.3</shortwave_reflectance>
<overall_u_value units="W/m2 K">0.512</overall_u_value>
<outside_solar_absorptance units="-">0</outside_solar_absorptance>
<shortwave_reflectance units="-">0</shortwave_reflectance>
</construction>
<construction type="floor" id="26" name="slab on grade_2001-2010">
<overall_u_value units="W/m2 K">0.51</overall_u_value>
<outside_solar_absorptance units="-">0.7</outside_solar_absorptance>
<shortwave_reflectance units="-">0.3</shortwave_reflectance>
<overall_u_value units="W/m2 K">0.512</overall_u_value>
<outside_solar_absorptance units="-">0</outside_solar_absorptance>
<shortwave_reflectance units="-">0</shortwave_reflectance>
</construction>
<construction type="floor" id="27" name="slab on grade_1996-2000">
<overall_u_value units="W/m2 K">0.67</overall_u_value>
<outside_solar_absorptance units="-">0.7</outside_solar_absorptance>
<shortwave_reflectance units="-">0.3</shortwave_reflectance>
<outside_solar_absorptance units="-">0</outside_solar_absorptance>
<shortwave_reflectance units="-">0</shortwave_reflectance>
</construction>
<construction type="floor" id="28" name="slab on grade_1984-1995">
<overall_u_value units="W/m2 K">0.85</overall_u_value>
<outside_solar_absorptance units="-">0.7</outside_solar_absorptance>
<shortwave_reflectance units="-">0.3</shortwave_reflectance>
<overall_u_value units="W/m2 K">0.848</overall_u_value>
<outside_solar_absorptance units="-">0</outside_solar_absorptance>
<shortwave_reflectance units="-">0</shortwave_reflectance>
</construction>
<construction type="floor" id="29" name="slab on grade_1978-1983">
<overall_u_value units="W/m2 K">1.05</overall_u_value>
<outside_solar_absorptance units="-">0.7</outside_solar_absorptance>
<shortwave_reflectance units="-">0.3</shortwave_reflectance>
<overall_u_value units="W/m2 K">1.048</overall_u_value>
<outside_solar_absorptance units="-">0</outside_solar_absorptance>
<shortwave_reflectance units="-">0</shortwave_reflectance>
</construction>
<construction type="floor" id="30" name="slab on grade_1961-1977">
<overall_u_value units="W/m2 K">1.15</overall_u_value>
<outside_solar_absorptance units="-">0.7</outside_solar_absorptance>
<shortwave_reflectance units="-">0.3</shortwave_reflectance>
<overall_u_value units="W/m2 K">1.154</overall_u_value>
<outside_solar_absorptance units="-">0</outside_solar_absorptance>
<shortwave_reflectance units="-">0</shortwave_reflectance>
</construction>
<construction type="floor" id="31" name="slab on grade_1946-1960">
<overall_u_value units="W/m2 K">1.24</overall_u_value>
<outside_solar_absorptance units="-">0.7</outside_solar_absorptance>
<shortwave_reflectance units="-">0.3</shortwave_reflectance>
<overall_u_value units="W/m2 K">1.243</overall_u_value>
<outside_solar_absorptance units="-">0</outside_solar_absorptance>
<shortwave_reflectance units="-">0</shortwave_reflectance>
</construction>
<construction type="floor" id="32" name="slab on grade_before 1946">
<overall_u_value units="W/m2 K">1.43</overall_u_value>
<outside_solar_absorptance units="-">0.7</outside_solar_absorptance>
<shortwave_reflectance units="-">0.3</shortwave_reflectance>
<overall_u_value units="W/m2 K">1.425</overall_u_value>
<outside_solar_absorptance units="-">0</outside_solar_absorptance>
<shortwave_reflectance units="-">0</shortwave_reflectance>
</construction>
</constructions>
</library>

View File

@ -2,7 +2,7 @@
<buildingUsageLibrary>
<name>Building Usage Library Reduced</name>
<description>Library created by Rabeeh from whatever norm</description>
<source>Source?</source>
<source>https://www.engineeringtoolbox.com/metabolic-heat-persons-d_706.html</source>
<zoneUsageType>
<id>residential</id>
<description>All residential buildings</description>
@ -12,7 +12,7 @@
<usageHoursPerDay>14</usageHoursPerDay>
<internGains>
<description>Persons and home appliances</description>
<averageInternGainPerSqm>4.3</averageInternGainPerSqm>
<averageInternGainPerSqm>9.69</averageInternGainPerSqm>
<convectiveFraction>0.40</convectiveFraction>
<radiantFraction>0.50</radiantFraction>
<latentFraction>0.10</latentFraction>

View File

@ -10,6 +10,7 @@ from city_model_structure.city import City
from city_model_structure.building import Building
from city_model_structure.attributes.surface import Surface
from helpers.geometry_helper import GeometryHelper
import time
class CityGml:
@ -68,6 +69,7 @@ class CityGml:
City model structure enriched with the geometry information
:return: City
"""
init = time.process_time_ns()
if self._city is None:
# todo: refactor this method to clearly choose the gml type
self._city = City(self._lower_corner, self._upper_corner, self._srs_name)

View File

@ -6,10 +6,10 @@ Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@conc
from pathlib import Path
from unittest import TestCase
from imports.geometry_factory import GeometryFactory
from exports.exports_factory import ExportsFactory
from city_model_structure.city import City
class TestExports(TestCase):
"""
TestGeometryFactory TestCase 1
@ -25,7 +25,7 @@ class TestExports(TestCase):
def _get_city(self):
if self._city_gml is None:
file_path = (self._example_path / 'one_building_in_kelowna_populated_weather_demand.pickle').resolve()
file_path = (self._example_path / 'kelowna.pickle').resolve()
self._city_gml = City.load(file_path)
return self._city_gml