Skip to content

Commit

Permalink
improved validation model to show retriggering tuning process
Browse files Browse the repository at this point in the history
  • Loading branch information
JayHuLBL committed Sep 28, 2023
1 parent 0ea3169 commit 5bd2846
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ model PIDWithFirstOrderAMIGO "Test model for an autotuning PID controller"
annotation (Placement(transformation(extent={{80,-60},{60,-40}})));
Buildings.Controls.OBC.CDL.Logical.Sources.Pulse autTunSig(
width=0.9,
period=10000,
shift=-9000) "Signal for enabling the autotuning"
period=6000,
shift=500) "Signal for enabling the autotuning"
annotation (Placement(transformation(extent={{-80,-60},{-60,-40}})));
equation
connect(resSig.y, PID.trigger) annotation (Line(points={{-58,70},{-30,70},{-30,
Expand Down Expand Up @@ -103,16 +103,20 @@ to that of a normal PID controller (<code>PID</code>) with prescribed gains.
</p>
<p>
Both PID controllers are connected with a first-order control process.
At the beginning (<i>0</i>s-<i>1000</i>s), the outputs from those two PID controllers
At the beginning (<i>0</i>s-<i>500</i>s), the outputs from those two PID controllers
are identical as their prescribed gains are the same.
</p>
<p>
Once the autotuning starts at <i>1000</i>s, the outputs of the two PID controllers become different.
Once the autotuning starts at <i>500</i>s, the outputs of the two PID controllers become different.
After the tuning completes, under the control of <code>PIDWitTun</code>, the value of the controlled variable
is close to the setpoint after the tuning period ends (<code>PIDWitTun.resPro.triEnd = true</code>).
On the contrary, <code>PID</code> has a poor control performance,
i.e., the value of the controlled variable oscillates.
</p>
<p>
The example also shows that the autotunning process can be retriggered
when the input <code>triTun</code> becomes <code>true</code>.
</p>
</html>",
revisions="<html>
<ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ model PIWithFirstOrderAMIGO "Test model for an autotuning PI controller"
annotation (Placement(transformation(extent={{80,-60},{60,-40}})));
Buildings.Controls.OBC.CDL.Logical.Sources.Pulse autTunSig(
width=0.9,
period=10000,
shift=-9000) "Signal for enabling the autotuning"
period=6000,
shift=500) "Signal for enabling the autotuning"
annotation (Placement(transformation(extent={{-80,-60},{-60,-40}})));

equation
Expand Down Expand Up @@ -99,7 +99,7 @@ Validation test for the block
Buildings.Controls.OBC.Utilities.PIDWithAutotuning.FirstOrderAMIGO</a>.
</p>
<p>
This example is almost identical to <a href=\"modelica://Buildings.Controls.OBC.Utilities.PIDWithAutotuning.Validation.PIDWithFirstOrderAMIGO\">
This example is similar as <a href=\"modelica://Buildings.Controls.OBC.Utilities.PIDWithAutotuning.Validation.PIDWithFirstOrderAMIGO\">
Buildings.Controls.OBC.Utilities.PIDWithAutotuning.Validation.PIDWithFirstOrderAMIGO</a>.
However, an autotuning PI controller rather than an autotuning PID controller is considered in this example.
</p>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
last-generated=2023-09-19
last-generated=2023-09-28
statistics-simulation=
{
"linear": " ",
Expand All @@ -8,8 +8,8 @@ statistics-simulation=
}
time=[0e+00, 1e+04]
PID.u_s=[8.00000011920929e-01, 8.00000011920929e-01]
PID.u_m=[7.200000286102295e-01, 7.999955415725708e-01, 8.00000011920929e-01, 9.998812675476074e-01, 9.999308586120605e-01, 1.35326012969017e-02, 7.544281288573984e-07, -1.620563416793161e-08, 9.999659657478333e-01, 1.000000357627869e+00, 1.831946196034551e-03, -1.746274449487828e-07, -5.609168685083432e-09, 9.999949336051941e-01, 1e+00, 2.480100665707141e-04, -3.585540753192618e-08, 9.864667057991029e-01, 9.999995827674866e-01, 1e+00, 3.373355139046907e-05, 2.50190019812635e-08, 9.98167872428894e-01, 9.999999403953552e-01, 1e+00, 4.743972112919437e-06, -2.480660725723283e-07, 9.997516870498657e-01, 1e+00, 1.353300828486681e-02, 6.803470000704692e-07, -5.640788103278283e-08, 9.999660849571228e-01, 9.999998807907104e-01, 1.831486006267333e-03, -3.732870013095635e-08, 1.908020763607965e-08, 9.999951720237732e-01, 9.999998807907104e-01, 2.48188734985888e-04, 3.217139621369824e-08, 9.864668846130371e-01, 9.999992251396179e-01, 1e+00, 3.372893115738407e-05, 2.197630877276424e-08, 9.981679320335388e-01, 9.999998807907104e-01, 1e+00, 4.769079168909229e-06, 7.429161996697076e-08, 9.997523427009583e-01, 9.999999403953552e-01, 1.353302784264088e-02, 1.034865135807195e-06, -3.435196793688533e-09, 9.999656081199646e-01, 1.000000476837158e+00, 1.831485773436725e-03, -3.617385146981178e-08, 3.050061181397723e-08, 9.999945759773254e-01, 1e+00, 2.482747659087181e-04, -6.974792654546036e-08, 9.864667057991028e-01, 9.999992251396179e-01, 1.000000357627869e+00, 3.369602563907262e-05, 3.903253897874272e-08, 9.981673955917358e-01, 9.999998211860657e-01, 1e+00, 4.767383416037774e-06, 7.603664897715134e-08, 9.997503757476807e-01, 1.00000011920929e+00, 1.353302784264088e-02, 1.032252612276352e-06, 7.175890459620859e-08, 9.999659657478333e-01, 9.999999403953552e-01, 1.831659930758178e-03, 1.311786519408997e-07, -8.21852594867778e-08, 9.99995231628418e-01, 9.999998807907104e-01, 2.481871633790433e-04, 1.744355060395719e-08, 9.864668846130371e-01, 9.999992251396179e-01, 1e+00, 3.380886846571229e-05, 3.752766986053757e-08, 9.981676936149597e-01, 9.999998211860657e-01, 1e+00, 4.767782684211852e-06, 7.561517634258053e-08, 9.99751091003418e-01, 9.999998807907104e-01]
PID.u_m=[7.200000286102295e-01, 7.999955415725708e-01, 8.00000011920929e-01, 9.998812675476074e-01, 9.999308586120605e-01, 1.35326012969017e-02, 6.440500328608323e-07, 5.875592457016523e-09, 9.999662637710571e-01, 1e+00, 1.831764704547822e-03, 2.342568024005232e-07, 3.603535025931137e-09, 9.999949336051941e-01, 1.00000011920929e+00, 2.480908297002316e-04, 1.595457987946247e-08, 9.864665865898133e-01, 9.999992251396179e-01, 1e+00, 3.365114389453083e-05, -2.422762435116965e-08, 9.981680512428284e-01, 9.999989867210388e-01, 1e+00, 4.310262738727033e-06, 2.328992820821441e-08, 9.997521042823792e-01, 1e+00, 1.35330380871892e-02, 6.79178299378691e-07, 5.870391106554962e-08, 9.999662637710571e-01, 1e+00, 1.831486239097976e-03, -3.691763694746442e-08, 2.421544209596505e-08, 9.999949932098389e-01, 1.00000011920929e+00, 2.481888514012098e-04, 2.742204401329218e-07, 9.86466646194458e-01, 9.999990463256836e-01, 1.000000357627869e+00, 3.372815262991935e-05, 3.534541903604804e-08, 9.981674551963806e-01, 9.999998807907104e-01, 1.00000011920929e+00, 4.776772584591527e-06, 6.763659854414072e-08, 9.997515082359314e-01, 9.999998211860657e-01, 1.35330380871892e-02, 6.777574981242651e-07, 6.637635152628718e-08, 9.999660849571228e-01, 9.999998807907104e-01, 1.8314867047593e-03, -3.725519093222829e-08, -6.732372992424018e-10, 9.999946355819702e-01, 1.00000011920929e+00, 2.48274503974244e-04, -6.918997286220474e-08, 9.864673614501953e-01, 9.999998211860657e-01, 9.999999403953552e-01, 3.363205541972871e-05, 2.555656308799375e-08, 9.981688261032104e-01, 1.000000357627869e+00, 1e+00, 4.579071628540987e-06, -1.041051547190364e-07, 9.997515082359314e-01, 1e+00, 1.353293657302856e-02, 8.939209124037006e-07, 8.830804532067305e-09, 9.999662041664124e-01, 1.00000011920929e+00, 1.831797766499221e-03, 2.47536121378289e-07, 2.051977361361423e-07, 9.999948740005493e-01, 9.999998807907104e-01, 2.481013943906873e-04, 1.673911924626736e-07, 9.864643812179565e-01, 9.999995827674866e-01, 1e+00, 3.373266372364014e-05, -1.096864554739341e-08, 9.981688261032104e-01, 1e+00, 9.999999403953552e-01, 4.647220521292184e-06, 1.295071854201524e-07, 9.997513294219971e-01, 1.000000834465027e+00]
PIDWitTun.u_s=[8.00000011920929e-01, 8.00000011920929e-01]
PIDWitTun.u_m=[7.200000286102295e-01, 7.999955415725708e-01, 8.00000011920929e-01, 9.998812675476074e-01, 9.999308586120605e-01, 1.35326012969017e-02, 7.544281288573984e-07, -1.620563416793161e-08, 9.999659657478333e-01, 1.000000357627869e+00, 1.831946196034551e-03, -1.746274449487828e-07, -5.609168685083432e-09, 9.999949336051941e-01, 1e+00, -9.972719103097916e-02, -1.000000387430191e-01, 9.851133823394777e-01, 9.999995231628418e-01, 1e+00, 7.412633299827576e-01, 7.412546277046204e-01, 8.219677209854126e-01, 8.221158385276794e-01, 8.221158385276794e-01, 7.949301600456238e-01, 7.949300408363342e-01, 8.028817772865295e-01, 8.028837442398071e-01, 7.998954653739929e-01, 7.998544573783875e-01, 7.998544573783875e-01, 8.005303740501404e-01, 8.005304336547852e-01, 8.001306056976318e-01, 8.001298904418945e-01, 8.001298904418945e-01, 8.001444935798645e-01, 8.001444935798645e-01, 8.000691533088684e-01, 8.000690937042236e-01, 8.000497221946716e-01, 8.000494837760925e-01, 8.000494837760925e-01, 8.000285625457764e-01, 8.000285625457764e-01, 8.000184297561646e-01, 8.000183701515198e-01, 8.000183701515198e-01, 8.000112175941467e-01, 8.000112175941467e-01, 8.000070452690125e-01, 8.000069856643677e-01, 8.000043630599976e-01, 8.000043034553528e-01, 8.000043034553528e-01, 8.000026941299438e-01, 8.000026941299438e-01, 8.000016808509827e-01, 8.000016808509827e-01, 8.000016808509827e-01, 8.000010251998901e-01, 8.000010251998901e-01, 8.000006675720215e-01, 8.000006675720215e-01, 8.000004291534424e-01, 8.000003695487976e-01, 8.000003695487976e-01, 8.000002503395081e-01, 8.000002503395081e-01, 8.000001311302185e-01, 8.000001311302185e-01, 8.000001311302185e-01, 8.000000715255737e-01, 8.000000715255737e-01, 8.000000715255737e-01, 8.000000715255737e-01, 8.00000011920929e-01, 8.00000011920929e-01, 8.00000011920929e-01, 8.00000011920929e-01, 8.00000011920929e-01, 8.00000011920929e-01, 8.00000011920929e-01, 8.00000011920929e-01, 8.00000011920929e-01, 8.00000011920929e-01, 8.00000011920929e-01, 8.00000011920929e-01, 8.00000011920929e-01, 8.00000011920929e-01, 8.00000011920929e-01, 8.00000011920929e-01, 8.00000011920929e-01, 8.00000011920929e-01, 8.00000011920929e-01, 8.00000011920929e-01, 8.00000011920929e-01, 8.00000011920929e-01, 8.00000011920929e-01, 8.00000011920929e-01]
autTunSig.y=[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, 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, 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]
PIDWitTun.inTunPro.y=[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, 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, 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]
PIDWitTun.u_m=[7.200000286102295e-01, 7.999955415725708e-01, 8.00000011920929e-01, 9.998812675476074e-01, 9.999308586120605e-01, 1.35326012969017e-02, 6.440500328608323e-07, 5.875593789284153e-09, 9.999662637710571e-01, 1e+00, -9.798505902290344e-02, -9.999974071979523e-02, -9.999999403953552e-02, 9.999944567680359e-01, 1.00000011920929e+00, 7.413181066513062e-01, 7.412539124488831e-01, 8.210213184356689e-01, 8.221156001091003e-01, 8.221156597137451e-01, 7.949307560920715e-01, 7.949298620223999e-01, 8.028690814971924e-01, 8.028836846351624e-01, 8.028836846351624e-01, 7.998543977737427e-01, 7.998543977737427e-01, 8.005301952362061e-01, 8.005303740501404e-01, 8.001352548599243e-01, 8.001298308372498e-01, 8.001298308372498e-01, 8.001444339752197e-01, 8.001444339752197e-01, 8.00069272518158e-01, 8.000690937042236e-01, 8.000690937042236e-01, 8.000494241714478e-01, 8.000494241714478e-01, 8.000285625457764e-01, 8.000285625457764e-01, 8.000185489654541e-01, 8.000183701515198e-01, 8.000183701515198e-01, 8.000112175941467e-01, 8.000112175941467e-01, 8.000070452690125e-01, 8.000069856643677e-01, 8.000069856643677e-01, 8.000043034553528e-01, 8.000043034553528e-01, 8.000026941299438e-01, 8.000026941299438e-01, 8.000016808509827e-01, 8.000016808509827e-01, 8.000016808509827e-01, 8.000010251998901e-01, 8.000010251998901e-01, 8.000006675720215e-01, 8.000006675720215e-01, 8.000006675720215e-01, 8.000003695487976e-01, 8.000003695487976e-01, 8.000002503395081e-01, 8.000002503395081e-01, 8.000001311302185e-01, 8.000001311302185e-01, 8.000001311302185e-01, -9.996972978115082e-02, -9.999997913837433e-02, 9.979857206344604e-01, 1.000000357627869e+00, 1e+00, -9.99949648976326e-02, -1.000001132488251e-01, 9.997266530990601e-01, 1e+00, 8.396642208099365e-01, 8.374648094177246e-01, 8.374646306037903e-01, 8.508558869361877e-01, 8.508563041687012e-01, 8.227573037147522e-01, 8.227057456970215e-01, 8.227057456970215e-01, 8.169187903404236e-01, 8.169187903404236e-01, 8.095905780792236e-01, 8.095887303352356e-01, 8.062845468521118e-01, 8.062391877174377e-01, 8.062391877174377e-01, 8.037776947021484e-01, 8.037775754928589e-01, 8.023759126663208e-01, 8.023733496665955e-01, 8.023733496665955e-01, 8.014628291130066e-01, 8.014628291130066e-01, 8.009107112884521e-01, 8.009105324745178e-01]
autTunSig.y=[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, 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, 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]
PIDWitTun.inTunPro.y=[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, 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, 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]
Loading

0 comments on commit 5bd2846

Please sign in to comment.