Skip to content

Commit

Permalink
Refactor templates with a record class for configuration parameters (#…
Browse files Browse the repository at this point in the history
…3508)

* Add cfg record for VAVMZ

* Add cfg record for VAV box

* Updated version to 11.0.0

---------

Co-authored-by: Michael Wetter <[email protected]>
  • Loading branch information
AntoineGautier and mwetter authored Sep 12, 2023
1 parent 90c974a commit 3cdd0c6
Show file tree
Hide file tree
Showing 24 changed files with 362 additions and 201 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// Conversion script for Buildings library
// from: Version 10
// to: Version 11.0.0
clear

convertClear();
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
within Buildings.Templates.AirHandlersFans.Configuration;
record PartialAirHandler "Configuration parameters for air handler interface class"
extends Modelica.Icons.Record;

parameter Buildings.Templates.AirHandlersFans.Types.Configuration typ
"Type of system"
annotation (Evaluate=true);
parameter Buildings.Templates.Components.Types.Fan typFanSup
"Type of supply fan"
annotation (Evaluate=true);
parameter Buildings.Templates.Components.Types.Fan typFanRet
"Type of return fan"
annotation (Evaluate=true);
parameter Buildings.Templates.Components.Types.Fan typFanRel
"Type of relief fan"
annotation (Evaluate=true);
parameter Boolean have_souChiWat
"Set to true if cooling coil requires fluid ports on the source side"
annotation (Evaluate=true);
parameter Boolean have_souHeaWat
"Set to true if heating coil requires fluid ports on the source side"
annotation (Evaluate=true);
parameter Buildings.Templates.AirHandlersFans.Types.Controller typCtl
"Type of controller"
annotation (Evaluate=true);

