Merge remote-tracking branch 'origin/master'

This commit is contained in:
Guille Gutierrez 2020-06-15 11:38:39 -04:00
commit 89ba809691
6 changed files with 33 additions and 16 deletions

View File

@ -189,10 +189,11 @@ class CityObject:
:param path: str
:return: None
"""
# todo: this is a method just for debugging, it will be soon removed
if self._polyhedron is None:
self._polyhedron = Polyhedron(self.surfaces)
full_path = (Path(path) / (self._name + '.stl')).resolve()
self._polyhedron.save(full_path)
self._polyhedron.export(full_path)
@property
def year_of_construction(self):

View File

@ -4,8 +4,8 @@ SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
"""
import numpy as np
import stl
from helpers.geometry_helper import GeometryHelper
from trimesh import Trimesh
class Polyhedron:
@ -24,7 +24,7 @@ class Polyhedron:
def _position_of(self, point):
vertices = self.vertices
for i in enumerate(vertices):
for i in range(len(vertices)):
if self._geometry.almost_equal(vertices[i], point):
return i
return -1
@ -70,10 +70,10 @@ class Polyhedron:
@property
def _polyhedron_mesh(self):
if self._mesh is None:
self._mesh = stl.mesh.Mesh(np.zeros(self.faces.shape[0], dtype=stl.mesh.Mesh.dtype))
for i, faces in enumerate(self.faces):
for j in range(3):
self._mesh.vectors[i][j] = self.vertices[faces[j], :]
self._mesh = Trimesh(vertices=np.asarray(self.vertices), faces=np.asarray(self.faces))
if not self._mesh.is_volume:
print('The geometry is not a closed volume')
return None
return self._mesh
@property
@ -83,7 +83,7 @@ class Polyhedron:
:return: float
"""
if self._volume is None:
self._volume, _, _ = self._polyhedron_mesh.get_mass_properties()
self._volume = self._polyhedron_mesh.volume
return self._volume
@property
@ -92,12 +92,15 @@ class Polyhedron:
Polyhedron maximal z value
:return: float
"""
return self._polyhedron_mesh.z.max()
bounds = self._polyhedron_mesh.bounds
z_max = max(bounds[:, 2])
print(z_max)
return z_max
def save(self, full_path):
def export(self, full_path):
"""
Export the polyhedron to stl given file
:param full_path: str
:return: None
"""
self._polyhedron_mesh.save(full_path)
self._polyhedron_mesh.export(full_path)

View File

@ -209,7 +209,7 @@ class Surface:
equal = 0
for terrain_point in terrain_points:
for ground_point in ground_points:
if self._geometry.almost_equal(terrain_point, ground_point):
if self._geometry_helper.almost_equal(terrain_point, ground_point):
equal += 1
return equal == len(terrain_points)

View File

@ -5,6 +5,7 @@ Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@conc
"""
from typing import List
from city_model_structure.internal_gains import InternalGains
from helpers.configuration_helper import ConfigurationHelper
class UsageZone:
@ -19,7 +20,8 @@ class UsageZone:
self._cooling_setpoint = None
self._hours_day = None
self._days_year = None
self._mechanical_air_change = None
# todo: this must come from library, talk to Rabeeh
self._mechanical_air_change = ConfigurationHelper().min_air_change
@property
def internal_gains(self) -> List[InternalGains]:

View File

@ -1,7 +1,9 @@
# These values are intended as configurable assumptions
[convective_fluxes]
h_i = 10 # W/m2K
h_e = 25 # W/m2K
# interior convective coefficient in W/m2K
h_i = 10
# exterior convective coefficient in W/m2K
h_e = 25
[windows]
frame_ratio = 0
@ -14,3 +16,4 @@ indirectly_heated_area_ratio = 0
infiltration_rate_system_on = 0
outside_solar_absorptance = 0.2
shortwave_reflectance = 0.8
min_air_change = 0.5

View File

@ -85,7 +85,15 @@ class ConfigurationHelper:
@property
def outside_solar_absorptance(self):
"""
Configured infiltration rate system off in air change per hour
Configured exterior solar absorptance
:return: float
"""
return self._config.getfloat('thermal_zones', 'outside_solar_absorptance')
@property
def min_air_change(self):
"""
Configured minimum air change rate in air changes per hour
:return: float
"""
return self._config.getfloat('thermal_zones', 'min_air_change')