Merge remote-tracking branch 'origin/master'

# Conflicts:
#	physics/physics_feeders/us_base_physics_parameters.py
This commit is contained in:
pilar 2020-06-10 11:11:35 -04:00
commit 0bdcf9b139
11 changed files with 229 additions and 65 deletions

View File

@ -3,7 +3,6 @@ City module
SPDX - License - Identifier: LGPL - 3.0 - or -later SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
""" """
import sys import sys
from typing import List, Union from typing import List, Union
import pyproj import pyproj
@ -119,7 +118,7 @@ class City:
def name(self, value): def name(self, value):
""" """
Set the city name Set the city name
:param value: :param value:str
:return: None :return: None
""" """
self._name = value self._name = value

View File

@ -4,6 +4,7 @@ SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
""" """
from typing import Union, List from typing import Union, List
from pathlib import Path
from matplotlib import pylab from matplotlib import pylab
from city_model_structure.polyhedron import Polyhedron from city_model_structure.polyhedron import Polyhedron
from city_model_structure.thermal_zone import ThermalZone from city_model_structure.thermal_zone import ThermalZone
@ -12,13 +13,12 @@ from city_model_structure.surface import Surface
from shapely import ops from shapely import ops
from shapely.geometry import MultiPolygon from shapely.geometry import MultiPolygon
import numpy as np import numpy as np
from pathlib import Path
import matplotlib.patches as patches import matplotlib.patches as patches
from helpers.geometry import Geometry from helpers.geometry import Geometry
from city_model_structure.usage_zone import UsageZone from city_model_structure.usage_zone import UsageZone
class CityObject: class CityObject:
""" """
CityObject class CityObject class
@ -146,7 +146,7 @@ class CityObject:
def surface(self, name) -> Union[Surface, None]: def surface(self, name) -> Union[Surface, None]:
""" """
Get the city object surface with a given name Get the city object surface with a given name
:param name: Surface name:str :param name: str
:return: None or Surface :return: None or Surface
""" """
for s in self.surfaces: for s in self.surfaces:
@ -185,8 +185,8 @@ class CityObject:
def stl_export(self, path): def stl_export(self, path):
""" """
Export the city object to stl file (city_object_name.stl) Export the city object to stl file (city_object_name.stl) to the given path
:param path: path to export :param path: str
:return: None :return: None
""" """
if self._polyhedron is None: if self._polyhedron is None:
@ -222,17 +222,26 @@ class CityObject:
def average_storey_height(self, value): def average_storey_height(self, value):
""" """
Set city object average storey height in meters Set city object average storey height in meters
:param value: average storey height in meters:float :param value: float
:return: None :return: None
""" """
self._average_storey_height = value self._average_storey_height = value
@property @property
def storeys_above_ground(self): def storeys_above_ground(self):
"""
Get city object storeys number above ground
:return: int
"""
return self._storeys_above_ground return self._storeys_above_ground
@storeys_above_ground.setter @storeys_above_ground.setter
def storeys_above_ground(self, value): def storeys_above_ground(self, value):
"""
Set city object storeys number above ground
:param value: int
:return:
"""
self._storeys_above_ground = value self._storeys_above_ground = value
@staticmethod @staticmethod
@ -259,6 +268,10 @@ class CityObject:
@property @property
def foot_print(self) -> Surface: def foot_print(self) -> Surface:
"""
City object foot print surface
:return: Surface
"""
if self._foot_print is None: if self._foot_print is None:
shapelys = [] shapelys = []
union = None union = None
@ -268,7 +281,7 @@ class CityObject:
shapelys.append(surface.shapely) shapelys.append(surface.shapely)
union = ops.unary_union(shapelys) union = ops.unary_union(shapelys)
shapelys = [union] shapelys = [union]
if type(union) == MultiPolygon: if isinstance(union, MultiPolygon):
Exception('foot print returns a multipolygon') Exception('foot print returns a multipolygon')
points_list = [] points_list = []
for point_tuple in union.exterior.coords: for point_tuple in union.exterior.coords:
@ -288,10 +301,18 @@ class CityObject:
@property @property
def type(self): def type(self):
"""
City object type
:return: str
"""
return self._type return self._type
@property @property
def max_height(self): def max_height(self):
"""
City object maximal height in meters
:return: float
"""
if self._polyhedron is None: if self._polyhedron is None:
self._polyhedron = Polyhedron(self.surfaces) self._polyhedron = Polyhedron(self.surfaces)
return self._polyhedron.max_z return self._polyhedron.max_z

View File

@ -6,40 +6,79 @@ Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@conc
class InternalGains: class InternalGains:
"""
InternalGains class
"""
def __init__(self): def __init__(self):
self._average_internal_gain_w_m2 = None self._average_internal_gain = None
self._convective_fraction = None self._convective_fraction = None
self._radiative_fraction = None self._radiative_fraction = None
self._latent_fraction = None self._latent_fraction = None
@property @property
def average_internal_gain_w_m2(self): def average_internal_gain(self):
return self._average_internal_gain_w_m2 """
Get internal gains average internal gain in w/m2
:return: float
"""
return self._average_internal_gain
@average_internal_gain_w_m2.setter @average_internal_gain.setter
def average_internal_gain_w_m2(self, value): def average_internal_gain(self, value):
self._average_internal_gain_w_m2 = value """
Set internal gains average internal gain in w/m2
:param value: float
:return: None
"""
self._average_internal_gain = value
@property @property
def convective_fraction(self): def convective_fraction(self):
"""
Get internal gains convective fraction
:return: float
"""
return self._convective_fraction return self._convective_fraction
@convective_fraction.setter @convective_fraction.setter
def convective_fraction(self, value): def convective_fraction(self, value):
"""
Set internal gains convective fraction
:param value: float
:return: None
"""
self._convective_fraction = value self._convective_fraction = value
@property @property
def radiative_fraction(self): def radiative_fraction(self):
"""
Get internal gains radiative fraction
:return: float
"""
return self._radiative_fraction return self._radiative_fraction
@radiative_fraction.setter @radiative_fraction.setter
def radiative_fraction(self, value): def radiative_fraction(self, value):
"""
Set internal gains convective fraction
:param value: float
:return: None
"""
self._radiative_fraction = value self._radiative_fraction = value
@property @property
def latent_fraction(self): def latent_fraction(self):
"""
Get internal gains latent fraction
:return: float
"""
return self._latent_fraction return self._latent_fraction
@latent_fraction.setter @latent_fraction.setter
def latent_fraction(self, value): def latent_fraction(self, value):
"""
Set internal gains latent fraction
:param value: float
:return: None
"""
self._latent_fraction = value self._latent_fraction = value

View File

@ -7,22 +7,43 @@ from city_model_structure.material import Material
class Layer: class Layer:
"""
Layer class
"""
def __init__(self): def __init__(self):
self._material = None self._material = None
self._thickness_m = None self._thickness = None
@property @property
def material(self) -> Material: def material(self) -> Material:
"""
Get layer material
:return: Material
"""
return self._material return self._material
@material.setter @material.setter
def material(self, value): def material(self, value):
"""
Set layer material
:param value: Material
:return: None
"""
self._material = value self._material = value
@property @property
def thickness_m(self): def thickness(self):
return self._thickness_m """
Get layer thickness in meters
:return: float
"""
return self._thickness
@thickness_m.setter @thickness.setter
def thickness_m(self, value): def thickness(self, value):
self._thickness_m = value """
Get layer thickness in meters
:param value: float
:return: None
"""
self._thickness = value

View File