annotation (Documentation(info="<html>
<p>
This record provides the set of configuration parameters for the class
<a href=\"modelica://Buildings.Templates.AirHandlersFans.Interfaces.PartialAirHandler\">
Buildings.Templates.AirHandlersFans.Interfaces.PartialAirHandler</a>.
</p>
</html>"));
end PartialAirHandler;
55 changes: 55 additions & 0 deletions Buildings/Templates/AirHandlersFans/Configuration/VAVMultiZone.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
within Buildings.Templates.AirHandlersFans.Configuration;
record VAVMultiZone "Configuration parameters for multiple-zone VAV"
extends Buildings.Templates.AirHandlersFans.Configuration.PartialAirHandler;

parameter Buildings.Templates.Components.Types.Coil typCoiHeaPre
"Type of heating coil in preheat position"
annotation (Evaluate=true);
parameter Buildings.Templates.Components.Types.Coil typCoiCoo
"Type of cooling coil"
annotation (Evaluate=true);
parameter Buildings.Templates.Components.Types.Coil typCoiHeaReh
"Type of heating coil in reheat position"
annotation (Evaluate=true);
parameter Buildings.Templates.Components.Types.Valve typValCoiHeaPre
"Type of valve for heating coil in preheat position"
annotation (Evaluate=true);
parameter Buildings.Templates.Components.Types.Valve typValCoiCoo
"Type of valve for cooling coil"
annotation (Evaluate=true);
parameter Buildings.Templates.Components.Types.Valve typValCoiHeaReh
"Type of valve for heating coil in reheat position"
annotation (Evaluate=true);
parameter Buildings.Templates.Components.Types.Damper typDamOut
"Outdoor air damper type"
annotation (Evaluate=true, Dialog(group="Configuration", enable=false));
parameter Buildings.Templates.Components.Types.Damper typDamOutMin
"Minimum outdoor air damper type"
annotation (Evaluate=true, Dialog(group="Configuration", enable=false));
parameter Buildings.Templates.Components.Types.Damper typDamRel
"Relief damper type"
annotation (Evaluate=true, Dialog(group="Configuration", enable=false));
parameter Buildings.Templates.Components.Types.Damper typDamRet
"Return damper type"
annotation (Evaluate=true, Dialog(group="Configuration", enable=false));
parameter Buildings.Controls.OBC.ASHRAE.G36.Types.OutdoorAirSection typSecOut
"Type of outdoor air section"
annotation (Evaluate=true);
parameter Buildings.Controls.OBC.ASHRAE.G36.Types.BuildingPressureControlTypes buiPreCon
"Type of building pressure control system"
annotation (Evaluate=true);
parameter Buildings.Controls.OBC.ASHRAE.G36.Types.VentilationStandard stdVen
"Ventilation standard"
annotation(Evaluate=true);

annotation (
defaultComponentPrefixes = "parameter",
defaultComponentName = "cfg",
Documentation(info="<html>
<p>
This record provides the set of configuration parameters for the class
<a href=\"modelica://Buildings.Templates.AirHandlersFans.VAVMultiZone\">
Buildings.Templates.AirHandlersFans.VAVMultiZone</a>.
</p>
</html>"));
end VAVMultiZone;
10 changes: 10 additions & 0 deletions Buildings/Templates/AirHandlersFans/Configuration/package.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
within Buildings.Templates.AirHandlersFans;
package Configuration "Records for configuration parameters"
extends Modelica.Icons.MaterialPropertiesPackage;

annotation (Documentation(info="<html>
<p>
This package provides records for configuration parameters.
</p>
</html>"));
end Configuration;
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
PartialAirHandler
VAVMultiZone
41 changes: 12 additions & 29 deletions Buildings/Templates/AirHandlersFans/Data/PartialAirHandler.mo
Original file line number Diff line number Diff line change
Expand Up @@ -2,53 +2,36 @@ within Buildings.Templates.AirHandlersFans.Data;
record PartialAirHandler "Record for air handler interface class"
extends Modelica.Icons.Record;

parameter Buildings.Templates.AirHandlersFans.Types.Configuration typ
"Type of system"
annotation (Evaluate=true, Dialog(group="Configuration", enable=false));
parameter Buildings.Templates.Components.Types.Fan typFanSup
"Type of supply fan"
annotation (Evaluate=true, Dialog(group="Configuration", enable=false));
parameter Buildings.Templates.Components.Types.Fan typFanRet
"Type of return fan"
annotation (Evaluate=true, Dialog(group="Configuration", enable=false));
parameter Buildings.Templates.Components.Types.Fan typFanRel
"Type of relief fan"
annotation (Evaluate=true, Dialog(group="Configuration", enable=false));
parameter Boolean have_souChiWat
"Set to true if cooling coil requires fluid ports on the source side"
annotation (Evaluate=true, Dialog(group="Configuration", enable=false));
parameter Boolean have_souHeaWat
"Set to true if heating coil requires fluid ports on the source side"
annotation (Evaluate=true, Dialog(group="Configuration", enable=false));
parameter Buildings.Templates.AirHandlersFans.Types.Controller typCtl
"Type of controller"
annotation (Evaluate=true, Dialog(group="Configuration", enable=false));
replaceable parameter
Buildings.Templates.AirHandlersFans.Configuration.PartialAirHandler cfg
"Configuration parameters"
annotation (Dialog(enable=false));

parameter String id=""
"System tag"
annotation (Dialog(tab="Advanced"));
parameter String id_souChiWat=""
"CHW supply system tag"
annotation (Dialog(tab="Advanced", enable=have_souChiWat));
annotation (Dialog(tab="Advanced", enable=cfg.have_souChiWat));
parameter String id_souHeaWat=""
"HHW supply system tag"
annotation (Dialog(tab="Advanced", enable=have_souHeaWat));
annotation (Dialog(tab="Advanced", enable=cfg.have_souHeaWat));

replaceable parameter Buildings.Templates.AirHandlersFans.Components.Data.PartialController
ctl(
final typFanSup=typFanSup,
final typFanRel=typFanRel,
final typFanRet=typFanRet,
final typ=typCtl)
final typFanSup=cfg.typFanSup,
final typFanRel=cfg.typFanRel,
final typFanRet=cfg.typFanRet,
final typ=cfg.typCtl)
"Controller"
annotation (Dialog(group="Controls"));

parameter Modelica.Units.SI.MassFlowRate mAirSup_flow_nominal
"Supply air mass flow rate"
annotation (Dialog(enable=typ<>Buildings.Templates.AirHandlersFans.Types.Configuration.ExhaustOnly));
annotation (Dialog(enable=cfg.typ<>Buildings.Templates.AirHandlersFans.Types.Configuration.ExhaustOnly));
parameter Modelica.Units.SI.MassFlowRate mAirRet_flow_nominal
"Return air mass flow rate"
annotation (Dialog(enable=typ<>Buildings.Templates.AirHandlersFans.Types.Configuration.SupplyOnly));
annotation (Dialog(enable=cfg.typ<>Buildings.Templates.AirHandlersFans.Types.Configuration.SupplyOnly));

annotation (Documentation(info="<html>
<p>
Expand Down
91 changes: 37 additions & 54 deletions Buildings/Templates/AirHandlersFans/Data/VAVMultiZone.mo
Original file line number Diff line number Diff line change
@@ -1,56 +1,35 @@
within Buildings.Templates.AirHandlersFans.Data;
record VAVMultiZone "Record for multiple-zone VAV"
extends Buildings.Templates.AirHandlersFans.Data.PartialAirHandler(
redeclare Buildings.Templates.AirHandlersFans.Configuration.VAVMultiZone cfg,
redeclare Buildings.Templates.AirHandlersFans.Components.Data.VAVMultiZoneController
ctl(
final typSecOut=typSecOut,
final buiPreCon=buiPreCon,
final stdVen=stdVen),
final mAirSup_flow_nominal=if typFanSup<>Buildings.Templates.Components.Types.Fan.None
then fanSup.m_flow_nominal else 0,
final mAirRet_flow_nominal=if typFanRet<>Buildings.Templates.Components.Types.Fan.None
then fanRet.m_flow_nominal
elseif typFanRel<>Buildings.Templates.Components.Types.Fan.None
then fanRel.m_flow_nominal
elseif typFanSup<>Buildings.Templates.Components.Types.Fan.None
then fanSup.m_flow_nominal else 0);

parameter Buildings.Templates.Components.Types.Coil typCoiHeaPre
"Type of heating coil in preheat position"
annotation (Evaluate=true, Dialog(group="Configuration", enable=false));
parameter Buildings.Templates.Components.Types.Coil typCoiCoo
"Type of cooling coil"
annotation (Evaluate=true, Dialog(group="Configuration", enable=false));
parameter Buildings.Templates.Components.Types.Coil typCoiHeaReh
"Type of heating coil in reheat position"
annotation (Evaluate=true, Dialog(group="Configuration", enable=false));
parameter Buildings.Templates.Components.Types.Valve typValCoiHeaPre
"Type of valve for heating coil in preheat position"
annotation (Evaluate=true, Dialog(group="Configuration", enable=false));
parameter Buildings.Templates.Components.Types.Valve typValCoiCoo
"Type of valve for cooling coil"
annotation (Evaluate=true, Dialog(group="Configuration", enable=false));
parameter Buildings.Templates.Components.Types.Valve typValCoiHeaReh
"Type of valve for heating coil in reheat position"
annotation (Evaluate=true, Dialog(group="Configuration", enable=false));
parameter Buildings.Controls.OBC.ASHRAE.G36.Types.OutdoorAirSection typSecOut
"Type of outdoor air section"
annotation (Evaluate=true, Dialog(group="Configuration", enable=false));
parameter Buildings.Controls.OBC.ASHRAE.G36.Types.BuildingPressureControlTypes buiPreCon
"Type of building pressure control system"
annotation (Evaluate=true, Dialog(group="Configuration", enable=false));
parameter Buildings.Controls.OBC.ASHRAE.G36.Types.VentilationStandard stdVen
"Ventilation standard"
annotation(Evaluate=true, Dialog(group="Energy and ventilation standards", enable=false));
final typSecOut=cfg.typSecOut,
final buiPreCon=cfg.buiPreCon,
final stdVen=cfg.stdVen),
final mAirSup_flow_nominal=if cfg.typFanSup<>Buildings.Templates.Components.Types.Fan.None
then fanSup.m_flow_nominal else 0,
final mAirRet_flow_nominal=if cfg.typFanRet<>Buildings.Templates.Components.Types.Fan.None
then fanRet.m_flow_nominal
elseif cfg.typFanRel<>Buildings.Templates.Components.Types.Fan.None
then fanRel.m_flow_nominal
elseif cfg.typFanSup<>Buildings.Templates.Components.Types.Fan.None
then fanSup.m_flow_nominal else 0);

parameter Buildings.Templates.Components.Data.Fan fanSup(
final typ=typFanSup)
final typ=cfg.typFanSup)
"Supply fan"
annotation (Dialog(
group="Fans", enable=typFanSup <> Buildings.Templates.Components.Types.Fan.None));
group="Fans", enable=cfg.typFanSup <> Buildings.Templates.Components.Types.Fan.None));

extends
Buildings.Templates.AirHandlersFans.Components.Data.OutdoorReliefReturnSection(
final typDamOut=cfg.typDamOut,
final typDamOutMin=cfg.typDamOutMin,
final typDamRel=cfg.typDamRel,
final typDamRet=cfg.typDamRet,
final typFanRel=cfg.typFanRel,
final typFanRet=cfg.typFanRet,
fanRel,
fanRet,
damOut(
Expand All @@ -63,40 +42,44 @@ record VAVMultiZone "Record for multiple-zone VAV"
m_flow_nominal=mAirRet_flow_nominal));

parameter Buildings.Templates.Components.Data.Coil coiHeaPre(
final typ=typCoiHeaPre,
final typVal=typValCoiHeaPre,
final have_sou=have_souHeaWat,
final typ=cfg.typCoiHeaPre,
final typVal=cfg.typValCoiHeaPre,
final have_sou=cfg.have_souHeaWat,
mAir_flow_nominal=mAirSup_flow_nominal)
"Heating coil in preheat position"
annotation (Dialog(group="Coils",
enable=typCoiHeaPre <> Buildings.Templates.Components.Types.Coil.None));
enable=cfg.typCoiHeaPre <> Buildings.Templates.Components.Types.Coil.None));

parameter Buildings.Templates.Components.Data.Coil coiCoo(
final typ=typCoiCoo,
final typVal=typValCoiCoo,
final have_sou=have_souChiWat,
final typ=cfg.typCoiCoo,
final typVal=cfg.typValCoiCoo,
final have_sou=cfg.have_souChiWat,
mAir_flow_nominal=mAirSup_flow_nominal)
"Cooling coil"
annotation (Dialog(
group="Coils", enable=typCoiCoo <> Buildings.Templates.Components.Types.Coil.None));
group="Coils", enable=cfg.typCoiCoo <> Buildings.Templates.Components.Types.Coil.None));

parameter Buildings.Templates.Components.Data.Coil coiHeaReh(
final typ=typCoiHeaReh,
final typVal=typValCoiHeaReh,
final have_sou=have_souHeaWat,
final typ=cfg.typCoiHeaReh,
final typVal=cfg.typValCoiHeaReh,
final have_sou=cfg.have_souHeaWat,
mAir_flow_nominal=mAirSup_flow_nominal)
"Heating coil in reheat position"
annotation (Dialog(group="Coils",
enable=typCoiHeaReh <> Buildings.Templates.Components.Types.Coil.None));
enable=cfg.typCoiHeaReh <> Buildings.Templates.Components.Types.Coil.None));

annotation (
defaultComponentPrefixes = "parameter",
defaultComponentName = "dat",
Documentation(info="<html>
Documentation(info="<html>
<p>
This record provides the set of sizing and operating parameters for the class
<a href=\"modelica://Buildings.Templates.AirHandlersFans.VAVMultiZone\">
Buildings.Templates.AirHandlersFans.VAVMultiZone</a>.
</p>
<p>
The tab <code>Advanced</code> contains some optional parameters that can be used
for workflow automation, but are not used for simulation.
</p>
</html>"));
end VAVMultiZone;
23 changes: 11 additions & 12 deletions Buildings/Templates/AirHandlersFans/Interfaces/PartialAirHandler.mo
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,23 @@ partial model PartialAirHandler "Interface class for air handler"
"Type of system"
annotation (Evaluate=true, Dialog(group="Configuration"));

inner parameter Integer nZon(min=1)
"Number of served zones"
annotation (
Evaluate=true,
Dialog(group="Configuration"));

replaceable parameter
Buildings.Templates.AirHandlersFans.Data.PartialAirHandler dat(
Buildings.Templates.AirHandlersFans.Configuration.PartialAirHandler cfg(
final typ=typ,
final typFanSup=typFanSup,
final typFanRel=typFanRel,
final typFanRet=typFanRet,
final have_souChiWat=have_souChiWat,
final have_souHeaWat=have_souHeaWat)
"Configuration parameters";

inner parameter Integer nZon(min=1)
"Number of served zones"
annotation (Evaluate=true, Dialog(group="Configuration"));

replaceable parameter
Buildings.Templates.AirHandlersFans.Data.PartialAirHandler dat(
cfg=cfg)
"Design and operating parameters"
annotation (Placement(transformation(extent={{270,250},{290,270}})));

Expand All @@ -43,11 +46,7 @@ partial model PartialAirHandler "Interface class for air handler"
parameter Boolean have_porRel=
typ==Buildings.Templates.AirHandlersFans.Types.Configuration.ExhaustOnly
"Set to true for relief (exhaust) fluid port"
annotation (
Evaluate=true,
Dialog(
group="Configuration",
enable=false));
annotation (Evaluate=true, Dialog(group="Configuration", enable=false));
parameter Boolean have_souChiWat
"Set to true if system uses CHW"
annotation (Evaluate=true, Dialog(group="Configuration"));
Expand Down
Loading

0 comments on commit 3cdd0c6

Please sign in to comment.