Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
material_s1.heat_capac = 0.04
material_s1.thermal_conduc = 1.0
layer_s2 = Layer(parent=roof_south, id=1)
layer_s2.thickness = 0.15
material_s2 = Material(layer_s2)
material_s2.name = "Tile"
material_s2.density = 1400.0
material_s2.heat_capac = 0.6
material_s2.thermal_conduc = 2.5
layer_n1 = Layer(parent=roof_north, id=0)
layer_n1.thickness = 0.3
material_n1 = Material(layer_n1)
material_n1.name = "Insulation"
material_n1.density = 120.0
material_n1.heat_capac = 0.04
material_n1.thermal_conduc = 1.0
layer_n2 = Layer(parent=roof_north, id=1)
layer_n2.thickness = 0.15
material_n2 = Material(layer_n2)
material_n2.name = "Tile"
material_n2.density = 1400.0
material_n2.heat_capac = 0.6
material_n2.thermal_conduc = 2.5
prj.number_of_elements_calc = 1
prj.merge_windows_calc = False
def test_load_save_project(self):
"""test of load_project and save_project"""
prj.load_project(utilities.get_full_path(("examples/examplefiles"
"/new.teaserXML")))
therm_zone = prj.buildings[-1].thermal_zones[0]
assert therm_zone.outer_walls[0].area == 40.0
tz_area = sum([tz.area for tz in prj.buildings[
-1].thermal_zones])
assert prj.buildings[-1].net_leased_area == tz_area
prj.save_project(file_name="unitTest", path=None)
prj.save_project(file_name=None, path=utilities.get_default_path())
prj.set_default()
from teaser.project import Project
prj = Project(False)
class Test_tabula_sfh_dk(object):
global prj
def test_tabula_de_sfh_dk_area_2009(self):
"""
Test for area estimation of tabula sfh
"""
prj.add_residential(
method='tabula_dk',
usage='single_family_house',
name="ResidentialBuilding",
year_of_construction=2008,
"""
Created August 2019
@author: TEASER Development Team
"""
from teaser.logic import utilities
from teaser.project import Project
import math
import os
import warnings as warnings
prj = Project(True)
class Test_examples(object):
"""Unit Tests for TEASER"""
global prj
def test_e1_example_generate_archetype(self):
"""Tests the executability of example 1"""
from teaser.examples import e1_generate_archetype as e1
prj = e1.example_generate_archetype()
assert prj.name == "ArchetypeExample"
def test_e2_example_export_aixlib(self):
T_air_1 = T_air_mean[0:24]
T_air_10 = T_air_mean[216:240]
T_air_60 = T_air_mean[1416:1440]
ref_file = 'case12_res.csv'
ref_path = os.path.join(this_path, 'inputs', ref_file)
# Load reference results
(T_air_ref_1, T_air_ref_10, T_air_ref_60) = vdic.load_res(ref_path)
T_air_ref_1 = T_air_ref_1[:,0]
T_air_ref_10 = T_air_ref_10[:,0]
T_air_ref_60 = T_air_ref_60[:,0]
if plot_res:
plot_result(T_air_1, T_air_ref_1, "Results day 1", "temperature")
plot_result(T_air_10, T_air_ref_10, "Results day 10", "temperature")
plot_result(T_air_60, T_air_ref_60, "Results day 60", "temperature")
max_dev_1 = np.max(np.abs(T_air_1 - T_air_ref_1))
max_dev_10 = np.max(np.abs(T_air_10 - T_air_ref_10))
max_dev_60 = np.max(np.abs(T_air_60 - T_air_ref_60))
print("Max. deviation day 1: " + str(max_dev_1))
print("Max. deviation day 10: " + str(max_dev_10))
print("Max. deviation day 60: " + str(max_dev_60))
return (max_dev_1, max_dev_10, max_dev_60)
T_air_10 = T_air_mean[216:240]
T_air_60 = T_air_mean[1416:1440]
ref_file = 'case08_res.csv'
ref_path = os.path.join(this_path, 'inputs', ref_file)
# Load reference results
(T_air_ref_1, T_air_ref_10, T_air_ref_60) = vdic.load_res(ref_path)
T_air_ref_1 = T_air_ref_1[:, 0]
T_air_ref_10 = T_air_ref_10[:, 0]
T_air_ref_60 = T_air_ref_60[:, 0]
if plot_res:
plot_result(T_air_1, T_air_ref_1, "Results day 1", "temperature")
plot_result(T_air_10, T_air_ref_10, "Results day 10", "temperature")
plot_result(T_air_60, T_air_ref_60, "Results day 60", "temperature")
max_dev_1 = np.max(np.abs(T_air_1 - T_air_ref_1))
max_dev_10 = np.max(np.abs(T_air_10 - T_air_ref_10))
max_dev_60 = np.max(np.abs(T_air_60 - T_air_ref_60))
print("Max. deviation day 1: " + str(max_dev_1))
print("Max. deviation day 10: " + str(max_dev_10))
print("Max. deviation day 60: " + str(max_dev_60))
return (max_dev_1, max_dev_10, max_dev_60)
T_air_60 = T_air_mean[1416:1440]
this_path = os.path.dirname(os.path.abspath(__file__))
ref_file = 'case01_res.csv'
ref_path = os.path.join(this_path, 'inputs', ref_file)
# Load reference results
(T_air_ref_1, T_air_ref_10, T_air_ref_60) = load_res(ref_path)
T_air_ref_1 = T_air_ref_1[:, 0]
T_air_ref_10 = T_air_ref_10[:, 0]
T_air_ref_60 = T_air_ref_60[:, 0]
if plot_res:
plot_result(T_air_1, T_air_ref_1, "Results day 1", "temperature")
plot_result(T_air_10, T_air_ref_10, "Results day 10", "temperature")
plot_result(T_air_60, T_air_ref_60, "Results day 60", "temperature")
max_dev_1 = np.max(np.abs(T_air_1 - T_air_ref_1))
max_dev_10 = np.max(np.abs(T_air_10 - T_air_ref_10))
max_dev_60 = np.max(np.abs(T_air_60 - T_air_ref_60))
print("Max. deviation day 1: " + str(max_dev_1))
print("Max. deviation day 10: " + str(max_dev_10))
print("Max. deviation day 60: " + str(max_dev_60))
return (max_dev_1, max_dev_10, max_dev_60)
Q_hc_10 = Q_hc_mean[216:240]
Q_hc_60 = Q_hc_mean[1416:1440]
this_path = os.path.dirname(os.path.abspath(__file__))
ref_file = 'case07_res.csv'
ref_path = os.path.join(this_path, 'inputs', ref_file)
# Load reference results
(Q_hc_ref_1, Q_hc_ref_10, Q_hc_ref_60) = vdic.load_res(ref_path)
Q_hc_ref_1 = Q_hc_ref_1[:, 0]
Q_hc_ref_10 = Q_hc_ref_10[:, 0]
Q_hc_ref_60 = Q_hc_ref_60[:, 0]
if plot_res:
plot_result(Q_hc_1, Q_hc_ref_1, "Results day 1", "heat")
plot_result(Q_hc_10, Q_hc_ref_10, "Results day 10", "heat")
plot_result(Q_hc_60, Q_hc_ref_60, "Results day 60", "heat")
max_dev_1 = np.max(np.abs(Q_hc_1 - Q_hc_ref_1))
max_dev_10 = np.max(np.abs(Q_hc_10 - Q_hc_ref_10))
max_dev_60 = np.max(np.abs(Q_hc_60 - Q_hc_ref_60))
print("Max. deviation day 1: " + str(max_dev_1))
print("Max. deviation day 10: " + str(max_dev_10))
print("Max. deviation day 60: " + str(max_dev_60))
return (max_dev_1, max_dev_10, max_dev_60)
T_air_10 = T_air_mean[216:240]
T_air_60 = T_air_mean[1416:1440]
this_path = os.path.dirname(os.path.abspath(__file__))
ref_file = 'case02_res.csv'
ref_path = os.path.join(this_path, 'inputs', ref_file)
# Load reference results
(T_air_ref_1, T_air_ref_10, T_air_ref_60) = vdic.load_res(ref_path)
T_air_ref_1 = T_air_ref_1[:, 0]
T_air_ref_10 = T_air_ref_10[:, 0]
T_air_ref_60 = T_air_ref_60[:, 0]
if plot_res:
plot_result(T_air_1, T_air_ref_1, "Results day 1", "temperature")
plot_result(T_air_10, T_air_ref_10, "Results day 10", "temperature")
plot_result(T_air_60, T_air_ref_60, "Results day 60", "temperature")
max_dev_1 = np.max(np.abs(T_air_1 - T_air_ref_1))
max_dev_10 = np.max(np.abs(T_air_10 - T_air_ref_10))
max_dev_60 = np.max(np.abs(T_air_60 - T_air_ref_60))
print("Max. deviation day 1: " + str(max_dev_1))
print("Max. deviation day 10: " + str(max_dev_10))
print("Max. deviation day 60: " + str(max_dev_60))
return (max_dev_1, max_dev_10, max_dev_60)
T_air_1 = T_air_mean[0:24]
T_air_10 = T_air_mean[216:240]
T_air_60 = T_air_mean[1416:1440]
ref_file = 'case09_res.csv'
ref_path = os.path.join(this_path, 'inputs', ref_file)
# Load reference results
(T_air_ref_1, T_air_ref_10, T_air_ref_60) = vdic.load_res(ref_path)
T_air_ref_1 = T_air_ref_1[:, 0]
T_air_ref_10 = T_air_ref_10[:, 0]
T_air_ref_60 = T_air_ref_60[:, 0]
if plot_res:
plot_result(T_air_1, T_air_ref_1, "Results day 1", "temperature")
plot_result(T_air_10, T_air_ref_10, "Results day 10", "temperature")
plot_result(T_air_60, T_air_ref_60, "Results day 60", "temperature")
max_dev_1 = np.max(np.abs(T_air_1 - T_air_ref_1))
max_dev_10 = np.max(np.abs(T_air_10 - T_air_ref_10))
max_dev_60 = np.max(np.abs(T_air_60 - T_air_ref_60))
print("Max. deviation day 1: " + str(max_dev_1))
print("Max. deviation day 10: " + str(max_dev_10))
print("Max. deviation day 60: " + str(max_dev_60))
return (max_dev_1, max_dev_10, max_dev_60)