@ -6,76 +6,151 @@ Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@conc
class Material: class Material:
"""
Material class
"""
def __init__(self): def __init__(self):
self._conductivity_wm_k = None self._conductivity = None
self._specific_heat_jkg_k = None self._specific_heat = None
self._density_kg_m3 = None self._density = None
self._solar_absorptance = None self._solar_absorptance = None
self._thermal_absorptance = None self._thermal_absorptance = None
self._visible_absorptance = None self._visible_absorptance = None
self._no_mass = False self._no_mass = False
self._thermal_resistance_m2k_w = None self._thermal_resistance = None
@property @property
def conductivity_wm_k(self): def conductivity(self):
return self._conductivity_wm_k """
Get material conductivity in W/mK
:return: float
"""
return self._conductivity
@conductivity_wm_k.setter @conductivity.setter
def conductivity_wm_k(self, value): def conductivity(self, value):
self._conductivity_wm_k = value """
Set material conductivity in W/mK
:param value: float
:return: None
"""
self._conductivity = value
@property @property
def specific_heat_jkg_k(self): def specific_heat(self):
return self._specific_heat_jkg_k """
Get material conductivity in J/kgK
:return: float
"""
return self._specific_heat
@specific_heat_jkg_k.setter @specific_heat.setter
def specific_heat_jkg_k(self, value): def specific_heat(self, value):
self._specific_heat_jkg_k = value """
Get material conductivity in J/kgK
:param value: float
:return: None
"""
self._specific_heat = value
@property @property
def density_kg_m3(self): def density(self):
return self._density_kg_m3 """
Get material density in kg/m3
:return: float
"""
return self._density
@density_kg_m3.setter @density.setter
def density_kg_m3(self, value): def density(self, value):
self._density_kg_m3 = value """
Set material density in kg/m3
:param value: float
:return: None
"""
self._density = value
@property @property
def solar_absorptance(self): def solar_absorptance(self):
"""
Get material solar absorptance
:return: float
"""
return self._solar_absorptance return self._solar_absorptance
@solar_absorptance.setter @solar_absorptance.setter
def solar_absorptance(self, value): def solar_absorptance(self, value):
"""
Set material solar absorptance
:param value: float
:return: None
"""
self._solar_absorptance = value self._solar_absorptance = value
@property @property
def thermal_absorptance(self): def thermal_absorptance(self):
"""
Get material thermal absorptance
:return: float
"""
return self._thermal_absorptance return self._thermal_absorptance
@thermal_absorptance.setter @thermal_absorptance.setter
def thermal_absorptance(self, value): def thermal_absorptance(self, value):
"""
Set material thermal absorptance
:param value: float
:return: None
"""
self._thermal_absorptance = value self._thermal_absorptance = value
@property @property
def visible_absorptance(self): def visible_absorptance(self):
"""
Get material visible absorptance
:return: float
"""
return self._visible_absorptance return self._visible_absorptance
@visible_absorptance.setter @visible_absorptance.setter
def visible_absorptance(self, value): def visible_absorptance(self, value):
"""
Set material visible absorptance
:param value: float
:return: None
"""
self._visible_absorptance = value self._visible_absorptance = value
@property @property
def no_mass(self): def no_mass(self):
"""
Get material no mass flag
:return: Boolean
"""
return self._no_mass return self._no_mass
@no_mass.setter @no_mass.setter
def no_mass(self, value): def no_mass(self, value):
"""
Set material no mass flag
:param value: Boolean
:return: None
"""
self._no_mass = value self._no_mass = value
@property @property
def thermal_resistance_m2k_w(self): def thermal_resistance(self):
return self._thermal_resistance_m2k_w """
Get material thermal resistance in m2K/W
:return: float
"""
return self._thermal_resistance
@thermal_resistance_m2k_w.setter @thermal_resistance.setter
def thermal_resistance_m2k_w(self, value): def thermal_resistance(self, value):
self._thermal_resistance_m2k_w = value """
Set material thermal resistance in m2K/W
:param value: float
:return: None
"""
self._thermal_resistance = value

View File

@ -120,9 +120,9 @@ class ThermalBoundary:
try: try:
for layer in self.layers: for layer in self.layers:
if layer.material.no_mass: if layer.material.no_mass:
r_value += float(layer.material.thermal_resistance_m2k_w) r_value += float(layer.material.thermal_resistance)
else: else:
r_value = r_value + float(layer.material.conductivity_wm_k)/float(layer.thickness_m) r_value = r_value + float(layer.material.conductivity) / float(layer.thickness)
self._u_value = 1.0/r_value self._u_value = 1.0/r_value
except TypeError: except TypeError:
raise Exception('Constructions layers are not initialized') raise Exception('Constructions layers are not initialized')

View File

