From 9e4eb4e9028cb510bdebd8f08f254345de0aa644 Mon Sep 17 00:00:00 2001 From: junkewang001 Date: Thu, 30 Mar 2023 16:33:34 -0700 Subject: [PATCH 01/20] Deleted modifiers in extIndSig blocks --- .../SetPoints/MinimumFlowSetPoint.mo | 20 ++++++------------- .../Validation/MinimumFlowSetPoint.mo | 12 +++-------- 2 files changed, 9 insertions(+), 23 deletions(-) diff --git a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/SetPoints/MinimumFlowSetPoint.mo b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/SetPoints/MinimumFlowSetPoint.mo index 3e3d1c94743..4508c64b5d7 100644 --- a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/SetPoints/MinimumFlowSetPoint.mo +++ b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/SetPoints/MinimumFlowSetPoint.mo @@ -175,9 +175,7 @@ protected annotation (Placement(transformation(extent={{60,-60},{80,-40}}))); Buildings.Controls.OBC.CDL.Routing.RealExtractor extIndSig1( - final allowOutOfRange=true, - final nin=nSta, - final outOfRangeValue=1e-6) + final nin=nSta) "Extract flow ratio of previous setpoint during stage-up" annotation (Placement(transformation(extent={{60,70},{80,90}}))); @@ -204,9 +202,7 @@ protected annotation (Placement(transformation(extent={{60,30},{80,50}}))); Buildings.Controls.OBC.CDL.Routing.RealExtractor extIndSig3( - final allowOutOfRange=true, - final nin=nBoi, - final outOfRangeValue=1e-6) + final nin=nBoi) "Extract max flowrate of boiler being disabled during stage-up" annotation (Placement(transformation(extent={{-20,40},{0,60}}))); @@ -248,9 +244,7 @@ protected annotation (Placement(transformation(extent={{-90,-310},{-70,-290}}))); Buildings.Controls.OBC.CDL.Routing.RealExtractor extIndSig4( - final allowOutOfRange=true, - final nin=nSta, - final outOfRangeValue=1e-6) + final nin=nSta) "Extract flow ratio of previous setpoint during stage-down" annotation (Placement(transformation(extent={{60,-280},{80,-260}}))); @@ -259,9 +253,7 @@ protected annotation (Placement(transformation(extent={{100,-260},{120,-240}}))); Buildings.Controls.OBC.CDL.Routing.RealExtractor extIndSig5( - final allowOutOfRange=true, - final nin=nBoi, - final outOfRangeValue=1e-6) + final nin=nBoi) "Extract max flowrate of boiler being disabled during stage-down" annotation (Placement(transformation(extent={{-40,-270},{-20,-250}}))); @@ -369,8 +361,8 @@ equation connect(uStaSet, extIndSig.index) annotation (Line(points={{-160,-90},{70,-90}, {70,-62}}, color={255,127,0})); - connect(matMax.y, extIndSig1.u) annotation (Line(points={{42,-150},{52,-150},{ - 52,80},{58,80}}, + connect(matMax.y, extIndSig1.u) annotation (Line(points={{42,-150},{52,-150}, + {52,80},{58,80}}, color={0,0,127})); connect(conInt.y,subInt. u2) annotation (Line(points={{-98,70},{-72,70},{-72, diff --git a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/SetPoints/Validation/MinimumFlowSetPoint.mo b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/SetPoints/Validation/MinimumFlowSetPoint.mo index f3966daa1ab..b1e81266798 100644 --- a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/SetPoints/Validation/MinimumFlowSetPoint.mo +++ b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/SetPoints/Validation/MinimumFlowSetPoint.mo @@ -54,9 +54,7 @@ protected annotation (Placement(transformation(extent={{-90,90},{-70,110}}))); Buildings.Controls.OBC.CDL.Routing.RealExtractor extIndSig( - final allowOutOfRange=true, - final nin=3, - final outOfRangeValue=0) + final nin=3) "Extract scalar out of vector" annotation (Placement(transformation(extent={{-60,90},{-40,110}}))); @@ -93,9 +91,7 @@ protected annotation (Placement(transformation(extent={{-90,-30},{-70,-10}}))); Buildings.Controls.OBC.CDL.Routing.RealExtractor extIndSig1( - final allowOutOfRange=true, - final nin=3, - final outOfRangeValue=0) + final nin=3) "Extract scalar out of vector" annotation (Placement(transformation(extent={{-60,-30},{-40,-10}}))); @@ -121,9 +117,7 @@ protected annotation (Placement(transformation(extent={{-90,-60},{-70,-40}}))); Buildings.Controls.OBC.CDL.Routing.RealExtractor extIndSig2( - final allowOutOfRange=true, - final nin=3, - final outOfRangeValue=0) + final nin=3) "Extract scalar out of vector" annotation (Placement(transformation(extent={{-60,-60},{-40,-40}}))); From e99851316aa074a1600dba7f31823c4e4b388bdf Mon Sep 17 00:00:00 2001 From: junkewang001 Date: Thu, 30 Mar 2023 16:34:19 -0700 Subject: [PATCH 02/20] Changed the input of stage0 from 0 to 1 --- .../Staging/SetPoints/Subsequences/Validation/Capacities.mo | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/Validation/Capacities.mo b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/Validation/Capacities.mo index eb07c310468..a034b3b938d 100644 --- a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/Validation/Capacities.mo +++ b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/Validation/Capacities.mo @@ -37,8 +37,7 @@ protected "Minimum stage capacities" annotation (Placement(transformation(extent={{-140,60},{-120,80}}))); - Buildings.Controls.OBC.CDL.Integers.Sources.Constant stage0( - final k=0) + Buildings.Controls.OBC.CDL.Integers.Sources.Constant stage0(final k=1) "Boiler stage" annotation (Placement(transformation(extent={{-140,20},{-120,40}}))); @@ -72,8 +71,7 @@ protected "Boiler stage" annotation (Placement(transformation(extent={{20,-20},{40,0}}))); - Buildings.Controls.OBC.CDL.Integers.Sources.Constant stage6( - final k=3) + Buildings.Controls.OBC.CDL.Integers.Sources.Constant stage6(final k=2) "Boiler stage" annotation (Placement(transformation(extent={{-60,-20},{-40,0}}))); From eaa16cb85026e13c75f394ba478a9392df7bb98e Mon Sep 17 00:00:00 2001 From: junkewang001 Date: Thu, 30 Mar 2023 17:45:04 -0700 Subject: [PATCH 03/20] Deleted modifiers of allowOutOfRange and outOfRangeValue in components --- .../Pumps/SecondaryPumps/Controller.mo | 15 ++++++-------- .../SetPoints/MinimumFlowSetPoint.mo | 20 +++++++++++++------ .../Validation/MinimumFlowSetPoint.mo | 12 ++++++++--- 3 files changed, 29 insertions(+), 18 deletions(-) diff --git a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Pumps/SecondaryPumps/Controller.mo b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Pumps/SecondaryPumps/Controller.mo index 5261b8728dc..91851905713 100644 --- a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Pumps/SecondaryPumps/Controller.mo +++ b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Pumps/SecondaryPumps/Controller.mo @@ -382,9 +382,7 @@ protected annotation (Placement(transformation(extent={{-40,220},{-20,240}}))); Buildings.Controls.OBC.CDL.Routing.RealExtractor nexLagPum( - final allowOutOfRange=true, - final nin=nPum, - final outOfRangeValue=0) + final nin=nPum) "Next lag pump" annotation (Placement(transformation(extent={{-80,-60},{-60,-40}}))); @@ -393,9 +391,7 @@ protected annotation (Placement(transformation(extent={{-8,-60},{12,-40}}))); Buildings.Controls.OBC.CDL.Routing.RealExtractor lasLagPum( - final allowOutOfRange=true, - final nin=nPum, - final outOfRangeValue=0) + final nin=nPum) "Last lag pump" annotation (Placement(transformation(extent={{-80,-110},{-60,-90}}))); @@ -421,7 +417,7 @@ protected annotation (Placement(transformation(extent={{-250,-166},{-230,-146}}))); Buildings.Controls.OBC.CDL.Integers.MultiSum mulSumInt1( - final nin=nPumPri) if not have_varSecPum + final nin=nPumPri) if not have_varSecPum "Sum of integer inputs" annotation (Placement(transformation(extent={{-200,-166},{-180,-146}}))); @@ -735,8 +731,9 @@ equation 0},{274,-264},{-74,-264},{-74,-326},{-62,-326}}, color={255,0,255})); connect(logSwi.y, pumSpeRemDp.uHotWatPum) annotation (Line(points={{214,0},{274, 0},{274,-264},{-74,-264},{-74,-362},{-62,-362}}, color={255,0,255})); - connect(booToInt1.y, mulSumInt1.u[1:2]) annotation (Line(points={{-228,-156},{ - -216,-156},{-216,-159.5},{-202,-159.5}}, color={255,127,0})); + connect(booToInt1.y, mulSumInt1.u[1:2]) annotation (Line(points={{-228,-156}, + {-216,-156},{-216,-154.25},{-202,-154.25}}, + color={255,127,0})); connect(min.y, yPumSpe) annotation (Line(points={{182,-400},{300,-400}}, color={0,0,127})); annotation (defaultComponentName="secPumCon", diff --git a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/SetPoints/MinimumFlowSetPoint.mo b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/SetPoints/MinimumFlowSetPoint.mo index 4508c64b5d7..3e3d1c94743 100644 --- a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/SetPoints/MinimumFlowSetPoint.mo +++ b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/SetPoints/MinimumFlowSetPoint.mo @@ -175,7 +175,9 @@ protected annotation (Placement(transformation(extent={{60,-60},{80,-40}}))); Buildings.Controls.OBC.CDL.Routing.RealExtractor extIndSig1( - final nin=nSta) + final allowOutOfRange=true, + final nin=nSta, + final outOfRangeValue=1e-6) "Extract flow ratio of previous setpoint during stage-up" annotation (Placement(transformation(extent={{60,70},{80,90}}))); @@ -202,7 +204,9 @@ protected annotation (Placement(transformation(extent={{60,30},{80,50}}))); Buildings.Controls.OBC.CDL.Routing.RealExtractor extIndSig3( - final nin=nBoi) + final allowOutOfRange=true, + final nin=nBoi, + final outOfRangeValue=1e-6) "Extract max flowrate of boiler being disabled during stage-up" annotation (Placement(transformation(extent={{-20,40},{0,60}}))); @@ -244,7 +248,9 @@ protected annotation (Placement(transformation(extent={{-90,-310},{-70,-290}}))); Buildings.Controls.OBC.CDL.Routing.RealExtractor extIndSig4( - final nin=nSta) + final allowOutOfRange=true, + final nin=nSta, + final outOfRangeValue=1e-6) "Extract flow ratio of previous setpoint during stage-down" annotation (Placement(transformation(extent={{60,-280},{80,-260}}))); @@ -253,7 +259,9 @@ protected annotation (Placement(transformation(extent={{100,-260},{120,-240}}))); Buildings.Controls.OBC.CDL.Routing.RealExtractor extIndSig5( - final nin=nBoi) + final allowOutOfRange=true, + final nin=nBoi, + final outOfRangeValue=1e-6) "Extract max flowrate of boiler being disabled during stage-down" annotation (Placement(transformation(extent={{-40,-270},{-20,-250}}))); @@ -361,8 +369,8 @@ equation connect(uStaSet, extIndSig.index) annotation (Line(points={{-160,-90},{70,-90}, {70,-62}}, color={255,127,0})); - connect(matMax.y, extIndSig1.u) annotation (Line(points={{42,-150},{52,-150}, - {52,80},{58,80}}, + connect(matMax.y, extIndSig1.u) annotation (Line(points={{42,-150},{52,-150},{ + 52,80},{58,80}}, color={0,0,127})); connect(conInt.y,subInt. u2) annotation (Line(points={{-98,70},{-72,70},{-72, diff --git a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/SetPoints/Validation/MinimumFlowSetPoint.mo b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/SetPoints/Validation/MinimumFlowSetPoint.mo index b1e81266798..f3966daa1ab 100644 --- a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/SetPoints/Validation/MinimumFlowSetPoint.mo +++ b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/SetPoints/Validation/MinimumFlowSetPoint.mo @@ -54,7 +54,9 @@ protected annotation (Placement(transformation(extent={{-90,90},{-70,110}}))); Buildings.Controls.OBC.CDL.Routing.RealExtractor extIndSig( - final nin=3) + final allowOutOfRange=true, + final nin=3, + final outOfRangeValue=0) "Extract scalar out of vector" annotation (Placement(transformation(extent={{-60,90},{-40,110}}))); @@ -91,7 +93,9 @@ protected annotation (Placement(transformation(extent={{-90,-30},{-70,-10}}))); Buildings.Controls.OBC.CDL.Routing.RealExtractor extIndSig1( - final nin=3) + final allowOutOfRange=true, + final nin=3, + final outOfRangeValue=0) "Extract scalar out of vector" annotation (Placement(transformation(extent={{-60,-30},{-40,-10}}))); @@ -117,7 +121,9 @@ protected annotation (Placement(transformation(extent={{-90,-60},{-70,-40}}))); Buildings.Controls.OBC.CDL.Routing.RealExtractor extIndSig2( - final nin=3) + final allowOutOfRange=true, + final nin=3, + final outOfRangeValue=0) "Extract scalar out of vector" annotation (Placement(transformation(extent={{-60,-60},{-40,-40}}))); From 8b8109d477d1a86c1c516da8039c162acfaba817 Mon Sep 17 00:00:00 2001 From: Devaprasad Date: Mon, 3 Apr 2023 19:57:42 -0700 Subject: [PATCH 04/20] Added new class and modified existing class to fix zero index error on real extractor --- .../SetPoints/Subsequences/Capacities.mo | 88 ++++++++---- .../Validation/ZeroStageIndexCorrection.mo | 84 +++++++++++ .../Subsequences/Validation/package.order | 1 + .../Subsequences/ZeroStageIndexCorrection.mo | 134 ++++++++++++++++++ .../SetPoints/Subsequences/package.order | 1 + .../Validation/ZeroStageIndexCorrection.mos | 8 ++ 6 files changed, 292 insertions(+), 24 deletions(-) create mode 100644 Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/Validation/ZeroStageIndexCorrection.mo create mode 100644 Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/ZeroStageIndexCorrection.mo create mode 100644 Buildings/Resources/Scripts/Dymola/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/Validation/ZeroStageIndexCorrection.mos diff --git a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/Capacities.mo b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/Capacities.mo index 090ff09856b..e93073cb958 100644 --- a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/Capacities.mo +++ b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/Capacities.mo @@ -89,6 +89,26 @@ protected final parameter Real larGai = 10 "Large gain"; + Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Staging.SetPoints.Subsequences.ZeroStageIndexCorrection zerStaIndCor + "Modify real extractor inputs and outputs" + annotation (Placement(transformation(extent={{-120,110},{-100,130}}))); + + Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Staging.SetPoints.Subsequences.ZeroStageIndexCorrection zerStaIndCor1 + "Modify real extractor inputs and outputs" + annotation (Placement(transformation(extent={{-20,40},{0,60}}))); + + Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Staging.SetPoints.Subsequences.ZeroStageIndexCorrection zerStaIndCor2 + "Modify real extractor inputs and outputs" + annotation (Placement(transformation(extent={{-120,-10},{-100,10}}))); + + Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Staging.SetPoints.Subsequences.ZeroStageIndexCorrection zerStaIndCor3 + "Modify real extractor inputs and outputs" + annotation (Placement(transformation(extent={{-40,-60},{-20,-40}}))); + + Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Staging.SetPoints.Subsequences.ZeroStageIndexCorrection zerStaIndCor4 + "Modify real extractor inputs and outputs" + annotation (Placement(transformation(extent={{-40,-100},{-20,-80}}))); + Buildings.Controls.OBC.CDL.Routing.RealExtractor cap( final nin=nSta) "Extracts the design capacity at the current stage" @@ -135,17 +155,9 @@ protected equation connect(swi2.y, yUpDes) annotation (Line(points={{182,60},{220,60}}, color={0,0,127})); - connect(upCap.y, swi2.u3) annotation ( - Line(points={{22,80},{80,80},{80,52},{158,52}}, color={0,0,127})); connect(yMin, yMin) annotation (Line(points={{220,-20},{220,-20}}, color={0,0,127})); - connect(upCapMin.y, swi4.u3) annotation (Line(points={{22,-30},{40,-30},{40,-98}, - {158,-98}}, color={0,0,127})); connect(swi4.y, yUpMin) annotation (Line(points={{182,-90},{220,-90}}, color={0,0,127})); - connect(capMin.y, yMin) annotation (Line(points={{22,-70},{80,-70},{80,-20},{220, - -20}}, color={0,0,127})); - connect(dowCap.y, swi1.u3) annotation (Line(points={{-78,80},{-40,80},{-40,12}, - {98,12}}, color={0,0,127})); connect(uMinCap, upCapMin.u) annotation (Line(points={{-220,-180},{-120,-180}, {-120,-30},{-2,-30}}, color={0,0,127})); connect(uMinCap, capMin.u) annotation (Line(points={{-220,-180},{-120,-180},{-120, @@ -162,30 +174,58 @@ equation {158,60}}, color={255,0,255})); connect(uHig, swi4.u2) annotation (Line(points={{-220,-120},{140,-120},{140,-90}, {158,-90}}, color={255,0,255})); - connect(cap.y, gai.u) annotation (Line(points={{-78,150},{-70,150},{-70,120},{ - -62,120}}, color={0,0,127})); connect(gai.y, swi2.u1) annotation (Line(points={{-38,120},{100,120},{100,68}, {158,68}}, color={0,0,127})); connect(gai.y, swi4.u1) annotation (Line(points={{-38,120},{60,120},{60,-82},{ 158,-82}}, color={0,0,127})); connect(swi1.y, yDowDes) annotation (Line(points={{122,20},{220,20}}, color={0,0,127})); - connect(u, cap.index) annotation (Line(points={{-220,120},{-90,120},{-90,138}}, - color={255,127,0})); - connect(uDown, dowCap.index) annotation (Line(points={{-220,0},{-90,0},{-90,68}}, - color={255,127,0})); - connect(uUp, upCap.index) annotation (Line(points={{-220,60},{10,60},{10,68}}, - color={255,127,0})); - connect(uUp, upCapMin.index) annotation (Line(points={{-220,60},{-60,60},{-60, - -50},{10,-50},{10,-42}}, color={255,127,0})); - connect(cap.y, yDes) annotation (Line(points={{-78,150},{220,150}}, - color={0,0,127})); - connect(capMin.y, swi1.u1) annotation (Line(points={{22,-70},{80,-70},{80,28}, - {98,28}},color={0,0,127})); - connect(u, capMin.index) annotation (Line(points={{-220,120},{-160,120},{-160, - -90},{10,-90},{10,-82}}, color={255,127,0})); connect(yUpMin, yUpMin) annotation (Line(points={{220,-90},{220,-90}}, color={0,0,127})); + connect(u, zerStaIndCor.uInd) annotation (Line(points={{-220,120},{-160,120},{ + -160,124},{-122,124}}, color={255,127,0})); + connect(zerStaIndCor.yIndMod, cap.index) annotation (Line(points={{-98,124},{-90, + 124},{-90,138}}, color={255,127,0})); + connect(cap.y, zerStaIndCor.uCap) annotation (Line(points={{-78,150},{-74,150}, + {-74,172},{-130,172},{-130,116},{-122,116}}, color={0,0,127})); + connect(zerStaIndCor.yCapMod, gai.u) annotation (Line(points={{-98,116},{-70,116}, + {-70,120},{-62,120}}, color={0,0,127})); + connect(zerStaIndCor.yCapMod, yDes) annotation (Line(points={{-98,116},{-70,116}, + {-70,150},{220,150}}, color={0,0,127})); + connect(zerStaIndCor1.yIndMod, upCap.index) + annotation (Line(points={{2,54},{10,54},{10,68}}, color={255,127,0})); + connect(uUp, zerStaIndCor1.uInd) annotation (Line(points={{-220,60},{-60,60},{ + -60,54},{-22,54}}, color={255,127,0})); + connect(upCap.y, zerStaIndCor1.uCap) annotation (Line(points={{22,80},{30,80}, + {30,100},{-30,100},{-30,46},{-22,46}}, color={0,0,127})); + connect(zerStaIndCor1.yCapMod, swi2.u3) annotation (Line(points={{2,46},{20,46}, + {20,52},{158,52}}, color={0,0,127})); + connect(uDown, zerStaIndCor2.uInd) annotation (Line(points={{-220,0},{-128,0}, + {-128,4},{-122,4}}, color={255,127,0})); + connect(zerStaIndCor2.yIndMod, dowCap.index) + annotation (Line(points={{-98,4},{-90,4},{-90,68}}, color={255,127,0})); + connect(dowCap.y, zerStaIndCor2.uCap) annotation (Line(points={{-78,80},{-70,80}, + {-70,100},{-132,100},{-132,-4},{-122,-4}}, color={0,0,127})); + connect(zerStaIndCor2.yCapMod, swi1.u3) annotation (Line(points={{-98,-4},{-80, + -4},{-80,12},{98,12}}, color={0,0,127})); + connect(uUp, zerStaIndCor3.uInd) annotation (Line(points={{-220,60},{-60,60},{ + -60,-46},{-42,-46}}, color={255,127,0})); + connect(zerStaIndCor3.yIndMod, upCapMin.index) annotation (Line(points={{-18,-46}, + {-10,-46},{-10,-50},{10,-50},{10,-42}}, color={255,127,0})); + connect(upCapMin.y, zerStaIndCor3.uCap) annotation (Line(points={{22,-30},{30, + -30},{30,-10},{-50,-10},{-50,-54},{-42,-54}}, color={0,0,127})); + connect(zerStaIndCor3.yCapMod, swi4.u3) annotation (Line(points={{-18,-54},{40, + -54},{40,-98},{158,-98}}, color={0,0,127})); + connect(u, zerStaIndCor4.uInd) annotation (Line(points={{-220,120},{-160,120}, + {-160,-86},{-42,-86}}, color={255,127,0})); + connect(zerStaIndCor4.yIndMod, capMin.index) + annotation (Line(points={{-18,-86},{10,-86},{10,-82}}, color={255,127,0})); + connect(zerStaIndCor4.yCapMod, swi1.u1) annotation (Line(points={{-18,-94},{70, + -94},{70,28},{98,28}}, color={0,0,127})); + connect(zerStaIndCor4.yCapMod, yMin) annotation (Line(points={{-18,-94},{70,-94}, + {70,-20},{220,-20}}, color={0,0,127})); + connect(capMin.y, zerStaIndCor4.uCap) annotation (Line(points={{22,-70},{30,-70}, + {30,-110},{-50,-110},{-50,-94},{-42,-94}}, color={0,0,127})); annotation (defaultComponentName = "cap", Icon(graphics={ Rectangle( diff --git a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/Validation/ZeroStageIndexCorrection.mo b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/Validation/ZeroStageIndexCorrection.mo new file mode 100644 index 00000000000..b1c0684a949 --- /dev/null +++ b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/Validation/ZeroStageIndexCorrection.mo @@ -0,0 +1,84 @@ +within Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Staging.SetPoints.Subsequences.Validation; +model ZeroStageIndexCorrection + "Validation model for zero stage index correction block" + + Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Staging.SetPoints.Subsequences.ZeroStageIndexCorrection + zerStaIndCor + "Validation instance with zero index signal" + annotation (Placement(transformation(extent={{-40,-10},{-20,10}}))); + + Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Staging.SetPoints.Subsequences.ZeroStageIndexCorrection + zerStaIndCor1 + "Validation instance with index signal one" + annotation (Placement(transformation(extent={{60,-10},{80,10}}))); + +protected + Buildings.Controls.OBC.CDL.Continuous.Sources.Constant conCap( + final k=10) + "Constant capacity value" + annotation (Placement(transformation(extent={{-80,-50},{-60,-30}}))); + + Buildings.Controls.OBC.CDL.Integers.Sources.Constant conIntZer( + final k=0) + "Zero integer signal" + annotation (Placement(transformation(extent={{-80,30},{-60,50}}))); + + Buildings.Controls.OBC.CDL.Integers.Sources.Constant conIntOne( + final k=1) + "Constant integer one signal" + annotation (Placement(transformation(extent={{20,30},{40,50}}))); + +equation + + connect(conCap.y, zerStaIndCor.uCap) annotation (Line(points={{-58,-40},{-50,-40}, + {-50,-4},{-42,-4}}, color={0,0,127})); + connect(conCap.y, zerStaIndCor1.uCap) annotation (Line(points={{-58,-40},{50,-40}, + {50,-4},{58,-4}}, color={0,0,127})); + connect(conIntZer.y, zerStaIndCor.uInd) annotation (Line(points={{-58,40},{-50, + 40},{-50,4},{-42,4}}, color={255,127,0})); + connect(conIntOne.y, zerStaIndCor1.uInd) annotation (Line(points={{42,40},{50, + 40},{50,4},{58,4}}, color={255,127,0})); +annotation ( + __Dymola_Commands(file="modelica://Buildings/Resources/Scripts/Dymola/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/Validation/Up.mos" + "Simulate and plot"), + Documentation(info=" +

+ This example validates + + Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Staging.SetPoints.Subsequences.ZeroStageIndexCorrection. +

+

+ It contains two instances: +

    +
  • + zerStaIndCor: Gets a zero index input signal. +
  • +
  • + zerStaIndCor1: Gets a non-zero index input signal. +
  • +
+ The model simulates and plots these two instances to demonstrate that the block + is performing the modifications correctly. +

+ ", revisions=" +
    +
  • + April 3, 2023, by Karthik Devaprasad:
    + First implementation. +
  • +
+ "), + Icon(coordinateSystem(extent={{-100,-100},{100,100}}), + graphics={ + Ellipse(lineColor = {75,138,73}, + fillColor={255,255,255}, + fillPattern = FillPattern.Solid, + extent = {{-100,-100},{100,100}}), + Polygon(lineColor = {0,0,255}, + fillColor = {75,138,73}, + pattern = LinePattern.None, + fillPattern = FillPattern.Solid, + points = {{-36,60},{64,0},{-36,-60},{-36,60}})}), + Diagram(coordinateSystem(preserveAspectRatio=false, + extent={{-100,-100},{100,100}}))); +end ZeroStageIndexCorrection; diff --git a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/Validation/package.order b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/Validation/package.order index 369181c67db..da53e4f6340 100644 --- a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/Validation/package.order +++ b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/Validation/package.order @@ -8,3 +8,4 @@ EfficiencyCondition FailsafeCondition Status Up +ZeroStageIndexCorrection diff --git a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/ZeroStageIndexCorrection.mo b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/ZeroStageIndexCorrection.mo new file mode 100644 index 00000000000..0a98d501895 --- /dev/null +++ b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/ZeroStageIndexCorrection.mo @@ -0,0 +1,134 @@ +within Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Staging.SetPoints.Subsequences; +block ZeroStageIndexCorrection + "Block to pass the correct capacity details when index signal is zero, while avoiding assert errors" + + Buildings.Controls.OBC.CDL.Interfaces.IntegerInput uInd + "Index signal" + annotation (Placement(transformation(extent={{-140,20},{-100,60}}), + iconTransformation(extent={{-140,20},{-100,60}}))); + + Buildings.Controls.OBC.CDL.Interfaces.RealInput uCap( + final unit="W", + displayUnit="W", + final quantity="Power") + "Capacity signal" + annotation (Placement(transformation(extent={{-140,-60},{-100,-20}}), + iconTransformation(extent={{-140,-60},{-100,-20}}))); + + Buildings.Controls.OBC.CDL.Interfaces.IntegerOutput yIndMod + "Modified index value to avoid assert errors" + annotation (Placement(transformation(extent={{100,20},{140,60}}), + iconTransformation(extent={{100,20},{140,60}}))); + + Buildings.Controls.OBC.CDL.Interfaces.RealOutput yCapMod( + final unit="W", + displayUnit="W", + final quantity="Power") + "Modified capacity value" + annotation (Placement(transformation(extent={{100,-60},{140,-20}}), + iconTransformation(extent={{100,-60},{140,-20}}))); + +protected + Buildings.Controls.OBC.CDL.Integers.Equal intEqu + "Check if the index signal is zero" + annotation (Placement(transformation(extent={{-40,30},{-20,50}}))); + + Buildings.Controls.OBC.CDL.Integers.Sources.Constant conIntZer( + final k=0) + "Constant zero integer signal" + annotation (Placement(transformation(extent={{-80,0},{-60,20}}))); + + Buildings.Controls.OBC.CDL.Conversions.BooleanToReal booToRea( + final realTrue=0, + final realFalse=1) + "Pass a zero multiplication signal to the capacity modfier" + annotation (Placement(transformation(extent={{0,10},{20,30}}))); + + Buildings.Controls.OBC.CDL.Integers.Add addInt + "Add one to the index value when it is zero" + annotation (Placement(transformation(extent={{40,70},{60,90}}))); + + Buildings.Controls.OBC.CDL.Conversions.BooleanToInteger booToInt1 + "Pass an integer one signal to the index modifier" + annotation (Placement(transformation(extent={{0,50},{20,70}}))); + + Buildings.Controls.OBC.CDL.Continuous.Multiply mul + "Multiply the capacity value by zero when the index signal is zero" + annotation (Placement(transformation(extent={{40,-50},{60,-30}}))); + +equation + connect(uInd, intEqu.u1) + annotation (Line(points={{-120,40},{-42,40}}, color={255,127,0})); + connect(conIntZer.y, intEqu.u2) annotation (Line(points={{-58,10},{-50,10},{-50, + 32},{-42,32}}, color={255,127,0})); + connect(intEqu.y, booToRea.u) annotation (Line(points={{-18,40},{-10,40},{-10, + 20},{-2,20}}, color={255,0,255})); + connect(uInd, addInt.u1) annotation (Line(points={{-120,40},{-80,40},{-80,86}, + {38,86}}, color={255,127,0})); + connect(intEqu.y, booToInt1.u) annotation (Line(points={{-18,40},{-10,40},{-10, + 60},{-2,60}}, color={255,0,255})); + connect(booToInt1.y, addInt.u2) annotation (Line(points={{22,60},{30,60},{30,74}, + {38,74}}, color={255,127,0})); + connect(addInt.y, yIndMod) annotation (Line(points={{62,80},{80,80},{80,40},{120, + 40}}, color={255,127,0})); + connect(mul.y, yCapMod) + annotation (Line(points={{62,-40},{120,-40}}, color={0,0,127})); + connect(booToRea.y, mul.u1) annotation (Line(points={{22,20},{30,20},{30,-34}, + {38,-34}}, color={0,0,127})); + connect(uCap, mul.u2) annotation (Line(points={{-120,-40},{30,-40},{30,-46},{38, + -46}}, color={0,0,127})); + annotation (defaultComponentName="zerStaIndCor", + Icon(coordinateSystem(preserveAspectRatio=false), + graphics={ + Rectangle( + extent={{-100,100},{100,-100}}, + lineColor={0,0,0}, + fillColor={255,255,255}, + fillPattern=FillPattern.Solid), + Text( + extent={{-110,140},{110,100}}, + textColor={0,0,255}, + textString="%name")}), + Diagram(coordinateSystem(preserveAspectRatio=false)), + Documentation(info=" +

+ This block has been iomplemented to overcome the zero-index errors being + reported in the block + + Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Staging.SetPoints.Subsequences.Capacities. + The current staging setpoint logic uses an index value of 0 to represent the + block being turned off. This is resulting in errors reported in the instances + of the + + RealExtractor block. +

+

+ To overcome, this the block accepts input signals uInd for the + current index value, and uCap for the current capacity signal. + It outputs a modified index signal yIndMod and a modified + capacity signal yCapMod. +

    +
  • + yIndMod is set to 1 and yCapMod is set to zero + when uInd is zero. +
  • +
  • + yIndMod is set to uInd and yCapMod is + set to uCap when uInd is not zero. +
  • +
+

+

+ For an example of usage, check the + + Capacities block. +

+ ", revisions=" +
    +
  • + April 3, 2023, by Karthik Devaprasad:
    + First implementation. +
  • +
+ ")); +end ZeroStageIndexCorrection; diff --git a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/package.order b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/package.order index d1db2c14227..6b048a66b4e 100644 --- a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/package.order +++ b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/package.order @@ -9,3 +9,4 @@ FailsafeCondition Status Up Validation +ZeroStageIndexCorrection diff --git a/Buildings/Resources/Scripts/Dymola/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/Validation/ZeroStageIndexCorrection.mos b/Buildings/Resources/Scripts/Dymola/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/Validation/ZeroStageIndexCorrection.mos new file mode 100644 index 00000000000..d19f5bf7472 --- /dev/null +++ b/Buildings/Resources/Scripts/Dymola/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/Validation/ZeroStageIndexCorrection.mos @@ -0,0 +1,8 @@ +simulateModel("Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Staging.SetPoints.Subsequences.Validation.ZeroStageIndexCorrection", method="cvode", stopTime=10, tolerance=1e-06, resultFile="ZeroStageIndexCorrection"); + +createPlot(id=1, position={95, 95, 534, 336}, y={"zerStaIndCor.uInd"}, range={0.0, 10.0, -1.5, 1.5}, grid=true, colors={{28,108,200}}); +createPlot(id=1, position={95, 95, 534, 108}, y={"zerStaIndCor.yIndMod"}, range={0.0, 10.0, 0.8500000000000001, 1.1500000000000001}, grid=true, subPlot=2, colors={{28,108,200}}); +createPlot(id=1, position={95, 95, 534, 109}, y={"zerStaIndCor.yCapMod"}, range={0.0, 10.0, -1.5, 1.5}, grid=true, subPlot=3, colors={{28,108,200}}); +createPlot(id=2, position={0, 0, 971, 830}, y={"zerStaIndCor1.uInd"}, range={0.0, 10.0, 0.8500000000000001, 1.1500000000000001}, grid=true, colors={{28,108,200}}); +createPlot(id=2, position={0, 0, 971, 274}, y={"zerStaIndCor1.yIndMod"}, range={0.0, 10.0, 0.8500000000000001, 1.1500000000000001}, grid=true, subPlot=2, colors={{28,108,200}}); +createPlot(id=2, position={0, 0, 971, 273}, y={"zerStaIndCor1.yCapMod"}, range={0.0, 10.0, 8.5, 11.5}, grid=true, subPlot=3, colors={{28,108,200}}); From b889ffcc0f2d48b89761b0e419ac61b4a8dd97ae Mon Sep 17 00:00:00 2001 From: root Date: Tue, 4 Apr 2023 03:20:17 +0000 Subject: [PATCH 05/20] Updated class name for zero index correction --- .../Staging/SetPoints/Subsequences/Capacities.mo | 10 +++++----- ...tageIndexCorrection.mo => ZeroIndexCorrection.mo} | 12 ++++++------ .../SetPoints/Subsequences/Validation/package.order | 2 +- ...tageIndexCorrection.mo => ZeroIndexCorrection.mo} | 4 ++-- .../Staging/SetPoints/Subsequences/package.order | 2 +- Buildings/Controls/OBC/ASHRAE/package.order | 2 +- ...geIndexCorrection.mos => ZeroIndexCorrection.mos} | 2 +- 7 files changed, 17 insertions(+), 17 deletions(-) rename Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/Validation/{ZeroStageIndexCorrection.mo => ZeroIndexCorrection.mo} (91%) rename Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/{ZeroStageIndexCorrection.mo => ZeroIndexCorrection.mo} (98%) rename Buildings/Resources/Scripts/Dymola/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/Validation/{ZeroStageIndexCorrection.mos => ZeroIndexCorrection.mos} (86%) diff --git a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/Capacities.mo b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/Capacities.mo index e93073cb958..cb71cb28ccf 100644 --- a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/Capacities.mo +++ b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/Capacities.mo @@ -89,23 +89,23 @@ protected final parameter Real larGai = 10 "Large gain"; - Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Staging.SetPoints.Subsequences.ZeroStageIndexCorrection zerStaIndCor + Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Staging.SetPoints.Subsequences.ZeroIndexCorrection zerStaIndCor "Modify real extractor inputs and outputs" annotation (Placement(transformation(extent={{-120,110},{-100,130}}))); - Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Staging.SetPoints.Subsequences.ZeroStageIndexCorrection zerStaIndCor1 + Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Staging.SetPoints.Subsequences.ZeroIndexCorrection zerStaIndCor1 "Modify real extractor inputs and outputs" annotation (Placement(transformation(extent={{-20,40},{0,60}}))); - Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Staging.SetPoints.Subsequences.ZeroStageIndexCorrection zerStaIndCor2 + Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Staging.SetPoints.Subsequences.ZeroIndexCorrection zerStaIndCor2 "Modify real extractor inputs and outputs" annotation (Placement(transformation(extent={{-120,-10},{-100,10}}))); - Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Staging.SetPoints.Subsequences.ZeroStageIndexCorrection zerStaIndCor3 + Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Staging.SetPoints.Subsequences.ZeroIndexCorrection zerStaIndCor3 "Modify real extractor inputs and outputs" annotation (Placement(transformation(extent={{-40,-60},{-20,-40}}))); - Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Staging.SetPoints.Subsequences.ZeroStageIndexCorrection zerStaIndCor4 + Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Staging.SetPoints.Subsequences.ZeroIndexCorrection zerStaIndCor4 "Modify real extractor inputs and outputs" annotation (Placement(transformation(extent={{-40,-100},{-20,-80}}))); diff --git a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/Validation/ZeroStageIndexCorrection.mo b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/Validation/ZeroIndexCorrection.mo similarity index 91% rename from Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/Validation/ZeroStageIndexCorrection.mo rename to Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/Validation/ZeroIndexCorrection.mo index b1c0684a949..1a95dea8648 100644 --- a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/Validation/ZeroStageIndexCorrection.mo +++ b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/Validation/ZeroIndexCorrection.mo @@ -1,13 +1,13 @@ within Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Staging.SetPoints.Subsequences.Validation; -model ZeroStageIndexCorrection +model ZeroIndexCorrection "Validation model for zero stage index correction block" - Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Staging.SetPoints.Subsequences.ZeroStageIndexCorrection + Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Staging.SetPoints.Subsequences.ZeroIndexCorrection zerStaIndCor "Validation instance with zero index signal" annotation (Placement(transformation(extent={{-40,-10},{-20,10}}))); - Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Staging.SetPoints.Subsequences.ZeroStageIndexCorrection + Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Staging.SetPoints.Subsequences.ZeroIndexCorrection zerStaIndCor1 "Validation instance with index signal one" annotation (Placement(transformation(extent={{60,-10},{80,10}}))); @@ -44,8 +44,8 @@ annotation ( Documentation(info="

This example validates - - Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Staging.SetPoints.Subsequences.ZeroStageIndexCorrection. + + Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Staging.SetPoints.Subsequences.ZeroIndexCorrection.

It contains two instances: @@ -81,4 +81,4 @@ annotation ( points = {{-36,60},{64,0},{-36,-60},{-36,60}})}), Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},{100,100}}))); -end ZeroStageIndexCorrection; +end ZeroIndexCorrection; diff --git a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/Validation/package.order b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/Validation/package.order index da53e4f6340..c8f1ed9e93e 100644 --- a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/Validation/package.order +++ b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/Validation/package.order @@ -8,4 +8,4 @@ EfficiencyCondition FailsafeCondition Status Up -ZeroStageIndexCorrection +ZeroIndexCorrection diff --git a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/ZeroStageIndexCorrection.mo b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/ZeroIndexCorrection.mo similarity index 98% rename from Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/ZeroStageIndexCorrection.mo rename to Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/ZeroIndexCorrection.mo index 0a98d501895..3cc6a4af5cd 100644 --- a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/ZeroStageIndexCorrection.mo +++ b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/ZeroIndexCorrection.mo @@ -1,5 +1,5 @@ within Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Staging.SetPoints.Subsequences; -block ZeroStageIndexCorrection +block ZeroIndexCorrection "Block to pass the correct capacity details when index signal is zero, while avoiding assert errors" Buildings.Controls.OBC.CDL.Interfaces.IntegerInput uInd @@ -131,4 +131,4 @@ equation ")); -end ZeroStageIndexCorrection; +end ZeroIndexCorrection; diff --git a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/package.order b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/package.order index 6b048a66b4e..825e9992adc 100644 --- a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/package.order +++ b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/package.order @@ -8,5 +8,5 @@ EfficiencyCondition FailsafeCondition Status Up +ZeroIndexCorrection Validation -ZeroStageIndexCorrection diff --git a/Buildings/Controls/OBC/ASHRAE/package.order b/Buildings/Controls/OBC/ASHRAE/package.order index a20c96ab04e..4d8c195216a 100644 --- a/Buildings/Controls/OBC/ASHRAE/package.order +++ b/Buildings/Controls/OBC/ASHRAE/package.order @@ -1,2 +1,2 @@ G36 -PrimarySystem \ No newline at end of file +PrimarySystem diff --git a/Buildings/Resources/Scripts/Dymola/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/Validation/ZeroStageIndexCorrection.mos b/Buildings/Resources/Scripts/Dymola/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/Validation/ZeroIndexCorrection.mos similarity index 86% rename from Buildings/Resources/Scripts/Dymola/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/Validation/ZeroStageIndexCorrection.mos rename to Buildings/Resources/Scripts/Dymola/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/Validation/ZeroIndexCorrection.mos index d19f5bf7472..08be92554cd 100644 --- a/Buildings/Resources/Scripts/Dymola/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/Validation/ZeroStageIndexCorrection.mos +++ b/Buildings/Resources/Scripts/Dymola/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/Validation/ZeroIndexCorrection.mos @@ -1,4 +1,4 @@ -simulateModel("Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Staging.SetPoints.Subsequences.Validation.ZeroStageIndexCorrection", method="cvode", stopTime=10, tolerance=1e-06, resultFile="ZeroStageIndexCorrection"); +simulateModel("Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Staging.SetPoints.Subsequences.Validation.ZeroIndexCorrection", method="cvode", stopTime=10, tolerance=1e-06, resultFile="ZeroIndexCorrection"); createPlot(id=1, position={95, 95, 534, 336}, y={"zerStaIndCor.uInd"}, range={0.0, 10.0, -1.5, 1.5}, grid=true, colors={{28,108,200}}); createPlot(id=1, position={95, 95, 534, 108}, y={"zerStaIndCor.yIndMod"}, range={0.0, 10.0, 0.8500000000000001, 1.1500000000000001}, grid=true, subPlot=2, colors={{28,108,200}}); From a936cfdad7a2063e8eb5d426172835be0c53fa6a Mon Sep 17 00:00:00 2001 From: root Date: Tue, 4 Apr 2023 03:32:13 +0000 Subject: [PATCH 06/20] Moved zero index correction to the generic package --- .../Validation/ZeroIndexCorrection.mo | 10 +++++----- .../BoilerPlant/Generic/Validation/package.order | 1 + .../Subsequences => Generic}/ZeroIndexCorrection.mo | 2 +- .../PrimarySystem/BoilerPlant/Generic/package.order | 1 + .../Staging/SetPoints/Subsequences/Capacities.mo | 10 +++++----- .../SetPoints/Subsequences/Validation/package.order | 1 - .../Staging/SetPoints/Subsequences/package.order | 1 - .../Validation/ZeroIndexCorrection.mos | 2 +- 8 files changed, 14 insertions(+), 14 deletions(-) rename Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/{Staging/SetPoints/Subsequences => Generic}/Validation/ZeroIndexCorrection.mo (85%) rename Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/{Staging/SetPoints/Subsequences => Generic}/ZeroIndexCorrection.mo (98%) rename Buildings/Resources/Scripts/Dymola/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/{Staging/SetPoints/Subsequences => Generic}/Validation/ZeroIndexCorrection.mos (87%) diff --git a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/Validation/ZeroIndexCorrection.mo b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Generic/Validation/ZeroIndexCorrection.mo similarity index 85% rename from Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/Validation/ZeroIndexCorrection.mo rename to Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Generic/Validation/ZeroIndexCorrection.mo index 1a95dea8648..fa06e87d28c 100644 --- a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/Validation/ZeroIndexCorrection.mo +++ b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Generic/Validation/ZeroIndexCorrection.mo @@ -1,13 +1,13 @@ -within Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Staging.SetPoints.Subsequences.Validation; +within Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Generic.Validation; model ZeroIndexCorrection "Validation model for zero stage index correction block" - Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Staging.SetPoints.Subsequences.ZeroIndexCorrection + Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Generic.ZeroIndexCorrection zerStaIndCor "Validation instance with zero index signal" annotation (Placement(transformation(extent={{-40,-10},{-20,10}}))); - Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Staging.SetPoints.Subsequences.ZeroIndexCorrection + Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Generic.ZeroIndexCorrection zerStaIndCor1 "Validation instance with index signal one" annotation (Placement(transformation(extent={{60,-10},{80,10}}))); @@ -44,8 +44,8 @@ annotation ( Documentation(info="

This example validates - - Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Staging.SetPoints.Subsequences.ZeroIndexCorrection. + + Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Generic.ZeroIndexCorrection.

It contains two instances: diff --git a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Generic/Validation/package.order b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Generic/Validation/package.order index cbfd9cb3843..0c367abad16 100644 --- a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Generic/Validation/package.order +++ b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Generic/Validation/package.order @@ -1,3 +1,4 @@ PlantDisable PlantEnable RotationController +ZeroIndexCorrection diff --git a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/ZeroIndexCorrection.mo b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Generic/ZeroIndexCorrection.mo similarity index 98% rename from Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/ZeroIndexCorrection.mo rename to Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Generic/ZeroIndexCorrection.mo index 3cc6a4af5cd..ae079343d57 100644 --- a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/ZeroIndexCorrection.mo +++ b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Generic/ZeroIndexCorrection.mo @@ -1,4 +1,4 @@ -within Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Staging.SetPoints.Subsequences; +within Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Generic; block ZeroIndexCorrection "Block to pass the correct capacity details when index signal is zero, while avoiding assert errors" diff --git a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Generic/package.order b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Generic/package.order index a2175baf07d..1593843a624 100644 --- a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Generic/package.order +++ b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Generic/package.order @@ -1,6 +1,7 @@ PlantDisable PlantEnable RotationController +ZeroIndexCorrection EquipmentRotation Subsequences Validation diff --git a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/Capacities.mo b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/Capacities.mo index cb71cb28ccf..b62d96dadd4 100644 --- a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/Capacities.mo +++ b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/Capacities.mo @@ -89,23 +89,23 @@ protected final parameter Real larGai = 10 "Large gain"; - Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Staging.SetPoints.Subsequences.ZeroIndexCorrection zerStaIndCor + Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Generic.ZeroIndexCorrection zerStaIndCor "Modify real extractor inputs and outputs" annotation (Placement(transformation(extent={{-120,110},{-100,130}}))); - Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Staging.SetPoints.Subsequences.ZeroIndexCorrection zerStaIndCor1 + Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Generic.ZeroIndexCorrection zerStaIndCor1 "Modify real extractor inputs and outputs" annotation (Placement(transformation(extent={{-20,40},{0,60}}))); - Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Staging.SetPoints.Subsequences.ZeroIndexCorrection zerStaIndCor2 + Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Generic.ZeroIndexCorrection zerStaIndCor2 "Modify real extractor inputs and outputs" annotation (Placement(transformation(extent={{-120,-10},{-100,10}}))); - Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Staging.SetPoints.Subsequences.ZeroIndexCorrection zerStaIndCor3 + Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Generic.ZeroIndexCorrection zerStaIndCor3 "Modify real extractor inputs and outputs" annotation (Placement(transformation(extent={{-40,-60},{-20,-40}}))); - Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Staging.SetPoints.Subsequences.ZeroIndexCorrection zerStaIndCor4 + Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Generic.ZeroIndexCorrection zerStaIndCor4 "Modify real extractor inputs and outputs" annotation (Placement(transformation(extent={{-40,-100},{-20,-80}}))); diff --git a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/Validation/package.order b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/Validation/package.order index c8f1ed9e93e..369181c67db 100644 --- a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/Validation/package.order +++ b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/Validation/package.order @@ -8,4 +8,3 @@ EfficiencyCondition FailsafeCondition Status Up -ZeroIndexCorrection diff --git a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/package.order b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/package.order index 825e9992adc..d1db2c14227 100644 --- a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/package.order +++ b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/package.order @@ -8,5 +8,4 @@ EfficiencyCondition FailsafeCondition Status Up -ZeroIndexCorrection Validation diff --git a/Buildings/Resources/Scripts/Dymola/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/Validation/ZeroIndexCorrection.mos b/Buildings/Resources/Scripts/Dymola/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Generic/Validation/ZeroIndexCorrection.mos similarity index 87% rename from Buildings/Resources/Scripts/Dymola/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/Validation/ZeroIndexCorrection.mos rename to Buildings/Resources/Scripts/Dymola/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Generic/Validation/ZeroIndexCorrection.mos index 08be92554cd..b91d361fb33 100644 --- a/Buildings/Resources/Scripts/Dymola/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/Validation/ZeroIndexCorrection.mos +++ b/Buildings/Resources/Scripts/Dymola/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Generic/Validation/ZeroIndexCorrection.mos @@ -1,4 +1,4 @@ -simulateModel("Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Staging.SetPoints.Subsequences.Validation.ZeroIndexCorrection", method="cvode", stopTime=10, tolerance=1e-06, resultFile="ZeroIndexCorrection"); +simulateModel("Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Generic.Validation.ZeroIndexCorrection", method="cvode", stopTime=10, tolerance=1e-06, resultFile="ZeroIndexCorrection"); createPlot(id=1, position={95, 95, 534, 336}, y={"zerStaIndCor.uInd"}, range={0.0, 10.0, -1.5, 1.5}, grid=true, colors={{28,108,200}}); createPlot(id=1, position={95, 95, 534, 108}, y={"zerStaIndCor.yIndMod"}, range={0.0, 10.0, 0.8500000000000001, 1.1500000000000001}, grid=true, subPlot=2, colors={{28,108,200}}); From b91833cf8e7ce9415652416aae4c5dd2b3088e98 Mon Sep 17 00:00:00 2001 From: Devaprasad Date: Mon, 3 Apr 2023 22:11:01 -0700 Subject: [PATCH 07/20] Updated models to resolve errors logged during unit test --- .../Pumps/SecondaryPumps/Controller.mo | 54 +++++---- .../SetPoints/MinimumFlowSetPoint.mo | 99 ++++++++++------- .../Validation/MinimumFlowSetPoint.mo | 104 ++++++++++-------- .../Staging/SetPoints/Subsequences/Down.mo | 72 +++++++----- .../Subsequences/EfficiencyCondition.mo | 23 +++- 5 files changed, 213 insertions(+), 139 deletions(-) diff --git a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Pumps/SecondaryPumps/Controller.mo b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Pumps/SecondaryPumps/Controller.mo index 5261b8728dc..b1940abba29 100644 --- a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Pumps/SecondaryPumps/Controller.mo +++ b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Pumps/SecondaryPumps/Controller.mo @@ -337,6 +337,16 @@ protected parameter Integer pumInd[nPum]={i for i in 1:nPum} "Pump index, {1,2,...,n}"; + Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Generic.ZeroIndexCorrection + zerStaIndCor + "Block to resolve zero index errors" + annotation (Placement(transformation(extent={{-102,-84},{-82,-64}}))); + + Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Generic.ZeroIndexCorrection + zerStaIndCor1 + "Block to resolve zero index errors" + annotation (Placement(transformation(extent={{-114,-134},{-94,-114}}))); + Buildings.Controls.OBC.CDL.Discrete.UnitDelay uniDel( final samplePeriod=1) if have_varSecPum and not have_secFloSen "Unit delay for pump speed" @@ -382,9 +392,7 @@ protected annotation (Placement(transformation(extent={{-40,220},{-20,240}}))); Buildings.Controls.OBC.CDL.Routing.RealExtractor nexLagPum( - final allowOutOfRange=true, - final nin=nPum, - final outOfRangeValue=0) + final nin=nPum) "Next lag pump" annotation (Placement(transformation(extent={{-80,-60},{-60,-40}}))); @@ -393,9 +401,7 @@ protected annotation (Placement(transformation(extent={{-8,-60},{12,-40}}))); Buildings.Controls.OBC.CDL.Routing.RealExtractor lasLagPum( - final allowOutOfRange=true, - final nin=nPum, - final outOfRangeValue=0) + final nin=nPum) "Last lag pump" annotation (Placement(transformation(extent={{-80,-110},{-60,-90}}))); @@ -414,7 +420,7 @@ protected Buildings.Controls.OBC.CDL.Integers.Add addInt "Integer add" - annotation (Placement(transformation(extent={{-120,-80},{-100,-60}}))); + annotation (Placement(transformation(extent={{-132,-80},{-112,-60}}))); Buildings.Controls.OBC.CDL.Conversions.BooleanToInteger booToInt1[nPumPri] if not have_varSecPum "Convert boolean to integer" @@ -562,20 +568,14 @@ equation connect(booToInt.y, mulSumInt.u) annotation (Line(points={{-228,-120},{-202,-120}}, color={255,127,0})); - connect(addInt.y, nexLagPum.index) - annotation (Line(points={{-98,-70},{-70,-70},{-70,-62}}, color={255,127,0})); - connect(mulSumInt.y, addInt.u2) - annotation (Line(points={{-178,-120},{-128,-120},{-128,-76},{-122,-76}}, + annotation (Line(points={{-178,-120},{-166,-120},{-166,-76},{-134,-76}}, color={255,127,0})); connect(conInt.y, addInt.u1) - annotation (Line(points={{-252,200},{-140,200},{-140,-64},{-122,-64}}, + annotation (Line(points={{-252,200},{-140,200},{-140,-64},{-134,-64}}, color={255,127,0})); - connect(mulSumInt.y, lasLagPum.index) - annotation (Line(points={{-178,-120},{-70,-120},{-70,-112}}, color={255,127,0})); - connect(reaToInt.y, chaPumSta1.uNexLagPum) annotation (Line(points={{-18,230}, {46,230},{46,74},{56,74}}, color={255,127,0})); @@ -663,12 +663,6 @@ equation connect(or2.y, chaPumSta3.uLasLagPumSta) annotation (Line(points={{56,-218},{58, -218},{58,-167},{60,-167}}, color={255,0,255})); - connect(nexLagPum.y, reaToInt1.u) - annotation (Line(points={{-58,-50},{-10,-50}}, color={0,0,127})); - - connect(lasLagPum.y, reaToInt2.u) - annotation (Line(points={{-58,-100},{-10,-100}}, color={0,0,127})); - connect(mulSumInt.y, intLesEquThr.u) annotation (Line(points={{-178,-120},{-166, -120},{-166,-218},{-160,-218}}, color={255,127,0})); @@ -736,9 +730,25 @@ equation connect(logSwi.y, pumSpeRemDp.uHotWatPum) annotation (Line(points={{214,0},{274, 0},{274,-264},{-74,-264},{-74,-362},{-62,-362}}, color={255,0,255})); connect(booToInt1.y, mulSumInt1.u[1:2]) annotation (Line(points={{-228,-156},{ - -216,-156},{-216,-159.5},{-202,-159.5}}, color={255,127,0})); + -216,-156},{-216,-156},{-202,-156}}, color={255,127,0})); connect(min.y, yPumSpe) annotation (Line(points={{182,-400},{300,-400}}, color={0,0,127})); + connect(addInt.y, zerStaIndCor.uInd) + annotation (Line(points={{-110,-70},{-104,-70}}, color={255,127,0})); + connect(zerStaIndCor.yIndMod, nexLagPum.index) annotation (Line(points={{-80,-70}, + {-70,-70},{-70,-62}}, color={255,127,0})); + connect(zerStaIndCor.yCapMod, reaToInt1.u) annotation (Line(points={{-80,-78}, + {-46,-78},{-46,-50},{-10,-50}}, color={0,0,127})); + connect(nexLagPum.y, zerStaIndCor.uCap) annotation (Line(points={{-58,-50},{-52, + -50},{-52,-32},{-108,-32},{-108,-78},{-104,-78}}, color={0,0,127})); + connect(mulSumInt.y, zerStaIndCor1.uInd) + annotation (Line(points={{-178,-120},{-116,-120}}, color={255,127,0})); + connect(zerStaIndCor1.yIndMod, lasLagPum.index) annotation (Line(points={{-92, + -120},{-70,-120},{-70,-112}}, color={255,127,0})); + connect(zerStaIndCor1.yCapMod, reaToInt2.u) annotation (Line(points={{-92,-128}, + {-44,-128},{-44,-100},{-10,-100}}, color={0,0,127})); + connect(lasLagPum.y, zerStaIndCor1.uCap) annotation (Line(points={{-58,-100},{ + -50,-100},{-50,-86},{-122,-86},{-122,-128},{-116,-128}}, color={0,0,127})); annotation (defaultComponentName="secPumCon", Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-280,-440},{280,260}}), diff --git a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/SetPoints/MinimumFlowSetPoint.mo b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/SetPoints/MinimumFlowSetPoint.mo index 3e3d1c94743..1f48b7b1bca 100644 --- a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/SetPoints/MinimumFlowSetPoint.mo +++ b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/SetPoints/MinimumFlowSetPoint.mo @@ -76,6 +76,22 @@ protected "Boiler maximum design flowrate expanded for element-wise multiplication with the staging matrix"; + Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Generic.ZeroIndexCorrection zerStaIndCor + "Block to resolve errors caused by zero index" + annotation (Placement(transformation(extent={{-80,20},{-60,40}}))); + + Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Generic.ZeroIndexCorrection zerStaIndCor1 + "Block to resolve errors caused by zero index" + annotation (Placement(transformation(extent={{-110,-288},{-90,-268}}))); + + Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Generic.ZeroIndexCorrection zerStaIndCor2 + "Block to resolve errors caused by zero index" + annotation (Placement(transformation(extent={{-40,-310},{-20,-290}}))); + + Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Generic.ZeroIndexCorrection zerStaIndCor3 + "Block to resolve errors caused by zero index" + annotation (Placement(transformation(extent={{-8,70},{12,90}}))); + Buildings.Controls.OBC.CDL.Continuous.IntegratorWithReset intWitRes "Used to break algebraic loop and sample the minimum flow setpoint at the start of stage change process to use as reference for calculations" @@ -175,9 +191,7 @@ protected annotation (Placement(transformation(extent={{60,-60},{80,-40}}))); Buildings.Controls.OBC.CDL.Routing.RealExtractor extIndSig1( - final allowOutOfRange=true, - final nin=nSta, - final outOfRangeValue=1e-6) + final nin=nSta) "Extract flow ratio of previous setpoint during stage-up" annotation (Placement(transformation(extent={{60,70},{80,90}}))); @@ -204,11 +218,9 @@ protected annotation (Placement(transformation(extent={{60,30},{80,50}}))); Buildings.Controls.OBC.CDL.Routing.RealExtractor extIndSig3( - final allowOutOfRange=true, - final nin=nBoi, - final outOfRangeValue=1e-6) + final nin=nBoi) "Extract max flowrate of boiler being disabled during stage-up" - annotation (Placement(transformation(extent={{-20,40},{0,60}}))); + annotation (Placement(transformation(extent={{-12,40},{8,60}}))); Buildings.Controls.OBC.CDL.Continuous.Switch swi "Pass minimum flow setpoint based on whether stage-up involves a boiler being disabled" @@ -245,12 +257,10 @@ protected Buildings.Controls.OBC.CDL.Integers.Add addInt1 "Previous stage during stage change" - annotation (Placement(transformation(extent={{-90,-310},{-70,-290}}))); + annotation (Placement(transformation(extent={{-80,-310},{-60,-290}}))); Buildings.Controls.OBC.CDL.Routing.RealExtractor extIndSig4( - final allowOutOfRange=true, - final nin=nSta, - final outOfRangeValue=1e-6) + final nin=nSta) "Extract flow ratio of previous setpoint during stage-down" annotation (Placement(transformation(extent={{60,-280},{80,-260}}))); @@ -259,9 +269,7 @@ protected annotation (Placement(transformation(extent={{100,-260},{120,-240}}))); Buildings.Controls.OBC.CDL.Routing.RealExtractor extIndSig5( - final allowOutOfRange=true, - final nin=nBoi, - final outOfRangeValue=1e-6) + final nin=nBoi) "Extract max flowrate of boiler being disabled during stage-down" annotation (Placement(transformation(extent={{-40,-270},{-20,-250}}))); @@ -381,9 +389,6 @@ equation -128,100},{-72,100},{-72,86},{-62,86}}, color={255,127,0})); - connect(subInt.y, extIndSig1.index) annotation (Line(points={{-38,80},{40,80}, - {40,60},{70,60},{70,68}},color={255,127,0})); - connect(matGai.y, extIndSig2.u) annotation (Line(points={{-18,-220},{-2,-220}}, color={0,0,127})); @@ -392,7 +397,7 @@ equation {-128,-240},{10,-240},{10,-232}}, color={255,127,0})); connect(con3.y, extIndSig3.u) annotation (Line(points={{-58,-220},{-54,-220},{ - -54,50},{-22,50}}, color={0,0,127})); + -54,50},{-14,50}}, color={0,0,127})); connect(max.y, pro2.u1) annotation (Line(points={{122,100},{130,100},{130,76}, {138,76}}, color={0,0,127})); @@ -445,36 +450,21 @@ equation connect(pro3.y, swi2.u3) annotation (Line(points={{114,-90},{120,-90},{120,-158}, {138,-158}}, color={0,0,127})); - connect(extIndSig3.y, add2.u1) annotation (Line(points={{2,50},{40,50},{40,46}, - {58,46}}, color={0,0,127})); - connect(extIndSig2.y, add2.u2) annotation (Line(points={{22,-220},{46,-220},{46, 34},{58,34}}, color={0,0,127})); - connect(uLasDisBoi, extIndSig3.index) - annotation (Line(points={{-160,30},{-10,30},{-10,38}}, color={255,127,0})); - connect(extIndSig.y, max.u2) annotation (Line(points={{82,-50},{88,-50},{88,94}, {98,94}}, color={0,0,127})); - connect(extIndSig1.y, max.u1) annotation (Line(points={{82,80},{84,80},{84,106}, - {98,106}}, color={0,0,127})); - connect(conInt1.y, addInt1.u2) annotation (Line(points={{-108,-320},{-100,-320}, - {-100,-306},{-92,-306}}, color={255,127,0})); + {-100,-306},{-82,-306}}, color={255,127,0})); connect(uStaSet, addInt1.u1) annotation (Line(points={{-160,-90},{-128,-90},{-128, - -294},{-92,-294}}, color={255,127,0})); + -294},{-82,-294}}, color={255,127,0})); connect(matMax.y, extIndSig4.u) annotation (Line(points={{42,-150},{52,-150},{ 52,-270},{58,-270}}, color={0,0,127})); - connect(addInt1.y, extIndSig4.index) annotation (Line(points={{-68,-300},{70,-300}, - {70,-282}}, color={255,127,0})); - - connect(extIndSig4.y, max1.u2) annotation (Line(points={{82,-270},{88,-270},{88, - -256},{98,-256}}, color={0,0,127})); - connect(extIndSig.y, max1.u1) annotation (Line(points={{82,-50},{88,-50},{88,-244}, {98,-244}}, color={0,0,127})); @@ -484,9 +474,6 @@ equation connect(extIndSig2.y, add1.u1) annotation (Line(points={{22,-220},{46,-220},{46, -294},{98,-294}}, color={0,0,127})); - connect(extIndSig5.y, add1.u2) annotation (Line(points={{-18,-260},{0,-260},{0, - -306},{98,-306}}, color={0,0,127})); - connect(max1.y, pro4.u1) annotation (Line(points={{122,-250},{130,-250},{130,-264}, {138,-264}}, color={0,0,127})); @@ -496,9 +483,6 @@ equation connect(pro4.y, swi2.u1) annotation (Line(points={{162,-270},{166,-270},{166,-170}, {132,-170},{132,-142},{138,-142}}, color={0,0,127})); - connect(uLasDisBoi, extIndSig5.index) annotation (Line(points={{-160,30},{-134, - 30},{-134,-280},{-30,-280},{-30,-272}}, color={255,127,0})); - connect(swi.y, lin.f2) annotation (Line(points={{162,10},{166,10},{166,-8},{258, -8}}, color={0,0,127})); connect(swi2.y, lin1.f2) annotation (Line(points={{162,-150},{254,-150},{254,-148}, @@ -563,6 +547,39 @@ equation 172,-136},{258,-136}}, color={0,0,127})); connect(intWitRes.y, sub3.u2) annotation (Line(points={{162,-100},{172,-100},{ 172,-136},{220,-136},{220,-206},{228,-206}}, color={0,0,127})); + connect(uLasDisBoi, zerStaIndCor.uInd) annotation (Line(points={{-160,30},{-86, + 30},{-86,34},{-82,34}}, color={255,127,0})); + connect(zerStaIndCor.yIndMod, extIndSig3.index) + annotation (Line(points={{-58,34},{-2,34},{-2,38}}, color={255,127,0})); + connect(zerStaIndCor.yCapMod, add2.u1) annotation (Line(points={{-58,26},{38,26}, + {38,46},{58,46}}, color={0,0,127})); + connect(extIndSig3.y, zerStaIndCor.uCap) annotation (Line(points={{10,50},{20, + 50},{20,66},{-90,66},{-90,26},{-82,26}}, color={0,0,127})); + connect(uLasDisBoi, zerStaIndCor1.uInd) annotation (Line(points={{-160,30},{-132, + 30},{-132,-274},{-112,-274}}, color={255,127,0})); + connect(zerStaIndCor1.yIndMod, extIndSig5.index) annotation (Line(points={{-88, + -274},{-30,-274},{-30,-272}}, color={255,127,0})); + connect(zerStaIndCor1.yCapMod, add1.u2) annotation (Line(points={{-88,-282},{0, + -282},{0,-306},{98,-306}}, color={0,0,127})); + connect(extIndSig5.y, zerStaIndCor1.uCap) annotation (Line(points={{-18,-260}, + {-10,-260},{-10,-244},{-120,-244},{-120,-282},{-112,-282}}, color={0,0, + 127})); + connect(addInt1.y, zerStaIndCor2.uInd) annotation (Line(points={{-58,-300},{-50, + -300},{-50,-296},{-42,-296}}, color={255,127,0})); + connect(zerStaIndCor2.yIndMod, extIndSig4.index) annotation (Line(points={{-18, + -296},{70,-296},{70,-282}}, color={255,127,0})); + connect(zerStaIndCor2.yCapMod, max1.u2) annotation (Line(points={{-18,-304},{90, + -304},{90,-256},{98,-256}}, color={0,0,127})); + connect(extIndSig4.y, zerStaIndCor2.uCap) annotation (Line(points={{82,-270},{ + 86,-270},{86,-320},{-50,-320},{-50,-304},{-42,-304}}, color={0,0,127})); + connect(subInt.y, zerStaIndCor3.uInd) annotation (Line(points={{-38,80},{-20,80}, + {-20,84},{-10,84}}, color={255,127,0})); + connect(zerStaIndCor3.yIndMod, extIndSig1.index) annotation (Line(points={{14, + 84},{30,84},{30,60},{70,60},{70,68}}, color={255,127,0})); + connect(zerStaIndCor3.yCapMod, max.u1) annotation (Line(points={{14,76},{20,76}, + {20,106},{98,106}}, color={0,0,127})); + connect(extIndSig1.y, zerStaIndCor3.uCap) annotation (Line(points={{82,80},{84, + 80},{84,100},{-14,100},{-14,76},{-10,76}}, color={0,0,127})); annotation ( defaultComponentName="minBoiFloSet", Icon(coordinateSystem(extent={{-100,-100},{100,100}}), diff --git a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/SetPoints/Validation/MinimumFlowSetPoint.mo b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/SetPoints/Validation/MinimumFlowSetPoint.mo index f3966daa1ab..41217b894bb 100644 --- a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/SetPoints/Validation/MinimumFlowSetPoint.mo +++ b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/SetPoints/Validation/MinimumFlowSetPoint.mo @@ -36,6 +36,21 @@ model MinimumFlowSetPoint "Validation model for MinimumFlowSetPoint sequence" annotation (Placement(transformation(extent={{0,-90},{20,-70}}))); protected + Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Generic.ZeroIndexCorrection + zerStaIndCor + "Block to resolve zero index errors" + annotation (Placement(transformation(extent={{-80,50},{-60,70}}))); + + Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Generic.ZeroIndexCorrection + zerStaIndCor1 + "Block to resolve zero index errors" + annotation (Placement(transformation(extent={{-90,-190},{-70,-170}}))); + + Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Generic.ZeroIndexCorrection + zerStaIndCor2 + "Block to resolve zero index errors" + annotation (Placement(transformation(extent={{-20,-60},{0,-40}}))); + Buildings.Controls.OBC.CDL.Continuous.Sources.Ramp ram( final height=3, final duration=45, @@ -54,9 +69,7 @@ protected annotation (Placement(transformation(extent={{-90,90},{-70,110}}))); Buildings.Controls.OBC.CDL.Routing.RealExtractor extIndSig( - final allowOutOfRange=true, - final nin=3, - final outOfRangeValue=0) + final nin=3) "Extract scalar out of vector" annotation (Placement(transformation(extent={{-60,90},{-40,110}}))); @@ -90,22 +103,20 @@ protected Buildings.Controls.OBC.CDL.Continuous.Sources.Constant con2[3]( final k={2,1,0}) "Last boiler being disabled during stage change" - annotation (Placement(transformation(extent={{-90,-30},{-70,-10}}))); + annotation (Placement(transformation(extent={{-90,-150},{-70,-130}}))); Buildings.Controls.OBC.CDL.Routing.RealExtractor extIndSig1( - final allowOutOfRange=true, - final nin=3, - final outOfRangeValue=0) + final nin=3) "Extract scalar out of vector" - annotation (Placement(transformation(extent={{-60,-30},{-40,-10}}))); + annotation (Placement(transformation(extent={{-60,-150},{-40,-130}}))); Buildings.Controls.OBC.CDL.Conversions.RealToInteger reaToInt3 "Real to Integer conversion" - annotation (Placement(transformation(extent={{20,-30},{40,-10}}))); + annotation (Placement(transformation(extent={{20,-150},{40,-130}}))); Buildings.Controls.OBC.CDL.Continuous.GreaterThreshold greThr1 "Check if current stage setpoint involves boilers being turned on and off" - annotation (Placement(transformation(extent={{-30,-60},{-10,-40}}))); + annotation (Placement(transformation(extent={{20,-30},{40,-10}}))); Buildings.Controls.OBC.CDL.Integers.Change cha2 "Detect change in setpoint" @@ -118,14 +129,12 @@ protected Buildings.Controls.OBC.CDL.Continuous.Sources.Constant con3[3]( final k={1,0,0}) "Vector indicating if stage change involves boilers being turned on and off" - annotation (Placement(transformation(extent={{-90,-60},{-70,-40}}))); + annotation (Placement(transformation(extent={{-90,-30},{-70,-10}}))); Buildings.Controls.OBC.CDL.Routing.RealExtractor extIndSig2( - final allowOutOfRange=true, - final nin=3, - final outOfRangeValue=0) + final nin=3) "Extract scalar out of vector" - annotation (Placement(transformation(extent={{-60,-60},{-40,-40}}))); + annotation (Placement(transformation(extent={{-30,-30},{-10,-10}}))); equation connect(ram.y, reaToInt.u) @@ -137,18 +146,9 @@ equation connect(con1.y, extIndSig.u) annotation (Line(points={{-68,100},{-62,100}}, color={0,0,127})); - connect(reaToInt.y, extIndSig.index) annotation (Line(points={{-38,20},{64,20}, - {64,86},{-50,86},{-50,88}}, color={255,127,0})); - - connect(extIndSig.y, reaToInt1.u) - annotation (Line(points={{-38,100},{18,100}}, color={0,0,127})); - connect(reaToInt1.y, minBoiFloSet.uLasDisBoi) annotation (Line(points={{42,100}, {66,100},{66,66},{68,66}}, color={255,127,0})); - connect(extIndSig.y, greThr.u) annotation (Line(points={{-38,100},{-34,100},{-34, - 70},{-32,70}}, color={0,0,127})); - connect(greThr.y, minBoiFloSet.uOnOff) annotation (Line(points={{-8,70},{60,70}, {60,62},{68,62}}, color={255,0,255})); @@ -171,19 +171,14 @@ equation {64,-100},{64,-66},{68,-66}}, color={255,127,0})); connect(con2.y, extIndSig1.u) - annotation (Line(points={{-68,-20},{-62,-20}}, color={0,0,127})); - - connect(reaToInt2.y, extIndSig1.index) annotation (Line(points={{-38,-100},{64, - -100},{64,-34},{-50,-34},{-50,-32}}, color={255,127,0})); - - connect(extIndSig1.y, reaToInt3.u) - annotation (Line(points={{-38,-20},{18,-20}}, color={0,0,127})); + annotation (Line(points={{-68,-140},{-62,-140}}, + color={0,0,127})); - connect(reaToInt3.y, minBoiFloSet1.uLasDisBoi) annotation (Line(points={{42,-20}, - {66,-20},{66,-54},{68,-54}}, color={255,127,0})); + connect(reaToInt3.y, minBoiFloSet1.uLasDisBoi) annotation (Line(points={{42,-140}, + {56,-140},{56,-54},{68,-54}},color={255,127,0})); - connect(greThr1.y, minBoiFloSet1.uOnOff) annotation (Line(points={{-8,-50},{60, - -50},{60,-58},{68,-58}}, color={255,0,255})); + connect(greThr1.y, minBoiFloSet1.uOnOff) annotation (Line(points={{42,-20},{60, + -20},{60,-58},{68,-58}}, color={255,0,255})); connect(reaToInt2.y, cha2.u) annotation (Line(points={{-38,-100},{-36,-100},{-36, -80},{-32,-80}}, color={255,127,0})); @@ -198,14 +193,35 @@ equation {60,-80},{60,-62},{68,-62}}, color={255,0,255})); connect(con3.y, extIndSig2.u) - annotation (Line(points={{-68,-50},{-62,-50}}, color={0,0,127})); - - connect(extIndSig2.y, greThr1.u) - annotation (Line(points={{-38,-50},{-32,-50}}, color={0,0,127})); - - connect(reaToInt2.y, extIndSig2.index) annotation (Line(points={{-38,-100},{64, - -100},{64,-64},{-50,-64},{-50,-62}}, color={255,127,0})); - + annotation (Line(points={{-68,-20},{-32,-20}}, color={0,0,127})); + + connect(reaToInt.y, zerStaIndCor.uInd) annotation (Line(points={{-38,20},{64,20}, + {64,84},{-90,84},{-90,64},{-82,64}}, color={255,127,0})); + connect(zerStaIndCor.yIndMod, extIndSig.index) + annotation (Line(points={{-58,64},{-50,64},{-50,88}}, color={255,127,0})); + connect(zerStaIndCor.yCapMod, reaToInt1.u) annotation (Line(points={{-58,56},{ + -34,56},{-34,100},{18,100}}, color={0,0,127})); + connect(zerStaIndCor.yCapMod, greThr.u) annotation (Line(points={{-58,56},{-34, + 56},{-34,70},{-32,70}}, color={0,0,127})); + connect(extIndSig.y, zerStaIndCor.uCap) annotation (Line(points={{-38,100},{-36, + 100},{-36,80},{-86,80},{-86,56},{-82,56}}, color={0,0,127})); + connect(reaToInt2.y, zerStaIndCor1.uInd) annotation (Line(points={{-38,-100},{ + -30,-100},{-30,-120},{-96,-120},{-96,-176},{-92,-176}}, color={255,127, + 0})); + connect(zerStaIndCor1.yIndMod, extIndSig1.index) annotation (Line(points={{-68, + -176},{-50,-176},{-50,-152}}, color={255,127,0})); + connect(zerStaIndCor1.yCapMod, reaToInt3.u) annotation (Line(points={{-68,-184}, + {0,-184},{0,-140},{18,-140}}, color={0,0,127})); + connect(extIndSig1.y, zerStaIndCor1.uCap) annotation (Line(points={{-38,-140}, + {-30,-140},{-30,-196},{-96,-196},{-96,-184},{-92,-184}}, color={0,0,127})); + connect(reaToInt2.y, zerStaIndCor2.uInd) annotation (Line(points={{-38,-100},{ + -36,-100},{-36,-46},{-22,-46}}, color={255,127,0})); + connect(zerStaIndCor2.yIndMod, extIndSig2.index) annotation (Line(points={{2,-46}, + {8,-46},{8,-34},{-20,-34},{-20,-32}}, color={255,127,0})); + connect(extIndSig2.y, zerStaIndCor2.uCap) annotation (Line(points={{-8,-20},{-4, + -20},{-4,0},{-40,0},{-40,-54},{-22,-54}}, color={0,0,127})); + connect(zerStaIndCor2.yCapMod, greThr1.u) annotation (Line(points={{2,-54},{12, + -54},{12,-20},{18,-20}}, color={0,0,127})); annotation ( Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},{100,100}}), graphics={Ellipse( @@ -220,7 +236,7 @@ equation fillPattern = FillPattern.Solid, points={{-36,60},{64,0},{-36,-60},{-36,60}})}), Diagram(coordinateSystem( - preserveAspectRatio=false, extent={{-100,-120},{100,120}})), + preserveAspectRatio=false, extent={{-100,-220},{100,120}})), experiment( StopTime=10, Interval=1, diff --git a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/Down.mo b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/Down.mo index 4e02a279727..a60c5085e1d 100644 --- a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/Down.mo +++ b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/Down.mo @@ -234,19 +234,29 @@ block Down annotation (Placement(transformation(extent={{-160,120},{-140,140}}))); protected + Buildings.Controls.OBC.CDL.Continuous.AddParameter addParDivZer( + final p=1e-6) + "Add small vcalue to input signal to prevent divide by zero" + annotation (Placement(transformation(extent={{-166,10},{-146,30}}))); + + Buildings.Controls.OBC.CDL.Continuous.AddParameter addParDivZer1( + final p=1e-6) + "Add small vcalue to input signal to prevent divide by zero" + annotation (Placement(transformation(extent={{-166,-66},{-146,-46}}))); + Buildings.Controls.OBC.CDL.Logical.Not not1 "Logical Not" annotation (Placement(transformation(extent={{-120,120},{-100,140}}))); Buildings.Controls.OBC.CDL.Continuous.Divide div "Thermal capacity ratio" - annotation (Placement(transformation(extent={{-150,34},{-130,54}}))); + annotation (Placement(transformation(extent={{-150,44},{-130,64}}))); Buildings.Controls.OBC.CDL.Continuous.Hysteresis hys( final uLow=fraMinFir, final uHigh=fraMinFir + sigDif) "Hysteresis loop" - annotation (Placement(transformation(extent={{-120,34},{-100,54}}))); + annotation (Placement(transformation(extent={{-120,44},{-100,64}}))); Buildings.Controls.OBC.CDL.Logical.Or or2 if have_priOnl "Logical Or" @@ -254,13 +264,13 @@ protected Buildings.Controls.OBC.CDL.Continuous.Divide div1 "Thermal capacity ratio" - annotation (Placement(transformation(extent={{-160,-50},{-140,-30}}))); + annotation (Placement(transformation(extent={{-160,-40},{-140,-20}}))); Buildings.Controls.OBC.CDL.Continuous.Hysteresis hys1( final uLow=fraDesCap, final uHigh=fraDesCap + sigDif) "Hysteresis loop" - annotation (Placement(transformation(extent={{-130,-50},{-110,-30}}))); + annotation (Placement(transformation(extent={{-130,-40},{-110,-20}}))); Buildings.Controls.OBC.CDL.Logical.And3 and3 "Logical And" @@ -308,17 +318,17 @@ protected Buildings.Controls.OBC.CDL.Logical.Not not2 "Logical Not" - annotation (Placement(transformation(extent={{-90,34},{-70,54}}))); + annotation (Placement(transformation(extent={{-90,44},{-70,64}}))); Buildings.Controls.OBC.CDL.Logical.Not not3 "Logical Not" - annotation (Placement(transformation(extent={{-90,-50},{-70,-30}}))); + annotation (Placement(transformation(extent={{-90,-40},{-70,-20}}))); Buildings.Controls.OBC.CDL.Continuous.Hysteresis hys4( final uLow=bypValClo, final uHigh=bypValClo + sigDif) if have_priOnl "Hysteresis loop" - annotation (Placement(transformation(extent={{-158,-10},{-138,10}}))); + annotation (Placement(transformation(extent={{-140,-10},{-120,10}}))); Buildings.Controls.OBC.CDL.Continuous.Hysteresis hys2( final uLow=sigDif, @@ -386,7 +396,7 @@ protected Buildings.Controls.OBC.CDL.Logical.And and5 "Turn on timer when hysteresis turns on and reset it when hysteresis turns off or stage change process is completed" - annotation (Placement(transformation(extent={{-50,-50},{-30,-30}}))); + annotation (Placement(transformation(extent={{-50,-40},{-30,-20}}))); Buildings.Controls.OBC.CDL.Logical.And and6 if not have_priOnl "Turn on timer when hysteresis turns on and reset it when hysteresis turns @@ -408,15 +418,11 @@ equation connect(faiSafCon.TSup, THotWatSup) annotation (Line(points={{-162,130},{-170,130},{-170,120},{-200,120}}, color={0,0,127})); - connect(div.u2, uCapMin) annotation (Line(points={{-152,38},{-160,38},{-160,30}, - {-200,30}}, color={0,0,127})); connect(hys.u, div.y) - annotation (Line(points={{-122,44},{-128,44}}, + annotation (Line(points={{-122,54},{-124,54},{-124,54},{-128,54}}, color={0,0,127})); - connect(div1.u2, uCapDowDes) annotation (Line(points={{-162,-46},{-172,-46},{-172, - -30},{-200,-30}}, color={0,0,127})); connect(hys1.u, div1.y) - annotation (Line(points={{-132,-40},{-138,-40}}, + annotation (Line(points={{-132,-30},{-134,-30},{-134,-30},{-138,-30}}, color={0,0,127})); connect(and3.y, yStaDow) annotation (Line(points={{202,0},{240,0}}, color={255,0,255})); @@ -444,16 +450,18 @@ equation color={255,0,255})); connect(and3.u2, logSwi1.y) annotation (Line(points={{178,0},{134,0},{134,-20}, {170,-20},{170,-90},{162,-90}}, color={255,0,255})); - connect(div.u1, uCapReq) annotation (Line(points={{-152,50},{-160,50},{-160,60}, - {-200,60}}, color={0,0,127})); - connect(div1.u1, uCapReq) annotation (Line(points={{-162,-34},{-166,-34},{-166, + connect(div.u1, uCapReq) annotation (Line(points={{-152,60},{-200,60}}, + color={0,0,127})); + connect(div1.u1, uCapReq) annotation (Line(points={{-162,-24},{-172,-24},{-172, 60},{-200,60}}, color={0,0,127})); connect(not2.u, hys.y) - annotation (Line(points={{-92,44},{-98,44}}, color={255,0,255})); + annotation (Line(points={{-92,54},{-94,54},{-94,54},{-98,54}}, + color={255,0,255})); connect(hys1.y, not3.u) - annotation (Line(points={{-108,-40},{-92,-40}},color={255,0,255})); + annotation (Line(points={{-108,-30},{-104,-30},{-104,-30},{-92,-30}}, + color={255,0,255})); connect(hys4.u, uBypValPos) - annotation (Line(points={{-160,0},{-200,0}}, color={0,0,127})); + annotation (Line(points={{-142,0},{-200,0}}, color={0,0,127})); connect(hys2.y, not4.u) annotation (Line(points={{-124,-80},{-122,-80}}, color={255,0,255})); @@ -489,18 +497,20 @@ equation connect(tim3.u, and1.y) annotation (Line(points={{-22,44},{-28,44}}, color={255,0,255})); connect(and1.u1, not2.y) - annotation (Line(points={{-52,44},{-68,44}}, color={255,0,255})); + annotation (Line(points={{-52,44},{-60,44},{-60,54},{-68,54}}, + color={255,0,255})); connect(tim1.u, and4.y) annotation (Line(points={{-22,0},{-28,0}}, color={255,0,255})); connect(and5.y, tim.u) - annotation (Line(points={{-28,-40},{30,-40},{30,-20},{48,-20}}, + annotation (Line(points={{-28,-30},{30,-30},{30,-20},{48,-20}}, color={255,0,255})); connect(tim2.u, and6.y) annotation (Line(points={{-22,-100},{-28,-100}}, color={255,0,255})); connect(hys4.y, and4.u1) - annotation (Line(points={{-136,0},{-52,0}}, color={255,0,255})); + annotation (Line(points={{-118,0},{-52,0}}, color={255,0,255})); connect(not3.y, and5.u1) - annotation (Line(points={{-68,-40},{-52,-40}}, color={255,0,255})); + annotation (Line(points={{-68,-30},{-64,-30},{-64,-30},{-52,-30}}, + color={255,0,255})); connect(and2.y, and6.u1) annotation (Line(points={{-68,-100},{-52,-100}}, color={255,0,255})); connect(not5.u, uStaChaProEnd) @@ -509,8 +519,8 @@ equation -52,36}}, color={255,0,255})); connect(not5.y, and4.u2) annotation (Line(points={{-98,90},{-60,90},{-60,-8},{ -52,-8}}, color={255,0,255})); - connect(not5.y, and5.u2) annotation (Line(points={{-98,90},{-60,90},{-60,-48}, - {-52,-48}}, color={255,0,255})); + connect(not5.y, and5.u2) annotation (Line(points={{-98,90},{-60,90},{-60,-38}, + {-52,-38}}, color={255,0,255})); connect(not5.y, and6.u2) annotation (Line(points={{-98,90},{-60,90},{-60,-108}, {-52,-108}}, color={255,0,255})); @@ -520,7 +530,7 @@ equation {58,-98}}, color={255,0,255})); connect(tim1.passed, or2.u2) annotation (Line(points={{2,-8},{50,-8},{50,10},{ 58,10}}, color={255,0,255})); - connect(and5.y, tim4.u) annotation (Line(points={{-28,-40},{30,-40},{30,-60},{ + connect(and5.y, tim4.u) annotation (Line(points={{-28,-30},{30,-30},{30,-60},{ 48,-60}}, color={255,0,255})); connect(tim.passed, logSwi.u1) annotation (Line(points={{72,-28},{90,-28},{90, -32},{98,-32}}, color={255,0,255})); @@ -528,6 +538,14 @@ equation -48},{98,-48}}, color={255,0,255})); connect(tim2.passed, or1.u2) annotation (Line(points={{2,-108},{40,-108},{40,-106}, {58,-106}}, color={255,0,255})); + connect(uCapMin, addParDivZer.u) annotation (Line(points={{-200,30},{-176,30}, + {-176,20},{-168,20}}, color={0,0,127})); + connect(addParDivZer.y, div.u2) annotation (Line(points={{-144,20},{-134,20},{ + -134,40},{-160,40},{-160,48},{-152,48}}, color={0,0,127})); + connect(uCapDowDes, addParDivZer1.u) annotation (Line(points={{-200,-30},{-176, + -30},{-176,-56},{-168,-56}}, color={0,0,127})); + connect(addParDivZer1.y, div1.u2) annotation (Line(points={{-144,-56},{-132,-56}, + {-132,-42},{-172,-42},{-172,-36},{-162,-36}}, color={0,0,127})); annotation(defaultComponentName = "staDow", Icon(coordinateSystem(extent={{-100,-160},{100,190}}), graphics={ diff --git a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/EfficiencyCondition.mo b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/EfficiencyCondition.mo index e697a0c036e..f514b8cfabb 100644 --- a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/EfficiencyCondition.mo +++ b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/EfficiencyCondition.mo @@ -95,6 +95,16 @@ block EfficiencyCondition iconTransformation(extent={{100,-20},{140,20}}))); protected + Buildings.Controls.OBC.CDL.Continuous.AddParameter addParDivZer( + final p=1e-6) + "Add small vcalue to input signal to prevent divide by zero" + annotation (Placement(transformation(extent={{-110,90},{-90,110}}))); + + Buildings.Controls.OBC.CDL.Continuous.AddParameter addParDivZer1( + final p=1e-6) + "Add small vcalue to input signal to prevent divide by zero" + annotation (Placement(transformation(extent={{-112,10},{-92,30}}))); + Buildings.Controls.OBC.CDL.Continuous.Divide div "Divider to get relative value of required heating capacity" annotation (Placement(transformation(extent={{-80,20},{-60,40}}))); @@ -187,11 +197,6 @@ protected annotation (Placement(transformation(extent={{-40,-190},{-20,-170}}))); equation - connect(div.u2,uCapUpMin) - annotation (Line(points={{-82,24},{-110,24},{-110,20},{-140,20}}, - color={0,0,127})); - connect(div1.u2, uCapDes) annotation (Line(points={{-82,64},{-90,64},{-90,70}, - {-114,70},{-114,100},{-140,100}}, color={0,0,127})); connect(sub1.u1, VHotWat_flow) annotation (Line(points={{-82,-34},{-110,-34},{ -110,-20},{-140,-20}}, color={0,0,127})); connect(sub1.u2, VUpMinSet_flow) annotation (Line(points={{-82,-46},{-110,-46}, @@ -268,6 +273,14 @@ equation {-110,-70},{-82,-70}}, color={0,0,127})); connect(addPar.y, div2.u2) annotation (Line(points={{-58,-70},{-50,-70},{-50,-56}, {-42,-56}}, color={0,0,127})); + connect(uCapDes, addParDivZer.u) + annotation (Line(points={{-140,100},{-112,100}}, color={0,0,127})); + connect(addParDivZer.y, div1.u2) annotation (Line(points={{-88,100},{-86,100}, + {-86,64},{-82,64}}, color={0,0,127})); + connect(uCapUpMin, addParDivZer1.u) + annotation (Line(points={{-140,20},{-114,20}}, color={0,0,127})); + connect(addParDivZer1.y, div.u2) annotation (Line(points={{-90,20},{-86,20},{-86, + 24},{-82,24}}, color={0,0,127})); annotation ( defaultComponentName = "effCon", Icon( From 3823371dbf5059a1e57c7572b9f4f22823506c01 Mon Sep 17 00:00:00 2001 From: Devaprasad Date: Mon, 3 Apr 2023 22:21:01 -0700 Subject: [PATCH 08/20] Added tolerance to model file --- .../PrimarySystem/BoilerPlant/Generic/ZeroIndexCorrection.mo | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Generic/ZeroIndexCorrection.mo b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Generic/ZeroIndexCorrection.mo index ae079343d57..cd6f3c1a4ef 100644 --- a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Generic/ZeroIndexCorrection.mo +++ b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Generic/ZeroIndexCorrection.mo @@ -130,5 +130,6 @@ equation First implementation. - ")); + "), + experiment(Tolerance=1e-6)); end ZeroIndexCorrection; From 7a08b9b74f2891272821c3d5218aa1dcb57dd03a Mon Sep 17 00:00:00 2001 From: Devaprasad Date: Mon, 3 Apr 2023 22:23:16 -0700 Subject: [PATCH 09/20] Added tolerance to validation model --- .../BoilerPlant/Generic/Validation/ZeroIndexCorrection.mo | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Generic/Validation/ZeroIndexCorrection.mo b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Generic/Validation/ZeroIndexCorrection.mo index fa06e87d28c..46efa0e4bbf 100644 --- a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Generic/Validation/ZeroIndexCorrection.mo +++ b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Generic/Validation/ZeroIndexCorrection.mo @@ -80,5 +80,6 @@ annotation ( fillPattern = FillPattern.Solid, points = {{-36,60},{64,0},{-36,-60},{-36,60}})}), Diagram(coordinateSystem(preserveAspectRatio=false, - extent={{-100,-100},{100,100}}))); + extent={{-100,-100},{100,100}})), + experiment(Tolerance=1e-6)); end ZeroIndexCorrection; From 364347be3908a69a8c0d4b440b03a0884b00fb36 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 4 Apr 2023 07:24:29 +0000 Subject: [PATCH 10/20] Updated unit test results --- ...lant_Generic_Validation_ZeroIndexCorrection.txt | 14 ++++++++++++++ ...nt_SetPoints_Validation_MinimumFlowSetPoint.txt | 4 ++-- ...lant.Generic.Validation.ZeroIndexCorrection.mos | 9 +++++++++ 3 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 Buildings/Resources/ReferenceResults/Dymola/Buildings_Controls_OBC_ASHRAE_PrimarySystem_BoilerPlant_Generic_Validation_ZeroIndexCorrection.txt create mode 100644 Buildings/Resources/Scripts/OpenModelica/compareVars/Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Generic.Validation.ZeroIndexCorrection.mos diff --git a/Buildings/Resources/ReferenceResults/Dymola/Buildings_Controls_OBC_ASHRAE_PrimarySystem_BoilerPlant_Generic_Validation_ZeroIndexCorrection.txt b/Buildings/Resources/ReferenceResults/Dymola/Buildings_Controls_OBC_ASHRAE_PrimarySystem_BoilerPlant_Generic_Validation_ZeroIndexCorrection.txt new file mode 100644 index 00000000000..02101bd0fe9 --- /dev/null +++ b/Buildings/Resources/ReferenceResults/Dymola/Buildings_Controls_OBC_ASHRAE_PrimarySystem_BoilerPlant_Generic_Validation_ZeroIndexCorrection.txt @@ -0,0 +1,14 @@ +last-generated=2023-04-04 +statistics-simulation= +{ + "linear": " ", + "nonlinear": " ", + "numerical Jacobians": "0" +} +time=[0e+00, 1e+01] +zerStaIndCor.uInd=[0e+00, 0e+00] +zerStaIndCor.yIndMod=[1e+00, 1e+00] +zerStaIndCor.yCapMod=[0e+00, 0e+00] +zerStaIndCor1.uInd=[1e+00, 1e+00] +zerStaIndCor1.yIndMod=[1e+00, 1e+00] +zerStaIndCor1.yCapMod=[1e+01, 1e+01] diff --git a/Buildings/Resources/ReferenceResults/Dymola/Buildings_Controls_OBC_ASHRAE_PrimarySystem_BoilerPlant_SetPoints_Validation_MinimumFlowSetPoint.txt b/Buildings/Resources/ReferenceResults/Dymola/Buildings_Controls_OBC_ASHRAE_PrimarySystem_BoilerPlant_SetPoints_Validation_MinimumFlowSetPoint.txt index 1e69561575c..19b694e5fa1 100644 --- a/Buildings/Resources/ReferenceResults/Dymola/Buildings_Controls_OBC_ASHRAE_PrimarySystem_BoilerPlant_SetPoints_Validation_MinimumFlowSetPoint.txt +++ b/Buildings/Resources/ReferenceResults/Dymola/Buildings_Controls_OBC_ASHRAE_PrimarySystem_BoilerPlant_SetPoints_Validation_MinimumFlowSetPoint.txt @@ -1,4 +1,4 @@ -last-generated=2022-11-22 +last-generated=2023-04-04 statistics-simulation= { "linear": " ", @@ -18,7 +18,7 @@ minBoiFloSet.maxFloSet[2]=[8.999999761581421e-01, 8.999999761581421e-01] minBoiFloSet.VHotWatMinSet_flow=[0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 2.999995045371726e-02, 8.999994486552741e-02, 9.999999403953552e-02, 9.999999403953552e-02, 9.999999403953552e-02, 9.999999403953552e-02, 9.999999403953552e-02, 9.999999403953552e-02, 9.999999403953552e-02, 9.999999403953552e-02, 9.999999403953552e-02, 9.999999403953552e-02, 9.999999403953552e-02, 9.999999403953552e-02, 9.999999403953552e-02, 9.999999403953552e-02, 9.999999403953552e-02, 9.999999403953552e-02, 9.999999403953552e-02, 9.999999403953552e-02, 9.999999403953552e-02, 9.999999403953552e-02, 9.999999403953552e-02, 9.999999403953552e-02, 9.999999403953552e-02, 1.300000566239389e-01, 1.900000059601805e-01, 2.499999552965164e-01, 3.099999046328524e-01, 3.699998390680275e-01, 4.299999940389672e-01, 4.599999785423279e-01, 4.599999785423279e-01, 4.500000262258617e-01, 3.900000023838069e-01, 3.299998176103557e-01, 2.999999821186066e-01, 2.999999821186066e-01, 2.999999821186066e-01, 2.999999821186066e-01, 2.999999821186066e-01, 2.999999821186066e-01, 2.999999821186066e-01, 2.999999821186066e-01, 2.999999821186066e-01, 2.999999821186066e-01, 2.999999821186066e-01, 2.999999821186066e-01, 2.999999821186066e-01, 2.999999821186066e-01, 3.300000596052887e-01, 3.899997735062908e-01, 4.499998986721039e-01, 4.599999785423279e-01, 4.599999785423279e-01, 4.599999785423279e-01, 4.599999785423279e-01, 4.599999785423279e-01, 4.599999785423279e-01, 4.599999785423279e-01, 4.599999785423279e-01, 4.599999785423279e-01, 4.599999785423279e-01, 4.599999785423279e-01, 4.599999785423279e-01, 4.599999785423279e-01, 4.599999785423279e-01, 4.599999785423279e-01, 4.599999785423279e-01, 4.599999785423279e-01, 4.599999785423279e-01, 4.599999785423279e-01, 4.599999785423279e-01, 4.599999785423279e-01, 4.599999785423279e-01, 4.599999785423279e-01, 4.599999785423279e-01, 4.599999785423279e-01, 4.599999785423279e-01, 4.599999785423279e-01, 4.599999785423279e-01, 4.599999785423279e-01, 4.599999785423279e-01, 4.599999785423279e-01, 4.599999785423279e-01, 4.599999785423279e-01, 4.599999785423279e-01, 4.599999785423279e-01] minBoiFloSet1.uStaSet=[4e+00, 4e+00, 4e+00, 4e+00, 4e+00, 4e+00, 4e+00, 4e+00, 4e+00, 4e+00, 4e+00, 4e+00, 4e+00, 3e+00, 3e+00, 3e+00, 3e+00, 3e+00, 3e+00, 3e+00, 3e+00, 3e+00, 3e+00, 3e+00, 3e+00, 3e+00, 3e+00, 3e+00, 3e+00, 3e+00, 3e+00, 3e+00, 3e+00, 3e+00, 3e+00, 3e+00, 3e+00, 3e+00, 2e+00, 2e+00, 2e+00, 2e+00, 2e+00, 2e+00, 2e+00, 2e+00, 2e+00, 2e+00, 2e+00, 2e+00, 2e+00, 2e+00, 2e+00, 2e+00, 2e+00, 2e+00, 2e+00, 2e+00, 2e+00, 2e+00, 2e+00, 2e+00, 2e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00] minBoiFloSet1.uOnOff=[0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00] -truFalHol1.y=[1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 0e+00, 0e+00, 0e+00, 0e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 3.814682717262485e-06, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 3.814682699498917e-06, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00] +truFalHol1.y=[0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 3.814682717262485e-06, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 3.814682699498917e-06, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00] minBoiFloSet1.uLasDisBoi=[0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 0e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 1e+00, 2e+00, 2e+00, 2e+00, 2e+00, 2e+00, 2e+00, 2e+00, 2e+00, 2e+00, 2e+00, 2e+00, 2e+00, 2e+00, 2e+00, 2e+00, 2e+00, 2e+00, 2e+00, 2e+00, 2e+00, 2e+00, 2e+00, 2e+00, 2e+00, 2e+00, 2e+00, 2e+00, 2e+00, 2e+00, 2e+00, 2e+00, 2e+00, 2e+00, 2e+00, 2e+00, 2e+00, 2e+00, 2e+00] minBoiFloSet1.minFloSet[1]=[1.000000014901161e-01, 1.000000014901161e-01] minBoiFloSet1.minFloSet[2]=[3.00000011920929e-01, 3.00000011920929e-01] diff --git a/Buildings/Resources/Scripts/OpenModelica/compareVars/Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Generic.Validation.ZeroIndexCorrection.mos b/Buildings/Resources/Scripts/OpenModelica/compareVars/Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Generic.Validation.ZeroIndexCorrection.mos new file mode 100644 index 00000000000..721d7840d9d --- /dev/null +++ b/Buildings/Resources/Scripts/OpenModelica/compareVars/Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Generic.Validation.ZeroIndexCorrection.mos @@ -0,0 +1,9 @@ +compareVars := + { + "zerStaIndCor.uInd", + "zerStaIndCor.yIndMod", + "zerStaIndCor.yCapMod", + "zerStaIndCor1.uInd", + "zerStaIndCor1.yIndMod", + "zerStaIndCor1.yCapMod" + }; From e100a161b2ce57352b7129830d306c569c57032a Mon Sep 17 00:00:00 2001 From: Devaprasad Date: Thu, 6 Apr 2023 17:48:02 -0700 Subject: [PATCH 11/20] Updated input signals for validation model --- .../Staging/SetPoints/Subsequences/Validation/Capacities.mo | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/Validation/Capacities.mo b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/Validation/Capacities.mo index a034b3b938d..eb07c310468 100644 --- a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/Validation/Capacities.mo +++ b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/Validation/Capacities.mo @@ -37,7 +37,8 @@ protected "Minimum stage capacities" annotation (Placement(transformation(extent={{-140,60},{-120,80}}))); - Buildings.Controls.OBC.CDL.Integers.Sources.Constant stage0(final k=1) + Buildings.Controls.OBC.CDL.Integers.Sources.Constant stage0( + final k=0) "Boiler stage" annotation (Placement(transformation(extent={{-140,20},{-120,40}}))); @@ -71,7 +72,8 @@ protected "Boiler stage" annotation (Placement(transformation(extent={{20,-20},{40,0}}))); - Buildings.Controls.OBC.CDL.Integers.Sources.Constant stage6(final k=2) + Buildings.Controls.OBC.CDL.Integers.Sources.Constant stage6( + final k=3) "Boiler stage" annotation (Placement(transformation(extent={{-60,-20},{-40,0}}))); From 9e8071d9cbf8442ddb538e5b945b4a38ad5fad57 Mon Sep 17 00:00:00 2001 From: Devaprasad Date: Thu, 6 Apr 2023 18:01:48 -0700 Subject: [PATCH 12/20] Removed excess zeros from validation script --- .../BoilerPlant/Generic/Validation/ZeroIndexCorrection.mos | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Buildings/Resources/Scripts/Dymola/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Generic/Validation/ZeroIndexCorrection.mos b/Buildings/Resources/Scripts/Dymola/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Generic/Validation/ZeroIndexCorrection.mos index b91d361fb33..38e605e66f9 100644 --- a/Buildings/Resources/Scripts/Dymola/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Generic/Validation/ZeroIndexCorrection.mos +++ b/Buildings/Resources/Scripts/Dymola/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Generic/Validation/ZeroIndexCorrection.mos @@ -1,8 +1,8 @@ simulateModel("Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Generic.Validation.ZeroIndexCorrection", method="cvode", stopTime=10, tolerance=1e-06, resultFile="ZeroIndexCorrection"); createPlot(id=1, position={95, 95, 534, 336}, y={"zerStaIndCor.uInd"}, range={0.0, 10.0, -1.5, 1.5}, grid=true, colors={{28,108,200}}); -createPlot(id=1, position={95, 95, 534, 108}, y={"zerStaIndCor.yIndMod"}, range={0.0, 10.0, 0.8500000000000001, 1.1500000000000001}, grid=true, subPlot=2, colors={{28,108,200}}); +createPlot(id=1, position={95, 95, 534, 108}, y={"zerStaIndCor.yIndMod"}, range={0.0, 10.0, 0.85, 1.15}, grid=true, subPlot=2, colors={{28,108,200}}); createPlot(id=1, position={95, 95, 534, 109}, y={"zerStaIndCor.yCapMod"}, range={0.0, 10.0, -1.5, 1.5}, grid=true, subPlot=3, colors={{28,108,200}}); -createPlot(id=2, position={0, 0, 971, 830}, y={"zerStaIndCor1.uInd"}, range={0.0, 10.0, 0.8500000000000001, 1.1500000000000001}, grid=true, colors={{28,108,200}}); -createPlot(id=2, position={0, 0, 971, 274}, y={"zerStaIndCor1.yIndMod"}, range={0.0, 10.0, 0.8500000000000001, 1.1500000000000001}, grid=true, subPlot=2, colors={{28,108,200}}); +createPlot(id=2, position={0, 0, 971, 830}, y={"zerStaIndCor1.uInd"}, range={0.0, 10.0, 0.85, 1.15}, grid=true, colors={{28,108,200}}); +createPlot(id=2, position={0, 0, 971, 274}, y={"zerStaIndCor1.yIndMod"}, range={0.0, 10.0, 0.85, 1.15}, grid=true, subPlot=2, colors={{28,108,200}}); createPlot(id=2, position={0, 0, 971, 273}, y={"zerStaIndCor1.yCapMod"}, range={0.0, 10.0, 8.5, 11.5}, grid=true, subPlot=3, colors={{28,108,200}}); From 32fc2cfbbb447fcbabe801ce66e1b062f9ed1c4e Mon Sep 17 00:00:00 2001 From: Devaprasad Date: Thu, 6 Apr 2023 18:12:55 -0700 Subject: [PATCH 13/20] Changed default component name --- .../PrimarySystem/BoilerPlant/Generic/ZeroIndexCorrection.mo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Generic/ZeroIndexCorrection.mo b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Generic/ZeroIndexCorrection.mo index cd6f3c1a4ef..2a415b62774 100644 --- a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Generic/ZeroIndexCorrection.mo +++ b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Generic/ZeroIndexCorrection.mo @@ -77,7 +77,7 @@ equation {38,-34}}, color={0,0,127})); connect(uCap, mul.u2) annotation (Line(points={{-120,-40},{30,-40},{30,-46},{38, -46}}, color={0,0,127})); - annotation (defaultComponentName="zerStaIndCor", + annotation (defaultComponentName="zerIndCor", Icon(coordinateSystem(preserveAspectRatio=false), graphics={ Rectangle( From 52f2f672755799c80e95999451f3791537025b3b Mon Sep 17 00:00:00 2001 From: Devaprasad Date: Mon, 10 Apr 2023 00:51:05 -0700 Subject: [PATCH 14/20] Fixed typos in documentation --- .../PrimarySystem/BoilerPlant/Generic/ZeroIndexCorrection.mo | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Generic/ZeroIndexCorrection.mo b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Generic/ZeroIndexCorrection.mo index 2a415b62774..bcd36992a3f 100644 --- a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Generic/ZeroIndexCorrection.mo +++ b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Generic/ZeroIndexCorrection.mo @@ -92,7 +92,7 @@ equation Diagram(coordinateSystem(preserveAspectRatio=false)), Documentation(info="

