Skip to content
Snippets Groups Projects
Commit 53511565 authored by Peter Remmen's avatar Peter Remmen
Browse files

Merge branch 'issue297_vdi_core' into issue297_weather

parents 83da0777 92503fd4
No related branches found
No related tags found
No related merge requests found
# -*- coding: utf-8 -*-
class SimulationVDI6007(object):
"""Simulation Class for TEASER VDI 6007 Based Simulations
This Simulation class provides the handling of the simulation logic used
in the VDI 6007.
Parameters
----------
Attributes
----------
weather : object
Weather class containing weather informations and VDI required weather
calculations like equal air temperatures
indoor_air_temperature = array [K]
This array contains the indoor_air_temperature values after the
simulation
q_flow_heater_cooler = array
This array contains the heat load of after the simulation with
positive (Heating) and negative (Cooling) values
"""
def __init__(self, arg):
self.weather = None
self.indoor_air_temperature = None
self.q_flow_heater_cooler = None
\ No newline at end of file
...@@ -267,11 +267,14 @@ class Wall(BuildingElement): ...@@ -267,11 +267,14 @@ class Wall(BuildingElement):
This function adds an additional layer of insulation and sets the This function adds an additional layer of insulation and sets the
thickness of the layer according to the retrofit standard in the thickness of the layer according to the retrofit standard in the
year of refurbishment. Refurbishment year must be newer then 1995 year of refurbishment. Refurbishment year must be newer then 1977
Note: To Calculate thickness and U-Value, the standard TEASER Note: To Calculate thickness and U-Value, the standard TEASER
coefficients for outer and inner heat transfer are used. coefficients for outer and inner heat transfer are used.
The used Standards are namely the Waermeschutzverordnung (WSVO) and
Energieeinsparverordnung (EnEv)
Parameters Parameters
---------- ----------
material : string material : string
...@@ -355,7 +358,7 @@ class Wall(BuildingElement): ...@@ -355,7 +358,7 @@ class Wall(BuildingElement):
calc_u = 0.3 * self.area calc_u = 0.3 * self.area
elif year_of_retrofit >= 2014: elif year_of_retrofit >= 2014:
self.insulate_wall(material) self.insulate_wall(material)
calc_u = 0.25 * self.area calc_u = 0.3 * self.area
r_conduc = 0 r_conduc = 0
......
...@@ -11,6 +11,7 @@ from teaser.logic.buildingobjects.calculation.two_element import TwoElement ...@@ -11,6 +11,7 @@ from teaser.logic.buildingobjects.calculation.two_element import TwoElement
from teaser.logic.buildingobjects.calculation.three_element import ThreeElement from teaser.logic.buildingobjects.calculation.three_element import ThreeElement
from teaser.logic.buildingobjects.calculation.four_element import FourElement from teaser.logic.buildingobjects.calculation.four_element import FourElement
class ThermalZone(object): class ThermalZone(object):
"""Thermal zone class. """Thermal zone class.
...@@ -80,6 +81,9 @@ class ThermalZone(object): ...@@ -80,6 +81,9 @@ class ThermalZone(object):
average density of the air in the thermal zone average density of the air in the thermal zone
heat_capac_air : float [J/K] heat_capac_air : float [J/K]
average heat capacity of the air in the thermal zone average heat capacity of the air in the thermal zone
sim_model : instance of SimulationVDI6007()
Instance of the VDI Simulation Class containing simulation methods and
informations
""" """
def __init__(self, parent=None): def __init__(self, parent=None):
...@@ -110,7 +114,6 @@ class ThermalZone(object): ...@@ -110,7 +114,6 @@ class ThermalZone(object):
self.heat_capac_air = 1002 self.heat_capac_air = 1002
self.t_ground = 286.15 self.t_ground = 286.15
def calc_zone_parameters( def calc_zone_parameters(
self, self,
number_of_elements=2, number_of_elements=2,
...@@ -457,7 +460,6 @@ class ThermalZone(object): ...@@ -457,7 +460,6 @@ class ThermalZone(object):
def floors(self): def floors(self):
return self._floors return self._floors
@floors.setter @floors.setter
def floors(self, value): def floors(self, value):
if value is None: if value is None:
......
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Script to change resolution of timeseries values with constant
sampling rate.
"""
from __future__ import division
import os
import pandas as pd
import numpy as np
import math
def changeResolution(values, oldResolution, newResolution, method="mean"):
"""
Change the temporal resolution of values that have a constant sampling rate
Parameters
----------
values : array-like
data points
oldResolution : integer
temporal resolution of the given values. oldResolution=3600 means
hourly sampled data
newResolution : integer
temporal resolution of the given data shall be converted to
method : ``{"mean"; "sum"}``, optional
- ``"mean"`` : compute mean values while resampling (e.g. for power).
- ``"sum"`` : compute sum values while resampling (e.g. for energy).
"""
# Compute original time indexes
timeOld = np.arange(len(values)) * oldResolution
# Compute new time indexes
length = math.ceil(len(values) * oldResolution / newResolution)
timeNew = np.arange(length) * newResolution
# Sample means or sum values
if method == "mean":
# Interpolate
valuesResampled = np.interp(timeNew, timeOld, values)
else:
# If values have to be summed up, use cumsum to modify the given data
# Add one dummy value to later use diff (which reduces the number of
# indexes by one)
values = np.cumsum(np.concatenate(([0], values)))
timeOld = np.concatenate((timeOld, [timeOld[-1] + oldResolution]))
timeNew = np.concatenate((timeNew, [timeNew[-1] + newResolution]))
# Interpolate
valuesResampled = np.interp(timeNew, timeOld, values)
# "Undo" the cumsum
valuesResampled = np.diff(valuesResampled)
return valuesResampled
if __name__ == "__main__":
values_old = np.arange(2000)
dt_old = 60
dt_new = 600
values_new = changeResolution(values_old, dt_old, dt_new)
# Define src path
src_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Temperature - mean values
try_filename = 'TRY2010_05_Jahr.dat'
f_TRY = os.path.join(src_path, 'inputs', 'weather', try_filename)
temp = np.loadtxt(f_TRY, skiprows=38, usecols=(8,))
dt_temp_old = 3600
dt_temp_short = 900
dt_temp_long = 7200
temp_long = changeResolution(temp, dt_temp_old, dt_temp_long)
temp_short = changeResolution(temp, dt_temp_old, dt_temp_short)
# Energy - sum values
np.random.seed(0)
profile = np.sort(np.random.rand(1440)) # minute wise sampling
dt_prof_old = 60
dt_prof_short = 20
dt_prof_long = 900
dt_prof_huge = 3600
prof_short = changeResolution(profile, dt_prof_old, dt_prof_short)
prof_long = changeResolution(profile, dt_prof_old, dt_prof_long)
prof_huge = changeResolution(profile, dt_prof_old, dt_prof_huge)
slp_filename = 'slp_el_h0.txt'
input_path = os.path.join(src_path, 'inputs', 'standard_load_profile',
slp_filename)
slp = np.loadtxt(input_path)
dt_slp = 900
dt_slp_short = 450
dt_slp_long = 3600
slp_short = changeResolution(slp, dt_slp, dt_slp_short, "sum")
slp_long = changeResolution(slp, dt_slp, dt_slp_long, "sum")
...@@ -1485,9 +1485,36 @@ class Test_teaser(object): ...@@ -1485,9 +1485,36 @@ class Test_teaser(object):
def test_retrofit_wall(self): def test_retrofit_wall(self):
'''test of retrofit_wall''' '''test of retrofit_wall'''
prj.set_default()
helptest.building_test2(prj)
therm_zone = prj.buildings[-1].thermal_zones[-1] therm_zone = prj.buildings[-1].thermal_zones[-1]
therm_zone.outer_walls[0].retrofit_wall(2016, "EPS035") therm_zone.outer_walls[0].retrofit_wall(2016, "EPS035")
assert round(therm_zone.outer_walls[0].ua_value, 6) == 2.4 assert round(therm_zone.outer_walls[0].ua_value, 6) == 2.4
prj.set_default()
helptest.building_test2(prj)
therm_zone = prj.buildings[-1].thermal_zones[-1]
therm_zone.outer_walls[0].retrofit_wall(2010, "EPS035")
assert round(therm_zone.outer_walls[0].ua_value, 6) == 2.4
prj.set_default()
helptest.building_test2(prj)
therm_zone = prj.buildings[-1].thermal_zones[-1]
therm_zone.outer_walls[0].retrofit_wall(2005, "EPS035")
assert round(therm_zone.outer_walls[0].ua_value, 2) == 4.13
prj.set_default()
helptest.building_test2(prj)
therm_zone = prj.buildings[-1].thermal_zones[-1]
therm_zone.outer_walls[0].retrofit_wall(1998, "EPS035")
assert round(therm_zone.outer_walls[0].ua_value, 2) == 4.13
prj.set_default()
helptest.building_test2(prj)
therm_zone = prj.buildings[-1].thermal_zones[-1]
therm_zone.outer_walls[0].retrofit_wall(1990, "EPS035")
assert round(therm_zone.outer_walls[0].ua_value, 2) == 4.13
prj.set_default()
helptest.building_test2(prj)
therm_zone = prj.buildings[-1].thermal_zones[-1]
therm_zone.outer_walls[0].retrofit_wall(1980, "EPS035")
assert round(therm_zone.outer_walls[0].ua_value, 2) == 4.13
def test_calc_equivalent_res_win(self): def test_calc_equivalent_res_win(self):
'''test of calc_equivalent_res, win''' '''test of calc_equivalent_res, win'''
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment