Skip to content

Commit

Permalink
reimplemented DHC sequences to comply CDL specification
Browse files Browse the repository at this point in the history
  • Loading branch information
JayHuLBL committed Feb 6, 2025
1 parent 9241965 commit 1bcfd70
Show file tree
Hide file tree
Showing 13 changed files with 877 additions and 675 deletions.
525 changes: 286 additions & 239 deletions Buildings/DHC/Plants/Combined/Controls/BaseClasses/StagingPlant.mo

Large diffs are not rendered by default.

92 changes: 47 additions & 45 deletions Buildings/DHC/Plants/Combined/Controls/BaseClasses/StagingPump.mo
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ block StagingPump "Pump staging"
start=1)
"Number of pumps"
annotation(Evaluate=true);
parameter Modelica.Units.SI.MassFlowRate m_flow_nominal=1
parameter Real m_flow_nominal(
final unit="kg/s",
final quantity="MassFlowRate")=1
"Loop design mass flow rate (all pumps)"
annotation(Dialog(group="Nominal condition", enable=have_flowCriterion));
parameter Real yDow=0.30
Expand All @@ -21,23 +23,31 @@ block StagingPump "Pump staging"
"Lead pump Enable signal (e.g. based on isolation valve opening command)"
annotation (Placement(transformation(extent={{-240,140},{-200,180}}),
iconTransformation(extent={{-140,40},{-100,80}})));
Buildings.Controls.OBC.CDL.Interfaces.RealInput m_flow(final unit="kg/s")
Buildings.Controls.OBC.CDL.Interfaces.RealInput m_flow(
final unit="kg/s")
if have_flowCriterion
"Mass flow rate as measured by the loop flow meter"
annotation (Placement(
transformation(extent={{-240,60},{-200,100}}),iconTransformation(extent={{-140,
-20},{-100,20}})));
annotation (Placement(transformation(extent={{-240,60},{-200,100}}),
iconTransformation(extent={{-140,-20},{-100,20}})));
Buildings.Controls.OBC.CDL.Interfaces.RealInput y(final unit="1")
"Commanded speed"
annotation (Placement(transformation(extent={{-240,-20},{-200,20}}),
iconTransformation(extent={{-140,-80},{-100,-40}})));
iconTransformation(extent={{-140,-80},{-100,-40}})));
Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y1[nPum]
"Start signal (VFD Run or motor starter contact)"
annotation (Placement(
transformation(extent={{200,-20},{240,20}}), iconTransformation(extent={{100,40},
{140,80}})));
annotation (Placement(transformation(extent={{200,-20},{240,20}}),
iconTransformation(extent={{100,40},{140,80}})));
Buildings.Controls.OBC.CDL.Interfaces.IntegerOutput nPumEna
"Number of pumps that are enabled"
annotation (Placement(transformation(extent={{200,-80},{240,-40}}),
iconTransformation(extent={{100,-80},{140,-40}})));
Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y1Any
"Return true if any pump enabled (left limit to avoid direct feedback)"
annotation (Placement(transformation(extent={{200,-140},{240,-100}}),
iconTransformation(extent={{100,-20},{140,20}})));