- This block has been iomplemented to overcome the zero-index errors being + This block has been implemented to overcome the zero-index errors being reported in the block Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Staging.SetPoints.Subsequences.Capacities. @@ -103,7 +103,7 @@ equation RealExtractor block.

- To overcome, this the block accepts input signals uInd for the + To overcome this, the block accepts input signals uInd for the current index value, and uCap for the current capacity signal. It outputs a modified index signal yIndMod and a modified capacity signal yCapMod. From 33c867501affbf99d434eac5b2e8276d4cdff4c6 Mon Sep 17 00:00:00 2001 From: Devaprasad Date: Mon, 5 Jun 2023 19:00:37 -0700 Subject: [PATCH 15/20] Updated annotation instances of dialog to Dialog --- .../PrimarySystem/BoilerPlant/Controller.mo | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Controller.mo b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Controller.mo index 1385924af7b..537408cf31e 100644 --- a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Controller.mo +++ b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Controller.mo @@ -50,12 +50,12 @@ model Controller parameter Integer nIgnReq( final min=0) = 0 "Number of hot-water requests to be ignored before enabling boiler plant loop" - annotation(dialog(tab="Plant enable/disable parameters")); + annotation(Dialog(tab="Plant enable/disable parameters")); parameter Integer nSchRow( final min=1) = 4 "Number of rows to be created for plant schedule table" - annotation(dialog(tab="Plant enable/disable parameters")); + annotation(Dialog(tab="Plant enable/disable parameters")); parameter Integer nBoi "Number of boilers" @@ -116,38 +116,38 @@ model Controller parameter Real schTab[nSchRow,2] = [0,1;6,1;18,1;24,1] "Table defining schedule for enabling plant" - annotation(dialog(tab="Plant enable/disable parameters")); + annotation(Dialog(tab="Plant enable/disable parameters")); parameter Real TOutLoc( final unit="K", displayUnit="K") = 300 "Boiler lock-out temperature for outdoor air" - annotation(dialog(tab="Plant enable/disable parameters")); + annotation(Dialog(tab="Plant enable/disable parameters")); parameter Real locDt( final unit="K", displayUnit="K", final quantity="ThermodynamicTemperature") = 1 "Temperature deadband for boiler lockout" - annotation(dialog(tab="Plant enable/disable parameters", group="Advanced")); + annotation(Dialog(tab="Plant enable/disable parameters", group="Advanced")); parameter Real plaOffThrTim( final unit="s", displayUnit="s") = 900 "Minimum time for which the plant has to stay off once it has been disabled" - annotation(dialog(tab="Plant enable/disable parameters")); + annotation(Dialog(tab="Plant enable/disable parameters")); parameter Real plaOnThrTim( final unit="s", displayUnit="s") = plaOffThrTim "Minimum time for which the boiler plant has to stay on once it has been enabled" - annotation(dialog(tab="Plant enable/disable parameters")); + annotation(Dialog(tab="Plant enable/disable parameters")); parameter Real staOnReqTim( final unit="s", displayUnit="s") = 180 "Time-limit for receiving hot-water requests to maintain enabled plant on" - annotation(dialog(tab="Plant enable/disable parameters")); + annotation(Dialog(tab="Plant enable/disable parameters")); parameter Real boiDesCap[nBoi]( final unit="W", From 2405421f51d2f7cfe183b3b4e8b84009591d72a1 Mon Sep 17 00:00:00 2001 From: Devaprasad Date: Tue, 6 Jun 2023 08:20:44 -0700 Subject: [PATCH 16/20] Changed plant enable schedule from parameter to Boolean input --- .../PrimarySystem/BoilerPlant/Controller.mo | 34 ++- .../BoilerPlant/Generic/PlantEnable.mo | 51 ++-- .../Generic/Validation/PlantEnable.mo | 60 +++-- .../BoilerPlant/Validation/Controller.mo | 246 ++++++++++++------ 4 files changed, 235 insertions(+), 156 deletions(-) diff --git a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Controller.mo b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Controller.mo index 537408cf31e..83c3158c1ae 100644 --- a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Controller.mo +++ b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Controller.mo @@ -52,11 +52,6 @@ model Controller "Number of hot-water requests to be ignored before enabling boiler plant loop" annotation(Dialog(tab="Plant enable/disable parameters")); - parameter Integer nSchRow( - final min=1) = 4 - "Number of rows to be created for plant schedule table" - annotation(Dialog(tab="Plant enable/disable parameters")); - parameter Integer nBoi "Number of boilers" annotation(Dialog(tab="General", group="Boiler plant configuration parameters")); @@ -114,10 +109,6 @@ model Controller "Total number of pumps that operate at design conditions in secondary loop" annotation (Dialog(group="Boiler plant configuration parameters")); - parameter Real schTab[nSchRow,2] = [0,1;6,1;18,1;24,1] - "Table defining schedule for enabling plant" - annotation(Dialog(tab="Plant enable/disable parameters")); - parameter Real TOutLoc( final unit="K", displayUnit="K") = 300 @@ -899,6 +890,11 @@ model Controller annotation (Placement(transformation(extent={{-440,-460},{-400,-420}}), iconTransformation(extent={{-140,-250},{-100,-210}}))); + Buildings.Controls.OBC.CDL.Interfaces.BooleanInput uSchEna + "Signal indicating if schedule allows plant to be enabled" + annotation (Placement(transformation(extent={{-440,400},{-400,440}}), + iconTransformation(extent={{-140,330},{-100,370}}))); + Buildings.Controls.OBC.CDL.Interfaces.IntegerInput plaReq "Plant requests" annotation (Placement(transformation(extent={{-440,330},{-400,370}}), @@ -1105,8 +1101,6 @@ model Controller Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Generic.PlantEnable plaEna( final nIgnReq=nIgnReq, - final nSchRow=nSchRow, - final schTab=schTab, final TOutLoc=TOutLoc, final plaOffThrTim=plaOffThrTim, final plaOnThrTim=plaOnThrTim, @@ -1552,7 +1546,7 @@ equation 86,-128},{86,-152.933},{118,-152.933}}, color={255,127,0})); connect(plaReq, plaEna.supResReq) annotation (Line(points={{-420,350},{-360,350}, - {-360,334},{-342,334}}, color={255,127,0})); + {-360,330},{-342,330}}, color={255,127,0})); connect(reaToInt.u, triSam.y) annotation (Line(points={{-130,-40},{-138,-40}}, color={0,0,127})); @@ -1563,7 +1557,7 @@ equation {-80,-60},{-220,-60},{-220,-13},{-212,-13}}, color={255,127,0})); connect(TOut, plaEna.TOut) annotation (Line(points={{-420,310},{-360,310},{-360, - 326},{-342,326}}, + 324},{-342,324}}, color={0,0,127})); connect(TSupPri, staSetCon.THotWatSup) annotation (Line(points={{-420,270},{-240, 270},{-240,8},{-212,8}}, color={0,0,127})); @@ -1698,8 +1692,8 @@ equation connect(plaEna.yPla, priPumCon.uPlaEna) annotation (Line(points={{-318,330},{ -230,330},{-230,-78},{90,-78},{90,-158.533},{118,-158.533}}, color={255,0,255})); - connect(hotWatSupTemRes.TPlaHotWatSupSet, upProCon.THotWatSupSet) annotation - (Line(points={{-118,184},{-100,184},{-100,107},{118,107}}, color={0,0,127})); + connect(hotWatSupTemRes.TPlaHotWatSupSet, upProCon.THotWatSupSet) annotation ( + Line(points={{-118,184},{-100,184},{-100,107},{118,107}}, color={0,0,127})); connect(TRetPri, staSetCon.THotWatRetPri) annotation (Line(points={{-420,230}, {-260,230},{-260,-1},{-212,-1}}, color={0,0,127})); connect(TRetSec, staSetCon.THotWatRetSec) annotation (Line(points={{-420,150}, @@ -1859,16 +1853,18 @@ equation connect(plaEna.yPla, yPla) annotation (Line(points={{-318,330},{-230,330},{-230, 252},{-80,252},{-80,192},{380,192},{380,300},{420,300}}, color={255,0, 255})); + connect(uSchEna, plaEna.uSchEna) annotation (Line(points={{-420,420},{-350,420}, + {-350,336},{-342,336}}, color={255,0,255})); annotation (defaultComponentName="boiPlaCon", - Icon(coordinateSystem(extent={{-100,-340},{100,340}}), + Icon(coordinateSystem(extent={{-100,-360},{100,360}}), graphics={ Rectangle( - extent={{-100,-340},{100,340}}, + extent={{-100,-360},{100,360}}, lineColor={0,0,0}, fillColor={255,255,255}, fillPattern=FillPattern.Solid), Text( - extent={{-120,378},{100,338}}, + extent={{-120,400},{100,360}}, textColor={0,0,255}, textString="%name"), Rectangle( @@ -1882,7 +1878,7 @@ equation lineColor={175,175,175}, fillColor={175,175,175}, fillPattern=FillPattern.Solid)}), Diagram( - coordinateSystem(preserveAspectRatio=false, extent={{-400,-620},{400,400}}), + coordinateSystem(preserveAspectRatio=false, extent={{-400,-580},{400,440}}), graphics={ Rectangle( extent={{-394,392},{-266,290}}, diff --git a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Generic/PlantEnable.mo b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Generic/PlantEnable.mo index fee4e54e247..35743bc2197 100644 --- a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Generic/PlantEnable.mo +++ b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Generic/PlantEnable.mo @@ -6,13 +6,6 @@ block PlantEnable final min=0) = 0 "Number of hot-water requests to be ignored before enablng boiler plant loop"; - parameter Integer nSchRow( - final min=1) = 4 - "Number of rows to be created for plant schedule table"; - - parameter Real schTab[nSchRow,2] = [0,1; 6,1; 18,1; 24,1] - "Table defining schedule for enabling plant"; - parameter Real TOutLoc( final unit="K", final displayUnit="K") = 300 @@ -40,10 +33,15 @@ block PlantEnable "Temperature deadband for boiler lockout" annotation (Dialog(tab="Advanced")); + Buildings.Controls.OBC.CDL.Interfaces.BooleanInput uSchEna + "Signal indicating if schedule allows plant to be enabled" + annotation (Placement(transformation(extent={{-200,-130},{-160,-90}}), + iconTransformation(extent={{-140,40},{-100,80}}))); + Buildings.Controls.OBC.CDL.Interfaces.IntegerInput supResReq "Number of heating hot-water requests" annotation (Placement(transformation(extent={{-200,30},{-160,70}}), - iconTransformation(extent={{-140,20},{-100,60}}))); + iconTransformation(extent={{-140,-20},{-100,20}}))); Buildings.Controls.OBC.CDL.Interfaces.RealInput TOut( final unit="K", @@ -51,20 +49,13 @@ block PlantEnable final quantity="ThermodynamicTemperature") "Measured outdoor air temperature" annotation (Placement(transformation(extent={{-200,-40},{-160,0}}), - iconTransformation(extent={{-140,-60},{-100,-20}}))); + iconTransformation(extent={{-140,-80},{-100,-40}}))); Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput yPla "Plant enable signal" annotation (Placement(transformation(extent={{160,-20},{200,20}}), iconTransformation(extent={{100,-20},{140,20}}))); - Buildings.Controls.OBC.CDL.Continuous.Sources.TimeTable enaSch( - final table=schTab, - final smoothness=Buildings.Controls.OBC.CDL.Types.Smoothness.ConstantSegments, - final timeScale=3600) - "Table defining when plant can be enabled" - annotation (Placement(transformation(extent={{-150,-120},{-130,-100}}))); - Buildings.Controls.OBC.CDL.Logical.Timer tim(t=plaOnThrTim) "Time since plant has been enabled" annotation (Placement(transformation(extent={{10,0},{30,20}}))); @@ -79,11 +70,6 @@ protected "Invert signal for subtraction" annotation (Placement(transformation(extent={{-152,-30},{-132,-10}}))); - Buildings.Controls.OBC.CDL.Continuous.GreaterThreshold greThr( - final t=0.5) - "Check if schedule lets the controller enable the plant or not" - annotation (Placement(transformation(extent={{-120,-120},{-100,-100}}))); - Buildings.Controls.OBC.CDL.Integers.GreaterThreshold intGreThr( final t=nIgnReq) "Check if number of requests is greater than number of requests to be ignored" @@ -145,8 +131,6 @@ protected equation connect(yPla, yPla) annotation (Line(points={{180,0},{180,0}}, color={255,0,255})); - connect(greThr.y, not1.u) - annotation (Line(points={{-98,-110},{-12,-110}}, color={255,0,255})); connect(hys.u, addPar.y) annotation (Line(points={{-122,-50},{-128,-50},{-128, -34},{-96,-34},{-96,-20},{-98,-20}}, color={0,0,127})); connect(not3.y, tim1.u) @@ -159,13 +143,10 @@ equation {-72,-30}}, color={255,0,255})); connect(pre1.y, not4.u) annotation (Line(points={{-38,50},{-30,50},{-30,70},{-22, 70}}, color={255,0,255})); - connect(greThr.y, mulAnd.u[1]) annotation (Line(points={{-98,-110},{-92,-110}, - {-92,125.25},{78,125.25}}, - color={255,0,255})); - connect(hys.y, mulAnd.u[2]) annotation (Line(points={{-98,-50},{-86,-50},{-86, - 121.75},{78,121.75}}, color={255,0,255})); - connect(intGreThr.y, mulAnd.u[3]) annotation (Line(points={{-98,50},{-80,50},{ - -80,118.25},{78,118.25}}, color={255,0,255})); + connect(hys.y, mulAnd.u[1]) annotation (Line(points={{-98,-50},{-86,-50},{-86, + 125.25},{78,125.25}}, color={255,0,255})); + connect(intGreThr.y, mulAnd.u[2]) annotation (Line(points={{-98,50},{-80,50},{ + -80,121.75},{78,121.75}}, color={255,0,255})); connect(mulAnd.y, lat.u) annotation (Line(points={{102,120},{110,120},{110,0}, {118,0}}, color={255,0,255})); connect(and2.y, lat.clr) annotation (Line(points={{102,-30},{110,-30},{110,-6}, @@ -185,10 +166,8 @@ equation 30},{-70,50},{-62,50}}, color={255,0,255})); connect(pre1.y, tim.u) annotation (Line(points={{-38,50},{-30,50},{-30,10},{8, 10}}, color={255,0,255})); - connect(enaSch.y[1], greThr.u) - annotation (Line(points={{-128,-110},{-122,-110}}, color={0,0,127})); - connect(tim2.passed, mulAnd.u[4]) annotation (Line(points={{32,62},{60,62},{60, - 114},{78,114},{78,114.75}}, color={255,0,255})); + connect(tim2.passed, mulAnd.u[3]) annotation (Line(points={{32,62},{40,62},{40, + 118},{78,118},{78,118.25}}, color={255,0,255})); connect(tim.passed, and2.u1) annotation (Line(points={{32,2},{70,2},{70,-30},{ 78,-30}}, color={255,0,255})); connect(tim1.passed, mulOr.u[3]) annotation (Line(points={{-18,-38},{20,-38}, @@ -197,6 +176,10 @@ equation annotation (Line(points={{-122,-20},{-130,-20}}, color={0,0,127})); connect(TOut, gai.u) annotation (Line(points={{-180,-20},{-154,-20}}, color={0,0,127})); + connect(uSchEna, not1.u) + annotation (Line(points={{-180,-110},{-12,-110}}, color={255,0,255})); + connect(uSchEna, mulAnd.u[4]) annotation (Line(points={{-180,-110},{-92,-110}, + {-92,114.75},{78,114.75}}, color={255,0,255})); annotation (defaultComponentName = "plaEna", Icon(graphics={ Rectangle( diff --git a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Generic/Validation/PlantEnable.mo b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Generic/Validation/PlantEnable.mo index 3f64d5b9f4b..f96fd144b59 100644 --- a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Generic/Validation/PlantEnable.mo +++ b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Generic/Validation/PlantEnable.mo @@ -1,12 +1,17 @@ within Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Generic.Validation; -model PlantEnable "Validation model for PlantEnable sequence" +model PlantEnable + "Validation model for PlantEnable sequence" + + parameter Integer nSchRow( + final min=1) = 4 + "Number of rows to be created for plant schedule table"; + + parameter Real schTab[nSchRow,2] = [0,1; 6,1; 18,1; 24,1] + "Table defining schedule for enabling plant"; Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Generic.PlantEnable plaEna( - final nIgnReq=2, - final plaOffThrTim=15*60, - final plaOnThrTim=15*60, - final schTab=[0,0; 1,1; 18,1; 24,1]) + final nIgnReq=2) "Testing time-variance for all inputs" annotation (Placement(transformation(extent={{-20,50},{0,70}}))); @@ -24,12 +29,18 @@ model PlantEnable "Validation model for PlantEnable sequence" Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Generic.PlantEnable plaEna3( - final nIgnReq=2, - final schTab=[0,0; 1,1; 18,1; 24,1]) + final nIgnReq=2) "Testing time-varying boiler plant enable schedule" annotation (Placement(transformation(extent={{80,-50},{100,-30}}))); protected + Buildings.Controls.OBC.CDL.Continuous.Sources.TimeTable enaSch( + final table=schTab, + final smoothness=Buildings.Controls.OBC.CDL.Types.Smoothness.ConstantSegments, + final timeScale=3600) + "Table defining when plant can be enabled" + annotation (Placement(transformation(extent={{-110,110},{-90,130}}))); + Buildings.Controls.OBC.CDL.Continuous.Sources.Sine sin( final amplitude=2, final freqHz=1/(6*60), @@ -100,6 +111,11 @@ protected "Input for outdoor air temperature" annotation (Placement(transformation(extent={{10,-70},{30,-50}}))); + Buildings.Controls.OBC.CDL.Continuous.GreaterThreshold greThr( + final t=0.5) + "Check if schedule lets the controller enable the plant or not" + annotation (Placement(transformation(extent={{-80,110},{-60,130}}))); + equation connect(sin.y, reaToInt.u) annotation (Line(points={{-68,80},{-62,80}}, @@ -114,31 +130,41 @@ equation annotation (Line(points={{38,-20},{32,-20}}, color={0,0,127})); connect(plaEna1.supResReq, reaToInt1.y) - annotation (Line(points={{-22,-36},{-30,-36},{-30,-20},{-38,-20}}, + annotation (Line(points={{-22,-40},{-30,-40},{-30,-20},{-38,-20}}, color={255,127,0})); connect(plaEna2.supResReq, reaToInt2.y) - annotation (Line(points={{78,64},{70,64},{70,80},{62,80}}, + annotation (Line(points={{78,60},{70,60},{70,80},{62,80}}, color={255,127,0})); connect(plaEna2.TOut, sin5.y) - annotation (Line(points={{78,56},{70,56},{70,40},{32,40}}, + annotation (Line(points={{78,54},{70,54},{70,40},{32,40}}, color={0,0,127})); connect(plaEna3.supResReq, reaToInt3.y) - annotation (Line(points={{78,-36},{70,-36},{70,-20},{62,-20}}, + annotation (Line(points={{78,-40},{70,-40},{70,-20},{62,-20}}, color={255,127,0})); connect(plaEna3.TOut, con3.y) - annotation (Line(points={{78,-44},{70,-44},{70,-60},{32,-60}}, + annotation (Line(points={{78,-46},{70,-46},{70,-60},{32,-60}}, color={0,0,127})); connect(reaToInt.y, plaEna.supResReq) - annotation (Line(points={{-38,80},{-30,80},{-30,64},{-22,64}}, + annotation (Line(points={{-38,80},{-30,80},{-30,60},{-22,60}}, color={255,127,0})); connect(sin1.y, plaEna.TOut) - annotation (Line(points={{-68,40},{-30,40},{-30,56},{-22,56}}, + annotation (Line(points={{-68,40},{-30,40},{-30,54},{-22,54}}, color={0,0,127})); connect(con1.y, plaEna1.TOut) - annotation (Line(points={{-68,-60},{-30,-60},{-30,-44},{-22,-44}}, + annotation (Line(points={{-68,-60},{-30,-60},{-30,-46},{-22,-46}}, color={0,0,127})); + connect(enaSch.y[1], greThr.u) + annotation (Line(points={{-88,120},{-82,120}}, color={0,0,127})); + connect(greThr.y, plaEna.uSchEna) annotation (Line(points={{-58,120},{-26,120}, + {-26,66},{-22,66}}, color={255,0,255})); + connect(greThr.y, plaEna1.uSchEna) annotation (Line(points={{-58,120},{-26,120}, + {-26,-34},{-22,-34}}, color={255,0,255})); + connect(greThr.y, plaEna2.uSchEna) annotation (Line(points={{-58,120},{74,120}, + {74,66},{78,66}}, color={255,0,255})); + connect(greThr.y, plaEna3.uSchEna) annotation (Line(points={{-58,120},{74,120}, + {74,-34},{78,-34}}, color={255,0,255})); annotation ( - Icon(coordinateSystem(preserveAspectRatio=false), + Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},{100,100}}), graphics={Ellipse( lineColor = {75,138,73}, fillColor={255,255,255}, @@ -151,7 +177,7 @@ equation fillPattern = FillPattern.Solid, points={{-36,60},{64,0},{-36,-60},{-36,60}})}), Diagram(coordinateSystem( - preserveAspectRatio=false), + preserveAspectRatio=false, extent={{-140,-140},{140,140}}), graphics={Text( extent={{-72,26},{-24,18}}, textColor={28,108,200}, diff --git a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Validation/Controller.mo b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Validation/Controller.mo index c70da3b199e..011376162d5 100644 --- a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Validation/Controller.mo +++ b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Validation/Controller.mo @@ -2,6 +2,13 @@ within Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Validation; model Controller "Validation model for boiler plant control sequence" + parameter Integer nSchRow( + final min=1) = 4 + "Number of rows to be created for plant schedule table"; + + parameter Real schTab[nSchRow,2] = [0,1; 6,1; 18,1; 24,1] + "Table defining schedule for enabling plant"; + Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Controller controller( final have_priOnl=true, final nBoi=2, @@ -347,146 +354,193 @@ protected "Measured hot water volume flowrate in secondary loop" annotation (Placement(transformation(extent={{140,-100},{160,-80}}))); + Buildings.Controls.OBC.CDL.Continuous.GreaterThreshold greThr( + final t=0.5) + "Check if schedule lets the controller enable the plant or not" + annotation (Placement(transformation(extent={{-300,190},{-280,210}}))); + + Buildings.Controls.OBC.CDL.Continuous.Sources.TimeTable enaSch( + final table=schTab, + final smoothness=Buildings.Controls.OBC.CDL.Types.Smoothness.ConstantSegments, + final timeScale=3600) + "Table defining when plant can be enabled" + annotation (Placement(transformation(extent={{-340,190},{-320,210}}))); + equation - connect(TOut.y, controller.TOut) annotation (Line(points={{-318,100},{-262,100}}, + connect(TOut.y, controller.TOut) annotation (Line(points={{-318,100},{-290, + 100},{-290,98.5556},{-262,98.5556}}, color={0,0,127})); - connect(uBoiAva.y, controller.uBoiAva) annotation (Line(points={{-318,-50},{-288, - -50},{-288,82},{-262,82}}, color={255,0,255})); + connect(uBoiAva.y, controller.uBoiAva) annotation (Line(points={{-318,-50},{ + -288,-50},{-288,81.5556},{-262,81.5556}}, + color={255,0,255})); - connect(TSup.y, controller.TSupPri) annotation (Line(points={{-318,70},{-310,70}, - {-310,97},{-262,97}}, color={0,0,127})); + connect(TSup.y, controller.TSupPri) annotation (Line(points={{-318,70},{-310, + 70},{-310,95.7222},{-262,95.7222}}, + color={0,0,127})); - connect(TRet.y, controller.TRetPri) annotation (Line(points={{-318,40},{-300,40}, - {-300,94},{-262,94}}, color={0,0,127})); + connect(TRet.y, controller.TRetPri) annotation (Line(points={{-318,40},{-300, + 40},{-300,92.8889},{-262,92.8889}}, + color={0,0,127})); connect(dPHotWat.y, controller.dpHotWatPri_rem) annotation (Line(points={{-318, - -20},{-294,-20},{-294,85},{-262,85}}, color={0,0,127})); + -20},{-294,-20},{-294,84.3889},{-262,84.3889}}, + color={0,0,127})); connect(VHotWat_flow[4].y, controller.VHotWatPri_flow) annotation (Line( - points={{-318,10},{-298,10},{-298,91},{-262,91}}, color={0,0,127})); + points={{-318,10},{-298,10},{-298,90.0556},{-262,90.0556}}, + color={0,0,127})); connect(sin.y, reaToInt.u) annotation (Line(points={{-318,130},{-302,130}}, color={0,0,127})); - connect(TOut1.y, controller1.TOut) annotation (Line(points={{-58,100},{-2,100}}, + connect(TOut1.y, controller1.TOut) annotation (Line(points={{-58,100},{-30, + 100},{-30,98.5556},{-2,98.5556}}, color={0,0,127})); - connect(uBoiAva1.y, controller1.uBoiAva) annotation (Line(points={{-58,-50},{-34, - -50},{-34,82},{-2,82}}, color={255,0,255})); + connect(uBoiAva1.y, controller1.uBoiAva) annotation (Line(points={{-58,-50},{ + -34,-50},{-34,81.5556},{-2,81.5556}}, + color={255,0,255})); - connect(TSup1.y, controller1.TSupPri) annotation (Line(points={{-58,70},{-50,70}, - {-50,97},{-2,97}}, color={0,0,127})); + connect(TSup1.y, controller1.TSupPri) annotation (Line(points={{-58,70},{-50, + 70},{-50,95.7222},{-2,95.7222}}, + color={0,0,127})); - connect(TRet1.y, controller1.TRetPri) annotation (Line(points={{-58,40},{-40,40}, - {-40,94},{-2,94}}, color={0,0,127})); + connect(TRet1.y, controller1.TRetPri) annotation (Line(points={{-58,40},{-40, + 40},{-40,92.8889},{-2,92.8889}}, + color={0,0,127})); connect(VHotWat_flow1[4].y, controller1.VHotWatPri_flow) annotation (Line( - points={{-58,10},{-38,10},{-38,91},{-2,91}}, color={0,0,127})); + points={{-58,10},{-38,10},{-38,90.0556},{-2,90.0556}}, + color={0,0,127})); connect(sin1.y, reaToInt1.u) annotation (Line(points={{-58,130},{-42,130}}, color={0,0,127})); connect(VHotWatSec_flow.y, controller1.VHotWatSec_flow) annotation (Line( - points={{-58,-90},{-30,-90},{-30,79},{-2,79}}, + points={{-58,-90},{-30,-90},{-30,78.7222},{-2,78.7222}}, color={0,0,127})); connect(dPHotWat1.y, controller1.dpHotWatSec_rem) annotation (Line(points={{-58,-20}, - {-26,-20},{-26,66},{-2,66}}, color={0,0,127})); + {-26,-20},{-26,66.4444},{-2,66.4444}}, + color={0,0,127})); - connect(TRet1.y, controller1.TRetSec) annotation (Line(points={{-58,40},{-40,40}, - {-40,88},{-2,88}}, color={0,0,127})); + connect(TRet1.y, controller1.TRetSec) annotation (Line(points={{-58,40},{-40, + 40},{-40,87.2222},{-2,87.2222}}, + color={0,0,127})); - connect(TOut2.y,controller2. TOut) annotation (Line(points={{162,100},{218,100}}, + connect(TOut2.y,controller2. TOut) annotation (Line(points={{162,100},{190, + 100},{190,98.5556},{218,98.5556}}, color={0,0,127})); - connect(uBoiAva2.y,controller2. uBoiAva) annotation (Line(points={{162,-50},{192, - -50},{192,82},{218,82}},color={255,0,255})); + connect(uBoiAva2.y,controller2. uBoiAva) annotation (Line(points={{162,-50},{ + 192,-50},{192,81.5556},{218,81.5556}}, + color={255,0,255})); - connect(TSup2.y,controller2. TSupPri) annotation (Line(points={{162,70},{170,70}, - {170,97},{218,97}}, color={0,0,127})); + connect(TSup2.y,controller2. TSupPri) annotation (Line(points={{162,70},{170, + 70},{170,95.7222},{218,95.7222}}, + color={0,0,127})); - connect(TRet2.y,controller2. TRetPri) annotation (Line(points={{162,40},{180,40}, - {180,94},{218,94}}, color={0,0,127})); + connect(TRet2.y,controller2. TRetPri) annotation (Line(points={{162,40},{180, + 40},{180,92.8889},{218,92.8889}}, + color={0,0,127})); connect(VHotWat_flow2[4].y,controller2. VHotWatPri_flow) annotation (Line( - points={{162,10},{182,10},{182,91},{218,91}}, color={0,0,127})); + points={{162,10},{182,10},{182,90.0556},{218,90.0556}}, + color={0,0,127})); connect(sin2.y,reaToInt2. u) annotation (Line(points={{162,130},{178,130}}, color={0,0,127})); connect(VHotWatSec_flow1.y, controller2.VHotWatSec_flow) annotation (Line( - points={{162,-90},{196,-90},{196,79},{218,79}}, color={0,0,127})); + points={{162,-90},{196,-90},{196,78.7222},{218,78.7222}}, + color={0,0,127})); connect(dPHotWat2.y,controller2. dpHotWatSec_rem) annotation (Line(points={{162,-20}, - {200,-20},{200,66},{218,66}}, color={0,0,127})); + {200,-20},{200,66.4444},{218,66.4444}}, + color={0,0,127})); - connect(TRet2.y,controller2. TRetSec) annotation (Line(points={{162,40},{180,40}, - {180,88},{218,88}}, color={0,0,127})); + connect(TRet2.y,controller2. TRetSec) annotation (Line(points={{162,40},{180, + 40},{180,87.2222},{218,87.2222}}, + color={0,0,127})); - connect(controller.yBoi, truDel.u) annotation (Line(points={{-238,84},{-230, - 84},{-230,140},{-222,140}}, + connect(controller.yBoi, truDel.u) annotation (Line(points={{-238,83.4444},{ + -230,83.4444},{-230,140},{-222,140}}, color={255,0,255})); - connect(controller.yPriPum, truDel1.u) annotation (Line(points={{-238,68},{ - -230,68},{-230,50},{-222,50}}, + connect(controller.yPriPum, truDel1.u) annotation (Line(points={{-238,68.3333}, + {-230,68.3333},{-230,50},{-222,50}}, color={255,0,255})); - connect(controller.yBypValPos, uniDel.u) annotation (Line(points={{-238,72},{ - -224,72},{-224,80},{-222,80}}, + connect(controller.yBypValPos, uniDel.u) annotation (Line(points={{-238, + 72.1111},{-224,72.1111},{-224,80},{-222,80}}, color={0,0,127})); - connect(uniDel.y, controller.uBypValPos) annotation (Line(points={{-198,80},{-150, - 80},{-150,20},{-272,20},{-272,45},{-262,45}}, color={0,0,127})); - connect(controller.yHotWatIsoVal, uniDel1.u) annotation (Line(points={{-238,76}, - {-226,76},{-226,110},{-222,110}}, color={0,0,127})); - connect(uniDel1.y, controller.uHotWatIsoVal) annotation (Line(points={{-198,110}, - {-144,110},{-144,-16},{-278,-16},{-278,48},{-262,48}}, color={0,0,127})); - connect(controller1.yBoi, truDel2.u) annotation (Line(points={{22,84},{26,84}, - {26,140},{38,140}}, color={255,0,255})); - connect(controller1.yHotWatIsoVal, uniDel2.u) annotation (Line(points={{22,76}, - {28,76},{28,110},{38,110}}, color={0,0,127})); - connect(controller1.yPriPum, truDel3.u) annotation (Line(points={{22,68},{34, - 68},{34,70},{38,70}}, + connect(uniDel.y, controller.uBypValPos) annotation (Line(points={{-198,80},{ + -150,80},{-150,20},{-272,20},{-272,46.6111},{-262,46.6111}}, + color={0,0,127})); + connect(controller.yHotWatIsoVal, uniDel1.u) annotation (Line(points={{-238, + 75.8889},{-226,75.8889},{-226,110},{-222,110}}, + color={0,0,127})); + connect(uniDel1.y, controller.uHotWatIsoVal) annotation (Line(points={{-198, + 110},{-144,110},{-144,-16},{-278,-16},{-278,49.4444},{-262,49.4444}}, + color={0,0,127})); + connect(controller1.yBoi, truDel2.u) annotation (Line(points={{22,83.4444},{ + 26,83.4444},{26,140},{38,140}}, + color={255,0,255})); + connect(controller1.yHotWatIsoVal, uniDel2.u) annotation (Line(points={{22, + 75.8889},{28,75.8889},{28,110},{38,110}}, + color={0,0,127})); + connect(controller1.yPriPum, truDel3.u) annotation (Line(points={{22,68.3333}, + {34,68.3333},{34,70},{38,70}}, color={255,0,255})); connect(uniDel2.y, controller1.uHotWatIsoVal) annotation (Line(points={{62,110}, - {106,110},{106,-16},{-18,-16},{-18,48},{-2,48}}, color={0,0,127})); - connect(controller1.ySecPum, truDel4.u) annotation (Line(points={{22,60},{30, - 60},{30,10},{38,10}}, + {106,110},{106,-16},{-18,-16},{-18,49.4444},{-2,49.4444}}, + color={0,0,127})); + connect(controller1.ySecPum, truDel4.u) annotation (Line(points={{22,60.7778}, + {30,60.7778},{30,10},{38,10}}, color={255,0,255})); connect(reaRep.y, uniDel4.u) annotation (Line(points={{62,40},{68,40}}, color={0,0,127})); - connect(controller1.yPriPumSpe, reaRep.u) annotation (Line(points={{22,64},{ - 32,64},{32,40},{38,40}}, + connect(controller1.yPriPumSpe, reaRep.u) annotation (Line(points={{22, + 64.5556},{32,64.5556},{32,40},{38,40}}, color={0,0,127})); - connect(uniDel4.y, controller1.uPriPumSpe) annotation (Line(points={{92,40},{96, - 40},{96,-10},{-6,-10},{-6,42},{-2,42}}, color={0,0,127})); - connect(controller2.yBoi, truDel5.u) annotation (Line(points={{242,84},{250, - 84},{250,130},{258,130}}, + connect(uniDel4.y, controller1.uPriPumSpe) annotation (Line(points={{92,40},{ + 96,40},{96,-10},{-6,-10},{-6,43.7778},{-2,43.7778}}, + color={0,0,127})); + connect(controller2.yBoi, truDel5.u) annotation (Line(points={{242,83.4444},{ + 250,83.4444},{250,130},{258,130}}, color={255,0,255})); connect(truDel6.u, controller2.yPriPum) annotation (Line(points={{258,100},{ - 254,100},{254,68},{242,68}}, + 254,100},{254,68.3333},{242,68.3333}}, color={255,0,255})); connect(reaRep1.y, uniDel3.u) annotation (Line(points={{282,70},{288,70}}, color={0,0,127})); - connect(controller2.yPriPumSpe, reaRep1.u) annotation (Line(points={{242,64}, - {254,64},{254,70},{258,70}},color={0,0,127})); - connect(uniDel3.y, controller2.uPriPumSpe) annotation (Line(points={{312,70},{ - 320,70},{320,10},{216,10},{216,42},{218,42}}, color={0,0,127})); - connect(controller2.ySecPum, truDel7.u) annotation (Line(points={{242,60},{ - 252,60},{252,40},{258,40}}, + connect(controller2.yPriPumSpe, reaRep1.u) annotation (Line(points={{242, + 64.5556},{254,64.5556},{254,70},{258,70}}, + color={0,0,127})); + connect(uniDel3.y, controller2.uPriPumSpe) annotation (Line(points={{312,70}, + {320,70},{320,10},{216,10},{216,43.7778},{218,43.7778}}, + color={0,0,127})); + connect(controller2.ySecPum, truDel7.u) annotation (Line(points={{242,60.7778}, + {252,60.7778},{252,40},{258,40}}, color={255,0,255})); - connect(conInt.y, controller.TSupResReq) annotation (Line(points={{-318,160},{ - -266,160},{-266,106},{-262,106}}, color={255,127,0})); + connect(conInt.y, controller.TSupResReq) annotation (Line(points={{-318,160}, + {-266,160},{-266,104.222},{-262,104.222}}, + color={255,127,0})); connect(conInt.y, controller1.TSupResReq) annotation (Line(points={{-318,160}, - {-6,160},{-6,106},{-2,106}}, color={255,127,0})); + {-6,160},{-6,104.222},{-2,104.222}}, + color={255,127,0})); connect(conInt.y, controller2.TSupResReq) annotation (Line(points={{-318,160}, - {212,160},{212,106},{218,106}}, color={255,127,0})); + {212,160},{212,104.222},{218,104.222}}, + color={255,127,0})); connect(truDel.y, pre1.u) annotation (Line(points={{-198,140},{-192,140}}, color={255,0,255})); - connect(pre1.y, controller.uBoi) annotation (Line(points={{-168,140},{-130,140}, - {-130,-30},{-284,-30},{-284,57},{-262,57}}, color={255,0,255})); + connect(pre1.y, controller.uBoi) annotation (Line(points={{-168,140},{-130, + 140},{-130,-30},{-284,-30},{-284,57.9444},{-262,57.9444}}, + color={255,0,255})); connect(pre2.u, truDel1.y) annotation (Line(points={{-192,50},{-198,50}}, color={255,0,255})); - connect(pre2.y, controller.uPriPum) annotation (Line(points={{-168,50},{-154,50}, - {-154,8},{-274,8},{-274,54},{-262,54}}, color={255,0,255})); + connect(pre2.y, controller.uPriPum) annotation (Line(points={{-168,50},{-154, + 50},{-154,8},{-274,8},{-274,55.1111},{-262,55.1111}}, + color={255,0,255})); connect(truDel2.y, pre3.u) annotation (Line(points={{62,140},{68,140}}, color={255,0,255})); connect(truDel3.y, pre4.u) @@ -494,29 +548,49 @@ equation connect(truDel4.y, pre5.u) annotation (Line(points={{62,10},{68,10}}, color={255,0,255})); connect(pre5.y, controller1.uSecPum) annotation (Line(points={{92,10},{100,10}, - {100,-12},{-14,-12},{-14,51},{-2,51}}, color={255,0,255})); + {100,-12},{-14,-12},{-14,52.2778},{-2,52.2778}}, + color={255,0,255})); connect(pre4.y, controller1.uPriPum) annotation (Line(points={{92,70},{108,70}, - {108,-20},{-10,-20},{-10,54},{-2,54}}, color={255,0,255})); + {108,-20},{-10,-20},{-10,55.1111},{-2,55.1111}}, + color={255,0,255})); connect(pre3.y, controller1.uBoi) annotation (Line(points={{92,140},{110,140}, - {110,-22},{-20,-22},{-20,57},{-2,57}}, color={255,0,255})); + {110,-22},{-20,-22},{-20,57.9444},{-2,57.9444}}, + color={255,0,255})); connect(pre6.u, truDel5.y) annotation (Line(points={{288,130},{282,130}}, color={255,0,255})); connect(pre6.y, controller2.uBoi) annotation (Line(points={{312,130},{340,130}, - {340,0},{202,0},{202,57},{218,57}}, color={255,0,255})); + {340,0},{202,0},{202,57.9444},{218,57.9444}}, + color={255,0,255})); connect(pre7.u, truDel6.y) annotation (Line(points={{288,100},{282,100}}, color={255,0,255})); - connect(pre7.y, controller2.uPriPum) annotation (Line(points={{312,100},{338,100}, - {338,2},{204,2},{204,54},{218,54}}, color={255,0,255})); + connect(pre7.y, controller2.uPriPum) annotation (Line(points={{312,100},{338, + 100},{338,2},{204,2},{204,55.1111},{218,55.1111}}, + color={255,0,255})); connect(truDel7.y, pre8.u) annotation (Line(points={{282,40},{288,40}}, color={255,0,255})); - connect(pre8.y, controller2.uSecPum) annotation (Line(points={{312,40},{336,40}, - {336,4},{206,4},{206,51},{218,51}}, color={255,0,255})); + connect(pre8.y, controller2.uSecPum) annotation (Line(points={{312,40},{336, + 40},{336,4},{206,4},{206,52.2778},{218,52.2778}}, + color={255,0,255})); connect(reaToInt.y, controller.plaReq) annotation (Line(points={{-278,130},{ - -272,130},{-272,103},{-262,103}}, color={255,127,0})); + -272,130},{-272,101.389},{-262,101.389}}, + color={255,127,0})); connect(reaToInt1.y, controller1.plaReq) annotation (Line(points={{-18,130},{ - -12,130},{-12,103},{-2,103}}, color={255,127,0})); + -12,130},{-12,101.389},{-2,101.389}}, + color={255,127,0})); connect(reaToInt2.y, controller2.plaReq) annotation (Line(points={{202,130},{ - 208,130},{208,103},{218,103}}, color={255,127,0})); + 208,130},{208,101.389},{218,101.389}}, + color={255,127,0})); + connect(enaSch.y[1], greThr.u) + annotation (Line(points={{-318,200},{-302,200}}, color={0,0,127})); + connect(greThr.y, controller.uSchEna) annotation (Line(points={{-278,200},{ + -264,200},{-264,107.056},{-262,107.056}}, + color={255,0,255})); + connect(greThr.y, controller1.uSchEna) annotation (Line(points={{-278,200},{ + -4,200},{-4,108},{-2,108},{-2,107.056}}, + color={255,0,255})); + connect(greThr.y, controller2.uSchEna) annotation (Line(points={{-278,200},{ + 216,200},{216,107.056},{218,107.056}}, + color={255,0,255})); annotation ( Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},{100,100}}), graphics={Ellipse( From 94b090867c1df46fefe22997bfeb18f6c6f8068c Mon Sep 17 00:00:00 2001 From: Devaprasad Date: Thu, 15 Jun 2023 02:26:31 -0700 Subject: [PATCH 17/20] Fixed typos in comments and added missing comments --- .../BoilerPlant/Staging/SetPoints/Subsequences/Down.mo | 4 ++-- .../Staging/SetPoints/Subsequences/EfficiencyCondition.mo | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/Down.mo b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/Down.mo index a60c5085e1d..d5ce52f41d0 100644 --- a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/Down.mo +++ b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/Down.mo @@ -236,12 +236,12 @@ block Down protected Buildings.Controls.OBC.CDL.Continuous.AddParameter addParDivZer( final p=1e-6) - "Add small vcalue to input signal to prevent divide by zero" + "Add small value to input signal to prevent divide by zero" annotation (Placement(transformation(extent={{-166,10},{-146,30}}))); Buildings.Controls.OBC.CDL.Continuous.AddParameter addParDivZer1( final p=1e-6) - "Add small vcalue to input signal to prevent divide by zero" + "Add small value to input signal to prevent divide by zero" annotation (Placement(transformation(extent={{-166,-66},{-146,-46}}))); Buildings.Controls.OBC.CDL.Logical.Not not1 diff --git a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/EfficiencyCondition.mo b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/EfficiencyCondition.mo index f514b8cfabb..b824821e1f1 100644 --- a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/EfficiencyCondition.mo +++ b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Staging/SetPoints/Subsequences/EfficiencyCondition.mo @@ -97,12 +97,12 @@ block EfficiencyCondition protected Buildings.Controls.OBC.CDL.Continuous.AddParameter addParDivZer( final p=1e-6) - "Add small vcalue to input signal to prevent divide by zero" + "Add small value to input signal to prevent divide by zero" annotation (Placement(transformation(extent={{-110,90},{-90,110}}))); Buildings.Controls.OBC.CDL.Continuous.AddParameter addParDivZer1( final p=1e-6) - "Add small vcalue to input signal to prevent divide by zero" + "Add small value to input signal to prevent divide by zero" annotation (Placement(transformation(extent={{-112,10},{-92,30}}))); Buildings.Controls.OBC.CDL.Continuous.Divide div @@ -111,6 +111,7 @@ protected Buildings.Controls.OBC.CDL.Continuous.AddParameter addPar( final p=1e-6) + "Add small value to input signal to prevent divide by zero" annotation (Placement(transformation(extent={{-80,-80},{-60,-60}}))); Buildings.Controls.OBC.CDL.Continuous.Divide div1 From 19107605b9816296b7381fc46660a544e3eca11f Mon Sep 17 00:00:00 2001 From: Devaprasad Date: Thu, 15 Jun 2023 14:16:05 -0700 Subject: [PATCH 18/20] Changed Boolean parameter names in line with changes being made at top-level controller --- .../Pumps/PrimaryPumps/Controller.mo | 61 +++++++++---------- .../PrimaryPumps/Subsequences/Speed_flow.mo | 24 ++++---- .../Subsequences/Speed_temperature.mo | 39 ++++++------ .../Pumps/SecondaryPumps/Controller.mo | 21 +++---- 4 files changed, 69 insertions(+), 76 deletions(-) diff --git a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Pumps/PrimaryPumps/Controller.mo b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Pumps/PrimaryPumps/Controller.mo index e58ecf17cde..6298c23fc74 100644 --- a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Pumps/PrimaryPumps/Controller.mo +++ b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Pumps/PrimaryPumps/Controller.mo @@ -6,43 +6,41 @@ block Controller "Type of controller" annotation (Dialog(tab="Pump control parameters", group="PID parameters")); - parameter Boolean have_heaPriPum = true + parameter Boolean have_heaPriPum "Flag of headered hot water pumps design: true=headered, false=dedicated" annotation (Dialog(group="Plant parameters")); - parameter Boolean have_priOnl = false + parameter Boolean have_priOnl "True: Plant is primary-only; False: Plant is primary-secondary" annotation (Dialog(group="Plant parameters")); - parameter Boolean have_varPriPum = false + parameter Boolean have_varPriPum "True: Variable-speed primary pumps; False: Fixed-speed primary pumps" annotation (Dialog(group="Plant parameters")); - parameter Boolean have_secFloSen = true - "True: Flowrate sensors in primary and secondary loops; - False: Flowrate sensor in decoupler" - annotation (Dialog(tab="Pump control parameters", - group="Flowrate-based speed regulation", + parameter Boolean use_priSecFloSen + "True: Use flowrate sensors in primary/secondary loops for speed regulation; + False: Flowrate sensor in decoupler leg for spoeed regulation" + annotation (Dialog(group="Plant parameters", enable= speConTyp == Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Types.PrimaryPumpSpeedControlTypes.flowrate)); - parameter Boolean have_priSecTemSen = true - "True: Temperature sensors in primary and secondary loops; - False: Temperature sensors in boiler supply and secondary loop" - annotation (Dialog(tab="Pump control parameters", - group="Temperature-based speed regulation", + parameter Boolean use_priTemSen + "True: Use Temperature sensors in primary loop for speed control; + False: Use temperature sensors in boiler supply for speed control" + annotation (Dialog(group="Plant parameters", enable= speConTyp == Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Types.PrimaryPumpSpeedControlTypes.temperature)); - parameter Integer nPum = 2 + parameter Integer nPum "Total number of hot water pumps" annotation (Dialog(group="Plant parameters")); - parameter Integer nBoi = 2 + parameter Integer nBoi "Total number of boilers" annotation (Dialog(group="Plant parameters")); - parameter Integer nSen = 2 + parameter Integer nSen "Total number of remote differential pressure sensors" annotation (Dialog(group="Plant parameters")); @@ -78,7 +76,7 @@ block Controller final min=1e-6, final unit="m3/s", displayUnit="m3/s", - final quantity="VolumeFlowRate") = 0.5 + final quantity="VolumeFlowRate") "Total plant design hot water flow rate" annotation (Dialog(group="Plant parameters")); @@ -86,7 +84,7 @@ block Controller final min=1e-6, final unit="m3/s", displayUnit="m3/s", - final quantity="VolumeFlowRate") = {0.5,0.5} + final quantity="VolumeFlowRate")= "Vector of design flowrates for all boilers in plant" annotation (Dialog(group="Plant parameters")); @@ -94,7 +92,7 @@ block Controller final unit="Pa", displayUnit="Pa", final quantity="PressureDifference", - final min=1e-6) = 5*6894.75 + final min=1e-6) "Maximum hot water loop local differential pressure setpoint" annotation (Dialog(tab="Pump control parameters", group="DP-based speed regulation", enable = speConTyp == Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Types.PrimaryPumpSpeedControlTypes.localDP)); @@ -103,7 +101,7 @@ block Controller final unit="Pa", displayUnit="Pa", final quantity="PressureDifference", - final min=1e-6) = 5*6894.75 + final min=1e-6) "Minimum hot water loop local differential pressure setpoint" annotation (Dialog(tab="Pump control parameters", group="DP-based speed regulation", @@ -340,7 +338,7 @@ block Controller Buildings.Controls.OBC.CDL.Interfaces.RealInput VHotWat_flow( final unit="m3/s", displayUnit="m3/s", - final quantity="VolumeFlowRate") + final quantity="VolumeFlowRate") if have_varPriPum "Hot water flow" annotation (Placement(transformation(extent={{-320,-40},{-280,0}}), iconTransformation(extent={{-140,150},{-100,190}}))); @@ -349,7 +347,7 @@ block Controller final unit="m3/s", displayUnit="m3/s", final quantity="VolumeFlowRate") if not have_priOnl and have_varPriPum - and floReg and have_secFloSen + and floReg and use_priSecFloSen "Measured hot water flowrate through secondary loop" annotation (Placement(transformation(extent={{-320,-600},{-280,-560}}), iconTransformation(extent={{-140,-190},{-100,-150}}))); @@ -358,7 +356,7 @@ block Controller final unit="m3/s", displayUnit="m3/s", final quantity="VolumeFlowRate") if not have_priOnl and have_varPriPum - and floReg and not have_secFloSen + and floReg and not use_priSecFloSen "Measured hot water flowrate through decoupler" annotation (Placement(transformation(extent={{-320,-630},{-280,-590}}), iconTransformation(extent={{-140,-220},{-100,-180}}))); @@ -367,8 +365,7 @@ block Controller final unit="K", displayUnit="K", final quantity="ThermodynamicTemperature") if not have_priOnl and - have_varPriPum and temReg and - have_priSecTemSen + have_varPriPum and temReg and use_priTemSen "Measured hot water temperature at primary loop supply" annotation (Placement(transformation(extent={{-320,-660},{-280,-620}}), iconTransformation(extent={{-140,-250},{-100,-210}}))); @@ -386,8 +383,7 @@ block Controller final unit=fill("K", nBoi), displayUnit=fill("K",nBoi), final quantity=fill("ThermodynamicTemperature",nBoi)) if not have_priOnl - and have_varPriPum and temReg and not - have_priSecTemSen + and have_varPriPum and temReg and not use_priTemSen "Measured hot water temperature at boiler supply" annotation (Placement(transformation(extent={{-320,-720},{-280,-680}}), iconTransformation(extent={{-140,-310},{-100,-270}}))); @@ -412,8 +408,7 @@ block Controller final timPer=timPer, final staCon=staCon, final relFloHys=relFloHys, - final VHotWat_flow_nominal=VHotWat_flow_nominal) if have_priOnl and - have_heaPriPum + final VHotWat_flow_nominal=VHotWat_flow_nominal) if have_priOnl and have_heaPriPum "Enable lag pump for primary-only plants using differential pressure pump speed control" annotation (Placement(transformation(extent={{-200,-10},{-180,10}}))); @@ -516,7 +511,7 @@ protected Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Pumps.PrimaryPumps.Subsequences.Speed_flow pumSpeFlo( final controllerType=controllerType, - final primarySecondarySensors=have_secFloSen, + final primarySecondarySensors=use_priSecFloSen, final nPum=nPum, final minPumSpe=minPumSpe, final maxPumSpe=maxPumSpe, @@ -530,7 +525,7 @@ protected Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Pumps.PrimaryPumps.Subsequences.Speed_temperature pumSpeTem( - final primarySecondarySensors=have_priSecTemSen, + final primarySecondarySensors=use_priTemSen, final nBoi=nBoi, final nPum=nPum, final numIgnReq=numIgnReq, @@ -1358,7 +1353,7 @@ The parameter values for valid pump configurations are as follows: NA - have_secFloSen + use_priSecFloSen NA NA TRUE @@ -1373,7 +1368,7 @@ The parameter values for valid pump configurations are as follows: NA - have_priSecTemSen + use_priTemSen NA NA NA diff --git a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Pumps/PrimaryPumps/Subsequences/Speed_flow.mo b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Pumps/PrimaryPumps/Subsequences/Speed_flow.mo index e68d3c4f1fa..323a2a3ef5d 100644 --- a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Pumps/PrimaryPumps/Subsequences/Speed_flow.mo +++ b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Pumps/PrimaryPumps/Subsequences/Speed_flow.mo @@ -6,9 +6,9 @@ block Speed_flow "Type of controller" annotation(Dialog(group="Speed controller")); - parameter Boolean primarySecondarySensors = true - "True: Flowrate sensors in primary and secondary circuits; - False: Flowrate sensor in decoupler"; + parameter Boolean use_priSecSen = true + "True: Use flowrate sensor in primary and secondary circuits for regulation; + False: Use flowrate sensor in decoupler for regulation"; parameter Integer nPum = 2 "Total number of hot water pumps"; @@ -64,7 +64,7 @@ block Speed_flow Buildings.Controls.OBC.CDL.Interfaces.RealInput VHotWatPri_flow( final unit="m3/s", displayUnit="m3/s", - final quantity="VolumeFlowRate") if primarySecondarySensors + final quantity="VolumeFlowRate") if use_priSecSen "Measured hot water flow rate through primary circuit" annotation (Placement(transformation(extent={{-160,-50},{-120,-10}}), iconTransformation(extent={{-140,-20},{-100,20}}))); @@ -72,7 +72,7 @@ block Speed_flow Buildings.Controls.OBC.CDL.Interfaces.RealInput VHotWatSec_flow( final unit="m3/s", displayUnit="m3/s", - final quantity="VolumeFlowRate") if primarySecondarySensors + final quantity="VolumeFlowRate") if use_priSecSen "Measured hot water flow rate through secondary circuit" annotation (Placement(transformation(extent={{-160,-80},{-120,-40}}), iconTransformation(extent={{-140,-70},{-100,-30}}))); @@ -80,7 +80,7 @@ block Speed_flow Buildings.Controls.OBC.CDL.Interfaces.RealInput VHotWatDec_flow( final unit="m3/s", displayUnit="m3/s", - final quantity="VolumeFlowRate") if not primarySecondarySensors + final quantity="VolumeFlowRate") if not use_priSecSen "Measured hot water flow rate through decoupler" annotation (Placement(transformation(extent={{-160,-120},{-120,-80}}), iconTransformation(extent={{-140,-70},{-100,-30}}))); @@ -113,11 +113,11 @@ protected "Pump speed" annotation (Placement(transformation(extent={{60,50},{80,70}}))); - Buildings.Controls.OBC.CDL.Continuous.Subtract sub2 if primarySecondarySensors + Buildings.Controls.OBC.CDL.Continuous.Subtract sub2 if use_priSecSen "Compare measured flowrate in primary and secondary loops" annotation (Placement(transformation(extent={{-100,-50},{-80,-30}}))); - Buildings.Controls.OBC.CDL.Continuous.Divide div if primarySecondarySensors + Buildings.Controls.OBC.CDL.Continuous.Divide div if use_priSecSen "Normalize flow-rate value" annotation (Placement(transformation(extent={{-60,-80},{-40,-60}}))); @@ -151,12 +151,12 @@ protected annotation (Placement(transformation(extent={{80,90},{100,110}}))); Buildings.Controls.OBC.CDL.Continuous.AddParameter addPar( - final p=1e-6) if primarySecondarySensors + final p=1e-6) if use_priSecSen "Ensure divisor is non-zero" annotation (Placement(transformation(extent={{-100,-80},{-80,-60}}))); Buildings.Controls.OBC.CDL.Continuous.MultiplyByParameter gai( - final k=1/VHotWat_flow_nominal) if not primarySecondarySensors + final k=1/VHotWat_flow_nominal) if not use_priSecSen "Normalize flowrate" annotation (Placement(transformation(extent={{-60,-110},{-40,-90}}))); @@ -245,14 +245,14 @@ pump speed(maxPumSpe) at 100%.

  1. When the plant has flowrate sensors in the primary and secondary loops, -primarySecondarySensors = true, the measured flowrate in primary +use_priSecSen = true, the measured flowrate in primary loop VHotWatPri_flow and the measured flowrate in secondary loop VHotWatSec_flow is used to calculate the flow through the decoupler (VHotWatPri_flow - VHotWatSec_flow) and generate the control signal.
  2. When the plant has a flowrate sensor in the decoupler, -primarySecondarySensors = false, the measured flowrate through the +use_priSecSen = false, the measured flowrate through the decoupler is used to calculate the control signal.
