diff --git a/Buildings/Controls/OBC/Utilities/PIDWithAutotuning/FirstOrderAMIGO.mo b/Buildings/Controls/OBC/Utilities/PIDWithAutotuning/FirstOrderAMIGO.mo index 1345d4bbc09..9cf8136dc42 100644 --- a/Buildings/Controls/OBC/Utilities/PIDWithAutotuning/FirstOrderAMIGO.mo +++ b/Buildings/Controls/OBC/Utilities/PIDWithAutotuning/FirstOrderAMIGO.mo @@ -116,7 +116,8 @@ block FirstOrderAMIGO conProMod( final yHig=yHig - yRef, final yLow=yRef + yLow, - final deaBan=deaBan) + final deaBan=deaBan, + final reverseActing=reverseActing) "Calculates the parameters of a first-order time delayed model" annotation (Placement(transformation(extent={{40,30},{60,50}}))); Buildings.Controls.OBC.CDL.Logical.Latch inTunPro @@ -179,8 +180,8 @@ equation {30,44},{22,44}},color={0,0,127})); connect(resPro.tOn, conProMod.tOn) annotation (Line(points={{22,48},{32,48},{32, 44},{38,44}},color={0,0,127})); - connect(rel.yErr, conProMod.u) annotation (Line(points={{-18,40},{-12,40},{-12, - 60},{34,60},{34,48},{38,48}},color={0,0,127})); + connect(rel.yDiff, conProMod.u) annotation (Line(points={{-18,40},{-12,40},{-12, + 60},{34,60},{34,48},{38,48}}, color={0,0,127})); connect(PIDPar.kp, conProMod.k) annotation (Line(points={{78,46},{62,46}}, color={0,0,127})); connect(PIDPar.T, conProMod.T) annotation (Line(points={{78,40},{62,40}}, color={0,0,127})); connect(PIDPar.L, conProMod.L) annotation (Line(points={{78,34},{62,34}}, color={0,0,127})); diff --git a/Buildings/Controls/OBC/Utilities/PIDWithAutotuning/Relay/Controller.mo b/Buildings/Controls/OBC/Utilities/PIDWithAutotuning/Relay/Controller.mo index b5ae105e3f5..20946ace0d4 100644 --- a/Buildings/Controls/OBC/Utilities/PIDWithAutotuning/Relay/Controller.mo +++ b/Buildings/Controls/OBC/Utilities/PIDWithAutotuning/Relay/Controller.mo @@ -32,10 +32,9 @@ block Controller Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput yOn "Relay switch output, true when control output switches to the higher value" annotation (Placement(transformation(extent={{100,-80},{140,-40}}))); - Buildings.Controls.OBC.CDL.Interfaces.RealOutput yErr - "Control error" + Buildings.Controls.OBC.CDL.Interfaces.RealOutput yDiff "Input difference" annotation (Placement(transformation(extent={{100,-10},{140,30}}), - iconTransformation(extent={{100,-20},{140,20}}))); + iconTransformation(extent={{100,-20},{140,20}}))); protected Buildings.Controls.OBC.CDL.Reals.Switch swi @@ -49,24 +48,21 @@ protected final k=-yLow) "Lower value for the output" annotation (Placement(transformation(extent={{-80,20},{-60,40}}))); - Buildings.Controls.OBC.CDL.Reals.Subtract conErr - "Control error (set point - measurement)" - annotation (Placement(transformation(extent={{40,0},{60,20}}))); Buildings.Controls.OBC.CDL.Reals.Switch swi1 "Switch between a higher value and a lower value" annotation (Placement(transformation(extent={{-10,-10},{10,10}}, origin={-50,-60}))); Buildings.Controls.OBC.CDL.Reals.Subtract sub - if reverseActing "Inputs difference" + if reverseActing "Inputs difference for reverse acting" annotation (Placement(transformation(extent={{0,-50},{20,-30}}))); Buildings.Controls.OBC.CDL.Reals.Hysteresis hys( - final uLow=-deaBa, - final uHigh=deaBa, + final uLow=-deaBan, + final uHigh=deaBan, final pre_y_start=true) - "Check if the measured value is larger than the reference, by default the relay control is on" + "Check if the input difference exceeds the thresholds, by default the relay control is on" annotation (Placement(transformation(extent={{40,-60},{60,-40}}))); Buildings.Controls.OBC.CDL.Reals.Subtract sub1 - if not reverseActing "Inputs difference" + if not reverseActing "Inputs difference for direct acting" annotation (Placement(transformation(extent={{0,-80},{20,-60}}))); Buildings.Controls.OBC.CDL.Reals.Greater gre "Check if the higher value is greater than the lower value" @@ -85,39 +81,25 @@ equation connect(higVal.y, swi.u1) annotation (Line(points={{-58,80},{-20,80},{-20,58},{58,58}},color={0,0,127})); connect(lowVal.y, swi.u3) annotation (Line(points={{-58,30},{-20,30},{-20,42}, - {58,42}}, - color={0,0,127})); - connect(conErr.y, yErr) annotation (Line(points={{62,10},{120,10}}, - color={0,0,127})); + {58,42}},color={0,0,127})); connect(swi1.u3, u_s) annotation (Line(points={{-62,-68},{-90,-68},{-90,0},{ - -120,0}}, - color={0,0,127})); + -120,0}},color={0,0,127})); connect(trigger, swi1.u2) annotation (Line(points={{-80,-120},{-80,-60},{-62, - -60}}, - color={255,0,255})); + -60}},color={255,0,255})); connect(u_m, swi1.u1) annotation (Line(points={{0,-120},{0,-90},{-70,-90},{ - -70,-52},{-62,-52}}, - color={0,0,127})); - connect(swi1.y, conErr.u1) annotation (Line(points={{-38,-60},{-20,-60},{-20, - 16},{38,16}}, color={0,0,127})); - connect(conErr.u2, u_s) annotation (Line(points={{38,4},{-42,4},{-42,0},{ - -120,0}}, - color={0,0,127})); + -70,-52},{-62,-52}},color={0,0,127})); connect(sub1.y, hys.u) annotation (Line(points={{22,-70},{30,-70},{30,-50},{ - 38,-50}}, - color={0,0,127})); + 38,-50}},color={0,0,127})); connect(sub.y, hys.u) annotation (Line(points={{22,-40},{30,-40},{30,-50},{38, -50}}, color={0,0,127})); connect(u_s, sub.u1) annotation (Line(points={{-120,0},{-90,0},{-90,-34},{-2, - -34}}, - color={0,0,127})); + -34}},color={0,0,127})); connect(u_s, sub1.u2) annotation (Line(points={{-120,0},{-90,0},{-90,-76},{-2, -76}}, color={0,0,127})); connect(swi1.y, sub.u2) annotation (Line(points={{-38,-60},{-20,-60},{-20,-46}, {-2,-46}}, color={0,0,127})); connect(swi1.y, sub1.u1) annotation (Line(points={{-38,-60},{-20,-60},{-20, - -64},{-2,-64}}, - color={0,0,127})); + -64},{-2,-64}},color={0,0,127})); connect(hys.y, swi.u2) annotation (Line(points={{62,-50},{80,-50},{80,30},{50, 30},{50,50},{58,50}}, color={255,0,255})); connect(gre.y, assMes.u) @@ -129,9 +111,12 @@ equation connect(higVal.y, gre.u1) annotation (Line(points={{-58,80},{-2,80}}, color={0,0,127})); connect(hys.y, yOn) annotation (Line(points={{62,-50},{80,-50},{80,-60},{120, - -60}}, - color={255,0,255})); - annotation (defaultComponentName = "relCon", + -60}},color={255,0,255})); + connect(yDiff, sub.y) annotation (Line(points={{120,10},{36,10},{36,-40},{22, + -40}}, color={0,0,127})); + connect(sub1.y, yDiff) annotation (Line(points={{22,-70},{36,-70},{36,10},{ + 120,10}}, color={0,0,127})); + annotation (defaultComponentName = "relCon", Icon(coordinateSystem(preserveAspectRatio=false), graphics={ Rectangle( extent={{-100,-100},{100,100}}, @@ -164,21 +149,22 @@ equation fillPattern=FillPattern.Solid, fillColor={175,175,175}, textString="Relay"), - Line(points={{-70,24},{-34,24},{-34,58},{38,58},{38,24},{66,24}}, color - ={28,108,200})}), Diagram( + Line(points={{-70,24},{-34,24},{-34,58},{38,58},{38,24},{66,24}}, color= + {28,108,200})}), Diagram( coordinateSystem(preserveAspectRatio=false)), Documentation(info="

This block generates a real control output y, a -boolean relay switch output yOn, and the control error -yErr. They are calculated as below: +boolean relay switch output yOn, +and an input difference yDiff. +They are calculated as below: