Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "default" construction type to use fixed time constant (tau) from SIA 2024 #653

Merged
merged 3 commits into from
Sep 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified GrasshopperExamples/LectureExercises/EaCS3_E04_Hive_Template.gh
Binary file not shown.
Binary file modified setup/Setup_Hive.exe
Binary file not shown.
3 changes: 2 additions & 1 deletion src/Hive.Core/sia380/Hive.Core.sia380.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
{"type": "boolean", "name": "Run obstructed solar simulation?", "nick-name": "RunObstructed?", "description": "Boolean to indicate if an obstructed solar simulation is conducted. True if yes.", "access": "item"},
{"type": "boolean", "name": "Run hourly?", "nick-name": "RunHourly?", "description": "Boolean to indicate if to run monthly or hourly simulations. True if hourly.", "access": "item"},
{"type": "boolean", "name": "Use adaptive comfort?", "nick-name": "UseAdaptiveComfort?", "description": "Boolean to indicate if adaptive comfort should be used instead of fixed setpoints. True if yes. Defaults to yes if setpoints_ub and setpoints_lb are null.", "access": "item"},
{"type": "boolean", "name": "Use natural ventilation?", "nick-name": "UseNaturalVentilation?", "description": "Boolean to indicate if natural ventilation should be considered (True) or not (False).", "access": "item"}
{"type": "boolean", "name": "Use natural ventilation?", "nick-name": "UseNaturalVentilation?", "description": "Boolean to indicate if natural ventilation should be considered (True) or not (False).", "access": "item"},
{"type": "boolean", "name": "Use fixed time constant?", "nick-name": "UseFixedTimeConstant?", "description": "Boolean to indicate if the fixed time constant from SIA 2024 should be used (True) or dynamically calculated based on capacities (False).", "access": "item"}
],
"outputs": [
{"type": "float", "name": "Heating demand", "nick-name": "Q_Heat", "description": "Heating loads of a zone in kWh.", "access": "list"},
Expand Down
26 changes: 18 additions & 8 deletions src/Hive.Core/sia380/sia380.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ def cleanDictForNaN(d):

def main(room_properties, room_schedules, floor_area, T_e_hourly, T_i_ub_hourly, T_i_lb_hourly, surface_areas, surface_type,
srf_irrad_obstr_tree, srf_irrad_unobstr_tree, g_value, g_value_total, setpoint_shading,
run_obstructed_simulation, hourly, use_adaptive_comfort, use_natural_ventilation, debug=False):
run_obstructed_simulation, hourly, use_adaptive_comfort, use_natural_ventilation, use_fixed_time_constant,
debug=False):
'''
Computes monthly heating, cooling and electricity demand for a thermal zone, based on SIA 380.1
:param room_properties: room properties in json format
Expand All @@ -68,6 +69,7 @@ def main(room_properties, room_schedules, floor_area, T_e_hourly, T_i_ub_hourly,
:param hourly: Boolean to indicate if hourly values should be returned instead of monthly. True if yes.
:param use_adaptive_comfort: Boolean to indicate if adaptive comfort should be used instead of fixed setpoints. True if yes. Defaults to yes if setpoints_ub and setpoints_lb are null.
:param use_natural_ventilation: Boolean to indicate if natural ventilation should be considered (True) or not (False).
:param use_fixed_time_constant: Boolean to indicate if fixed time constant should be uesd from SIA 2024 (True) or dynamically calculated based on room capacitance (False).

:return: Monthly or hourly cooling, heating and electricity loads for a thermal zone
'''
Expand Down Expand Up @@ -211,7 +213,7 @@ def main(room_properties, room_schedules, floor_area, T_e_hourly, T_i_ub_hourly,

# f_sh = 0.9 # sia2024, p.12, 1.3.1.9 Reduktion solare Wärmeeinträge
# g = room_properties["Gesamtenergiedurchlassgrad Verglasung"]
tau = room_properties["Zeitkonstante"]
tau_fixed = room_properties["Zeitkonstante"]
C_m = room_properties["Waermespeicherfaehigkeit des Raumes"]
# U_value_opaque = room_properties["U-Wert opake Bauteile"]
# U_value_transparent = room_properties["U-Wert Fenster"]
Expand Down Expand Up @@ -475,11 +477,17 @@ def calculate_step(t,

# time constant of the building (Zeitkonstante), tau
# TODO where does H_T come from...
tau = calc_tau(C_m, floor_area, H_V, H_T)
tau_no_hr = calc_tau(C_m, floor_area, H_V_no_heat_recovery, H_T)
if use_natural_ventilation:
tau_heating_nat_vent = calc_tau(C_m, floor_area, H_V_lb_nat_vent, H_T)
tau_cooling_nat_vent = calc_tau(C_m, floor_area, H_V_ub_nat_vent, H_T)
if use_fixed_time_constant:
tau = tau_fixed
tau_no_hr = tau_fixed
tau_heating_nat_vent = tau_fixed
tau_cooling_nat_vent = tau_fixed
else:
tau = calc_tau(C_m, floor_area, H_V, H_T)
tau_no_hr = calc_tau(C_m, floor_area, H_V_no_heat_recovery, H_T)
if use_natural_ventilation:
tau_heating_nat_vent = calc_tau(C_m, floor_area, H_V_lb_nat_vent, H_T)
tau_cooling_nat_vent = calc_tau(C_m, floor_area, H_V_ub_nat_vent, H_T)

# for debugging, to compare fixed tau
# tau = 126.0
Expand Down Expand Up @@ -878,10 +886,11 @@ def test():
results = main(**kwargs)

# Assert
Q_Heat, Q_Cool, Q_Elec, Q_T, Q_V, Q_i, Q_s, Q_T_op, Q_T_tr, Q_s_tr_tree = results
Q_Heat, Q_dhw, Q_Cool, Q_Elec, Q_T, Q_V, Q_i, Q_s, Q_T_op, Q_T_tr, Q_s_tr_tree = results
# with open(os.path.join(testdir, "results_variable_tau.json"), 'w') as f:
# data = {
# "Q_Heat": Q_Heat,
# "Q_dhw": Q_dhw,
# "Q_Cool": Q_Cool,
# "Q_Elec": Q_Elec,
# "Q_T": Q_T,
Expand All @@ -905,6 +914,7 @@ def test():
# X = range(t_start, t_end)
# plt.plot(X, Q_Cool[t_start:t_end], label='Q_Cool')
# plt.plot(X, Q_Heat[t_start:t_end], label='Q_Heat')
# plt.plot(X, Q_dhw[t_start:t_end], label='Q_dhw')
# plt.plot(X, Q_T[t_start:t_end], ':c', label='Q_T')
# plt.plot(X, Q_V[t_start:t_end], ':b', label='Q_V')
# plt.plot(X, Q_i[t_start:t_end], ':g', label='Q_i')
Expand Down
8 changes: 6 additions & 2 deletions src/Hive.IO/Hive.IO/Building/Sia2024Record.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public Sia2024RecordEx(Sia2024Record room)

RunAdaptiveComfort = room.RunAdaptiveComfort;
RunNaturalVentilation = room.RunNaturalVentilation;
UseFixedTimeConstant = room.UseFixedTimeConstant;
}

public new static Sia2024RecordEx FromJson(string json)
Expand Down Expand Up @@ -122,6 +123,7 @@ public class Sia2024Record
// custom booleans not part of sia2024
public bool RunAdaptiveComfort;
public bool RunNaturalVentilation;
public bool UseFixedTimeConstant;

// as per #466, allow Sia2024Record to have separate values for walls, floors, roofs. Fall back to the Opaque values
private double? _uValueFloors = null;
Expand Down Expand Up @@ -262,7 +264,8 @@ public string ToJson()
{"Emissionen Waende", EmissionsWalls },

{"Natuerliche Belueftung", RunNaturalVentilation },
{"Adaptiver Komfort", RunAdaptiveComfort }
{"Adaptiver Komfort", RunAdaptiveComfort },
{"Feste Zeitkonstante", UseFixedTimeConstant }
};
return JsonConvert.SerializeObject(result);
}
Expand Down Expand Up @@ -323,7 +326,8 @@ public static Sia2024Record FromJson(string json)
_emissionsWalls = readValueOrNull("Emissionen Waende"),