Buildings.Controls.OBC.CDL.Reals.GreaterThreshold cmp(final t=yUp, h=1e-3)
Buildings.Controls.OBC.CDL.Reals.GreaterThreshold cmp(
final t=yUp, h=1e-3)
"Compare"
annotation (Placement(transformation(extent={{-100,-10},{-80,10}})));
Buildings.Controls.OBC.CDL.Logical.Timer timSpe(t=5*60)
Expand Down Expand Up @@ -70,10 +80,12 @@ block StagingPump "Pump staging"
if have_flowCriterion
"Check if true for a given time"
annotation (Placement(transformation(extent={{-72,50},{-52,70}})));
Buildings.Controls.OBC.CDL.Reals.LessThreshold cmp4(final t=yDow, h=1e-3)
Buildings.Controls.OBC.CDL.Reals.LessThreshold cmp4(
final t=yDow, h=1e-3)
"Compare"
annotation (Placement(transformation(extent={{-100,-50},{-80,-30}})));
Buildings.Controls.OBC.CDL.Logical.Timer timSpe1(t=5*60) "True delay"
Buildings.Controls.OBC.CDL.Logical.Timer timSpe1(t=5*60)
"True delay"
annotation (Placement(transformation(extent={{-70,-50},{-50,-30}})));
Buildings.Controls.OBC.CDL.Logical.Or dow
"Check if flow or speed criterion passed for staging down"
Expand All @@ -89,7 +101,8 @@ block StagingPump "Pump staging"
Buildings.Controls.OBC.CDL.Routing.IntegerScalarReplicator rep(
final nout=nPum) "Replicate"
annotation (Placement(transformation(extent={{120,-10},{140,10}})));
Buildings.DHC.Plants.Combined.Controls.BaseClasses.StageIndex staLag(final nSta=max(1, nPum - 1), tSta=30)
Buildings.DHC.Plants.Combined.Controls.BaseClasses.StageIndex staLag(
final nSta=max(1, nPum - 1), tSta=30)
if nPum>1
"Stage lag pumps (minimum runtime allowing for pump start time)"
annotation (Placement(transformation(extent={{30,-10},{50,10}})));
Expand All @@ -110,60 +123,53 @@ block StagingPump "Pump staging"
if nPum==1
"Constant"
annotation (Placement(transformation(extent={{30,-50},{50,-30}})));
Buildings.Controls.OBC.CDL.Logical.Sources.Constant fal(final k=false)
Buildings.Controls.OBC.CDL.Logical.Sources.Constant fal(
final k=false)
if not have_flowCriterion
"Constant"
annotation (Placement(transformation(extent={{-70,-90},{-50,-70}})));
Buildings.Controls.OBC.CDL.Interfaces.IntegerOutput nPumEna
"Number of pumps that are enabled" annotation (Placement(transformation(
extent={{200,-80},{240,-40}}), iconTransformation(extent={{100,-80},{
140,-40}})));
Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y1Any
"Return true if any pump enabled (left limit to avoid direct feedback)"
annotation (Placement(transformation(extent={{200,-140},{240,-100}}),
iconTransformation(extent={{100,-20},{140,20}})));
Buildings.Controls.OBC.CDL.Integers.GreaterEqualThreshold anyEna(final t=1)
Buildings.Controls.OBC.CDL.Integers.GreaterEqualThreshold anyEna(
final t=1)
"Return true if any pump is enabled"
annotation (Placement(transformation(extent={{120,-130},{140,-110}})));
Buildings.Controls.OBC.CDL.Logical.Pre pre1
"Left limit of signal avoiding direct feedback"
annotation (Placement(transformation(extent={{160,-130},{180,-110}})));

