Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Issue2180 boiler plant main controller oct 2021 #3325

Open
wants to merge 22 commits into
base: issue2180_BoilerPlant_MainController_oct_2021
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
5602c1f
Merge pull request #61 from lbl-srg/issue2180_BoilerPlant_MainControl…
karthikeyad-pnnl Mar 28, 2023
9e4eb4e
Deleted modifiers in extIndSig blocks
junkewang001 Mar 30, 2023
e998513
Changed the input of stage0 from 0 to 1
junkewang001 Mar 30, 2023
eaa16cb
Deleted modifiers of allowOutOfRange and outOfRangeValue in components
junkewang001 Mar 31, 2023
8b8109d
Added new class and modified existing class to fix zero index error o…
karthikeyad-pnnl Apr 4, 2023
b889ffc
Updated class name for zero index correction
karthikeyad-pnnl Apr 4, 2023
a936cfd
Moved zero index correction to the generic package
karthikeyad-pnnl Apr 4, 2023
b91833c
Updated models to resolve errors logged during unit test
karthikeyad-pnnl Apr 4, 2023
3823371
Added tolerance to model file
karthikeyad-pnnl Apr 4, 2023
7a08b9b
Added tolerance to validation model
karthikeyad-pnnl Apr 4, 2023
364347b
Updated unit test results
karthikeyad-pnnl Apr 4, 2023
633760e
Merge branch 'issue2180_BoilerPlant_MainController_oct_2021' into iss…
karthikeyad-pnnl Apr 4, 2023
e100a16
Updated input signals for validation model
karthikeyad-pnnl Apr 7, 2023
9e8071d
Removed excess zeros from validation script
karthikeyad-pnnl Apr 7, 2023
32fc2cf
Changed default component name
karthikeyad-pnnl Apr 7, 2023
52f2f67
Fixed typos in documentation
karthikeyad-pnnl Apr 10, 2023
33c8675
Updated annotation instances of dialog to Dialog
karthikeyad-pnnl Jun 6, 2023
2405421
Changed plant enable schedule from parameter to Boolean input
karthikeyad-pnnl Jun 6, 2023
94b0908
Fixed typos in comments and added missing comments
karthikeyad-pnnl Jun 15, 2023
1910760
Changed Boolean parameter names in line with changes being made at to…
karthikeyad-pnnl Jun 15, 2023
e69b397
Made changes to address Antoine's comments for ctrl-flow template com…
karthikeyad-pnnl Jun 15, 2023
1f0b26b
Renamed nPriLeg and nSecLeg to nPriLoo and nSecLoo respectively
karthikeyad-pnnl Jun 20, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
515 changes: 301 additions & 214 deletions Buildings/Controls/OBC/ASHRAE/PrimarySystem/BoilerPlant/Controller.mo

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -40,31 +33,29 @@ 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",
final displayUnit="K",
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}})));
Expand All @@ -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"
Expand Down Expand Up @@ -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)
Expand All @@ -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},
Expand All @@ -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},
Expand All @@ -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(
Expand Down
Original file line number Diff line number Diff line change
@@ -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}})));

Expand All @@ -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),
Expand Down Expand Up @@ -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}},
Expand All @@ -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},
Expand All @@ -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},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
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.Generic.ZeroIndexCorrection
zerStaIndCor
"Validation instance with zero index signal"
annotation (Placement(transformation(extent={{-40,-10},{-20,10}})));

Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Generic.ZeroIndexCorrection
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="<html>
<p>
This example validates
<a href=\"modelica://Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Generic.ZeroIndexCorrection\">
Buildings.Controls.OBC.ASHRAE.PrimarySystem.BoilerPlant.Generic.ZeroIndexCorrection</a>.
</p>
<p>
It contains two instances:
<ul>
<li>
zerStaIndCor: Gets a zero index input signal.
</li>
<li>
zerStaIndCor1: Gets a non-zero index input signal.
</li>
</ul>
The model simulates and plots these two instances to demonstrate that the block
is performing the modifications correctly.
</p>
</html>", revisions="<html>
<ul>
<li>
April 3, 2023, by Karthik Devaprasad:<br/>
First implementation.
</li>
</ul>
</html>"),
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}})),
experiment(Tolerance=1e-6));
end ZeroIndexCorrection;
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
PlantDisable
PlantEnable
RotationController
ZeroIndexCorrection
Loading