chek units from libraries and storing classes

This commit is contained in:
Pilar 2021-01-08 16:08:29 -05:00
parent 5c93b64cd3
commit c3e06b5fa7
17 changed files with 144 additions and 45 deletions

View File

@ -3,9 +3,10 @@
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/venv" />
<excludeFolder url="file://$MODULE_DIR$/venv2" />
<excludeFolder url="file://$MODULE_DIR$/venv38" />
</content>
<orderEntry type="jdk" jdkName="Python 3.7 (libs)" jdkType="Python SDK" />
<orderEntry type="jdk" jdkName="Python 3.7 (venv)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View File

@ -18,7 +18,7 @@ class InternalGains:
@property
def average_internal_gain(self):
"""
Get internal gains average internal gain in w/m2
Get internal gains average internal gain in W/m2
:return: float
"""
return self._average_internal_gain
@ -26,7 +26,7 @@ class InternalGains:
@average_internal_gain.setter
def average_internal_gain(self, value):
"""
Set internal gains average internal gain in w/m2
Set internal gains average internal gain in W/m2
:param value: float
:return: None
"""

View File

@ -23,16 +23,16 @@ class Material:
@property
def name(self):
"""
Get material conductivity in W/mK
:return: float
Get material name
:return: string
"""
return self._name
@name.setter
def name(self, value):
"""
Set material conductivity in W/mK
:param value: float
Set material name
:param value: string
:return: None
"""
self._name = value

View File

@ -31,7 +31,6 @@ class Polyhedron:
self._min_y = None
self._min_x = None
self._geometry = GeometryHelper(delta=5.0, area_delta=0.01)
print(f'[{self._geometry._area_delta} {self._geometry._delta}]')
def _position_of(self, point, face):
vertices = self.vertices

View File

@ -227,7 +227,7 @@ class ThermalBoundary:
@property
def u_value(self):
"""
Thermal boundary u value in W/m2K
Get thermal boundary U-value in W/m2K
internal and external convective coefficient in W/m2K values, can be configured at configuration.ini
:return: float
"""
@ -248,6 +248,10 @@ class ThermalBoundary:
@u_value.setter
def u_value(self, value):
"""
Set thermal boundary U-value in W/m2K
:param value: float
"""
self._u_value = value
@property

View File

@ -82,7 +82,7 @@ class ThermalOpening:
@property
def g_value(self):
"""
Get thermal opening g value
Get thermal opening g-value
:return: float
"""
return self._g_value
@ -90,7 +90,7 @@ class ThermalOpening:
@g_value.setter
def g_value(self, value):
"""
Set thermal opening g value
Set thermal opening g-value
:param value:
:return:
"""
@ -157,7 +157,7 @@ class ThermalOpening:
@property
def overall_u_value(self):
"""
Get thermal opening overall u value in W/m2K
Get thermal opening overall U-value in W/m2K
:return: float
"""
return self._overall_u_value
@ -165,7 +165,7 @@ class ThermalOpening:
@overall_u_value.setter
def overall_u_value(self, value):
"""
Get thermal opening overall u value in W/m2K
Get thermal opening overall U-value in W/m2K
:param value: float
:return: None
"""

View File

@ -48,7 +48,7 @@ class ThermalZone:
@property
def floor_area(self):
"""
Get thermal zone floor area in square meters
Get thermal zone floor area in m2
:return: float
"""
if self._floor_area is None:
@ -104,7 +104,7 @@ class ThermalZone:
@property
def effective_thermal_capacity(self):
"""
Get thermal zone effective thermal capacity
Get thermal zone effective thermal capacity in J/m2K
:return: float
"""
return self._effective_thermal_capacity
@ -112,7 +112,7 @@ class ThermalZone:
@effective_thermal_capacity.setter
def effective_thermal_capacity(self, value):
"""
Set thermal zone effective thermal capacity
Set thermal zone effective thermal capacity in J/m2K
:param value: float
:return: None
"""
@ -138,7 +138,7 @@ class ThermalZone:
@property
def infiltration_rate_system_on(self):
"""
Get thermal zone infiltration rate system on in air changes per hour
Get thermal zone infiltration rate system on in air changes per hour (ACH)
:return: float
"""
return self._infiltration_rate_system_on
@ -146,7 +146,7 @@ class ThermalZone:
@infiltration_rate_system_on.setter
def infiltration_rate_system_on(self, value):
"""
Set thermal zone infiltration rate system on in air changes per hour
Set thermal zone infiltration rate system on in air changes per hour (ACH)
:param value: float
:return: None
"""
@ -155,7 +155,7 @@ class ThermalZone:
@property
def infiltration_rate_system_off(self):
"""
Get thermal zone infiltration rate system off in air changes per hour
Get thermal zone infiltration rate system off in air changes per hour (ACH)
:return: float
"""
return self._infiltration_rate_system_off
@ -163,7 +163,7 @@ class ThermalZone:
@infiltration_rate_system_off.setter
def infiltration_rate_system_off(self, value):
"""
Set thermal zone infiltration rate system on in air changes per hour
Set thermal zone infiltration rate system on in air changes per hour (ACH)
:param value: float
:return: None
"""

