Skip to content

Commit

Permalink
Issue566weatherfile (#664)
Browse files Browse the repository at this point in the history
* first changes

* weird things happening in git

* Revert "weird things happening in git"

This reverts commit 923747b.

* implement working version of weather file export

* delete trial results

* convert everything to: saving weather file at "project" level and not at building level

* Revert "Merge branch 'issue566weatherfile' into development"

This reverts commit 9e772fbff69fbce8711cf3629f0aec4eea0363c3.

* Revert "Revert "Merge branch 'issue566weatherfile' into development""

This reverts commit e376eec.

* blank lines (ci)

* run Black on project.py

* update unitTest.json -> previous weatherfile is outdated (doesnt work for AixLib Version) -> set to None(null) to use default weatherfile of Teaser

* naming

* naming

* Weather file line is to long resulting in error

* First try of IBPSA Weather file export

* fixing

* blank line end of file

* #566 fixed tab stop at end of file

* 566 raised aixlib version number to actual dev number

Co-authored-by: MichaMans <[email protected]>
  • Loading branch information
MartinRaetz and MichaMans authored Dec 3, 2020
1 parent 91b6f50 commit d9eb231
Show file tree
Hide file tree
Showing 12 changed files with 52 additions and 10 deletions.
3 changes: 2 additions & 1 deletion teaser/data/input/inputdata/weatherdata/ASHRAE140.mos
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ double tab1(8760,30)
#TYPICAL/EXTREME PERIODS,6,Summer - Week Nearest Max Temperature For Period,Extreme,7/13,7/19,Summer - Week Nearest Average Temperature For Period,Typical,8/ 3,8/ 9,Winter - Week Nearest Min Temperature For Period,Extreme,12/ 8,12/14,Winter - Week Nearest Average Temperature For Period,Typical,12/15,12/21,Autumn - Week Nearest Average Temperature For Period,Typical,10/20,10/26,Spring - Week Nearest Average Temperature For Period,Typical,4/19,4/25
#GROUND TEMPERATURES,3,.5,,,,3.79,3.08,4.35,6.34,11.55,15.57,18.29,19.11,17.71,14.58,10.41,6.54,2,,,,6.44,5.16,5.42,6.48,9.96,13.11,15.64,16.99,16.70,14.93,12.06,9.01,4,,,,8.62,7.31,7.02,7.42,9.39,11.52,13.46,14.82,15.14,14.37,12.68,10.62
#HOLIDAYS/DAYLIGHT SAVINGS,No,0,0,0
#COMMENTS 1,"Custom/User Format -- WMO#107290; Bundesinstitut f�r Bau-, Stadt- und Raumforschung im Bundesamt f�r Bauwesen und Raumordnung. 1) DWD are the original author of the DTRY dataset on which these EPWs are based. 2) The EPWs were converted by Climate.OneBuilding.Org. Neither the DWD nor the BBSR were responsible for the conversion, and they disclaim all liability associated with the use of the converted DTRY EPW data set. ATTENTION: So, far, it's only the header defining the location of the ASHRAE 140 weather data set. The rest is DEU_BW_Mannheim_107290_TRY2010_12_Jahr_BBSR."
#COMMENTS 1,"Custom/User Format -- WMO#107290; Bundesinstitut f�r Bau-, Stadt- und Raumforschung im Bundesamt f�r Bauwesen und Raumordnung. 1) DWD are the original author of the DTRY dataset on which these EPWs are based. 2) The EPWs were converted by Climate.OneBuilding.Org. Neither the DWD nor the BBSR were responsible for the conversion, and they disclaim all liability associated with the use of the converted DTRY EPW data set."
#COMMENTS 2,"Downloaded from Climate.OneBuilding.Org -- Ground temps represent undisturbed earth temperatures - calculated from this weather data."
#COMMENTS 3,"ATTENTION: So, far, it's only the header defining the location of the ASHRAE 140 weather data set. The rest is DEU_BW_Mannheim_107290_TRY2010_12_Jahr_BBSR."
#DATA PERIODS,1,1,Data,Monday, 1/ 1,12/31
#C1 Time in seconds. Beginning of a year is 0s.
#C2 Dry bulb temperature in Celsius at indicated time
Expand Down
16 changes: 16 additions & 0 deletions teaser/data/output/aixlib_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from mako.template import Template
from mako.lookup import TemplateLookup
import teaser.logic.utilities as utilities
import shutil


def export_multizone(buildings, prj, path=None):
Expand Down Expand Up @@ -95,6 +96,7 @@ def export_multizone(buildings, prj, path=None):
package_list=buildings,
addition=None,
extra=None)
_copy_weather_data(prj.weather_file_path, path)

for i, bldg in enumerate(buildings):

Expand Down Expand Up @@ -232,3 +234,17 @@ def _help_package_order(path, package_list, addition=None, extra=None):
out_file.write(order_template.render_unicode
(list=package_list, addition=addition, extra=extra))
out_file.close()


def _copy_weather_data(source_path, destination_path):
"""Copies the imported .mos weather file to the results folder.
Parameters
----------
source_path : str
path of local weather file
destination_path : str
path of where the weather file should be placed
"""

shutil.copy2(source_path, destination_path)
1 change: 1 addition & 0 deletions teaser/data/output/ibpsa_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ def export_ibpsa(
package_list=buildings,
addition=None,
extra=None)
ibpsa_output._copy_weather_data(prj.weather_file_path, path)

for i, bldg in enumerate(buildings):

Expand Down
4 changes: 2 additions & 2 deletions teaser/data/output/modelicatemplate/AixLib/AixLib_Multizone
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ AixLib.ThermalZones.ReducedOrder.Multizone.MultizoneEquipped multizone(
AixLib.BoundaryConditions.WeatherData.ReaderTMY3 weaDat(
calTSky=AixLib.BoundaryConditions.Types.SkyTemperatureCalculation.HorizontalRadiation,
computeWetBulbTemperature=false,
filNam=
"${weather.replace("\\", "/")}")
filNam=Modelica.Utilities.Files.loadResource(
"modelica://${bldg.parent.name}/${bldg.parent.weather_file_name}"))
"Weather data reader"
annotation (Placement(transformation(extent={{-82,30},{-62,50}})));

Expand Down
3 changes: 2 additions & 1 deletion teaser/data/output/modelicatemplate/IBPSA/IBPSA_FourElements
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ model ${zone.parent.name}_${zone.name}
${library}.BoundaryConditions.WeatherData.ReaderTMY3 weaDat(
calTSky=${library}.BoundaryConditions.Types.SkyTemperatureCalculation.HorizontalRadiation,
computeWetBulbTemperature=false,
filNam="${zone.parent.parent.weather_file_path.replace("\\", "/")}")
filNam=Modelica.Utilities.Files.loadResource(
"modelica://${zone.parent.parent.name}/${zone.parent.parent.weather_file_name}"))
"Weather data reader"
annotation (Placement(transformation(extent={{-98,52},{-78,72}})));
${library}.BoundaryConditions.SolarIrradiation.DiffusePerez HDifTil[${min_orientations(zone.model_attr.n_outer)}]( each outSkyCon=true,
Expand Down
3 changes: 2 additions & 1 deletion teaser/data/output/modelicatemplate/IBPSA/IBPSA_OneElement
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ model ${zone.parent.name}_${zone.name}
${library}.BoundaryConditions.WeatherData.ReaderTMY3 weaDat(
calTSky=${library}.BoundaryConditions.Types.SkyTemperatureCalculation.HorizontalRadiation,
computeWetBulbTemperature=false,
filNam="${zone.parent.parent.weather_file_path.replace("\\", "/")}")
filNam=Modelica.Utilities.Files.loadResource(
"modelica://${zone.parent.parent.name}/${zone.parent.parent.weather_file_name}"))
"Weather data reader"
annotation (Placement(transformation(extent={{-98,52},{-78,72}})));
${library}.BoundaryConditions.SolarIrradiation.DiffusePerez HDifTil[${min_orientations(zone.model_attr.n_outer)}]( each outSkyCon=true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ model ${zone.parent.name}_${zone.name}
${library}.BoundaryConditions.WeatherData.ReaderTMY3 weaDat(
calTSky=${library}.BoundaryConditions.Types.SkyTemperatureCalculation.HorizontalRadiation,
computeWetBulbTemperature=false,
filNam="${zone.parent.parent.weather_file_path.replace("\\", "/")}")
filNam=Modelica.Utilities.Files.loadResource(
"modelica://${zone.parent.parent.name}/${zone.parent.parent.weather_file_name}"))
"Weather data reader"
annotation (Placement(transformation(extent={{-98,52},{-78,72}})));
${library}.BoundaryConditions.SolarIrradiation.DiffusePerez HDifTil[${min_orientations(zone.model_attr.n_outer)}]( each outSkyCon=true,
Expand Down
3 changes: 2 additions & 1 deletion teaser/data/output/modelicatemplate/IBPSA/IBPSA_TwoElements
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ model ${zone.parent.name}_${zone.name}
${library}.BoundaryConditions.WeatherData.ReaderTMY3 weaDat(
calTSky=${library}.BoundaryConditions.Types.SkyTemperatureCalculation.HorizontalRadiation,
computeWetBulbTemperature=false,
filNam="${zone.parent.parent.weather_file_path.replace("\\", "/")}")
filNam=Modelica.Utilities.Files.loadResource(
"modelica://${zone.parent.parent.name}/${zone.parent.parent.weather_file_name}"))
"Weather data reader"
annotation (Placement(transformation(extent={{-98,52},{-78,72}})));
${library}.BoundaryConditions.SolarIrradiation.DiffusePerez HDifTil[${min_orientations(zone.model_attr.n_outer)}]( each outSkyCon=true,
Expand Down
2 changes: 1 addition & 1 deletion teaser/examples/examplefiles/unitTest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"project": {
"version": "0.7",
"name": "Project",
"weather_file_path": "modelica://AixLib/Resources/WeatherData/TRY2010_12_Jahr_Modelica-Library.txt",
"weather_file_path": null,
"number_of_elements_calc": 2,
"merge_windows_calc": false,
"used_library_calc": "AixLib",
Expand Down
2 changes: 1 addition & 1 deletion teaser/logic/buildingobjects/calculation/aixlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def __init__(self, parent):
self.file_set_t_cool = "TsetCool_" + self.parent.name + ".txt"
self.file_ahu = "AHU_" + self.parent.name + ".txt"
self.file_internal_gains = "InternalGains_" + self.parent.name + ".txt"
self.version = "0.9.1"
self.version = "0.10.7"
self.total_surface_area = None
self.consider_heat_capacity = True
self.use_set_back = True
Expand Down
2 changes: 1 addition & 1 deletion teaser/logic/buildingobjects/calculation/ibpsa.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def __init__(self, parent):
self.parent = parent
self.file_internal_gains = "InternalGains_" + self.parent.name + ".mat"
self.version = {
"AixLib": "0.9.1",
"AixLib": "0.10.7",
"Buildings": "7.0.0",
"BuildingSystems": "2.0.0-beta2",
"IDEAS": "2.1.0",
Expand Down
20 changes: 20 additions & 0 deletions teaser/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -1163,6 +1163,26 @@ def set_default(self, load_data=None):
self._merge_windows_calc = False
self._used_library_calc = "AixLib"

@property
def weather_file_path(self):
return self._weather_file_path

@weather_file_path.setter
def weather_file_path(self, value):
if value is None:
self._weather_file_path = utilities.get_full_path(
os.path.join(
"data",
"input",
"inputdata",
"weatherdata",
"DEU_BW_Mannheim_107290_TRY2010_12_Jahr_BBSR.mos",
)
)
else:
self._weather_file_path = os.path.normpath(value)
self.weather_file_name = os.path.split(self.weather_file_path)[1]

@property
def number_of_elements_calc(self):
return self._number_of_elements_calc
Expand Down

0 comments on commit d9eb231

Please sign in to comment.