Skip to content

Commit ac5502e

Browse files
committed
fix besmod export and clarify example and variable names
1 parent 4fda504 commit ac5502e

File tree

5 files changed

+63
-38
lines changed

5 files changed

+63
-38
lines changed

teaser/data/output/besmod_output.py

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -163,16 +163,16 @@ def export_besmod(
163163
for i, bldg in enumerate(buildings):
164164
bldg.bldg_height = bldg.number_of_floors * bldg.height_of_floors
165165
start_time_zones = []
166-
width_zones = []
167-
amplitude_zones = []
166+
hours_set_back_zones = []
167+
d_temp_set_back_zones = []
168168
t_set_zone_nominal = []
169169
for tz in bldg.thermal_zones:
170170
heating_profile = tz.use_conditions.heating_profile
171-
t_set_nominal, start_time, width, amplitude = _convert_heating_profile(heating_profile)
171+
t_set_nominal, start_time, hours_set_back, d_temp_set_back = _convert_heating_profile(heating_profile)
172172
t_set_zone_nominal.append(t_set_nominal)
173-
amplitude_zones.append(amplitude)
173+
d_temp_set_back_zones.append(d_temp_set_back)
174174
start_time_zones.append(start_time)
175-
width_zones.append(width)
175+
hours_set_back_zones.append(hours_set_back)
176176

177177
bldg_path = os.path.join(path, bldg.name)
178178
utilities.create_path(bldg_path)
@@ -195,9 +195,9 @@ def write_example_mo(example_template, example):
195195
TSetZone_nominal=t_set_zone_nominal,
196196
QBuiOld_flow_design=QBuiOld_flow_design[bldg.name],
197197
THydSupOld_design=t_hyd_sup_old_design_bldg[bldg.name],
198-
setBakTSetZone_amplitude=amplitude_zones,
199-
setBakTSetZone_startTime=start_time_zones,
200-
setBakTSetZone_width=width_zones))
198+
dTSetBack=d_temp_set_back_zones,
199+
startTimeSetBack=start_time_zones,
200+
hoursSetBack=hours_set_back_zones))
201201
model_file.close()
202202

203203
for exp in examples:
@@ -370,8 +370,8 @@ def _convert_heating_profile(heating_profile):
370370
This function analyzes a 24-hour heating profile to extract:
371371
- The nominal temperature.
372372
- Start time of setbacks (if any).
373-
- Width of setback intervals.
374-
- Amplitude of the heating variation.
373+
- hours_set_back of setback intervals.
374+
- d_temp_set_back of the heating variation.
375375
376376
Parameters
377377
----------
@@ -384,10 +384,10 @@ def _convert_heating_profile(heating_profile):
384384
Maximum temperature in the profile, used as the nominal set point.
385385
start_time : int
386386
Start time of the setback interval in seconds.
387-
width : float
388-
Width of the setback interval as a percentage of the day.
389-
amplitude : float
390-
Difference between the minimum and nominal temperatures.
387+
hours_set_back : float
388+
hours of the setback interval in h.
389+
d_temp_set_back : float
390+
Absolute difference between the minimum and nominal temperatures.
391391
392392
Raises
393393
------
@@ -404,25 +404,25 @@ def _convert_heating_profile(heating_profile):
404404
change_count += 1
405405
change_indexes.append(i)
406406
t_set_zone_nominal = max(heating_profile)
407-
amplitude = abs(min(heating_profile) - t_set_zone_nominal)
407+
d_temp_set_back = abs(min(heating_profile) - t_set_zone_nominal)
408408
if change_count == 0:
409-
amplitude = 0
409+
d_temp_set_back = 0
410410
start_time = 0
411-
width = 1e-50
411+
hours_set_back = 0
412412
elif change_count == 1:
413413
if heating_profile[0] < heating_profile[-1]:
414414
start_time = 0
415-
width = change_indexes[0]
415+
hours_set_back = change_indexes[0]
416416
else:
417417
start_time = change_indexes[0] * 3600
418-
width = (24 - change_indexes[0])
418+
hours_set_back = (24 - change_indexes[0])
419419
elif change_count == 2:
420420
start_time = change_indexes[1] * 3600
421-
width = (24 - change_indexes[1] + change_indexes[0])
421+
hours_set_back = (24 - change_indexes[1] + change_indexes[0])
422422
else:
423423
raise ValueError("You have more than two temperature intervals in the heating profile."
424424
"BESMod can only handel one heating set back.")
425-
return t_set_zone_nominal, start_time, width * 3600, amplitude
425+
return t_set_zone_nominal, start_time, hours_set_back, d_temp_set_back
426426

427427

428428
def _get_next_higher_year_value(years_dict, given_year):

teaser/data/output/modelicatemplate/BESMod/Example_GasBoilerBuildingOnly

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@ model GasBoilerBuildingOnly${bldg.name}
55
redeclare ${bldg.name} building,
66
userProfiles(fileNameIntGains=Modelica.Utilities.Files.loadResource(
77
"modelica://${bldg.parent.name}/${bldg.name}/InternalGains_${bldg.name}.txt"),
8-
nigSetBack(
9-
dTSetBack=${get_list(setBakTSetZone_amplitude)},
10-
timeSetBack=${get_list(setBakTSetZone_width)},
11-
startTimeSetBack=${get_list(setBakTSetZone_startTime)})),
8+
dTSetBack=${get_list(dTSetBack)},
9+
hoursSetBack=${get_list(hoursSetBack)},
10+
startTimeSetBack=${get_list(startTimeSetBack)}),
1211
systemParameters(nZones=${len(bldg.thermal_zones)},
1312
TSetZone_nominal=${get_list(TSetZone_nominal)},
1413
TOda_nominal=${TOda_nominal},

teaser/data/output/modelicatemplate/BESMod/Example_HeatPumpMonoenergetic

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,9 @@ model HeatPumpMonoenergetic${bldg.name}
77
energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial),
88
userProfiles(fileNameIntGains=Modelica.Utilities.Files.loadResource(
99
"modelica://${bldg.parent.name}/${bldg.name}/InternalGains_${bldg.name}.txt"),
10-
nigSetBack(
11-
dTSetBack=${get_list(setBakTSetZone_amplitude)},
12-
timeSetBack=${get_list(setBakTSetZone_width)},
13-
startTimeSetBack=${get_list(setBakTSetZone_startTime)})),
10+
dTSetBack=${get_list(dTSetBack)},
11+
hoursSetBack=${get_list(hoursSetBack)},
12+
startTimeSetBack=${get_list(startTimeSetBack)}),
1413
systemParameters(
1514
nZones=${len(bldg.thermal_zones)},
1615
TSetZone_nominal=${get_list(TSetZone_nominal)},

teaser/data/output/modelicatemplate/BESMod/Example_TEASERHeatLoadCalculation

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@ model TEASERHeatLoadCalculation${bldg.name}
66
userProfiles(
77
fileNameIntGains=Modelica.Utilities.Files.loadResource(
88
"modelica://${bldg.parent.name}/${bldg.name}/InternalGains_${bldg.name}.txt"),
9-
nigSetBack(
10-
dTSetBack=${get_list(setBakTSetZone_amplitude)},
11-
timeSetBack=${get_list(setBakTSetZone_width)},
12-
startTimeSetBack=${get_list(setBakTSetZone_startTime)})),
9+
dTSetBack=${get_list(dTSetBack)},
10+
hoursSetBack=${get_list(hoursSetBack)},
11+
startTimeSetBack=${get_list(startTimeSetBack)}),
1312
systemParameters(nZones=${len(bldg.thermal_zones)},
1413
TSetZone_nominal=${get_list(TSetZone_nominal)},
1514
TOda_nominal=${TOda_nominal},

teaser/examples/e11_export_besmod_models.py

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,37 @@ def example_export_besmod():
7474

7575
# In the examples, the parameters for BESMod.Systems.UserProfiles.TEASERProfiles are configured,
7676
# including internal gains and heating profiles for each zone.
77-
# BESMod requires 24-hour heating profiles, which are used
78-
# to define the parameters of the `setBakTSetZone` Pulse block.
77+
# BESMod requires 24-hour heating profiles in the export here, which are used
78+
# to define the set-back parameters. Setting these parameters directly or the use of TSet file
79+
# is not supported in the export here. Either override them later or use the custom export option shown below.
7980
# By default, the TEASER profiles are applied, but these can be customized if needed.
81+
# For example, we modify the heating profile of the first thermal zone of the first building here:
82+
prj.buildings[0].thermal_zones[0].use_conditions.heating_profile = [
83+
290.15, #0-1
84+
290.15, #1-2
85+
290.15, #2-3
86+
290.15, #3-4
87+
290.15, #4-5
88+
293.15, #5-6
89+
293.15, #6-7
90+
293.15, #7-8
91+
293.15, #8-9
92+
293.15, #9-10
93+
293.15, #10-11
94+
293.15, #11-12
95+
293.15, #12-13
96+
293.15, #13-14
97+
293.15, #14-15
98+
293.15, #15-16
99+
293.15, #16-17
100+
293.15, #17-18
101+
293.15, #18-19
102+
293.15, #19-20
103+
293.15, #20-21
104+
293.15, #21-22
105+
290.15, #22-23
106+
290.15 #23-24
107+
]
80108

81109
# Additionally, location-specific parameters must be set, which can be achieved using the following function.
82110
# The default values provided here correspond to Mannheim.
@@ -151,9 +179,9 @@ def example_export_besmod():
151179
# redeclare BESMod.Systems.UserProfiles.TEASERProfiles
152180
# userProfiles(fileNameIntGains=Modelica.Utilities.Files.loadResource(
153181
# "modelica://${bldg.parent.name}/${bldg.name}/InternalGains_${bldg.name}.txt"),
154-
# dTSetBack=${get_list(setBakTSetZone_amplitude)},
155-
# hoursSetBack=${get_list(setBakTSetZone_width)},
156-
# startTimeSetBack=${get_list(setBakTSetZone_startTime)}),
182+
# dTSetBack=${get_list(dTSetBack)},
183+
# hoursSetBack=${get_list(hoursSetBack)},
184+
# startTimeSetBack=${get_list(startTimeSetBack)})),
157185
# systemParameters(nZones=${len(bldg.thermal_zones)},
158186
# QBui_flow_nominal = building.QRec_flow_nominal,
159187
# TOda_nominal =${TOda_nominal},

0 commit comments

Comments
 (0)