equation
connect(y, cmp.u)
annotation (Line(points={{-220,0},{-102,0}}, color={0,0,127}));
annotation (Line(points={{-220,0},{-102,0}}, color={0,0,127}));
connect(cmp.y, timSpe.u)
annotation (Line(points={{-78,0},{-72,0}}, color={255,0,255}));
annotation (Line(points={{-78,0},{-72,0}}, color={255,0,255}));
connect(ratFlo.y, cmp2.u1)
annotation (Line(points={{-126,80},{-120,80},{-120,100},{-102,100}},
color={0,0,127}));
color={0,0,127}));
connect(addOff.y, cmp2.u2) annotation (Line(points={{-102,140},{-110,140},{
-110,92},{-102,92}}, color={0,0,127}));
-110,92},{-102,92}}, color={0,0,127}));
connect(timFlo.passed, up.u1) annotation (Line(points={{-50,92},{-36,92},{-36,
0},{-32,0}}, color={255,0,255}));
0},{-32,0}}, color={255,0,255}));
connect(ratFlo.y, cmp3.u1) annotation (Line(points={{-126,80},{-120,80},{-120,
60},{-102,60}}, color={0,0,127}));
connect(y, cmp4.u) annotation (Line(points={{-220,0},{-160,0},{-160,-40},{-102,
-40}}, color={0,0,127}));
-40}}, color={0,0,127}));
connect(cmp4.y, timSpe1.u)
annotation (Line(points={{-78,-40},{-72,-40}}, color={255,0,255}));
annotation (Line(points={{-78,-40},{-72,-40}}, color={255,0,255}));
connect(timFlo1.passed,dow. u1) annotation (Line(points={{-50,52},{-40,52},{
-40,-40},{-32,-40}}, color={255,0,255}));
-40,-40},{-32,-40}}, color={255,0,255}));
connect(addOff.u, ratOpeDsg.y)
annotation (Line(points={{-78,140},{-62,140}}, color={0,0,127}));
connect(rep.y, cvtBoo.u)
annotation (Line(points={{142,0},{158,0}}, color={255,127,0}));
connect(cmp2.y, timFlo.u)
annotation (Line(points={{-78,100},{-74,100}},
color={255,0,255}));
annotation (Line(points={{-78,100},{-74,100}}, color={255,0,255}));
connect(cmp3.y, timFlo1.u)
annotation (Line(points={{-78,60},{-74,60}}, color={255,0,255}));
connect(timSpe.passed, up.u2) annotation (Line(points={{-48,-8},{-32,-8}},
color={255,0,255}));
color={255,0,255}));
connect(timSpe1.passed,dow. u2) annotation (Line(points={{-48,-48},{-40,-48},
{-40,-48},{-32,-48}},color={255,0,255}));
connect(y1Ena, staLag.u1) annotation (Line(points={{-220,160},{0,160},{0,6},{
28,6}},
color={255,0,255}));
28,6}}, color={255,0,255}));
connect(cvtInt.y, ratOpeDsg.u)
annotation (Line(points={{28,140},{-38,140}}, color={0,0,127}));
connect(cvtBoo.y, y1)
Expand All @@ -173,29 +179,25 @@ equation
connect(addOffLowSta.y, cmp3.u2) annotation (Line(points={{-128,40},{-116,40},
{-116,52},{-102,52}}, color={0,0,127}));
connect(y1Ena, leaEna.u) annotation (Line(points={{-220,160},{0,160},{0,40},{
28,40}},
color={255,0,255}));
28,40}}, color={255,0,255}));
connect(dow.y, staLag.u1Dow) annotation (Line(points={{-8,-40},{0,-40},{0,
-5.8},{28,-5.8}},
color={255,0,255}));
-5.8},{28,-5.8}}, color={255,0,255}));
connect(num.y, rep.u)
annotation (Line(points={{102,0},{118,0}},
color={255,127,0}));
annotation (Line(points={{102,0},{118,0}}, color={255,127,0}));
connect(staLag.idxSta, num.u2) annotation (Line(points={{52,0},{60,0},{60,-6},
{78,-6}}, color={255,127,0}));
connect(leaEna.y, num.u1) annotation (Line(points={{52,40},{60,40},{60,6},{78,
6}}, color={255,127,0}));
connect(numPre.y, cvtInt.u) annotation (Line(points={{102,60},{120,60},{120,
140},{52,140}},
color={255,127,0}));
140},{52,140}}, color={255,127,0}));
connect(leaEna.y, numPre.u1) annotation (Line(points={{52,40},{60,40},{60,66},
{78,66}}, color={255,127,0}));
connect(staLag.preIdxSta, numPre.u2) annotation (Line(points={{52,-6},{56,-6},
{56,54},{78,54}}, color={255,127,0}));
connect(zer.y, num.u2) annotation (Line(points={{52,-40},{68,-40},{68,-6},{78,
-6}}, color={255,127,0}));
connect(zer.y, numPre.u2) annotation (Line(points={{52,-40},{68,-40},{68,54},
{78,54}},color={255,127,0}));
{78,54}}, color={255,127,0}));
connect(up.y, staLag.u1Up)
annotation (Line(points={{-8,0},{28,0}}, color={255,0,255}));
connect(fal.y, dow.u1) annotation (Line(points={{-48,-80},{-36,-80},{-36,-40},
Expand Down
Loading

0 comments on commit 1bcfd70

Please sign in to comment.