@ -3,8 +3,8 @@ ThermalZone module
SPDX - License - Identifier: LGPL - 3.0 - or -later SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
""" """
from __future__ import annotations
from typing import List from typing import List
from city_model_structure.thermal_boundary import ThermalBoundary
from city_model_structure.usage_zone import UsageZone from city_model_structure.usage_zone import UsageZone
from helpers.configuration import Configuration from helpers.configuration import Configuration
@ -41,7 +41,7 @@ class ThermalZone:
return self._floor_area return self._floor_area
@property @property
def bounded(self) -> List[ThermalBoundary]: def bounded(self) -> List['ThermalBoundary']:
return self._bounded return self._bounded
@bounded.setter @bounded.setter

View File

@ -6,8 +6,11 @@ Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@conc
class Window: class Window:
"""
Window class
"""
def __init__(self): def __init__(self):
self._conductivity_wm_k = None self._conductivity = None
self._solar_transmittance_at_normal_incidence = None self._solar_transmittance_at_normal_incidence = None
self._front_side_solar_reflectance_at_normal_incidence = None self._front_side_solar_reflectance_at_normal_incidence = None
self._back_side_solar_reflectance_at_normal_incidence = None self._back_side_solar_reflectance_at_normal_incidence = None
@ -16,12 +19,16 @@ class Window:
self._shgc = None self._shgc = None
@property @property
def conductivity_wm_k(self): def conductivity(self):
return self._conductivity_wm_k """
Get window conductivity in W/mK
:return: float
"""
return self._conductivity
@conductivity_wm_k.setter @conductivity.setter
def conductivity_wm_k(self, value): def conductivity(self, value):
self._conductivity_wm_k = value self._conductivity = value
@property @property
def solar_transmittance_at_normal_incidence(self): def solar_transmittance_at_normal_incidence(self):

View File

@ -62,19 +62,19 @@ class UsBasePhysicsParameters:
for current_layer in c_lib['layers']['layer']: for current_layer in c_lib['layers']['layer']:
layer = Layer() layer = Layer()
if 'thickness' in current_layer: if 'thickness' in current_layer:
layer.thickness_m = current_layer['thickness']['#text'] layer.thickness = current_layer['thickness']['#text']
material_lib = self.search_construction_type('material', current_layer['material']) material_lib = self.search_construction_type('material', current_layer['material'])
material = Material() material = Material()
if 'conductivity' in material_lib: if 'conductivity' in material_lib:
material.conductivity_wm_k = material_lib['conductivity']['#text'] material.conductivity = material_lib['conductivity']['#text']
material.specific_heat_jkg_k = material_lib['specific_heat']['#text'] material.specific_heat = material_lib['specific_heat']['#text']
material.density_kg_m3 = material_lib['density']['#text'] material.density = material_lib['density']['#text']
material.solar_absorptance = material_lib['solar_absorptance']['#text'] material.solar_absorptance = material_lib['solar_absorptance']['#text']
material.thermal_absorptance = material_lib['thermal_absorptance']['#text'] material.thermal_absorptance = material_lib['thermal_absorptance']['#text']
material.visible_absorptance = material_lib['visible_absorptance']['#text'] material.visible_absorptance = material_lib['visible_absorptance']['#text']
material.no_mass = 'no_mass' in material_lib material.no_mass = 'no_mass' in material_lib
if 'thermal_resistance' in material_lib: if 'thermal_resistance' in material_lib:
material.thermal_resistance_m2k_w = material_lib['thermal_resistance']['#text'] material.thermal_resistance = material_lib['thermal_resistance']['#text']
layer.material = material layer.material = material
thermal_boundary.layers.append(layer) thermal_boundary.layers.append(layer)
for opening in thermal_boundary.thermal_openings: for opening in thermal_boundary.thermal_openings:
@ -84,7 +84,7 @@ class UsBasePhysicsParameters:
opening.conductivity_w_mk = w_lib['conductivity']['#text'] opening.conductivity_w_mk = w_lib['conductivity']['#text']
opening.frame_ratio = w_lib['frame_ratio']['#text'] opening.frame_ratio = w_lib['frame_ratio']['#text']
opening.g_value = w_lib['solar_transmittance_at_normal_incidence']['#text'] opening.g_value = w_lib['solar_transmittance_at_normal_incidence']['#text']
opening.thickness_m = w_lib['thickness']['#text'] opening.thickness = w_lib['thickness']['#text']
opening.back_side_solar_transmittance_at_normal_incidence = \ opening.back_side_solar_transmittance_at_normal_incidence = \
w_lib['back_side_solar_transmittance_at_normal_incidence']['#text'] w_lib['back_side_solar_transmittance_at_normal_incidence']['#text']
opening.front_side_solar_transmittance_at_normal_incidence = \ opening.front_side_solar_transmittance_at_normal_incidence = \

