added volume to thermal_zones
This commit is contained in:
parent
826c5e566c
commit
eb32b7b3e6
|
@ -301,17 +301,17 @@ class Building(CityObject):
|
||||||
"""
|
"""
|
||||||
number_of_storeys, height = self._calculate_number_storeys_and_height(self.average_storey_height, self.eave_height,
|
number_of_storeys, height = self._calculate_number_storeys_and_height(self.average_storey_height, self.eave_height,
|
||||||
self.storeys_above_ground)
|
self.storeys_above_ground)
|
||||||
number_of_storeys = 1
|
|
||||||
if number_of_storeys == 0:
|
if number_of_storeys == 0:
|
||||||
raise Exception(f'Number of storeys cannot be 0')
|
raise Exception(f'Number of storeys cannot be 0')
|
||||||
|
|
||||||
if number_of_storeys == 1:
|
if number_of_storeys == 1:
|
||||||
return [Storey('storey_0', self.surfaces, [None, None])]
|
return [Storey('storey_0', self.surfaces, [None, None], self.volume)]
|
||||||
|
|
||||||
storeys = []
|
storeys = []
|
||||||
surfaces_child_last_storey = []
|
surfaces_child_last_storey = []
|
||||||
rest_surfaces = []
|
rest_surfaces = []
|
||||||
|
|
||||||
|
total_volume = 0
|
||||||
for i in range(0, number_of_storeys-1):
|
for i in range(0, number_of_storeys-1):
|
||||||
name = 'storey_' + str(i)
|
name = 'storey_' + str(i)
|
||||||
surfaces_child = []
|
surfaces_child = []
|
||||||
|
@ -345,10 +345,15 @@ class Building(CityObject):
|
||||||
polygon = Polygon(coordinates)
|
polygon = Polygon(coordinates)
|
||||||
ceiling = Surface(polygon, polygon, surface_type=cte.INTERIOR_SLAB)
|
ceiling = Surface(polygon, polygon, surface_type=cte.INTERIOR_SLAB)
|
||||||
surfaces_child.append(ceiling)
|
surfaces_child.append(ceiling)
|
||||||
storeys.append(Storey(name, surfaces_child, neighbours))
|
volume = ceiling.area_above_ground * height
|
||||||
|
total_volume += volume
|
||||||
|
storeys.append(Storey(name, surfaces_child, neighbours, volume))
|
||||||
name = 'storey_' + str(number_of_storeys-1)
|
name = 'storey_' + str(number_of_storeys-1)
|
||||||
neighbours = ['storey_' + str(number_of_storeys-2), None]
|
neighbours = ['storey_' + str(number_of_storeys-2), None]
|
||||||
storeys.append(Storey(name, surfaces_child_last_storey, neighbours))
|
volume = self.volume - total_volume
|
||||||
|
if volume < 0:
|
||||||
|
raise Exception('Error in storeys creation, volume of last storey cannot be lower that 0')
|
||||||
|
storeys.append(Storey(name, surfaces_child_last_storey, neighbours, volume))
|
||||||
return storeys
|
return storeys
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|
|
@ -19,7 +19,7 @@ class Storey:
|
||||||
"""
|
"""
|
||||||
Storey class
|
Storey class
|
||||||
"""
|
"""
|
||||||
def __init__(self, name, surfaces, neighbours):
|
def __init__(self, name, surfaces, neighbours, volume):
|
||||||
# todo: the information of the parent surface is lost -> need to recover it
|
# todo: the information of the parent surface is lost -> need to recover it
|
||||||
self._name = name
|
self._name = name
|
||||||
self._surfaces = surfaces
|
self._surfaces = surfaces
|
||||||
|
@ -27,6 +27,7 @@ class Storey:
|
||||||
self._virtual_surfaces = None
|
self._virtual_surfaces = None
|
||||||
self._thermal_zone = None
|
self._thermal_zone = None
|
||||||
self._neighbours = neighbours
|
self._neighbours = neighbours
|
||||||
|
self._volume = volume
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def name(self):
|
def name(self):
|
||||||
|
@ -94,5 +95,13 @@ class Storey:
|
||||||
:return: ThermalZone
|
:return: ThermalZone
|
||||||
"""
|
"""
|
||||||
if self._thermal_zone is None:
|
if self._thermal_zone is None:
|
||||||
self._thermal_zone = ThermalZone(self.thermal_boundaries)
|
self._thermal_zone = ThermalZone(self.thermal_boundaries, self.volume)
|
||||||
return self._thermal_zone
|
return self._thermal_zone
|
||||||
|
|
||||||
|
@property
|
||||||
|
def volume(self):
|
||||||
|
"""
|
||||||
|
Storey's volume
|
||||||
|
:return: float
|
||||||
|
"""
|
||||||
|
return self._volume
|
||||||
|
|
|
@ -12,7 +12,6 @@ from city_model_structure.attributes.polygon import Polygon
|
||||||
from city_model_structure.attributes.plane import Plane
|
from city_model_structure.attributes.plane import Plane
|
||||||
from city_model_structure.attributes.point import Point
|
from city_model_structure.attributes.point import Point
|
||||||
from city_model_structure.energy_systems.pv_system import PvSystem
|
from city_model_structure.energy_systems.pv_system import PvSystem
|
||||||
from city_model_structure.building_demand.thermal_boundary import ThermalBoundary
|
|
||||||
import helpers.constants as cte
|
import helpers.constants as cte
|
||||||
|
|
||||||
|
|
||||||
|
@ -268,16 +267,6 @@ class Surface:
|
||||||
self._inverse = Surface(new_solid_polygon, new_perimeter_polygon, new_holes_polygons, cte.VIRTUAL_INTERNAL)
|
self._inverse = Surface(new_solid_polygon, new_perimeter_polygon, new_holes_polygons, cte.VIRTUAL_INTERNAL)
|
||||||
return self._inverse
|
return self._inverse
|
||||||
|
|
||||||
@property
|
|
||||||
def associated_thermal_boundary(self) -> ThermalBoundary:
|
|
||||||
"""
|
|
||||||
Thermal boundary associated to this surface considered as the external face
|
|
||||||
:return: ThermalBoundary
|
|
||||||
"""
|
|
||||||
if self._thermal_boundary is None:
|
|
||||||
self._thermal_boundary = ThermalBoundary(self, delimits)
|
|
||||||
return self._thermal_boundary
|
|
||||||
|
|
||||||
def shared_surfaces(self):
|
def shared_surfaces(self):
|
||||||
# todo: check https://trimsh.org/trimesh.collision.html as an option to implement this method
|
# todo: check https://trimsh.org/trimesh.collision.html as an option to implement this method
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
|
@ -16,7 +16,7 @@ class ThermalZone:
|
||||||
"""
|
"""
|
||||||
ThermalZone class
|
ThermalZone class
|
||||||
"""
|
"""
|
||||||
def __init__(self, thermal_boundaries):
|
def __init__(self, thermal_boundaries, volume):
|
||||||
self._floor_area = None
|
self._floor_area = None
|
||||||
self._bounded = thermal_boundaries
|
self._bounded = thermal_boundaries
|
||||||
self._is_mechanically_ventilated = None
|
self._is_mechanically_ventilated = None
|
||||||
|
@ -26,7 +26,7 @@ class ThermalZone:
|
||||||
self._infiltration_rate_system_on = None
|
self._infiltration_rate_system_on = None
|
||||||
self._infiltration_rate_system_off = None
|
self._infiltration_rate_system_off = None
|
||||||
self._usage_zones = None
|
self._usage_zones = None
|
||||||
self._volume = None
|
self._volume = volume
|
||||||
self._volume_geometry = None
|
self._volume_geometry = None
|
||||||
self._id = None
|
self._id = None
|
||||||
self._is_heated = False
|
self._is_heated = False
|
||||||
|
@ -208,14 +208,6 @@ class ThermalZone:
|
||||||
"""
|
"""
|
||||||
return self._volume
|
return self._volume
|
||||||
|
|
||||||
@volume.setter
|
|
||||||
def volume(self, value):
|
|
||||||
"""
|
|
||||||
Set thermal zone volume
|
|
||||||
:param value: float
|
|
||||||
"""
|
|
||||||
self._volume = value
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def volume_geometry(self) -> Polyhedron:
|
def volume_geometry(self) -> Polyhedron:
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -8,7 +8,7 @@ from unittest import TestCase
|
||||||
from imports.geometry_factory import GeometryFactory
|
from imports.geometry_factory import GeometryFactory
|
||||||
from imports.construction_factory import ConstructionFactory
|
from imports.construction_factory import ConstructionFactory
|
||||||
from imports.weather_factory import WeatherFactory
|
from imports.weather_factory import WeatherFactory
|
||||||
# from exports.exports_factory import ExportsFactory
|
from exports.exports_factory import ExportsFactory
|
||||||
|
|
||||||
|
|
||||||
class MyTestCase(TestCase):
|
class MyTestCase(TestCase):
|
||||||
|
@ -48,6 +48,9 @@ class MyTestCase(TestCase):
|
||||||
for building in city.buildings:
|
for building in city.buildings:
|
||||||
print(building.name, building.function, len(building.surfaces))
|
print(building.name, building.function, len(building.surfaces))
|
||||||
print(building.volume)
|
print(building.volume)
|
||||||
|
for tz in building.thermal_zones:
|
||||||
|
print(tz.volume)
|
||||||
|
print(tz.floor_area)
|
||||||
|
|
||||||
WeatherFactory('epw', city, base_path=base_path, file_name=weather_file_name).enrich()
|
WeatherFactory('epw', city, base_path=base_path, file_name=weather_file_name).enrich()
|
||||||
#ExportsFactory('idf', city, 'c:\Documents\idf').export()
|
ExportsFactory('idf', city, 'c:\Documents\idf').export()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user