Skip to content

Commit

Permalink
Merge pull request #4027 from SenHuang19/issue2884_PID_autotuning
Browse files Browse the repository at this point in the history
issue2884 autotuning PID
  • Loading branch information
JayHuLBL authored Nov 20, 2024
2 parents 8757c90 + abf5949 commit 5504a20
Show file tree
Hide file tree
Showing 46 changed files with 239 additions and 217 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ block PIDDerivativeTime "Identify the derivative time of a PID controller"
final quantity="Time",
final unit="s",
min=100*Buildings.Controls.OBC.CDL.Constants.eps)
"Time constant of a first order time-delayed model"
"Time constant of a first-order plus time-delay (FOPTD) model"
annotation (Placement(transformation(extent={{-140,40},{-100,80}}),
iconTransformation(extent={{-140,40},{-100,80}})));
Buildings.Controls.OBC.CDL.Interfaces.RealInput L(
final quantity="Time",
final unit="s",
min=100*Buildings.Controls.OBC.CDL.Constants.eps)
"Time delay of a first order time-delayed model"
"Time delay of the FOPTD model"
annotation (Placement(transformation(extent={{-140,-80},{-100,-40}}),
iconTransformation(extent={{-140,-80},{-100,-40}})));
Buildings.Controls.OBC.CDL.Interfaces.RealOutput Td(
Expand Down Expand Up @@ -82,14 +82,14 @@ First implementation<br/>
T<sub>d</sub> = 0.5 L T/(0.3 L + T),
</p>
<p>
where <code>T</code> is the time constant of the first-order time delayed model
and <code>L</code> is the time delay of the first-order time delayed model.
where <code>T</code> is the time constant of the first-order plus time-delay (FOPTD) model
and <code>L</code> is the time delay of the FOPTD model.
</p>
<h4>References</h4>
<p>
Åström, Karl Johan and Tore Hägglund (2004)
\"Revisiting the Ziegler–Nichols step response method for PID control.\"
Journal of process control 14.6 (2004): 635-650.
Journal of Process Control 14.6 (2004): 635-650.
</p>
</html>"));
end PIDDerivativeTime;
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,25 @@ within Buildings.Controls.OBC.Utilities.PIDWithAutotuning.AutoTuner.AMIGO.BaseCl
block PIDGain "Identify the control gain of a PID controller"
Buildings.Controls.OBC.CDL.Interfaces.RealInput kp(
final min=1E-6)
"Gain of a first order time-delayed model"
"Gain of a first-order plus time-delay (FOPTD) model"
annotation (Placement(transformation(extent={{-140,40},{-100,80}}),
iconTransformation(extent={{-140,40},{-100,80}})));
Buildings.Controls.OBC.CDL.Interfaces.RealInput T(
final quantity="Time",
final unit="s",
min=100*Buildings.Controls.OBC.CDL.Constants.eps)
"Time constant of a first order time-delayed model"
"Time constant of the FOPTD model"
annotation (Placement(transformation(extent={{-140,-20},{-100,20}}),
iconTransformation(extent={{-140,-20},{-100,20}})));
Buildings.Controls.OBC.CDL.Interfaces.RealInput L(
final quantity="Time",
final unit="s",
min=100*Buildings.Controls.OBC.CDL.Constants.eps)
"Time delay of a first order time-delayed model"
"Time delay of the FOPTD model"
annotation (Placement(transformation(extent={{-140,-80},{-100,-40}}),
iconTransformation(extent={{-140,-80},{-100,-40}})));
Buildings.Controls.OBC.CDL.Interfaces.RealOutput k
"Control gain signal"
"Control gain"
annotation (Placement(transformation(extent={{100,-20},{140,20}})));
protected
Buildings.Controls.OBC.CDL.Reals.Divide div1
Expand Down Expand Up @@ -88,15 +88,15 @@ First implementation<br/>
k = 1/k<sub>p</sub> + (0.2 + 0.45 T/L),
</p>
<p>
where <code>k<sub>p</sub></code> is the gain of the first-order time delayed model,
<code>T</code> is the time constant of the first-order time delayed model,
and <code>L</code> is the time delay of the first-order time delayed model.
where <code>k<sub>p</sub></code> is the gain of the first-order plus time-delay (FOPTD) model,
<code>T</code> is the time constant of the FOPTD model,
and <code>L</code> is the time delay of the FOPTD model.
</p>
<h4>References</h4>
<p>
Åström, Karl Johan and Tore Hägglund (2004)
\"Revisiting the Ziegler–Nichols step response method for PID control.\"
Journal of process control 14.6 (2004): 635-650.
Journal of Process Control 14.6 (2004): 635-650.
</p>
</html>"));
end PIDGain;
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ block PIDIntegralTime "Identify the integral time of a PID controller"
final quantity="Time",
final unit="s",
min=100*Buildings.Controls.OBC.CDL.Constants.eps)
"Time constant of a first order time-delayed model"
"Time constant of a first-order plus time-delay (FOPTD) model"
annotation (Placement(transformation(extent={{-140,40},{-100,80}}),
iconTransformation(extent={{-140,40},{-100,80}})));
Buildings.Controls.OBC.CDL.Interfaces.RealInput L(
final quantity="Time",
final unit="s",
min=100*Buildings.Controls.OBC.CDL.Constants.eps)
"Time delay of a first order time-delayed model"
"Time delay of the FOPTD model"
annotation (Placement(transformation(extent={{-140,-80},{-100,-40}}),
iconTransformation(extent={{-140,-80},{-100,-40}})));
Buildings.Controls.OBC.CDL.Interfaces.RealOutput Ti(
Expand Down Expand Up @@ -96,14 +96,14 @@ First implementation<br/>
T<sub>i</sub> = L (0.4 L + 0.8 T)/(L + 0.1 T),
</p>
<p>
where <code>T</code> is the time constant of the first-order time delayed model
and <code>L</code> is the time delay of the first-order time delayed model.
where <code>T</code> is the time constant of the first-order plus time-delay (FOPTD) model
and <code>L</code> is the time delay of the FOPTD model.
</p>
<h4>References</h4>
<p>
Åström, Karl Johan and Tore Hägglund (2004)
\"Revisiting the Ziegler–Nichols step response method for PID control.\"
Journal of process control 14.6 (2004): 635-650.
Journal of Process Control 14.6 (2004): 635-650.
</p>
</html>"));
end PIDIntegralTime;
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,25 @@ within Buildings.Controls.OBC.Utilities.PIDWithAutotuning.AutoTuner.AMIGO.BaseCl
block PIGain "Identify the control gain of a PI controller"
Buildings.Controls.OBC.CDL.Interfaces.RealInput kp(
final min=1E-6)
"Gain of a first order time-delayed model"
"Gain of a first-order plus time-delay (FOPTD) model"
annotation (Placement(transformation(extent={{-140,40},{-100,80}}),
iconTransformation(extent={{-140,40},{-100,80}})));
Buildings.Controls.OBC.CDL.Interfaces.RealInput T(
final quantity="Time",
final unit="s",
min=100*Buildings.Controls.OBC.CDL.Constants.eps)
"Time constant of a first order time-delayed model"
"Time constant of the FOPTD model"
annotation (Placement(transformation(extent={{-140,-20},{-100,20}}),
iconTransformation(extent={{-140,-20},{-100,20}})));
Buildings.Controls.OBC.CDL.Interfaces.RealInput L(
final quantity="Time",
final unit="s",
min=100*Buildings.Controls.OBC.CDL.Constants.eps)
"Time delay of a first order time-delayed model"
"Time delay of the FOPTD model"
annotation (Placement(transformation(extent={{-140,-96},{-100,-56}}),
iconTransformation(extent={{-140,-80},{-100,-40}})));
Buildings.Controls.OBC.CDL.Interfaces.RealOutput k
"Control gain of a PI controller"
"Control gain"
annotation (Placement(transformation(extent={{100,-20},{140,20}})));

protected
Expand Down Expand Up @@ -129,9 +129,9 @@ First implementation<br/>
k = 0.15/k<sub>p</sub> + (0.35-LT/(L+T)<sup>2</sup>)(T/k<sub>p</sub>/L),
</p>
<p>
where <code>k<sub>p</sub></code> is the gain of the first-order time delayed model,
<code>T</code> is the time constant of the first-order time delayed model, and
<code>L</code> is the time delay of the first-order time delayed model.
where <code>k<sub>p</sub></code> is the gain of the first-order plus time-delay (FOPTD) model,
<code>T</code> is the time constant of the FOPTD model, and
<code>L</code> is the time delay of the FOPTD model.
</p>
<h4>References</h4>
<p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ block PIIntegralTime "Identify the integral time of a PI controller"
final quantity="Time",
final unit="s",
min=100*Buildings.Controls.OBC.CDL.Constants.eps)
"Time constant of a first order time-delayed model"
"Time constant of a first-order plus time-delay (FOPTD) model"
annotation (Placement(transformation(extent={{-140,40},{-100,80}}),
iconTransformation(extent={{-140,40},{-100,80}})));
Buildings.Controls.OBC.CDL.Interfaces.RealInput L(
final quantity="Time",
final unit="s",
min=100*Buildings.Controls.OBC.CDL.Constants.eps)
"Time delay of a first order time-delayed model"
"Time delay of the FOPTD model"
annotation (Placement(transformation(extent={{-140,-80},{-100,-40}}),
iconTransformation(extent={{-140,-80},{-100,-40}})));
Buildings.Controls.OBC.CDL.Interfaces.RealOutput Ti(
Expand Down Expand Up @@ -131,8 +131,8 @@ First implementation<br/>
T<sub>i</sub> = 0.35 L + 13 L T<sup>2</sup>/(T<sup>2</sup> + 12 L T + 7 L<sup>2</sup>),
</p>
<p>
where <code>T</code> is the time constant of the first-order time delayed model
and <code>L</code> is the time delay of the first-order time delayed model.
where <code>T</code> is the time constant of the first-order plus time-delay (FOPTD) model
and <code>L</code> is the time delay of the FOPTD model.
</p>
<h4>References</h4>
<p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ model PIDDerivativeTime "Test model for calculating the derivative time for a PI
duration=1,
offset=0.5,
height=0.5)
"Time constant of a first order time-delayed model"
"Time constant of a first-order plus time-delay (FOPTD) model"
annotation (Placement(transformation(extent={{-60,10},{-40,30}})));
Buildings.Controls.OBC.CDL.Reals.Sources.Ramp L(
duration=1,
offset=0.3,
height=0.3)
"Time delay of a first order time-delayed model"
"Time delay of the FOPTD model"
annotation (Placement(transformation(extent={{-60,-30},{-40,-10}})));
equation
connect(T.y, PIDDerTim.T) annotation (Line(points={{-38,20},{-20,20},{-20,6},{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@ model PIDGain "Test model for calculating the control gain for a PID controller"
duration=1,
offset=1,
height=1)
"Gain of a first order time-delayed model"
"Gain of a first-order plus time-delay (FOPTD) model"
annotation (Placement(transformation(extent={{-60,20},{-40,40}})));
Buildings.Controls.OBC.CDL.Reals.Sources.Ramp T(
duration=1,
offset=0.5,
height=0.5)
"Time constant of a first order time-delayed model"
"Time constant of the FOPTD model"
annotation (Placement(transformation(extent={{-60,-10},{-40,10}})));
Buildings.Controls.OBC.CDL.Reals.Sources.Ramp L(
duration=1,
offset=0.3,
height=0.3)
"Time delay of a first order time-delayed model"
"Time delay of the FOPTD model"
annotation (Placement(transformation(extent={{-60,-40},{-40,-20}})));
equation
connect(kp.y, PIDGai.kp) annotation (Line(points={{-38,30},{-20,30},{-20,6},{-12,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ model PIDIntegralTime "Test model for calculating the integral time for a PID co
duration=1,
offset=0.5,
height=0.5)
"Time constant of a first order time-delayed model"
"Time constant of a first-order plus time-delay (FOPTD) model"
annotation (Placement(transformation(extent={{-60,10},{-40,30}})));
Buildings.Controls.OBC.CDL.Reals.Sources.Ramp L(
duration=1,
offset=0.3,
height=0.3)
"Time delay of a first order time-delayed model"
"Time delay of the FOPTD model"
annotation (Placement(transformation(extent={{-60,-30},{-40,-10}})));
equation
connect(T.y, PIDIntTim.T) annotation (Line(points={{-38,20},{-20,20},{-20,6},{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@ model PIGain "Test model for calculating the gain for a PI controller"
duration=1,
offset=1,
height=1)
"Gain of a first order time-delayed model"
"Gain of a first-order plus time-delay (FOPTD) model"
annotation (Placement(transformation(extent={{-60,20},{-40,40}})));
Buildings.Controls.OBC.CDL.Reals.Sources.Ramp T(
duration=1,
offset=0.5,
height=0.5)
"Time constant of a first order time-delayed model"
"Time constant of the FOPTD model"
annotation (Placement(transformation(extent={{-60,-10},{-40,10}})));
Buildings.Controls.OBC.CDL.Reals.Sources.Ramp L(
duration=1,
offset=0.3,
height=0.3)
"Time delay of a first order time-delayed model"
"Time delay of the FOPTD model"
annotation (Placement(transformation(extent={{-60,-40},{-40,-20}})));
equation
connect(L.y, PIGai.L) annotation (Line(points={{-38,-30},{-20,-30},{-20,-6},{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ model PIIntegralTime "Test model for calculating the integral time for a PI cont
duration=1,
offset=0.5,
height=0.5)
"Time constant of a first order time-delayed model"
"Time constant of a first-order plus time-delay (FOPTD) model"
annotation (Placement(transformation(extent={{-60,10},{-40,30}})));
Buildings.Controls.OBC.CDL.Reals.Sources.Ramp L(
duration=1,
offset=0.3,
height=0.3)
"Time delay of a first order time-delayed model"
"Time delay of the FOPTD model"
annotation (Placement(transformation(extent={{-60,-30},{-40,-10}})));
equation
connect(T.y, PIIntTim.T) annotation (Line(points={{-38,20},{-20,20},{-20,6},{-12,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@ within Buildings.Controls.OBC.Utilities.PIDWithAutotuning.AutoTuner.AMIGO;
block PI "Identify control gain and integral time of a PI controller"
Buildings.Controls.OBC.CDL.Interfaces.RealInput kp(
final min=1E-6)
"Gain of a first order time-delayed model"
"Gain of a first-order plus time-delay (FOPTD) model"
annotation (Placement(transformation(extent={{-140,40},{-100,80}}),
iconTransformation(extent={{-140,40},{-100,80}})));
Buildings.Controls.OBC.CDL.Interfaces.RealInput T(
final quantity="Time",
final unit="s",
min=100*Buildings.Controls.OBC.CDL.Constants.eps)
"Time constant of a first order time-delayed model"
final min=100*Buildings.Controls.OBC.CDL.Constants.eps)
"Time constant of the FOPTD model"
annotation (Placement(transformation(extent={{-140,-20},{-100,20}}),
iconTransformation(extent={{-140,-20},{-100,20}})));
Buildings.Controls.OBC.CDL.Interfaces.RealInput L(
final quantity="Time",
final unit="s",
min=100*Buildings.Controls.OBC.CDL.Constants.eps)
"Time delay of a first order time-delayed model"
final min=100*Buildings.Controls.OBC.CDL.Constants.eps)
"Time delay of the FOPTD model"
annotation (Placement(transformation(extent={{-140,-80},{-100,-40}}),
iconTransformation(extent={{-140,-80},{-100,-40}})));
Buildings.Controls.OBC.CDL.Interfaces.RealOutput k
Expand All @@ -26,7 +26,7 @@ block PI "Identify control gain and integral time of a PI controller"
Buildings.Controls.OBC.CDL.Interfaces.RealOutput Ti(
final quantity="Time",
final unit="s",
min=100*Buildings.Controls.OBC.CDL.Constants.eps)
final min=100*Buildings.Controls.OBC.CDL.Constants.eps)
"Time constant signal for the integral term"
annotation (Placement(transformation(extent={{100,-50},{140,-10}}),
iconTransformation(extent={{100,-80},{140,-40}})));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@ within Buildings.Controls.OBC.Utilities.PIDWithAutotuning.AutoTuner.AMIGO;
block PID "Identify control gain, integral time, and derivative time of the PID model"
Buildings.Controls.OBC.CDL.Interfaces.RealInput kp(
final min=1E-6)
"Gain of a first order time-delayed model"
"Gain of a first-order plus time-delay (FOPTD) model"
annotation (Placement(transformation(extent={{-140,40},{-100,80}}),
iconTransformation(extent={{-140,40},{-100,80}})));
Buildings.Controls.OBC.CDL.Interfaces.RealInput T(
final quantity="Time",
final unit="s",
min=100*Buildings.Controls.OBC.CDL.Constants.eps)
"Time constant of a first order time-delayed model"
final min=100*Buildings.Controls.OBC.CDL.Constants.eps)
"Time constant of the FOPTD model"
annotation (Placement(transformation(extent={{-140,-20},{-100,20}}),
iconTransformation(extent={{-140,-20},{-100,20}})));
Buildings.Controls.OBC.CDL.Interfaces.RealInput L(
final quantity="Time",
final unit="s",
min=100*Buildings.Controls.OBC.CDL.Constants.eps)
"Time delay of a first order time-delayed model"
final min=100*Buildings.Controls.OBC.CDL.Constants.eps)
"Time delay of the FOPTD model"
annotation (Placement(transformation(extent={{-140,-80},{-100,-40}}),
iconTransformation(extent={{-140,-80},{-100,-40}})));
Buildings.Controls.OBC.CDL.Interfaces.RealOutput k
Expand All @@ -26,13 +26,13 @@ block PID "Identify control gain, integral time, and derivative time of the PID
Buildings.Controls.OBC.CDL.Interfaces.RealOutput Ti(
final quantity="Time",
final unit="s",
min=100*Buildings.Controls.OBC.CDL.Constants.eps)
final min=100*Buildings.Controls.OBC.CDL.Constants.eps)
"Time constant signal for the integral term"
annotation (Placement(transformation(extent={{100,-20},{140,20}})));
Buildings.Controls.OBC.CDL.Interfaces.RealOutput Td(
final quantity="Time",
final unit="s",
min=100*Buildings.Controls.OBC.CDL.Constants.eps)
final min=100*Buildings.Controls.OBC.CDL.Constants.eps)
"Time constant signal for the derivative term"
annotation (Placement(transformation(extent={{100,-80},{140,-40}}),
iconTransformation(extent={{100,-90},{140,-50}})));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@ model PI "Test model for calculating parameters of a PI controller"
duration=1,
offset=1,
height=1)
"Gain of a first order time-delayed model"
"Gain of a first-order plus time-delay (FOPTD) model"
annotation (Placement(transformation(extent={{-60,22},{-40,42}})));
Buildings.Controls.OBC.CDL.Reals.Sources.Ramp T(
duration=1,
offset=0.5,
height=0.5)
"Time constant of a first order time-delayed model"
"Time constant of the FOPTD model"
annotation (Placement(transformation(extent={{-60,-20},{-40,0}})));
Buildings.Controls.OBC.CDL.Reals.Sources.Ramp L(
duration=1,
offset=0.3,
height=0.3)
"Time delay of a first order time-delayed model"
"Time delay of the FOPTD model"
annotation (Placement(transformation(extent={{-60,-60},{-40,-40}})));
equation
connect(L.y, PI.L) annotation (Line(points={{-38,-50},{-20,-50},{-20,-6},{-12,
Expand Down
Loading

0 comments on commit 5504a20

Please sign in to comment.