diff --git a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Pumps/PrimaryPumps/Subsequences/Speed_temperature.mo b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Pumps/PrimaryPumps/Subsequences/Speed_temperature.mo index 341245aaed5..c1645c925f9 100644 --- a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Pumps/PrimaryPumps/Subsequences/Speed_temperature.mo +++ b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Pumps/PrimaryPumps/Subsequences/Speed_temperature.mo @@ -2,14 +2,14 @@ within Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Pumps.PrimaryPump block Speed_temperature "Pump speed control for primary-secondary plants where temperature sensors are available in the hot water circuit" - parameter Boolean primarySecondarySensors = true - "True: Temperature sensors in primary and secondary circuits; - False: Temperature sensors at boiler supply and in secondary circuit"; + parameter Boolean use_priSen = true + "True: Use temperature sensors in primary and secondary circuits for speed control; + False: Use temperature sensors at boiler supply and in secondary circuit for speed control"; - parameter Integer nBoi = 2 + parameter Integer nBoi "Total number of boilers"; - parameter Integer nPum = 2 + parameter Integer nPum "Total number of hot water pumps" annotation(Dialog(group="Pump parameters")); @@ -17,7 +17,7 @@ block Speed_temperature "Number of ignored requests" annotation(Dialog(group="Trim-and-Respond parameters")); - parameter Real boiDesFlo[nBoi]={0.5,0.5} + parameter Real boiDesFlo[nBoi] "Vector of design flowrates for all boilers in plant"; parameter Real minPumSpe( @@ -96,7 +96,7 @@ block Speed_temperature "Higher limit of hysteresis loop sending one request" annotation(Dialog(group="Hysteresis loop parameters for request generation")); - Buildings.Controls.OBC.CDL.Interfaces.BooleanInput uBoiSta[nBoi] if not primarySecondarySensors + Buildings.Controls.OBC.CDL.Interfaces.BooleanInput uBoiSta[nBoi] if not use_priSen "Boiler status vector" annotation (Placement(transformation(extent={{-160,-70},{-120,-30}}), iconTransformation(extent={{-140,-60},{-100,-20}}))); @@ -109,7 +109,7 @@ block Speed_temperature Buildings.Controls.OBC.CDL.Interfaces.RealInput THotWatPri( final unit="K", displayUnit="K", - final quantity="ThermodynamicTemperature") if primarySecondarySensors + final quantity="ThermodynamicTemperature") if use_priSen "Measured hot water temperature in primary circuit" annotation (Placement(transformation(extent={{-160,30},{-120,70}}), iconTransformation(extent={{-140,20},{-100,60}}))); @@ -125,7 +125,7 @@ block Speed_temperature Buildings.Controls.OBC.CDL.Interfaces.RealInput THotWatBoiSup[nBoi]( final unit=fill("K",nBoi), displayUnit=fill("K",nBoi), - final quantity=fill("ThermodynamicTemperature",nBoi)) if not primarySecondarySensors + final quantity=fill("ThermodynamicTemperature",nBoi)) if not use_priSen "Measured hot water temperature at boiler supply" annotation (Placement(transformation(extent={{-160,-130},{-120,-90}}), iconTransformation(extent={{-140,-100},{-100,-60}}))); @@ -145,7 +145,7 @@ block Speed_temperature Buildings.Controls.OBC.CDL.Continuous.MultiSum mulSum1( final k=fill(1, nBoi), - final nin=nBoi) if not primarySecondarySensors + final nin=nBoi) if not use_priSen "Weighted average of boiler supply temperatures" annotation (Placement(transformation(extent={{80,-90},{100,-70}}))); @@ -195,23 +195,23 @@ protected annotation (Placement(transformation(extent={{80,40},{100,60}}))); Buildings.Controls.OBC.CDL.Conversions.BooleanToReal booToRea[nBoi] if not - primarySecondarySensors + use_priSen "Boolean to Real converter" annotation (Placement(transformation(extent={{-100,-60},{-80,-40}}))); Buildings.Controls.OBC.CDL.Continuous.Sources.Constant con[nBoi]( - final k=boiDesFlo) if not primarySecondarySensors + final k=boiDesFlo) if not use_priSen "Vector of boiler design flowrates" annotation (Placement(transformation(extent={{-100,-90},{-80,-70}}))); Buildings.Controls.OBC.CDL.Continuous.Multiply pro1[nBoi] if not - primarySecondarySensors + use_priSen "Vector of design flowrates only for enabled boilers; Zero for disabled boilers" annotation (Placement(transformation(extent={{-70,-70},{-50,-50}}))); Buildings.Controls.OBC.CDL.Continuous.MultiSum mulSum( final k=fill(1, nBoi), - final nin=nBoi) if not primarySecondarySensors + final nin=nBoi) if not use_priSen "Sum of flowrates of all enabled boilers" annotation (Placement(transformation(extent={{-40,-100},{-20,-80}}))); @@ -234,21 +234,20 @@ protected annotation (Placement(transformation(extent={{80,90},{100,110}}))); Buildings.Controls.OBC.CDL.Routing.RealScalarReplicator reaRep( - final nout=nBoi) if not primarySecondarySensors + final nout=nBoi) if not use_priSen "Real replicator" annotation (Placement(transformation(extent={{20,-100},{40,-80}}))); - Buildings.Controls.OBC.CDL.Continuous.Divide div[nBoi] if not primarySecondarySensors + Buildings.Controls.OBC.CDL.Continuous.Divide div[nBoi] if not use_priSen "Calculate weights for average based on design flowrate" annotation (Placement(transformation(extent={{20,-70},{40,-50}}))); - Buildings.Controls.OBC.CDL.Continuous.Multiply pro[nBoi] if not primarySecondarySensors + Buildings.Controls.OBC.CDL.Continuous.Multiply pro[nBoi] if not use_priSen "Calculate weighted boiler supply temperatures" annotation (Placement(transformation(extent={{50,-90},{70,-70}}))); Buildings.Controls.OBC.CDL.Continuous.AddParameter addPar( - final p=1e-6) - if not primarySecondarySensors + final p=1e-6) if not use_priSen "Pass non-zero divisor in case sum is zero" annotation (Placement(transformation(extent={{-10,-100},{10,-80}}))); @@ -383,7 +382,7 @@ until the difference is less than oneReqLimLow.