View File

@ -143,7 +143,7 @@ class UsageZone:
@property
def mechanical_air_change(self):
"""
Set usage zone mechanical air change in air change per hour
Set usage zone mechanical air change in air change per hour (ACH)
:return: float
"""
return self._mechanical_air_change
@ -151,7 +151,7 @@ class UsageZone:
@mechanical_air_change.setter
def mechanical_air_change(self, value):
"""
Get usage zone mechanical air change in air change per hour
Get usage zone mechanical air change in air change per hour (ACH)
:param value: float
:return: None
"""
@ -241,7 +241,7 @@ class UsageZone:
@property
def dhw_average_volume_pers_day(self):
"""
Get average DHW consumption in liters per person per day
Get average DHW consumption in m3 per person per day
:return: float
"""
return self._dhw_average_volume_pers_day
@ -249,7 +249,7 @@ class UsageZone:
@dhw_average_volume_pers_day.setter
def dhw_average_volume_pers_day(self, values):
"""
average DHW consumption in liters per person per day
average DHW consumption in m3 per person per day
:param values: float
"""
self._dhw_average_volume_pers_day = values
@ -273,7 +273,7 @@ class UsageZone:
@property
def electrical_app_average_consumption_sqm_year(self):
"""
Get average consumption of electrical appliances in kiloWatts hour per m2 and year (kWh/m2yr)
Get average consumption of electrical appliances in Joules hour per m2 and year (J/m2yr)
:return: float
"""
return self._electrical_app_average_consumption_sqm_year
@ -281,7 +281,7 @@ class UsageZone:
@electrical_app_average_consumption_sqm_year.setter
def electrical_app_average_consumption_sqm_year(self, values):
"""
average consumption of electrical appliances in kiloWatts hour per m2 and year (kWh/m2yr)
average consumption of electrical appliances in Joules per m2 and year (J/m2yr)
:param values: float
"""
self._electrical_app_average_consumption_sqm_year = values

View File

@ -1,3 +1,8 @@
"""
NrelBuildingArchetype stores construction information by building archetypes
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2020 Project Author Pilar Monsalvete pilar_monsalvete@yahoo.es
"""
from typing import List
from factories.physics_feeders.data_classes.nrel_thermal_boundary_archetype import NrelThermalBoundaryArchetype
@ -22,59 +27,71 @@ class NrelBuildingArchetype:
@property
def archetype_keys(self) -> {}:
"""
Get keys that define the archetype
:return: dictionary
"""
return self._archetype_keys
@property
def average_storey_height(self):
"""
Get archetype's building storey height in meters
:return: float
"""
return self._average_storey_height
@property
def storeys_above_ground(self):
"""
Get archetype's building storey height in meters
:return: float
"""
return self._storeys_above_ground
@property
def effective_thermal_capacity(self):
"""
:return:
Get archetype's effective thermal capacity in J/m2K
:return: float
"""
return self._effective_thermal_capacity
@property
def additional_thermal_bridge_u_value(self):
"""
:return:
Get archetype's additional U value due to thermal bridges in W/m2K
:return: float
"""
return self._additional_thermal_bridge_u_value
@property
def indirectly_heated_area_ratio(self):
"""
:return:
Get archetype's indirectly heated area ratio
:return: float
"""
return self._indirectly_heated_area_ratio
@property
def infiltration_rate_system_off(self):
"""
:return:
Get archetype's infiltration rate when conditioning systems OFF in air changes per hour (ACH)
:return: float
"""
return self._infiltration_rate_system_off
@property
def infiltration_rate_system_on(self):
"""
:return:
Get archetype's infiltration rate when conditioning systems ON in air changes per hour (ACH)
:return: float
"""
return self._infiltration_rate_system_on
@property
def thermal_boundary_archetypes(self) -> List[NrelThermalBoundaryArchetype]:
"""
Get thermal boundary archetypes associated to the building archetype
:return: list of boundary archetypes
"""
return self._thermal_boundary_archetypes

View File

