Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
"""
from teaser.logic.buildingobjects.building import Building
prj.set_default(load_data=True)
bldg = Building(parent=prj)
bldg.name = "SuperExampleBuilding"
bldg.street_name = "AwesomeAvenue42"
bldg.city = "46325FantasticTown"
bldg.year_of_construction = 2015
bldg.number_of_floors = 1
bldg.height_of_floors = 3.5
from teaser.logic.buildingobjects.thermalzone import ThermalZone
tz = ThermalZone(parent=bldg)
tz.name = "LivingRoom"
tz.area = 140.0
tz.volume = tz.area * bldg.number_of_floors * bldg.height_of_floors
tz.infiltration_rate = 0.5
from teaser.logic.buildingobjects.boundaryconditions.boundaryconditions import BoundaryConditions
tz.use_conditions = BoundaryConditions(parent=tz)
tz.use_conditions.load_use_conditions("Living", prj.data)
from teaser.logic.buildingobjects.buildingphysics.innerwall import InnerWall
in_wall_dict = {"InnerWall1": [10.0],
"InnerWall2": [14.0],
"InnerWall3": [10.0]}
Tests AixLib output for a building with rooftops only
"""
from teaser.logic.buildingobjects.building import Building
bldg = Building(parent=prj)
bldg.name = "SuperExampleBuilding"
bldg.street_name = "AwesomeAvenue42"
bldg.city = "46325FantasticTown"
bldg.year_of_construction = 2015
bldg.number_of_floors = 1
bldg.height_of_floors = 3.5
from teaser.logic.buildingobjects.thermalzone import ThermalZone
tz = ThermalZone(parent=bldg)
tz.name = "LivingRoom"
tz.area = 140.0
tz.volume = tz.area * bldg.number_of_floors * bldg.height_of_floors
tz.infiltration_rate = 0.5
from teaser.logic.buildingobjects.boundaryconditions.boundaryconditions \
import BoundaryConditions
tz.use_conditions = BoundaryConditions(parent=tz)
tz.use_conditions.load_use_conditions("Living", prj.data)
from teaser.logic.buildingobjects.buildingphysics.rooftop import \
Rooftop
roof_south = Rooftop(parent=tz)
roof_south.name = "Roof_South"
def test_warnings_prj(self):
"""Tests misc parts in project.py"""
from teaser.logic.buildingobjects.building import Building
from teaser.logic.buildingobjects.thermalzone import ThermalZone
# warnings for not calculated buidlings
bld = Building(parent=prj)
tz = ThermalZone(parent=bld)
prj.calc_all_buildings()
prj.set_default()
# warning if iwu and number_of_apartments is used
prj.add_residential(method='iwu',
usage="single_family_dwelling",
name="test",
year_of_construction=1988,
number_of_floors=1,
height_of_floors=7,
net_leased_area=1988,
number_of_apartments=1)
# not all buildings if internal id is passed over
prj.add_residential(method='iwu',
usage="single_family_dwelling",
name="test1",
year_of_construction=1988,
ref_path = os.path.join(this_path, 'inputs', ref_file)
t_outside_raw = np.loadtxt(ref_path, delimiter=",")
t_outside = ([t_outside_raw[2 * i, 1] for i in range(24)])
t_outside_adj = np.repeat(t_outside, times_per_hour)
weatherTemperature = np.tile(t_outside_adj, 60)
weather = WeatherData()
weather.air_temp = weatherTemperature
prj = Project()
prj.weather_data = weather
bldg = Building(prj)
tz = ThermalZone(bldg)
model_data = TwoElement(tz, merge_windows=True, t_bt=5)
# Store building parameters for testcase 10
model_data.r1_iw = 0.000779671554640369
model_data.c1_iw = 12333949.4129606
model_data.area_iw = 58
model_data.r_rest_ow = 0.011638548
model_data.r1_ow = 0.00171957697767797
model_data.c1_ow = 4338751.41
model_data.area_ow = 28
model_data.outer_wall_areas = [28]
model_data.window_areas = np.zeros(1)
model_data.transparent_areas = [7]
tz.volume = 52.5
tz.density_air = 1.19
True if Project should be stored as .teaserXML at path
Returns
-------
prj: Project
Project that contains the building with the test room
"""
prj = Project(load_data=True)
prj.name = "ASHRAE140Verification"
bldg = Building(parent=prj)
bldg.name = "TestBuilding"
tz = ThermalZone(parent=bldg)
tz.name = "TestRoom600"
tz.area = 8.0 * 6.0
tz.volume = tz.area * 2.7
tz.use_conditions = UseConditions(parent=tz)
tz.use_conditions.infiltration_rate = 0.41
roof = Rooftop(parent=tz)
roof.name = "Roof"
roof.area = 8.0 * 6.0
roof.orientation = -1.0
roof.tilt = 0.0
roof.inner_convection = 1
roof.outer_convection = 24.67
roof.inner_radiation = 5.13
roof.outer_radiation = 4.63
def generate_from_gml(self):
"""Enriches lod1 or lod2 data from CityGML
Adds Zones, BoundaryConditions, Material settings for walls and
windows to the geometric representation of CityGML
"""
type_bldg_area = self.net_leased_area
self.net_leased_area = 0.0
# create zones with their corresponding area, name and usage
for key, value in self.zone_area_factors.items():
zone = ThermalZone(self)
zone.area = type_bldg_area * value[0]
zone.name = key
use_cond = UseCond(zone)
use_cond.load_use_conditions(value[1],
data_class=self.parent.data)
zone.use_conditions = use_cond
zone.use_conditions.with_ahu = False
zone.use_conditions.persons *= zone.area * 0.01
zone.use_conditions.machines *= zone.area * 0.01
for surface in self.gml_surfaces:
if surface.surface_tilt is not None:
if surface.surface_tilt == 90:
outer_wall = OuterWall(zone)
outer_wall.load_type_element(
year=self.year_of_construction,
True if Project should be stored as .teaserXML at path
Returns
-------
prj: Project
Project that contains the building with the test room
"""
prj = Project(load_data=True)
prj.name = "ASHRAE140Verification"
bldg = Building(parent=prj)
bldg.name = "TestBuilding"
tz = ThermalZone(parent=bldg)
tz.name = "TestRoom620"
tz.area = 8.0 * 6.0
tz.volume = tz.area * 2.7
tz.use_conditions = UseConditions(parent=tz)
tz.use_conditions.infiltration_rate = 0.41
roof = Rooftop(parent=tz)
roof.name = "Roof"
roof.area = 8.0 * 6.0
roof.orientation = -1.0
roof.tilt = 0.0
roof.inner_convection = 1
roof.outer_convection = 24.67
roof.inner_radiation = 5.13
roof.outer_radiation = 4.63
self._est_roof_area = type_bldg_area / self.number_of_floors
self._est_win_area = self.est_factor_win_area * type_bldg_area * \
(1 - self._est_factor_neighbour / 4)
self._est_outer_wall_area = (self.est_factor_facade_to_volume *
type_bldg_area *
self.height_of_floors -
self._est_ground_floor_area -
self._est_roof_area -
self._est_win_area) *\
(1 - self._est_factor_neighbour / 4)
for key, value in self.zone_area_factors.items():
zone = ThermalZone(self)
zone.name = key
zone.area = type_bldg_area * value[0]
use_cond = UseCond(zone)
use_cond.load_use_conditions(value[1])
zone.use_conditions = use_cond
for key, value in self.outer_wall_names.items():
# North and South
if value[1] == 0 or value[1] == 180.0:
self.outer_area[value[1]] = self._est_outer_wall_area / \
self.nr_of_orientation
# East and West
elif value[1] == 90 or value[1] == 270:
def generate_archetype(self):
"""Generates a SingleFamilyHouse archetype buildings
With given values, this function generates an archetype building for
Tabula Single Family House.
"""
self.thermal_zones = None
self._check_year_of_construction()
# help area for the correct building area setting while using typeBldgs
type_bldg_area = self.net_leased_area
self.net_leased_area = 0.0
for key, value in self.zone_area_factors.items():
zone = ThermalZone(parent=self)
zone.name = key
zone.area = type_bldg_area * value[0]
use_cond = UseCond(parent=zone)
use_cond.load_use_conditions(zone_usage=value[1])
zone.use_conditions = use_cond
zone.use_conditions.with_ahu = False
if self.facade_estimation_factors[self.building_age_group]["ow1"] != 0:
for key, value in self._outer_wall_names_1.items():
for zone in self.thermal_zones:
outer_wall = OuterWall(zone)
outer_wall.load_type_element(
year=self.year_of_construction,
construction=self._construction_type_1,
data_class=self.parent.data,
def generate_from_gml(self):
"""Enriches lod1 or lod2 data from CityGML
Adds Zones, BoundaryConditions, Material settings for walls and
windows to the geometric representation of CityGML
"""
type_bldg_area = self.net_leased_area
self.net_leased_area = 0.0
# create zones with their corresponding area, name and usage
for key, value in self.zone_area_factors.items():
zone = ThermalZone(self)
zone.area = type_bldg_area * value[0]
zone.name = key
use_cond = UseCond(zone)
use_cond.load_use_conditions(value[1],
data_class=self.parent.data)
zone.use_conditions = use_cond
zone.use_conditions.with_ahu = False
zone.use_conditions.persons *= zone.area * 0.01
zone.use_conditions.machines *= zone.area * 0.01
for surface in self.gml_surfaces:
if surface.surface_tilt is not None:
if surface.surface_tilt == 90:
outer_wall = OuterWall(zone)
outer_wall.load_type_element(
year=self.year_of_construction,