RunNaturalVentilation = readValueOrFalse("Natuerliche Belueftung"),
RunAdaptiveComfort = readValueOrFalse("Adaptiver Komfort")
RunAdaptiveComfort = readValueOrFalse("Adaptiver Komfort"),
UseFixedTimeConstant = readValueOrFalse("Feste Zeitkonstante")
};
}

Expand Down
5 changes: 5 additions & 0 deletions src/Hive.IO/Hive.IO/Building/Zone.cs
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,11 @@ public double RoofsCapacity
/// </summary>
[JsonProperty]
public bool RunNaturalVentilation { get; set; }
/// <summary>
/// Determines if the fixed time constant provided by SIA2024 should be used.
/// </summary>
[JsonProperty]
public bool UseFixedTimeConstant { get; set; }

#endregion

Expand Down
6 changes: 6 additions & 0 deletions src/Hive.IO/Hive.IO/Building/sia380_constructions.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
[
{
"ConstructionType": "default",
"ConstructionTypePretty": "Default",
"Description": "Uses the fixed time constants from SIA 2024 instead.",
"CapacitancePerFloorArea": 0.0
},
{
"ConstructionType": "superlightweight",
"ConstructionTypePretty": "Super Light Weight",
Expand Down
27 changes: 24 additions & 3 deletions src/Hive.IO/Hive.IO/Forms/BuildingInputState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -214,11 +214,15 @@ public string Quality
}
}

#region zone properties

public string Construction
{
get => _siaRoom.Construction ?? "undefined";
get => _siaRoom.Construction ?? Misc.DefaultConstructionType;
set
{
_siaRoom.UseFixedTimeConstant = value == Misc.DefaultConstructionType;
_zone.UseFixedTimeConstant = value == Misc.DefaultConstructionType;
_zone.ApplySia380ConstructionAssembly(value);
UpdateSiaRoomConstruction();

Expand All @@ -227,7 +231,6 @@ public string Construction
}
}

#region zone properties

public bool RunAdaptiveComfort
{
Expand Down Expand Up @@ -263,6 +266,24 @@ public bool RunNaturalVentilation
RaisePropertyChangedEvent();
}
}

public bool UseFixedTimeConstant
{
get => _siaRoom.UseFixedTimeConstant;
set
{
try
{
_zone.UseFixedTimeConstant = value;
_siaRoom.UseFixedTimeConstant = value; // not used, only to keep it consistent
}
catch
{ }

RaisePropertyChangedEvent();
}
}

#endregion

#endregion comboboxes
Expand All @@ -288,7 +309,7 @@ public string RoomConstant

public string CapacitancePerFloorArea
{
get => $"{_siaRoom.CapacitancePerFloorArea:0.00}";
get => _siaRoom.CapacitancePerFloorArea > 0 ? $"{_siaRoom.CapacitancePerFloorArea:0.00}" : "";
set
{
try
Expand Down
6 changes: 2 additions & 4 deletions src/Hive.IO/Hive.IO/GhDistributors/GhDistSIA.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Script.Serialization;
using System.Windows.Documents;
using Grasshopper.Kernel;
using Hive.IO.Building;

Expand Down Expand Up @@ -36,6 +33,7 @@ protected override void RegisterOutputParams(GH_Component.GH_OutputParamManager
pManager.AddTextParameter("SUA Room Schedules", "SiaRoomSchedules", "Schedules for occupancy, devices, lighting, amd setpoints.", GH_ParamAccess.item);
pManager.AddBooleanParameter("Use Adaptive Comfort", "UseAdaptiveComfort", "Determines whether to use adaptive comfort (true) or SIA 2024 setpoints (false)", GH_ParamAccess.item);
pManager.AddBooleanParameter("Use Natural Ventilation", "UseNatVent", "Use natural ventilation in the demand calculation. Based on simplified single sided ventilation", GH_ParamAccess.item);
pManager.AddBooleanParameter("Use Fixed Time Constant", "UseFixedTimeConstant", "Use the fixed time constant provided by SIA 2024", GH_ParamAccess.item);
}


Expand Down Expand Up @@ -113,7 +111,6 @@ protected override void SolveInstance(IGH_DataAccess DA)
//var json = building.SIA2024.ToJson();
//JavaScriptSerializer js = new JavaScriptSerializer();


DA.SetDataList(0, zoneAreas);
DA.SetDataList(1, windowAreas);
DA.SetDataList(2, extSrfAreas);
Expand All @@ -123,6 +120,7 @@ protected override void SolveInstance(IGH_DataAccess DA)
DA.SetData(6, Sia2024Schedules.ToJson(zonesSchedules[0].RoomType)); // single zone !!
DA.SetData(7, building.Zones[0].RunAdaptiveComfort); // single zone !!
DA.SetData(8, building.Zones[0].RunNaturalVentilation); // single zone !!
DA.SetData(9, building.Zones[0].UseFixedTimeConstant); // single zone !!
}


Expand Down
1 change: 1 addition & 0 deletions src/Hive.IO/Hive.IO/GhInputOutput/GhBuilding.cs
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ private Zone CreateZone(Sia2024Record siaRoom, rg.Brep zoneBrep, List<rg.BrepFac

zone.RunAdaptiveComfort = _buildingInputState.RunAdaptiveComfort;
zone.RunNaturalVentilation = _buildingInputState.RunNaturalVentilation;
zone.UseFixedTimeConstant = _buildingInputState.UseFixedTimeConstant;

return zone;
}
Expand Down
2 changes: 2 additions & 0 deletions src/Hive.IO/Hive.IO/Util/Misc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ public static class Misc

public const double Kelvin = 273.15;

public const string DefaultConstructionType = "default"; // For using fixed tau values instead of variable for SIA 380 demand calc

public static double[] GetAverageMonthlyValue(double[] annualTimeSeries)
{
if (annualTimeSeries == null)
Expand Down
2 changes: 2 additions & 0 deletions tests/Hive.Core/sia380/testdata.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"run_obstructed_simulation": false,
"use_adaptive_comfort": false,
"use_natural_ventilation": false,
"use_fixed_time_constant": true,
"hourly": false,
"g_value": 0.5,
"g_value_total": 0.14,
Expand Down Expand Up @@ -50,6 +51,7 @@
"Waermeeintragsleistung Personen (bei 24.0 deg C, bzw. 70 W)": 7.0,
"Waermeeintragsleistung der Raumbeleuchtung": 12.5,
"Waermeeintragsleistung der Geraete": 10.0,
"Jaehrlicher Waermebedarf fuer Warmwasser": 19.8,
"Vollaststunden pro Jahr (Personen)": 1500.0,
"Jaehrliche Vollaststunden der Raumbeleuchtung": 1860.0,
"Jaehrliche Vollaststunden der Geraete": 1930.0,
Expand Down