@ -1,3 +1,10 @@
"""
NrelLayerArchetype stores layer and materials information, complementing the NrelBuildingArchetype class
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2020 Project Author Pilar Monsalvete pilar_monsalvete@yahoo.es
"""
class NrelLayerArchetype:
"""
NrelLayerArchetype class

View File

@ -1,3 +1,8 @@
"""
NrelThermalBoundaryArchetype stores thermal boundaries information, complementing the NrelBuildingArchetype class
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2020 Project Author Pilar Monsalvete pilar_monsalvete@yahoo.es
"""
from typing import List
from factories.physics_feeders.data_classes.nrel_layer_archetype import NrelLayerArchetype

View File

@ -1,3 +1,10 @@
"""
NrelThermalOpeningArchetype stores thermal openings information, complementing the NrelBuildingArchetype class
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2020 Project Author Pilar Monsalvete pilar_monsalvete@yahoo.es
"""
class NrelThermalOpeningArchetype:
"""
NrelThermalOpeningArchetype class

View File

@ -4,6 +4,7 @@ and enriches the city with archetypes and materials
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2020 Project Author Pilar Monsalvete pilar_monsalvete@yahoo.es
"""
import sys
import xmltodict
from factories.physics_feeders.data_classes.nrel_building_achetype import NrelBuildingArchetype as nba
@ -35,12 +36,28 @@ class NrelPhysicsInterface:
if key[0] == '@':
archetype_keys[key] = value
average_storey_height = archetype['average_storey_height']['#text']
units = archetype['average_storey_height']['@units']
if units != 'm':
raise Exception(f'average storey height units = {units}, expected meters')
storeys_above_ground = archetype['number_of_storeys']['#text']
effective_thermal_capacity = archetype['thermal_capacity']['#text']
effective_thermal_capacity = float(archetype['thermal_capacity']['#text'])*1000
units = archetype['thermal_capacity']['@units']
if units != 'kJ/K m2':
raise Exception(f'thermal capacity units = {units}, expected kJ/K m2')
additional_thermal_bridge_u_value = archetype['extra_loses_due_to_thermal_bridges']['#text']
units = archetype['extra_loses_due_to_thermal_bridges']['@units']
if units != 'W/K m2':
raise Exception(f'extra loses due to thermal bridges units = {units}, expected W/K m2')
indirectly_heated_area_ratio = archetype['indirect_heated_ratio']['#text']
# todo: check how infiltration rate is used in the model
infiltration_rate_system_off = archetype['infiltration_rate_for_ventilation_system_off']['#text']
units = archetype['infiltration_rate_for_ventilation_system_off']['@units']
if units != 'ACH':
raise Exception(f'infiltration rate for ventilation when system off units = {units}, expected ACH')
infiltration_rate_system_on = archetype['infiltration_rate_for_ventilation_system_on']['#text']
units = archetype['infiltration_rate_for_ventilation_system_on']['@units']
if units != 'ACH':
raise Exception(f'infiltration rate for ventilation when system on units = {units}, expected ACH')
thermal_boundary_archetypes = []
for construction in archetype['constructions']['construction']:
@ -60,13 +77,28 @@ class NrelPhysicsInterface:
no_mass = 'no_mass' in material_lib
if no_mass:
thermal_resistance = material_lib['thermal_resistance']['#text']
units = material_lib['thermal_resistance']['@units']
if units != 'm2 K/W':
raise Exception(f'thermal resistance units = {units}, expected m2 K/W')
layer = nla(name, solar_absorptance, thermal_absorptance, visible_absorptance, no_mass=no_mass,
thermal_resistance=thermal_resistance)
else:
thickness = current_layer['thickness']['#text']
units = current_layer['thickness']['@units']
if units != 'm':
raise Exception(f'thickness units = {units}, expected m')
conductivity = material_lib['conductivity']['#text']
units = material_lib['conductivity']['@units']
if units != 'W/m K':
raise Exception(f'conductivity units = {units}, expected W/m K')
specific_heat = material_lib['specific_heat']['#text']
units = material_lib['specific_heat']['@units']
if units != 'J/kg K':
raise Exception(f'specific_heat units = {units}, expected J/kg K')
density = material_lib['density']['#text']
units = material_lib['density']['@units']
if units != 'kg/m3':
raise Exception(f'density units = {units}, expected kg/m3')
layer = nla(name, solar_absorptance, thermal_absorptance, visible_absorptance, thickness=thickness,
conductivity=conductivity, specific_heat=specific_heat, density=density)
layers.append(layer)
@ -79,7 +111,13 @@ class NrelPhysicsInterface:
frame_ratio = w_lib['frame_ratio']['#text']
if 'conductivity' in w_lib:
conductivity = w_lib['conductivity']['#text']
units = w_lib['conductivity']['@units']
if units != 'W/m K':
raise Exception(f'conductivity units = {units}, expected W/m K')
thickness = w_lib['thickness']['#text']
units = w_lib['thickness']['@units']
if units != 'm':
raise Exception(f'thickness units = {units}, expected m')
g_value = w_lib['solar_transmittance_at_normal_incidence']['#text']
back_side_solar_transmittance_at_normal_incidence = \
w_lib['back_side_solar_transmittance_at_normal_incidence']['#text']
@ -92,6 +130,9 @@ class NrelPhysicsInterface:
front_side_solar_transmittance_at_normal_incidence)
else:
overall_u_value = w_lib['overall_u_value']['#text']
units = w_lib['overall_u_value']['@units']
if units != 'W/m2 K':
raise Exception(f'overall U-value units = {units}, expected W/m2 K')
g_value = w_lib['g_value']
thermal_opening = ntoa(frame_ratio=frame_ratio, g_value=g_value, overall_u_value=overall_u_value)
@ -105,6 +146,9 @@ class NrelPhysicsInterface:
else:
if 'overall_u_value' in c_lib:
overall_u_value = c_lib['overall_u_value']['#text']
units = c_lib['overall_u_value']['@units']
if units != 'W/m2 K':
raise Exception(f'overall U-value units = {units}, expected W/m2 K')
outside_solar_absorptance = c_lib['outside_solar_absorptance']['#text']
thermal_boundary_archetype = ntba(construction_type, window_ratio, construction_name, layers,
thermal_opening, outside_solar_absorptance=outside_solar_absorptance,

View File

@ -1,3 +1,10 @@
"""
HftInternalGainsArchetype stores internal gains information, complementing the HftUsageZoneArchetype class
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2020 Project Author Pilar Monsalvete pilar_monsalvete@yahoo.es
"""
class HftInternalGainsArchetype:
"""
HftInternalGainsArchetype class
@ -12,7 +19,7 @@ class HftInternalGainsArchetype:
@property
def average_internal_gain(self):
"""
Get internal gains average internal gain in w/m2
Get internal gains average internal gain in W/m2
:return: float
"""
return self._average_internal_gain