View File

@ -18,7 +18,7 @@ ignore-patterns=
# Python code to execute, usually for sys.path manipulation such as # Python code to execute, usually for sys.path manipulation such as
# pygtk.require(). # pygtk.require().
init-hook='sys.path = list(); sys.path.append(".")' init-hook='sys.path = list(); sys.path.append("./helpers/"); sys.path.append("../")'
# Use multiple processes to speed up Pylint. Specifying 0 will auto-detect the # Use multiple processes to speed up Pylint. Specifying 0 will auto-detect the
# number of processors available to use. # number of processors available to use.
@ -138,7 +138,9 @@ disable=print-statement,
xreadlines-attribute, xreadlines-attribute,
deprecated-sys-function, deprecated-sys-function,
exception-escape, exception-escape,
comprehension-escape comprehension-escape,
import-error,
no-name-in-module
# Enable the message, report, category or checker with the given id(s). You can # Enable the message, report, category or checker with the given id(s). You can
# either give multiple identifier separated by comma (,) or put this option # either give multiple identifier separated by comma (,) or put this option

View File

@ -51,7 +51,7 @@ class UsBaseUsageParameters:
int_gains = InternalGains() int_gains = InternalGains()
int_gains.latent_fraction = zone_usage_type['occupancy']['internGains']['latentFraction'] int_gains.latent_fraction = zone_usage_type['occupancy']['internGains']['latentFraction']
int_gains.convective_fraction = zone_usage_type['occupancy']['internGains']['convectiveFraction'] int_gains.convective_fraction = zone_usage_type['occupancy']['internGains']['convectiveFraction']
int_gains.average_internal_gain_w_m2 = zone_usage_type['occupancy']['internGains']['averageInternGainPerSqm'] int_gains.average_internal_gain = zone_usage_type['occupancy']['internGains']['averageInternGainPerSqm']
int_gains.radiative_fraction = zone_usage_type['occupancy']['internGains']['radiantFraction'] int_gains.radiative_fraction = zone_usage_type['occupancy']['internGains']['radiantFraction']
usage_zone.internal_gains = [int_gains] usage_zone.internal_gains = [int_gains]
return usage_zone return usage_zone
@ -76,7 +76,7 @@ class UsBaseUsageParameters:
if 'convectiveFraction' in usage_zone_variant['occupancy']['internGains']: if 'convectiveFraction' in usage_zone_variant['occupancy']['internGains']:
usage_zone.int_gains[0].convective_fraction = usage_zone_variant['occupancy']['internGains']['convectiveFraction'] usage_zone.int_gains[0].convective_fraction = usage_zone_variant['occupancy']['internGains']['convectiveFraction']
if 'averageInternGainPerSqm' in usage_zone_variant['occupancy']['internGains']: if 'averageInternGainPerSqm' in usage_zone_variant['occupancy']['internGains']:
usage_zone.int_gains[0].average_internal_gain_w_m2 = \ usage_zone.int_gains[0].average_internal_gain = \
usage_zone_variant['occupancy']['internGains']['averageInternGainPerSqm'] usage_zone_variant['occupancy']['internGains']['averageInternGainPerSqm']
if 'radiantFraction' in usage_zone_variant['occupancy']['internGains']: if 'radiantFraction' in usage_zone_variant['occupancy']['internGains']:
usage_zone.int_gains[0].radiative_fraction = usage_zone_variant['occupancy']['internGains']['radiantFraction'] usage_zone.int_gains[0].radiative_fraction = usage_zone_variant['occupancy']['internGains']['radiantFraction']