When there is no single temperature sensor in the primary loop and instead there are temperature sensors at each boiler supply outlet THotWatBoiSup, -primarySecondarySensors = false, the primary loop temperature is +use_priSen = false, the primary loop temperature is calculated as the weighted average of THotWatBoiSup, weighted by the boiler design flowrates boiDesFlo of the enabled boilers uBoiSta. diff --git a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Pumps/SecondaryPumps/Controller.mo b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Pumps/SecondaryPumps/Controller.mo index a9a53b19cdb..433e95d4b8c 100644 --- a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Pumps/SecondaryPumps/Controller.mo +++ b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Pumps/SecondaryPumps/Controller.mo @@ -17,20 +17,20 @@ block Controller annotation (Dialog(group="Plant parameters", enable=have_varSecPum)); - parameter Integer nPum = 2 + parameter Integer nPum "Total number of secondary hot water pumps" annotation (Dialog(group="Plant parameters")); - parameter Integer nPumPri = 2 + parameter Integer nPumPri "Total number of primary hot water pumps" annotation (Dialog(group="Plant parameters", enable=not have_varSecPum)); - parameter Integer nBoi = 2 + parameter Integer nBoi "Total number of boilers" annotation (Dialog(group="Plant parameters")); - parameter Integer nSen=2 + parameter Integer nSen "Total number of remote differential pressure sensors" annotation (Dialog(group="Plant parameters")); @@ -60,7 +60,7 @@ block Controller final min=1e-6, final unit="m3/s", displayUnit="m3/s", - final quantity="VolumeFlowRate") = 0.5 + final quantity="VolumeFlowRate") "Total plant design hot water flow rate" annotation (Dialog(group="Plant parameters")); @@ -68,7 +68,7 @@ block Controller final unit="Pa", displayUnit="Pa", final quantity="PressureDifference", - final min=1e-6) = 5*6894.75 + final min=1e-6) "Maximum hot water loop local differential pressure setpoint" annotation (Dialog(tab="Pump control parameters", group="DP-based speed regulation", enable = speConTyp == Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Types.PrimaryPumpSpeedControlTypes.localDP)); @@ -77,7 +77,7 @@ block Controller final unit="Pa", displayUnit="Pa", final quantity="PressureDifference", - final min=1e-6) = 5*6894.75 + final min=1e-6) "Minimum hot water loop local differential pressure setpoint" annotation (Dialog(tab="Pump control parameters", group="DP-based speed regulation", @@ -427,7 +427,7 @@ protected annotation (Placement(transformation(extent={{-250,-166},{-230,-146}}))); Buildings.Controls.OBC.CDL.Integers.MultiSum mulSumInt1( - final nin=nPumPri) if not have_varSecPum + final nin=nPumPri) if not have_varSecPum "Sum of integer inputs" annotation (Placement(transformation(extent={{-200,-166},{-180,-146}}))); @@ -729,9 +729,8 @@ equation 0},{274,-264},{-74,-264},{-74,-326},{-62,-326}}, color={255,0,255})); connect(logSwi.y, pumSpeRemDp.uHotWatPum) annotation (Line(points={{214,0},{274, 0},{274,-264},{-74,-264},{-74,-362},{-62,-362}}, color={255,0,255})); - connect(booToInt1.y, mulSumInt1.u[1:2]) annotation (Line(points={{-228,-156}, - {-216,-156},{-216,-154.25},{-202,-154.25}}, - color={255,127,0})); + connect(booToInt1.y, mulSumInt1.u[1:2]) annotation (Line(points={{-228,-156},{ + -216,-156},{-216,-156},{-202,-156}}, color={255,127,0})); connect(min.y, yPumSpe) annotation (Line(points={{182,-400},{300,-400}}, color={0,0,127})); connect(addInt.y, zerStaIndCor.uInd) From e69b39714c0d114b63ab9afbd0d45113c4d9af17 Mon Sep 17 00:00:00 2001 From: Devaprasad Date: Thu, 15 Jun 2023 14:19:48 -0700 Subject: [PATCH 19/20] Made changes to address Antoine's comments for ctrl-flow template compatibility --- .../PrimarySystem/BoilerPlant/Controller.mo | 471 +++++++++++------- 1 file changed, 282 insertions(+), 189 deletions(-) diff --git a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Controller.mo b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Controller.mo index 83c3158c1ae..73f36776741 100644 --- a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Controller.mo +++ b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Controller.mo @@ -2,87 +2,129 @@ within Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant; model Controller "Boiler plant controller" - parameter Buildings.Controls.OBC.CDL.Types.SimpleController controllerType_priPum= Buildings.Controls.OBC.CDL.Types.SimpleController.PI + parameter Buildings.Controls.OBC.CDL.Types.SimpleController controllerType_priPum[nPriLeg]= fill(Buildings.Controls.OBC.CDL.Types.SimpleController.PI, nPriLeg) "Type of controller" - annotation (Dialog(tab="Primary pump control parameters", group="PID parameters")); + annotation (Dialog(tab="Primary pump control parameters", + group="PID parameters")); parameter Buildings.Controls.OBC.CDL.Types.SimpleController controllerType_bypVal= Buildings.Controls.OBC.CDL.Types.SimpleController.PI "Type of controller" annotation(Dialog(tab="Bypass valve control parameters")); - parameter Buildings.Controls.OBC.CDL.Types.SimpleController controllerType_secPum= Buildings.Controls.OBC.CDL.Types.SimpleController.PI + parameter Buildings.Controls.OBC.CDL.Types.SimpleController controllerType_secPum[nSecLeg]= fill(Buildings.Controls.OBC.CDL.Types.SimpleController.PI, nSecLeg) "Type of controller" - annotation(Dialog(tab="Secondary pump control parameters", group="PID parameters")); + annotation(Dialog(tab="Secondary pump control parameters", + group="PID parameters")); + + parameter Integer nPriLeg( + final min=1) = 1 + "Number of legs in the primary loop; Must be 1 for primary-only boiler + plant" + annotation(Dialog(group="Boiler plant configuration parameters", + enable = not have_priOnl)); - parameter Boolean have_priOnl = false - "Is the boiler plant a primary-only, condensing boiler plant?" - annotation(Dialog(tab="General", group="Boiler plant configuration parameters")); + parameter Integer boiLegMat[nBoi]( + final min=fill(1, nBoi), + final max=fill(nPriLeg, nBoi)) = fill(1, nBoi) + "Matrix describing the primary leg to which each boiler belongs" + annotation(Dialog(group="Boiler plant configuration parameters", + enable = not have_priOnl)); - parameter Boolean have_heaPriPum = true - "True: Headered primary hot water pumps; - False: Dedicated primary hot water pumps" - annotation(Dialog(tab="General", group="Boiler plant configuration parameters")); + parameter Boolean have_priOnl + "Is the boiler plant a primary-only boiler plant?" + annotation(Dialog(group="Boiler plant configuration parameters")); + + parameter Integer nSecLeg + "Number of legs in the secondary loop" + annotation(Dialog(group="Boiler plant configuration parameters", + enable = not have_priOnl)); - parameter Boolean have_varPriPum = false + parameter Boolean have_heaPriPum[nPriLeg] + "True: Headered primary pumps; + False: Dedicated primary pumps" + annotation(Dialog(group="Boiler plant configuration parameters")); + + parameter Boolean have_varPriPum[nPriLeg] "True: Variable-speed primary pumps; - False: Fixed-speed primary pumps" - annotation(Dialog(tab="General", group="Boiler plant configuration parameters")); + False: Fixed-speed primary pumps" + annotation(Dialog(group="Boiler plant configuration parameters")); - parameter Boolean have_secFloSen=false - "True: Flowrate sensor in secondary loop; - False: Flowrate sensor in decoupler" - annotation(Dialog(tab="General", - group="Boiler plant configuration parameters", + parameter Boolean have_priFloSen[nPriLeg] + "True: Flowrate sensor in primary loop in primary-secondary plants; + False: No flowrate sensor in primary loop" + annotation(Dialog(group="Boiler plant configuration parameters", enable = not have_priOnl)); - parameter Boolean have_priSecTemSen=false - "True: Temperature sensors in primary and secondary loops; - False: Temperature sensors in boiler supply and secondary loop" - annotation (Dialog(tab="Primary pump control parameters", - group="General parameters", + parameter Boolean have_secFloSen_PriCon[nSecLeg] + "True: Flowrate sensor in secondary loop downstream of decoupler for primary pump control; + False: No flowrate sensor in secondary loop" + annotation(Dialog(group="Boiler plant configuration parameters", + enable = (not have_priOnl and speConTypPri == fill(Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Types.PrimaryPumpSpeedControlTypes.flowrate, nPriLeg)))); + + parameter Boolean have_secFloSen_SecCon[nSecLeg] + "True: Flowrate sensor in secondary loop for secondary pump control; + False: No flowrate sensor in secondary loop" + annotation(Dialog(group="Boiler plant configuration parameters", + enable = (not have_priOnl and have_varSec))); + + parameter Boolean have_decFloSen[nPriLeg] + "True: Flowrate sensor in decoupler leg; + False: No flowrate sensor in decoupler leg" + annotation(Dialog(group="Boiler plant configuration parameters", + enable = not have_priOnl)); + + parameter Boolean have_priTemSen[nPriLeg] + "True: Temperature sensors in primary loop; + False: Temperature sensors in boiler supply" + annotation (Dialog(group="Boiler plant configuration parameters", enable = speConTypPri == Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Types.PrimaryPumpSpeedControlTypes.temperature)); - parameter Boolean have_varSecPum = false + parameter Boolean have_varSecPum[nSecLeg] "True: Variable-speed secondary pumps; False: Fixed-speed secondary pumps" - annotation (Dialog(group="Boiler plant configuration parameters")); + annotation (Dialog(group="Boiler plant configuration parameters", + enable = not have_priOnl)); parameter Integer nIgnReq( final min=0) = 0 "Number of hot-water requests to be ignored before enabling boiler plant loop" annotation(Dialog(tab="Plant enable/disable parameters")); - parameter Integer nBoi + parameter Integer nBoi[nPriLeg] "Number of boilers" - annotation(Dialog(tab="General", group="Boiler plant configuration parameters")); + annotation(Dialog(tab="General", + group="Boiler plant configuration parameters")); - parameter Integer boiTyp[nBoi]={ - Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Types.BoilerTypes.condensingBoiler, - Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Types.BoilerTypes.nonCondensingBoiler} - "Boiler type" - annotation(Dialog(tab="General", group="Boiler plant configuration parameters")); + parameter Integer boiTyp[nBoi] + "Boiler type for each boiler in plant staging logic" + annotation(Dialog(tab="General", + group="Boiler plant configuration parameters")); parameter Integer nSta "Number of boiler plant stages" - annotation(Dialog(tab="General", group="Boiler plant configuration parameters")); + annotation(Dialog(tab="General", + group="Boiler plant configuration parameters")); parameter Integer staMat[nSta, nBoi] "Staging matrix with stage as row index and boiler as column index" - annotation(Dialog(tab="General", group="Boiler plant configuration parameters")); + annotation(Dialog(tab="General", + group="Boiler plant configuration parameters")); - parameter Integer nPumPri - "Number of primary pumps in the boiler plant loop" - annotation(Dialog(tab="General", group="Boiler plant configuration parameters")); + parameter Integer nPumPri[nPriLeg] + "Number of primary pumps in each primary loop in the boiler plant" + annotation(Dialog(tab="General", + group="Boiler plant configuration parameters")); parameter Integer nHotWatResReqIgn = 2 "Number of hot-water supply temperature reset requests to be ignored" - annotation(Dialog(tab="Supply temperature reset parameters", group="Trim-and-Respond Logic parameters")); + annotation(Dialog(tab="Supply temperature reset parameters", + group="Trim-and-Respond Logic parameters")); - parameter Integer nSenPri - "Total number of remote differential pressure sensors in primary loop" + parameter Integer nDifPreSen + "Total number of remote differential pressure sensors" annotation(Dialog(tab="General", group="Boiler plant configuration parameters", - enable = have_remDPRegPri or have_locDPRegPri)); + enable = have_remDPRegPri or have_locDPRegPri or have_varSecPum)); parameter Integer numIgnReq = 0 "Number of ignored requests" @@ -90,34 +132,32 @@ model Controller group="Temperature-based speed regulation", enable= speConTypPri == Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Types.PrimaryPumpSpeedControlTypes.temperature)); - parameter Integer nPumPri_nominal( - final max=nPumPri, - final min=1) = nPumPri - "Total number of pumps that operate at design conditions" - annotation (Dialog(group="Boiler plant configuration parameters")); - - parameter Integer nPumSec - "Total number of secondary hot water pumps" + parameter Integer nPumPri_nominal[nPriLeg]( + final max=fill(nPumPri, nPriLeg), + final min=fill(1, nPriLeg)) = fill(nPumPri, nPriLeg) + "Total number of pumps that operate at design conditions in each primary loop" annotation (Dialog(group="Boiler plant configuration parameters")); - parameter Integer nSenSec - "Total number of remote differential pressure sensors in secondary loop" - annotation (Dialog(group="Boiler plant configuration parameters")); + parameter Integer nPumSec[nSecLeg] + "Total number of secondary hot water pumps in each secondary loop" + annotation (Dialog(group="Boiler plant configuration parameters", + enable = not have_priOnl)); - parameter Integer nPumSec_nominal( - final max=nPumSec) = nPumSec - "Total number of pumps that operate at design conditions in secondary loop" - annotation (Dialog(group="Boiler plant configuration parameters")); + parameter Integer nPumSec_nominal[nSecLeg]( + final max=nPumSec) = fill(nPumSec, nSecLeg) + "Total number of pumps that operate at design conditions in each secondary loop" + annotation (Dialog(group="Boiler plant configuration parameters", + enable = not have_priOnl)); parameter Real TOutLoc( final unit="K", - displayUnit="K") = 300 + displayUnit="degC") = 300 "Boiler lock-out temperature for outdoor air" annotation(Dialog(tab="Plant enable/disable parameters")); parameter Real locDt( final unit="K", - displayUnit="K", + displayUnit="degC", final quantity="ThermodynamicTemperature") = 1 "Temperature deadband for boiler lockout" annotation(Dialog(tab="Plant enable/disable parameters", group="Advanced")); @@ -150,7 +190,7 @@ model Controller parameter Real boiFirMin[nBoi]( final unit="1", displayUnit="1") - "Boiler minimum firing ratio" + "Boiler minimum firing rate ratio" annotation(Dialog(tab="General", group="Boiler plant configuration parameters")); parameter Real delStaCha( @@ -190,7 +230,7 @@ model Controller parameter Real TDif( final unit="K", - displayUnit="K", + displayUnit="degC", final quantity="TemperatureDifference") = 10 "Required temperature difference between setpoint and measured temperature" annotation(Dialog(tab="Staging setpoint parameters", group="Failsafe condition parameters")); @@ -210,7 +250,7 @@ model Controller parameter Real TDifHys( final unit="K", - displayUnit="K", + displayUnit="degC", final quantity="TemperatureDifference") = 1 "Temperature deadband for hysteresis loop" annotation (Dialog(tab="Staging setpoint parameters", group="Advanced")); @@ -227,85 +267,76 @@ model Controller displayUnit="s", final quantity="Time") = 300 "Delay for staging based on minimum firing rate of current stage" - annotation(Dialog(tab="Staging setpoint parameters", group="Staging down parameters")); + annotation(Dialog(tab="Staging setpoint parameters", + group="Staging down parameters")); parameter Real fraDesCap( final unit="1", displayUnit="1") = 0.8 "Fraction of design capacity of next lower stage that heating capacity needs to be for staging down" - annotation(Dialog(tab="Staging setpoint parameters", group="Staging down parameters")); + annotation(Dialog(tab="Staging setpoint parameters", + group="Staging down parameters")); parameter Real delDesCapNonConBoi( final unit="s", displayUnit="s", final quantity="Time") = 600 "Enable delay for capacity requirement condition for non-condensing boilers" - annotation(Dialog(tab="Staging setpoint parameters", group="Staging down parameters")); + annotation(Dialog(tab="Staging setpoint parameters", + group="Staging down parameters")); parameter Real delDesCapConBoi( final unit="s", displayUnit="s", final quantity="Time") = 300 "Enable delay for capacity requirement condition for condensing boilers" - annotation(Dialog(tab="Staging setpoint parameters", group="Staging down parameters")); + annotation(Dialog(tab="Staging setpoint parameters", + group="Staging down parameters")); parameter Real delBypVal( final unit="s", displayUnit="s", final quantity="Time") = 300 "Enable delay for bypass valve condition for primary-only plants" - annotation ( - Evaluate=true, - Dialog( - enable=have_priOnl, - tab="Staging setpoint parameters", - group="Staging down parameters")); + annotation (Dialog(enable=have_priOnl, + tab="Staging setpoint parameters", + group="Staging down parameters")); parameter Real TCirDif( final unit="K", - displayUnit="K", + displayUnit="degC", final quantity="TemperatureDifference") = 3 "Required return water temperature difference between primary and secondary circuits for staging down" - annotation ( - Evaluate=true, - Dialog( - enable=not - (have_priOnl), - tab="Staging setpoint parameters", - group="Staging down parameters")); + annotation (Dialog(enable=not have_priOnl, + tab="Staging setpoint parameters", + group="Staging down parameters")); parameter Real delTRetDif( final unit="s", displayUnit="s", final quantity="Time") = 300 "Enable delay for measured hot water return temperature difference condition" - annotation ( - Evaluate=true, - Dialog( - enable=not - (have_priOnl), - tab="Staging setpoint parameters", - group="Staging down parameters")); + annotation (Dialog(enable=not have_priOnl, + tab="Staging setpoint parameters", + group="Staging down parameters")); parameter Real bypValClo( final unit="1", displayUnit="1") = 0 "Adjustment for signal received when bypass valve is closed" - annotation ( - Evaluate=true, - Dialog( - enable=have_priOnl, - tab="Staging setpoint parameters", - group="Advanced")); + annotation (Dialog(enable=have_priOnl, + tab="Staging setpoint parameters", + group="Advanced")); parameter Real dTemp( final unit="K", - displayUnit="K", + displayUnit="degC", final quantity="TemperatureDifference") = 0.1 "Hysteresis deadband for measured temperatures" - annotation (Dialog(tab="Staging setpoint parameters", group="Advanced")); + annotation (Dialog(tab="Staging setpoint parameters", + group="Advanced")); parameter Real minFloSet[nBoi]( final unit="m3/s", @@ -314,7 +345,8 @@ model Controller final min=1e-6, final max=maxFloSet) "Design minimum hot water flow through each boiler" - annotation(Dialog(tab="General", group="Boiler plant configuration parameters")); + annotation(Dialog(tab="General", + group="Boiler plant configuration parameters")); parameter Real maxFloSet[nBoi]( final unit="m3/s", @@ -322,120 +354,137 @@ model Controller final quantity="VolumeFlowRate", final min=minFloSet) "Design maximum hot water flow through each boiler" - annotation(Dialog(tab="General", group="Boiler plant configuration parameters")); + annotation(Dialog(tab="General", + group="Boiler plant configuration parameters")); parameter Real bypSetRat( final unit="m3/s2", displayUnit="m3/s2", final min=0) = 0.001 "Rate at which to reset bypass valve setpoint during stage change" - annotation(Dialog(tab="Staging setpoint parameters", group="General parameters")); + annotation(Dialog(tab="Staging setpoint parameters", + group="General parameters")); parameter Real TPlaHotWatSetMax( final unit="K", - displayUnit="K", + displayUnit="degC", final quantity="ThermodynamicTemperature") = 353.15 "The maximum allowed hot-water setpoint temperature for the plant" - annotation(Dialog(tab="Supply temperature reset parameters", group="Trim-and-Respond Logic parameters")); + annotation(Dialog(tab="Supply temperature reset parameters", + group="Trim-and-Respond Logic parameters")); parameter Real TConBoiHotWatSetMax( final unit="K", - displayUnit="K", + displayUnit="degC", final quantity="ThermodynamicTemperature") = 353.15 "The maximum allowed hot water setpoint temperature for condensing boilers" - annotation(Dialog(tab="Supply temperature reset parameters", group="Trim-and-Respond Logic parameters")); + annotation(Dialog(tab="Supply temperature reset parameters", + group="Trim-and-Respond Logic parameters")); parameter Real TConBoiHotWatSetOff( final unit="K", - displayUnit="K", + displayUnit="degC", final quantity="TemperatureDifference") = -10 "The offset for hot water setpoint temperature for condensing boilers in non-condensing stage type" - annotation(Dialog(tab="Supply temperature reset parameters", group="General parameters")); + annotation(Dialog(tab="Supply temperature reset parameters", + group="General parameters")); parameter Real THotWatSetMinNonConBoi( final unit="K", - displayUnit="K", + displayUnit="degC", final quantity="ThermodynamicTemperature") = 341.48 "The minimum allowed hot-water setpoint temperature for non-condensing boilers" - annotation(Dialog(tab="Supply temperature reset parameters", group="Trim-and-Respond Logic parameters")); + annotation(Dialog(tab="Supply temperature reset parameters", + group="Trim-and-Respond Logic parameters")); parameter Real THotWatSetMinConBoi( final unit="K", - displayUnit="K", + displayUnit="degC", final quantity="ThermodynamicTemperature") = 305.37 "The minimum allowed hot-water setpoint temperature for condensing boilers" - annotation(Dialog(tab="Supply temperature reset parameters", group="Trim-and-Respond Logic parameters")); + annotation(Dialog(tab="Supply temperature reset parameters", + group="Trim-and-Respond Logic parameters")); parameter Real delTimVal( final unit="s", displayUnit="s", final quantity="Time") = 600 "Delay time" - annotation(Dialog(tab="Supply temperature reset parameters", group="Trim-and-Respond Logic parameters")); + annotation(Dialog(tab="Supply temperature reset parameters", + group="Trim-and-Respond Logic parameters")); parameter Real samPerVal( final unit="s", displayUnit="s", final quantity="Time") = 300 "Sample period" - annotation(Dialog(tab="Supply temperature reset parameters", group="Trim-and-Respond Logic parameters")); + annotation(Dialog(tab="Supply temperature reset parameters", + group="Trim-and-Respond Logic parameters")); parameter Real triAmoVal( final unit="K", - displayUnit="K", + displayUnit="degC", final quantity="TemperatureDifference") = -2 "Setpoint trim value" - annotation(Dialog(tab="Supply temperature reset parameters", group="Trim-and-Respond Logic parameters")); + annotation(Dialog(tab="Supply temperature reset parameters", + group="Trim-and-Respond Logic parameters")); parameter Real resAmoVal( final unit="K", - displayUnit="K", + displayUnit="degC", final quantity="TemperatureDifference") = 3 "Setpoint respond value" - annotation(Dialog(tab="Supply temperature reset parameters", group="Trim-and-Respond Logic parameters")); + annotation(Dialog(tab="Supply temperature reset parameters", + group="Trim-and-Respond Logic parameters")); parameter Real maxResVal( final unit="K", - displayUnit="K", + displayUnit="degC", final quantity="TemperatureDifference") = 7 "Setpoint maximum respond value" - annotation(Dialog(tab="Supply temperature reset parameters", group="Trim-and-Respond Logic parameters")); + annotation(Dialog(tab="Supply temperature reset parameters", + group="Trim-and-Respond Logic parameters")); parameter Real holTimVal( final unit="s", displayUnit="s", final quantity="Time") = 600 "Minimum setpoint hold time for stage change process" - annotation(Dialog(tab="Supply temperature reset parameters", group="General parameters")); + annotation(Dialog(tab="Supply temperature reset parameters", + group="General parameters")); parameter Real TMinSupNonConBoi( final unit="K", - displayUnit="K", + displayUnit="degC", final quantity="ThermodynamicTemperature") = 333.2 "Minimum supply temperature required for non-condensing boilers" - annotation(Dialog(tab="General", group="Boiler plant configuration parameters")); + annotation(Dialog(tab="General", + group="Boiler plant configuration parameters")); parameter Real delProSupTemSet( final unit="s", displayUnit="s", final quantity="time")=300 "Process time-out for hot water supply temperature setpoint reset" - annotation (Dialog(tab="Staging process parameters",group="Time and delay parameters")); + annotation (Dialog(tab="Staging process parameters", + group="Time and delay parameters")); parameter Real delEnaMinFloSet( final unit="s", displayUnit="s", final quantity="time")=60 "Enable delay after minimum flow setpoint is achieved in bypass valve" - annotation (Dialog(tab="Staging process parameters",group="Time and delay parameters")); + annotation (Dialog(tab="Staging process parameters", + group="Time and delay parameters")); parameter Real chaIsoValRat( final unit="1/s", displayUnit="1/s") = 1/60 "Rate at which to slowly change isolation valve position, should be determined in the field" - annotation (Dialog(tab="Staging process parameters",group="Time and delay parameters")); + annotation (Dialog(tab="Staging process parameters", + group="Time and delay parameters")); parameter Real chaIsoValTim( final unit="s", @@ -443,7 +492,8 @@ model Controller final quantity="time") = 1/chaIsoValRat "Time to slowly change isolation valve position from fully closed to fully open, should be determined in the field" - annotation (Dialog(tab="Staging process parameters", group="Time and delay parameters")); + annotation (Dialog(tab="Staging process parameters", + group="Time and delay parameters")); parameter Real delPreBoiEna( final unit="s", @@ -451,7 +501,8 @@ model Controller final quantity="time") = 30 "Time delay after valve and pump change process has been completed before starting boiler change process" - annotation (Dialog(tab="Staging process parameters",group="Time and delay parameters")); + annotation (Dialog(tab="Staging process parameters", + group="Time and delay parameters")); parameter Real boiChaProOnTim( final unit="s", @@ -459,7 +510,8 @@ model Controller final quantity="time") = 300 "Enabled boiler operation time to indicate if it is proven on during a staging process where one boiler is turned on and the other is turned off" - annotation (Dialog(tab="Staging process parameters",group="Time and delay parameters")); + annotation (Dialog(tab="Staging process parameters", + group="Time and delay parameters")); parameter Real delBoiEna( final unit="s", @@ -467,7 +519,8 @@ model Controller final quantity="time") = 180 "Time delay after boiler change process has been completed before turning off excess valves and pumps" - annotation (Dialog(tab="Staging process parameters",group="Time and delay parameters")); + annotation (Dialog(tab="Staging process parameters", + group="Time and delay parameters")); parameter Real k_bypVal( final min=0, @@ -498,7 +551,8 @@ model Controller final min=0, final max=maxPumSpePri) = 0.1 "Minimum pump speed" - annotation (Dialog(tab="Primary pump control parameters", group="General parameters", enable=have_varPriPum)); + annotation (Dialog(tab="Primary pump control parameters", + group="General parameters", enable=have_varPriPum)); parameter Real maxPumSpePri( final unit="1", @@ -506,7 +560,8 @@ model Controller final min=minPumSpePri, final max=1) = 1 "Maximum pump speed" - annotation (Dialog(tab="Primary pump control parameters", group="General parameters", enable=have_varPriPum)); + annotation (Dialog(tab="Primary pump control parameters", + group="General parameters", enable=have_varPriPum)); parameter Real VHotWatPri_flow_nominal( final min=1e-6, @@ -530,7 +585,8 @@ model Controller final quantity="PressureDifference", final min=1e-6) = 5*6894.75 "Maximum primary loop local differential pressure setpoint" - annotation (Dialog(tab="Primary pump control parameters", group="DP-based speed regulation", + annotation (Dialog(tab="Primary pump control parameters", + group="DP-based speed regulation", enable = speConTypPri == Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Types.PrimaryPumpSpeedControlTypes.localDP or speConTypPri == Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Types.PrimaryPumpSpeedControlTypes.remoteDP)); @@ -551,7 +607,8 @@ model Controller final quantity="time", final min=0) = 180 "Threshold to check lead boiler off time" - annotation (Dialog(tab="Primary pump control parameters", group="Pump staging parameters")); + annotation (Dialog(tab="Primary pump control parameters", + group="Pump staging parameters")); parameter Real timPer_priPum( final unit="s", @@ -559,19 +616,22 @@ model Controller final quantity="time", final min=0) = 600 "Delay time period for enabling and disabling lag pumps" - annotation (Dialog(tab="Primary pump control parameters", group="Pump staging parameters")); + annotation (Dialog(tab="Primary pump control parameters", + group="Pump staging parameters")); parameter Real staCon_priPum( final unit="1", displayUnit="1") = -0.03 "Constant used in the staging equation" - annotation (Dialog(tab="Primary pump control parameters", group="Pump staging parameters")); + annotation (Dialog(tab="Primary pump control parameters", + group="Pump staging parameters")); parameter Real relFloHys_priPum( final unit="1", displayUnit="1") = 0.01 "Constant value used in hysteresis for checking relative flow rate" - annotation (Dialog(tab="Primary pump control parameters", group="Pump staging parameters")); + annotation (Dialog(tab="Primary pump control parameters", + group="Pump staging parameters")); parameter Real delTim_priPum( final unit="s", @@ -619,7 +679,7 @@ model Controller parameter Real twoReqLimLow_priPum( final unit="K", - displayUnit="K", + displayUnit="degC", final quantity="TemperatureDifference") = 1.2 "Lower limit of hysteresis loop sending two requests" annotation (Dialog(tab="Primary pump control parameters", @@ -628,7 +688,7 @@ model Controller parameter Real twoReqLimHig_priPum( final unit="K", - displayUnit="K", + displayUnit="degC", final quantity="TemperatureDifference") = 2 "Higher limit of hysteresis loop sending two requests" annotation (Dialog(tab="Primary pump control parameters", @@ -637,7 +697,7 @@ model Controller parameter Real oneReqLimLow_priPum( final unit="K", - displayUnit="K", + displayUnit="degC", final quantity="TemperatureDifference") = 0.2 "Lower limit of hysteresis loop sending one request" annotation (Dialog(tab="Primary pump control parameters", @@ -646,7 +706,7 @@ model Controller parameter Real oneReqLimHig_priPum( final unit="K", - displayUnit="K", + displayUnit="degC", final quantity="TemperatureDifference") = 1 "Higher limit of hysteresis loop sending one request" annotation (Dialog(tab="Primary pump control parameters", @@ -666,7 +726,8 @@ model Controller final quantity="time", final min=0) = 0.5 "Time constant of integrator block" - annotation (Dialog(tab="Primary pump control parameters", group="PID parameters")); + annotation (Dialog(tab="Primary pump control parameters", + group="PID parameters")); parameter Real Td_priPum( final unit="s", @@ -674,18 +735,19 @@ model Controller final quantity="time", final min=0) = 0.1 "Time constant of derivative block" - annotation (Dialog(tab="Primary pump control parameters", group="PID parameters")); + annotation (Dialog(tab="Primary pump control parameters", + group="PID parameters")); parameter Real TRetSet( final unit="K", - displayUnit="K", + displayUnit="degC", final quantity="ThermodynamicTemperature") = 333.15 "Minimum hot water return temperature for optimal non-condensing boiler performance" annotation(Dialog(tab="Condensation control parameters")); parameter Real TRetMinAll( final unit="K", - displayUnit="K", + displayUnit="degC", final quantity="ThermodynamicTemperature") = 330.35 "Minimum allowed hot water return temperature for non-condensing boiler" annotation(Dialog(tab="Condensation control parameters")); @@ -729,9 +791,10 @@ model Controller parameter Real VHotWatSec_flow_nominal( final unit="m3/s", displayUnit="m3/s", - final quantity="VolumeFlowRate") = 0.5 + final quantity="VolumeFlowRate") "Secondary loop design hot water flow rate" - annotation (Dialog(group="Boiler plant configuration parameters")); + annotation (Dialog(group="Boiler plant configuration parameters", + enable = not have_priOnl)); parameter Real maxLocDpSec( final unit="Pa", @@ -739,7 +802,8 @@ model Controller final quantity="PressureDifference", final min=1e-6) = 5*6894.75 "Maximum hot water loop local differential pressure setpoint in secondary loop" - annotation (Dialog(tab="Secondary pump control parameters", group="DP-based speed regulation", + annotation (Dialog(tab="Secondary pump control parameters", + group="DP-based speed regulation", enable = speConTypSec == Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Types.PrimaryPumpSpeedControlTypes.localDP)); parameter Real minLocDpSec( @@ -932,15 +996,15 @@ model Controller Buildings.Controls.OBC.CDL.Interfaces.RealInput VHotWatPri_flow( final unit="m3/s", displayUnit="m3/s", - final quantity="VolumeFlowRate") + final quantity="VolumeFlowRate") if have_priOnl "Measured hot water primary circuit flowrate" annotation (Placement(transformation(extent={{-440,170},{-400,210}}), iconTransformation(extent={{-140,150},{-100,190}}))); - Buildings.Controls.OBC.CDL.Interfaces.RealInput dpHotWatPri_rem[nSenPri]( - final unit=fill("Pa", nSenPri), - displayUnit=fill("Pa", nSenPri), - final quantity=fill("PressureDifference", nSenPri)) if have_varPriPum and (have_remDPRegPri or have_locDPRegPri) + Buildings.Controls.OBC.CDL.Interfaces.RealInput dpHotWatPri_rem[nDifPreSen]( + final unit=fill("Pa", nDifPreSen), + displayUnit=fill("Pa", nDifPreSen), + final quantity=fill("PressureDifference", nDifPreSen)) if have_varPriPum and (have_remDPRegPri or have_locDPRegPri) "Measured differential pressure between hot water supply and return in primary circuit" annotation (Placement(transformation(extent={{-440,90},{-400,130}}), iconTransformation(extent={{-140,90},{-100,130}}))); @@ -953,28 +1017,28 @@ model Controller annotation (Placement(transformation(extent={{-440,130},{-400,170}}), iconTransformation(extent={{-140,120},{-100,160}}))); - Buildings.Controls.OBC.CDL.Interfaces.RealInput VHotWatSec_flow( + Buildings.Controls.OBC.CDL.Interfaces.RealInput VHotWatSecPriPumCon_flow[nPriLeg]( final unit="m3/s", displayUnit="m3/s", final quantity="VolumeFlowRate") if not have_priOnl and have_secFloSen - "Measured hot water secondary circuit flowrate" + "Measured hot water secondary circuit flowrate for primary pump control (from just downstream of decoupler)" annotation (Placement(transformation(extent={{-440,-90},{-400,-50}}), - iconTransformation(extent={{-140,30},{-100,70}}))); + iconTransformation(extent={{-140,30},{-100,70}}))); - Buildings.Controls.OBC.CDL.Interfaces.RealInput VHotWatDec_flow( + Buildings.Controls.OBC.CDL.Interfaces.RealInput VHotWatDec_flow[nPriLeg]( final unit="m3/s", displayUnit="m3/s", final quantity="VolumeFlowRate") if not have_priOnl and have_varPriPum and have_floRegPri and not have_secFloSen - "Measured hot water flowrate through decoupler leg" - annotation (Placement(transformation(extent={{-440,-130},{-400,-90}}), - iconTransformation(extent={{-140,0},{-100,40}}))); + "Measured hot water flowrate through decoupler leg" annotation (Placement( + transformation(extent={{-440,-130},{-400,-90}}), iconTransformation( + extent={{-140,0},{-100,40}}))); Buildings.Controls.OBC.CDL.Interfaces.RealInput TSupSec( final unit="K", displayUnit="degC", final quantity="ThermodynamicTemperature") if not have_priOnl and - have_varPriPum and have_temRegPri and have_priSecTemSen + have_varPriPum and have_temRegPri and have_priTemSen "Measured hot water supply temperature in secondary circuit" annotation (Placement(transformation(extent={{-440,-170},{-400,-130}}), iconTransformation(extent={{-140,-40},{-100,0}}))); @@ -983,15 +1047,15 @@ model Controller final unit=fill("K", nBoi), displayUnit=fill("degC", nBoi), final quantity=fill("ThermodynamicTemperature", nBoi)) if not have_priOnl - and have_varPriPum and have_temRegPri and not have_priSecTemSen - "Measured hot water supply temperatureat boiler outlets" + and have_varPriPum and have_temRegPri and not have_priTemSen + "Measured hot water supply temperature at boiler outlets" annotation (Placement(transformation(extent={{-440,-210},{-400,-170}}), iconTransformation(extent={{-140,-70},{-100,-30}}))); - Buildings.Controls.OBC.CDL.Interfaces.RealInput dpHotWatSec_rem[nSenSec]( - final unit=fill("Pa", nSenSec), - displayUnit=fill("Pa", nSenSec), - final quantity=fill("PressureDifference", nSenSec)) if not + Buildings.Controls.OBC.CDL.Interfaces.RealInput dpHotWatSec_rem[nDifPreSen]( + final unit=fill("Pa", nDifPreSen), + displayUnit=fill("Pa", nDifPreSen), + final quantity=fill("PressureDifference", nDifPreSen)) if not have_priOnl and have_varSecPum and (have_remDPRegSec or have_locDPRegSec) "Measured differential pressure between hot water supply and return in secondary circuit" annotation (Placement(transformation(extent={{-440,-250},{-400,-210}}), @@ -1011,7 +1075,7 @@ model Controller final quantity="PressureDifference") if not have_priOnl and have_varSecPum and have_locDPRegSec "Measured differential pressure between hot water supply and return in secondary circuit" - annotation (Placement(transformation(extent={{-440,-330},{-400,-290}}), + annotation (Placement(transformation(extent={{-440,-320},{-400,-280}}), iconTransformation(extent={{-140,-160},{-100,-120}}))); Buildings.Controls.OBC.CDL.Interfaces.RealInput uHotWatIsoVal[nBoi]( @@ -1057,7 +1121,7 @@ model Controller Buildings.Controls.OBC.CDL.Interfaces.RealOutput TPlaHotWatSupSet( final unit="K", - displayUnit="K", + displayUnit="degC", final quantity="ThermodynamicTemperature") "Plant hot water supply temperature setpoint" annotation (Placement(transformation(extent={{400,220},{440,260}}), @@ -1148,6 +1212,16 @@ model Controller annotation (Placement(transformation(extent={{250,310},{270,330}}))); protected + parameter Boolean use_priSecFloSen = (speConTypPri == Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Types.PrimaryPumpSpeedControlTypes.flowrate + and (have_secFloSen and not have_decFloSen)) + "True: Use flowrate sensors in primary/secondary loops for speed regulation; + False: Flowrate sensor in decoupler leg for speed regulation"; + + parameter Boolean use_priTemSen = (speConTypPri == Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Types.PrimaryPumpSpeedControlTypes.temperature + and have_priTemSen) + "True: Use Temperature sensors in primary loop for speed control; + False: Use temperature sensors in boiler supply for speed control"; + parameter Boolean have_remDPRegPri = (speConTypPri == Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Types.PrimaryPumpSpeedControlTypes.remoteDP) "Boolean flag for primary pump speed control with remote differential pressure"; @@ -1175,6 +1249,19 @@ protected parameter Integer secPumInd[nPumSec]={i for i in 1:nPumSec} "Vector of secondary pump indices up to total number of secondary pumps"; + Buildings.Controls.OBC.CDL.Routing.BooleanScalarReplicator booScaRep( + final nout=nPriLeg) + "Replicate pump change signal to each primary leg" + annotation (Placement(transformation(extent={{68,-220},{88,-200}}))); + + Buildings.Controls.OBC.CDL.Interfaces.RealInput VHotWatSecPumCon_flow[nSecLeg]( + final unit="m3/s", + displayUnit="m3/s", + final quantity="VolumeFlowRate") if not have_priOnl and have_secFloSen + "Measured hot water secondary circuit flowrate used for secondary pump control" + annotation (Placement(transformation(extent={{-440,-348},{-400,-308}}), + iconTransformation(extent={{-140,30},{-100,70}}))); + Buildings.Controls.OBC.CDL.Continuous.IntegratorWithReset intWitRes "Used to break algebraic loop and sample staging setpoint signal" annotation (Placement(transformation(extent={{-210,360},{-190,380}}))); @@ -1241,16 +1328,17 @@ protected "Stage-down process controller" annotation (Placement(transformation(extent={{120,20},{140,60}}))); - Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Pumps.PrimaryPumps.Controller priPumCon( + Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Pumps.PrimaryPumps.Controller + priPumCon[nPriLeg]( final controllerType=controllerType_priPum, final have_heaPriPum=have_heaPriPum, final have_priOnl=have_priOnl, final have_varPriPum=have_varPriPum, - final have_secFloSen=have_secFloSen, - final have_priSecTemSen=have_priSecTemSen, + final use_priSecFloSen=use_priSecFloSen, + final use_priTemSen=use_priTemSen, final nPum=nPumPri, final nBoi=nBoi, - final nSen=nSenPri, + final nSen=nDifPreSen, final numIgnReq=numIgnReq, final nPum_nominal=nPumPri, final minPumSpe=minPumSpePri, @@ -1276,7 +1364,7 @@ protected final k=k_priPum, final Ti=Ti_priPum, final Td=Td_priPum, - final speConTyp=speConTypPri) + final speConTyp=Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Types.PrimaryPumpSpeedControlTypes.temperature) "Primary pump controller" annotation (Placement(transformation(extent={{120,-208},{140,-152}}))); @@ -1365,7 +1453,7 @@ protected "Constant stage Integer source" annotation (Placement(transformation(extent={{-390,-40},{-370,-20}}))); - Buildings.Controls.OBC.CDL.Integers.Sources.Constant conInt2[nPumPri]( + Buildings.Controls.OBC.CDL.Integers.Sources.Constant conInt2[nPriLeg,nPumPri]( final k=priPumInd) "Constant stage Integer source" annotation (Placement(transformation(extent={{60,-138},{80,-118}}))); @@ -1382,7 +1470,7 @@ protected "Integer to Real converter" annotation (Placement(transformation(extent={{-190,-50},{-170,-30}}))); - Buildings.Controls.OBC.CDL.Continuous.Sources.Constant dpHotWatSet( + Buildings.Controls.OBC.CDL.Continuous.Sources.Constant dpHotWatSet[nPriLeg]( final k=maxLocDpPri) if have_priOnl "Differential pressure setpoint for primary circuit" annotation (Placement(transformation(extent={{60,-180},{80,-160}}))); @@ -1437,14 +1525,15 @@ protected "Plant disable process controller" annotation (Placement(transformation(extent={{240,60},{260,80}}))); - Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Pumps.SecondaryPumps.Controller secPumCon( + Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Pumps.SecondaryPumps.Controller + secPumCon[nSecLeg]( final controllerType=controllerType_secPum, final have_varSecPum=true, final have_secFloSen=have_secFloSen, final nPum=nPumSec, final nPumPri=nPumPri, final nBoi=nBoi, - final nSen=nSenSec, + final nSen=nDifPreSen, final nPum_nominal=nPumSec, final minPumSpe=minPumSpeSec, final maxPumSpe=maxPumSpeSec, @@ -1472,19 +1561,19 @@ protected "Switch input signal between stage-up and stage-down processes" annotation (Placement(transformation(extent={{64,280},{84,300}}))); - Buildings.Controls.OBC.CDL.Integers.Sources.Constant conInt3[nPumSec]( + Buildings.Controls.OBC.CDL.Integers.Sources.Constant conInt3[nSecLeg,nPumSec]( final k=secPumInd) if not have_priOnl "Constant stage Integer source" annotation (Placement(transformation(extent={{60,-290},{80,-270}}))); - Buildings.Controls.OBC.CDL.Continuous.Sources.Constant dpHotWatSet1( + Buildings.Controls.OBC.CDL.Continuous.Sources.Constant dpHotWatSet1[nSecLeg]( final k=maxLocDpSec) if not have_priOnl "Differential pressure setpoint for secondary circuit" annotation (Placement(transformation(extent={{60,-390},{80,-370}}))); Buildings.Controls.OBC.CDL.Logical.Or or1 if not have_priOnl "Or operator for pump stage change signal from up-staging, down-staging and plant disable process controllers" - annotation (Placement(transformation(extent={{58,-220},{78,-200}}))); + annotation (Placement(transformation(extent={{42,-220},{62,-200}}))); Buildings.Controls.OBC.CDL.Logical.And and2 "Ensure stage-down process is not initiated when plant is disabled" @@ -1720,8 +1809,9 @@ equation color={0,0,127})); connect(conInt3.y, secPumCon.uPumLeaLag) annotation (Line(points={{82,-280},{90, -280},{90,-341.8},{118,-341.8}}, color={255,127,0})); - connect(VHotWatSec_flow, priPumCon.VHotWatSec_flow) annotation (Line(points={{-420, - -70},{8,-70},{8,-224},{114,-224},{114,-195.867},{118,-195.867}}, + connect(VHotWatSecPriPumCon_flow, priPumCon.VHotWatSec_flow) annotation (Line( + points={{-420,-70},{8,-70},{8,-224},{114,-224},{114,-195.867},{118, + -195.867}}, color={0,0,127})); connect(VHotWatDec_flow, priPumCon.VHotWatDec_flow) annotation (Line(points={{-420, -110},{-190,-110},{-190,-212},{6,-212},{6,-226},{116,-226},{116, @@ -1745,8 +1835,8 @@ equation 350},{-154,20},{14,20},{14,-354},{118,-354}}, color={255,127,0})); connect(plaEna.yPla, secPumCon.uPlaEna) annotation (Line(points={{-318,330},{-230, 330},{-230,-78},{12,-78},{12,-350},{118,-350}}, color={255,0,255})); - connect(VHotWatSec_flow, secPumCon.VHotWat_flow) annotation (Line(points={{-420, - -70},{8,-70},{8,-358},{118,-358}}, color={0,0,127})); + connect(VHotWatSecPriPumCon_flow, secPumCon.VHotWat_flow) annotation (Line( + points={{-420,-70},{8,-70},{8,-358},{118,-358}}, color={0,0,127})); connect(conSet.yMaxSecPumSpe, secPumCon.uMaxSecPumSpeCon) annotation (Line( points={{-38,-108},{94,-108},{94,-378},{118,-378}},color={0,0,127})); connect(dpHotWatSet1.y, secPumCon.dpHotWatSet) annotation (Line(points={{82,-380}, @@ -1758,7 +1848,7 @@ equation -270},{-180,-270},{-180,-234},{96,-234},{96,-184.667},{118,-184.667}}, color={0,0,127})); connect(dpHotWatSec_loc, secPumCon.dpHotWat_local) annotation (Line(points={{-420, - -310},{100,-310},{100,-366},{118,-366}}, color={0,0,127})); + -300},{100,-300},{100,-366},{118,-366}}, color={0,0,127})); connect(reaToInt2.y, priPumCon.uLasDisBoi) annotation (Line(points={{142,380}, {150,380},{150,340},{288,340},{288,-210},{102,-210},{102,-181.867},{ 118,-181.867}}, color={255,127,0})); @@ -1768,13 +1858,12 @@ equation -10},{372,-64},{78,-64},{78,26},{118,26}}, color={255,0,255})); connect(pre1.y, upProCon.uStaChaPro) annotation (Line(points={{322,-10},{372, -10},{372,-64},{78,-64},{78,80},{118,80}}, color={255,0,255})); - connect(upProCon.yPumChaPro, or1.u1) annotation (Line(points={{142,84},{160,84}, - {160,14},{32,14},{32,-210},{56,-210}}, color={255,0,255})); - connect(dowProCon.yPumChaPro, or1.u2) annotation (Line(points={{142,28},{156,28}, - {156,18},{28,18},{28,-218},{56,-218}}, color={255,0,255})); - connect(or1.y, priPumCon.uPumChaPro) annotation (Line(points={{80,-210},{100, - -210},{100,-175.333},{118,-175.333}}, - color={255,0,255})); + connect(upProCon.yPumChaPro, or1.u1) annotation (Line(points={{142,84},{160, + 84},{160,14},{32,14},{32,-210},{40,-210}}, + color={255,0,255})); + connect(dowProCon.yPumChaPro, or1.u2) annotation (Line(points={{142,28},{156, + 28},{156,18},{28,18},{28,-218},{40,-218}}, + color={255,0,255})); connect(staSetCon.yChaDowEdg, and2.u2) annotation (Line(points={{-188,-6},{-40, -6},{-40,52},{-30,52}}, color={255,0,255})); connect(plaEna.yPla, and2.u1) annotation (Line(points={{-318,330},{-230,330},{ @@ -1855,6 +1944,10 @@ equation 255})); connect(uSchEna, plaEna.uSchEna) annotation (Line(points={{-420,420},{-350,420}, {-350,336},{-342,336}}, color={255,0,255})); + connect(or1.y, booScaRep.u) + annotation (Line(points={{64,-210},{66,-210}}, color={255,0,255})); + connect(booScaRep.y, priPumCon.uPumChaPro) annotation (Line(points={{90,-210}, + {98,-210},{98,-175.333},{118,-175.333}}, color={255,0,255})); annotation (defaultComponentName="boiPlaCon", Icon(coordinateSystem(extent={{-100,-360},{100,360}}), graphics={ From 1f0b26b29dcf03dda513976918f1e7e1a0c44700 Mon Sep 17 00:00:00 2001 From: Devaprasad Date: Tue, 20 Jun 2023 08:20:47 -0700 Subject: [PATCH 20/20] Renamed nPriLeg and nSecLeg to nPriLoo and nSecLoo respectively --- .../PrimarySystem/BoilerPlant/Controller.mo | 70 +++++++++---------- 1 file changed, 34 insertions(+), 36 deletions(-) diff --git a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Controller.mo b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Controller.mo index 73f36776741..56248cc33cd 100644 --- a/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Controller.mo +++ b/Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Controller.mo @@ -2,7 +2,7 @@ within Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant; model Controller "Boiler plant controller" - parameter Buildings.Controls.OBC.CDL.Types.SimpleController controllerType_priPum[nPriLeg]= fill(Buildings.Controls.OBC.CDL.Types.SimpleController.PI, nPriLeg) + parameter Buildings.Controls.OBC.CDL.Types.SimpleController controllerType_priPum[nPriLoo]= fill(Buildings.Controls.OBC.CDL.Types.SimpleController.PI, nPriLoo) "Type of controller" annotation (Dialog(tab="Primary pump control parameters", group="PID parameters")); @@ -11,22 +11,20 @@ model Controller "Type of controller" annotation(Dialog(tab="Bypass valve control parameters")); - parameter Buildings.Controls.OBC.CDL.Types.SimpleController controllerType_secPum[nSecLeg]= fill(Buildings.Controls.OBC.CDL.Types.SimpleController.PI, nSecLeg) + parameter Buildings.Controls.OBC.CDL.Types.SimpleController controllerType_secPum[nSecLoo]= fill(Buildings.Controls.OBC.CDL.Types.SimpleController.PI, nSecLoo) "Type of controller" annotation(Dialog(tab="Secondary pump control parameters", group="PID parameters")); - parameter Integer nPriLeg( - final min=1) = 1 + parameter Integer nPriLoo( + final min=1) "Number of legs in the primary loop; Must be 1 for primary-only boiler plant" annotation(Dialog(group="Boiler plant configuration parameters", enable = not have_priOnl)); - parameter Integer boiLegMat[nBoi]( - final min=fill(1, nBoi), - final max=fill(nPriLeg, nBoi)) = fill(1, nBoi) - "Matrix describing the primary leg to which each boiler belongs" + parameter Integer boiLooMat[nPriLoo, :] + "Matrix describing the primary loops and their constituent boilers" annotation(Dialog(group="Boiler plant configuration parameters", enable = not have_priOnl)); @@ -34,52 +32,52 @@ model Controller "Is the boiler plant a primary-only boiler plant?" annotation(Dialog(group="Boiler plant configuration parameters")); - parameter Integer nSecLeg + parameter Integer nSecLoo "Number of legs in the secondary loop" annotation(Dialog(group="Boiler plant configuration parameters", enable = not have_priOnl)); - parameter Boolean have_heaPriPum[nPriLeg] + parameter Boolean have_heaPriPum[nPriLoo] "True: Headered primary pumps; False: Dedicated primary pumps" annotation(Dialog(group="Boiler plant configuration parameters")); - parameter Boolean have_varPriPum[nPriLeg] + parameter Boolean have_varPriPum[nPriLoo] "True: Variable-speed primary pumps; False: Fixed-speed primary pumps" annotation(Dialog(group="Boiler plant configuration parameters")); - parameter Boolean have_priFloSen[nPriLeg] + parameter Boolean have_priFloSen[nPriLoo] "True: Flowrate sensor in primary loop in primary-secondary plants; False: No flowrate sensor in primary loop" annotation(Dialog(group="Boiler plant configuration parameters", enable = not have_priOnl)); - parameter Boolean have_secFloSen_PriCon[nSecLeg] + parameter Boolean have_secFloSen_PriCon[nSecLoo] "True: Flowrate sensor in secondary loop downstream of decoupler for primary pump control; False: No flowrate sensor in secondary loop" annotation(Dialog(group="Boiler plant configuration parameters", - enable = (not have_priOnl and speConTypPri == fill(Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Types.PrimaryPumpSpeedControlTypes.flowrate, nPriLeg)))); + enable = (not have_priOnl and speConTypPri == fill(Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Types.PrimaryPumpSpeedControlTypes.flowrate, nPriLoo)))); - parameter Boolean have_secFloSen_SecCon[nSecLeg] + parameter Boolean have_secFloSen_SecCon[nSecLoo] "True: Flowrate sensor in secondary loop for secondary pump control; False: No flowrate sensor in secondary loop" annotation(Dialog(group="Boiler plant configuration parameters", enable = (not have_priOnl and have_varSec))); - parameter Boolean have_decFloSen[nPriLeg] + parameter Boolean have_decFloSen[nPriLoo] "True: Flowrate sensor in decoupler leg; False: No flowrate sensor in decoupler leg" annotation(Dialog(group="Boiler plant configuration parameters", enable = not have_priOnl)); - parameter Boolean have_priTemSen[nPriLeg] + parameter Boolean have_priTemSen[nPriLoo] "True: Temperature sensors in primary loop; False: Temperature sensors in boiler supply" annotation (Dialog(group="Boiler plant configuration parameters", enable = speConTypPri == Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Types.PrimaryPumpSpeedControlTypes.temperature)); - parameter Boolean have_varSecPum[nSecLeg] + parameter Boolean have_varSecPum[nSecLoo] "True: Variable-speed secondary pumps; False: Fixed-speed secondary pumps" annotation (Dialog(group="Boiler plant configuration parameters", @@ -90,7 +88,7 @@ model Controller "Number of hot-water requests to be ignored before enabling boiler plant loop" annotation(Dialog(tab="Plant enable/disable parameters")); - parameter Integer nBoi[nPriLeg] + parameter Integer nBoi[nPriLoo] "Number of boilers" annotation(Dialog(tab="General", group="Boiler plant configuration parameters")); @@ -110,7 +108,7 @@ model Controller annotation(Dialog(tab="General", group="Boiler plant configuration parameters")); - parameter Integer nPumPri[nPriLeg] + parameter Integer nPumPri[nPriLoo] "Number of primary pumps in each primary loop in the boiler plant" annotation(Dialog(tab="General", group="Boiler plant configuration parameters")); @@ -132,19 +130,19 @@ model Controller group="Temperature-based speed regulation", enable= speConTypPri == Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Types.PrimaryPumpSpeedControlTypes.temperature)); - parameter Integer nPumPri_nominal[nPriLeg]( - final max=fill(nPumPri, nPriLeg), - final min=fill(1, nPriLeg)) = fill(nPumPri, nPriLeg) + parameter Integer nPumPri_nominal[nPriLoo]( + final max=fill(nPumPri, nPriLoo), + final min=fill(1, nPriLoo)) = fill(nPumPri, nPriLoo) "Total number of pumps that operate at design conditions in each primary loop" annotation (Dialog(group="Boiler plant configuration parameters")); - parameter Integer nPumSec[nSecLeg] + parameter Integer nPumSec[nSecLoo] "Total number of secondary hot water pumps in each secondary loop" annotation (Dialog(group="Boiler plant configuration parameters", enable = not have_priOnl)); - parameter Integer nPumSec_nominal[nSecLeg]( - final max=nPumSec) = fill(nPumSec, nSecLeg) + parameter Integer nPumSec_nominal[nSecLoo]( + final max=nPumSec) = fill(nPumSec, nSecLoo) "Total number of pumps that operate at design conditions in each secondary loop" annotation (Dialog(group="Boiler plant configuration parameters", enable = not have_priOnl)); @@ -1017,7 +1015,7 @@ model Controller annotation (Placement(transformation(extent={{-440,130},{-400,170}}), iconTransformation(extent={{-140,120},{-100,160}}))); - Buildings.Controls.OBC.CDL.Interfaces.RealInput VHotWatSecPriPumCon_flow[nPriLeg]( + Buildings.Controls.OBC.CDL.Interfaces.RealInput VHotWatSecPriPumCon_flow[nPriLoo]( final unit="m3/s", displayUnit="m3/s", final quantity="VolumeFlowRate") if not have_priOnl and have_secFloSen @@ -1025,7 +1023,7 @@ model Controller annotation (Placement(transformation(extent={{-440,-90},{-400,-50}}), iconTransformation(extent={{-140,30},{-100,70}}))); - Buildings.Controls.OBC.CDL.Interfaces.RealInput VHotWatDec_flow[nPriLeg]( + Buildings.Controls.OBC.CDL.Interfaces.RealInput VHotWatDec_flow[nPriLoo]( final unit="m3/s", displayUnit="m3/s", final quantity="VolumeFlowRate") if not have_priOnl and have_varPriPum @@ -1250,11 +1248,11 @@ protected "Vector of secondary pump indices up to total number of secondary pumps"; Buildings.Controls.OBC.CDL.Routing.BooleanScalarReplicator booScaRep( - final nout=nPriLeg) + final nout=nPriLoo) "Replicate pump change signal to each primary leg" annotation (Placement(transformation(extent={{68,-220},{88,-200}}))); - Buildings.Controls.OBC.CDL.Interfaces.RealInput VHotWatSecPumCon_flow[nSecLeg]( + Buildings.Controls.OBC.CDL.Interfaces.RealInput VHotWatSecPumCon_flow[nSecLoo]( final unit="m3/s", displayUnit="m3/s", final quantity="VolumeFlowRate") if not have_priOnl and have_secFloSen @@ -1329,7 +1327,7 @@ protected annotation (Placement(transformation(extent={{120,20},{140,60}}))); Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Pumps.PrimaryPumps.Controller - priPumCon[nPriLeg]( + priPumCon[nPriLoo]( final controllerType=controllerType_priPum, final have_heaPriPum=have_heaPriPum, final have_priOnl=have_priOnl, @@ -1453,7 +1451,7 @@ protected "Constant stage Integer source" annotation (Placement(transformation(extent={{-390,-40},{-370,-20}}))); - Buildings.Controls.OBC.CDL.Integers.Sources.Constant conInt2[nPriLeg,nPumPri]( + Buildings.Controls.OBC.CDL.Integers.Sources.Constant conInt2[nPriLoo,nPumPri]( final k=priPumInd) "Constant stage Integer source" annotation (Placement(transformation(extent={{60,-138},{80,-118}}))); @@ -1470,7 +1468,7 @@ protected "Integer to Real converter" annotation (Placement(transformation(extent={{-190,-50},{-170,-30}}))); - Buildings.Controls.OBC.CDL.Continuous.Sources.Constant dpHotWatSet[nPriLeg]( + Buildings.Controls.OBC.CDL.Continuous.Sources.Constant dpHotWatSet[nPriLoo]( final k=maxLocDpPri) if have_priOnl "Differential pressure setpoint for primary circuit" annotation (Placement(transformation(extent={{60,-180},{80,-160}}))); @@ -1526,7 +1524,7 @@ protected annotation (Placement(transformation(extent={{240,60},{260,80}}))); Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Pumps.SecondaryPumps.Controller - secPumCon[nSecLeg]( + secPumCon[nSecLoo]( final controllerType=controllerType_secPum, final have_varSecPum=true, final have_secFloSen=have_secFloSen, @@ -1561,12 +1559,12 @@ protected "Switch input signal between stage-up and stage-down processes" annotation (Placement(transformation(extent={{64,280},{84,300}}))); - Buildings.Controls.OBC.CDL.Integers.Sources.Constant conInt3[nSecLeg,nPumSec]( + Buildings.Controls.OBC.CDL.Integers.Sources.Constant conInt3[nSecLoo,nPumSec]( final k=secPumInd) if not have_priOnl "Constant stage Integer source" annotation (Placement(transformation(extent={{60,-290},{80,-270}}))); - Buildings.Controls.OBC.CDL.Continuous.Sources.Constant dpHotWatSet1[nSecLeg]( + Buildings.Controls.OBC.CDL.Continuous.Sources.Constant dpHotWatSet1[nSecLoo]( final k=maxLocDpSec) if not have_priOnl "Differential pressure setpoint for secondary circuit" annotation (Placement(transformation(extent={{60,-390},{80,-370}})));