View File

@ -1,3 +1,8 @@
"""
HftUsageZoneArchetype stores usage information by building archetypes
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2020 Project Author Pilar Monsalvete pilar_monsalvete@yahoo.es
"""
from typing import List
from factories.usage_feeders.data_classes.hft_internal_gains_archetype import HftInternalGainsArchetype
@ -77,7 +82,7 @@ class HftUsageZoneArchetype:
@property
def mechanical_air_change(self):
"""
Set usage zone mechanical air change in air change per hour
Set usage zone mechanical air change in air change per hour (ACH)
:return: float
"""
return self._mechanical_air_change
@ -117,7 +122,7 @@ class HftUsageZoneArchetype:
@property
def dhw_average_volume_pers_day(self):
"""
Get average DHW consumption in liters per person per day
Get average DHW consumption in m3 per person per day
:return: float
"""
return self._dhw_average_volume_pers_day
@ -133,7 +138,7 @@ class HftUsageZoneArchetype:
@property
def electrical_app_average_consumption_sqm_year(self):
"""
Get average consumption of electrical appliances in kiloWatts hour per m2 and year (kWh/m2yr)
Get average consumption of electrical appliances in Joules per m2 and year (J/m2yr)
:return: float
"""
return self._electrical_app_average_consumption_sqm_year

View File

@ -42,13 +42,16 @@ class HftUsageInterface:
dhw_average_volume_pers_day = None
dhw_preparation_temperature = None
if 'domestic_hot_water' in zone_usage_type['endUses']:
dhw_average_volume_pers_day = zone_usage_type['endUses']['domestic_hot_water']['averageVolumePerPersAndDay']
# liters to cubic meters
dhw_average_volume_pers_day = float(
zone_usage_type['endUses']['domestic_hot_water']['averageVolumePerPersAndDay'])/1000
dhw_preparation_temperature = zone_usage_type['endUses']['domestic_hot_water']['preparationTemperature']
electrical_app_average_consumption_sqm_year = None
if 'all_electrical_appliances' in zone_usage_type['endUses']:
if 'averageConsumptionPerSqmAndYear' in zone_usage_type['endUses']['all_electrical_appliances']:
# kWh to J
electrical_app_average_consumption_sqm_year = \
zone_usage_type['endUses']['all_electrical_appliances']['averageConsumptionPerSqmAndYear']
float(zone_usage_type['endUses']['all_electrical_appliances']['averageConsumptionPerSqmAndYear'])/3.6
# todo: for internal_gain in usage_zone_variant['occupancy']['internGains']:????????????????
# There are no more internal gains? How is it saved when more than one???

View File

@ -1,6 +1,5 @@
xmltodict~=0.12.0
numpy~=1.19.0
open3d~=0.10.0.0
trimesh~=3.7.0
pyproj~=2.6.1.post1
pyny3d~=0.2
@ -56,3 +55,4 @@ geomeppy~=0.11.8
pyglet~=1.5.8
networkx~=2.5
xlrd~=1.2.0
open3d~=0.11.2