## Preliminary Automatics Course

Chapter 30. PID control
Chapter 30.1 Introduction
The previous chapter conclusions are:
The P and especially PD control enables fast reaction for x(t) step type but it doesn’t enable null steady control error e(t)=0
The PI control enables null steady control error e(t)=0 but it is relatively slow than above mentioned.
The PID controller conception is obvious. Let’s add component to obtain PID controller!

Chapter 30.2 PID unit
Chapter 30.2.1 PID unit Kp=1 Ti=10 sec Td=1 sec
Call Desktop/PID/16_regulacja_typu_PID/01_czlon_PID_Kp1_I10_D1_skok.zcos Fig. 30-1
PID unit has 3 components:
– proportional sP(t)
– integrating sI(t)
– differential sD(t)
Oscilloscop shows sD(t), sI(t) and output controller signal sPID(t)
But where is sP(t)?–> sP(t)=x(t) because Kp=1 here.
*We named the a/m structure the PID unit (and not a PID controller) because input is a single x(t) signal (and not a error  e(t)=x(t)-y(t) signal)
Click”start” Fig. 30-2
Kp=1 Ti=10 sec Td=1 sec
Input x(t) is a step type.
The output controller signal sPID(t) is doubled after Ti=10 sec. You dont see this moment at oscilloscope.
Other Ti definition–> Ti=10 sec–>time when  sI(t)=sP(t).
There is a real differentiation and not ideal.  The Td interpretation is complicated a little. It’s easier when x(t) is a ramp type.

Chapter 30.2.2 PID unit when x(t) is a ramp type
Call Desktop/PID/16_regulacja_typu_PID/02_czlon_PID_Kp1_I10_D1_pila.zcos Fig. 30-3
This same PID but  x(t) is a ramp type.
Click “start” Fig. 30-4
Kp=1 Ti=10 sec Td=1 sec
x(t) ramp type
– Proportional  sP(t) is a copy of the x(t) because KP=1.
– Integral sI(t) is a quadratic function as a integral of the linear function
– Real differential sD(t) is a x(t) speed “calculated” with inertia 0.1sec. There is state sP(t)=sD(t) after Td=1sec.

Chapter 30.3 PID controller with the one-inertial object
Chapter 30.3.1 Introduction
The one-inertial object is controlled by the PID

Chapter 30.3.2 PID controller Kp=3 Ti=4 sec Td=0 Differentiation OFF
Call Desktop/PID/16_regulacja_typu_PID/03_1T_Kp3_I4_D0.zcos Fig. 30-5
Kp=3 Ti=4 sec Td=0 sec
E.i. This is PI controller
Click “start” Fig. 30-6
The  process is the same as chapter 29 Fig. 29-24 because there are these same PI type control systems. Let’s make the real PID control.

Chapter 30.3.3 PID controller Kp=3 Ti=4 sec Td=0.5 sec
Call Desktop/PID/16_regulacja_typu_PID/04_1T_Kp3_I4_D0.5.zcos Fig. 30-7
Kp=3 Ti=4 sec Td=0.5 sec
Click “start” Fig. 30-8
Where is the positive effect of the D component? The setting time is even longer!

Chapter 30.3.4 PID controller Kp=3 Ti=4 sec Td=1 sec
Call Desktop/PID/19_regulacja_typu_PID/05_1T_Kp3_I4_D1 Fig. 30-9
Kp=3 Ti=4 sec Td=1 sec
Click “start” Fig. 30-10
It’s worse!

Chapter 30.3.5 PID controller Kp=10 Ti=5 sec Td=0 Differentiation OFF
Call PID/16_regulacja_typu_PID/06_1T_Kp10_I5_D0.zcos Fig. 30-11
Kp=10 Ti=5 sec Td=0 sec
Click “start” Fig. 30-12
The best process so far!

Chapter 30.3.6 PID controller Kp=10 Ti=5 sec Td=0.5 sec
Call Desktop/PID/16_regulacja_typu_PID/07_1T_Kp10_I5_D0.5.zcos Fig. 30-13
Kp=10 Ti=5 sec Td=0.5 sec
Click “start” Fig. 30-14
The differentiation doesn’t work out the situation.

Chapter 30.3.7 PID controller Kp=10 Ti=5 sec Td=1 sec
Call Desktop/PID/30_regulacja_typu_PID/08_1T_Kp10_I5_D1.zcos Fig. 30-15
Kp=10 Ti=5 sec Td=1 sec
Click “start” Fig. 30-16
It’s worse. Conclusion.  The optimal control for one inertial object is a PI control. I expect that the better is a P control even, but it
requires Kp=infinity. It’s a difficult problem.

Chapter 30.4 PID controller with the two-inertial object
Chapter 30.4.1 Introduction
The two-inertial object is controlled by the PID. We tested this object in the chapter 29 Fig. 29-38.

Chapter 30.4.2 PID controller Kp=3 Ti=8 sec Td=0 – Differentiation OFF
Call Desktop/PID/16_regulacja_typu_PID/09_2T_Kp3_I8_D0.zcos Fig. 30-17
Kp=3 Ti=8 sec Td=0 sek Differentiation OFF
This is PI controller the same as in  Chapter 29 Fig 29-23.
Click “start” Fig. 30-18
PID as PI controller

Chapter 30.4.3 PID controller Kp=3 Ti=8 sec Td=0.5 sec
Call Desktop/PID/16_regulacja_typu_PID/10_2T_Kp3_I8_D0.5.zcos Fig. 30-19
Kp=3 Ti=8 sec Td=0.5 sec
Click “start” Fig. 30-20
You observe a good job of the D component. Furthermore it was a very careful differentiaton. I remind you the principle of the D job. There are two opposing actions here. D differentiates the setpoint x(t) first–>y(t) arises very quickly at the begining. But this quickly arising y(t) causes braking effect because e(t)=x(t)-y(t)–> minus by y(t)! It prevents from overregulations and generally process is more stable.
Let’s look at this process by the other oscilloscope parameters. You will see all the sPID(t) control signal. Fig. 30-21
This “needle” type sPID(t) is an effect of the setpoint front edge differentiation. It causes quickly y(t) arising. You see the braking effect between circa 8…14 sec. This very careful differentiation gives good effects. Let’s be a bit more aggresive and set the Td=1 sec.

Chapter 30.4.4 PID controller Kp=3 Ti=8 sec Td=1 sec
Call Desktop/PID/16_regulacja_typu_PID/11_2T_Kp3_I8_D1_opt.zcos Fig. 30-22
Kp=3 Ti=8 sec Td=1 sec
Click “start” Fig. 30-23
Marvel! The process is quick and without oscillations almost. Go this way and increase Td.

Chapter 30.4.5 PID controller Kp=3 Ti=8 sec Td=5 sec
Call Desktop/PID/16_regulacja_typu_PID/12_2T_Kp3_I8_D5.zcos Fig. 30-24
Kp=3 Ti=8 sec Td=5 sec
Click “start” Fig. 30-25
Every exaggeration is bad. The braking D effect is too strong and the setting time is longer. But some people like this process. There are no overregulations! Let’s increase the Kp parameter up to Kp=10. Will be better?

Chapter 30.4.6 PID controller Kp=10 Ti=10 sec Td=0 sec Differentiation OFF
Call Desktop/PID/16_regulacja_typu_PID/13_2T_Kp10_I10_D0.zcos Fig. 30-26
Kp=10 Ti=10 sec Td=0 sec – Differentiation OFF
Click “start” Fig. 30-27
This is PI control. Big oscillations! Does D component help?

Chapter 30.4.7 PID controller Kp=10 Ti=10 sec Td=0.5 sec
Call Desktop/PID/16_regulacja_typu_PID/14_2T_Kp10_I10_D0.5.zcos Fig. 30-28
Kp=10 Ti=10 sek Td=0.5 sec
Click “start” Fig. 30-29
Good job. The smaller oscillations and shorter setting time. Isn’t D component beautiful? Go on this way and increase Td.

Chapter 30.4.8 PID controller Kp=10 Ti=10 sec Td=1 sec
Call Desktop/PID/16_regulacja_typu_PID/15_2T_Kp10_I10_D1.zcos Fig. 30-30
Kp=10 Ti=10 sec Td=1 sec
Click “start” Fig. 30-31
It’s better.

Chapter 30.4.9 PID controller Kp=10 Ti=10 sec Td=2 sec
Call Desktop/PID/16_regulacja_typu_PID/16_2T_Kp10_I10_D2.zcos Fig. 30-32
Kp=10 Ti=10 sec Td=2 sec
Click “start” Fig. 30-33
There aren’t overregulations but steady error e(t)=0 is only after 25 sec. It’s too slowly. Is the braking D effect dominant? The previous Td=1 sec was better.
Really? The error e(t)=0.05 was accomplished quickly after circa 5 sec. It achieves very slowly null error e(t)=0 then after circa 25 sec. It means that interration I action is too careful! let’s make it a bit more aggresive e.i Ti=7sec. We will diminish the Td up to Td=1.5 sec. by the way. Why is this Td? I don’t know. My nose is my adviser.

Chapter 30.4.10 PID controller Kp=10 Ti=7 sec Td=1.5 sec
Call Desktop/PID/15_regulacja_typu_PID/17_2T_Kp10_I7_D1.5optall.zcos Fig. 30-34
Kp=10 Ti=7 sec Td=1.5 sec
Click “start” Fig. 30-35
Author!! author! The parameters  Kp=10 Ti=7 sek Td=1.5 sek are optimal for our two-inertial  object. Compare this process with PI control Fig. 30-27. Shock!

Chapter 30.5 PID controller with the three-inertial object
Chapter 30.5.1 Introduction
The three-inertial object with K=1 T1=0.5 sec T2=3 sec i T3=5 sec  was tested in chapter 29 Fig. 27-53.

Chapter 30.5.2 PID controller Kp=3 Ti=10 sec Td=0 – Differentiation OFF
Call Desktop/PID/16_regulacja_typu_PID/18_3T_Kp3_I10_D0.zcos Fig. 30-36
Kp=3 Ti=10 sec Td=0 sec – Differentiation OFF
This same PI control as in  chapter 29 Fig. 29-52.
Click  “start” Fig. 30-37
Typical PI “slow” control but the main goal e(t)=0 is achieved.

Chapter 30.5.3 PID controller Kp=3 Ti=10 sec Td=0.5 sec
Call Desktop/PID/16_regulacja_typu_PID/19_3T_Kp3_I10_D0.5.zcos Fig. 30-38
Kp=3 Ti=10 sec Td=0.5 sec
The careful differentiation Td=0.5 sec  at start as usually
Click “start” Fig. 30-39
Even this small differentiation component D gives positive effect. Go on and set Td=1 sec.

Chapter 30.5.4 PID controller Kp=3 Ti=10 sec Td=1 sec
Call Desktop/PID/16_regulacja_typu_PID/20_3T_Kp3_I10_D1.zcos Fig. 30-40
Kp=3 Ti=10 sec Td=1 sec
Click “start” Fig. 30-41
The oscillations are smaller but the setting time is longer. Let’s increase Td.

Chapter 30.5.5 PID controller Kp=3 Ti=10 sec Td=1.5 sec
Call Desktop/PID/16_regulacja_typu_PID/21_3T_Kp3_I10_D1.5.zcos Fig. 30-42
Kp=3 Ti=10 sec Td=1.5 sec
Click “start” Fig. 30-43
The improvent is questionable. I suppose that the Ti decreament will do better as for two-inertial in Fig. 30-34. I recommend to do experiment with lower Ti for more ambitious readers.

Chapter 30.5.6 PID controller Kp=10 Ti=10 sec Td=0 – Differentiation OFF
Call Desktop/PID/16_regulacja_typu_PID/22_3T_Kp10_I10_D0.zcos Fig. 30-44
Kp=10 Ti=10 sec Td=0 sec– Differentiation OFF. In fact, this is PI control.
Click “start” Fig. 30-45
We expected the bigger oscillations because Kp was increased. Let’s calm the process by the D component.

Chapter 30.5.7 PID controller Kp=10 Ti=10 sec Td=1 sec
Call Desktop/PID/16_regulacja_typu_PID/23_3T_Kp10_I10_D1.zcos Fig. 30-46
Kp=10 Ti=10 sec Td=1 sec
Click “start” Fig. 30-47
This is an good example “how differentiation D component is good!” Compare with the Fig. 30-45. Try be better and do Td=2sec.

Chapter 30.5.8 PID controller Kp=10 Ti=10 sec Td=2 sec
Call Desktop/PID/16_regulacja_typu_PID/24_3T_Kp10_I10_D2.zcos Fig. 30-48
Kp=10 Ti=10 sec Td=2 sec
Click “start” Fig. 30-49
It’s better. But can we improve the setting time by the integration I intensification? For example Ti=7 sec?

Chapter 30.5.9 PID controller Kp=10 Ti=7 sec Td=2 sec
Call Desktop/PID/15_regulacja_typu_PID/25_3T_Kp10_I7_D2_optall.zcos Fig. 30-50
Kp=10 Ti=7 sec Td=2 sec
Click “start” Fig. 30-51
It’s better. The Kp=10 Ti=7 sec Td=2 sec parameters are optimal PID controller parameters for this three-inertial object.
These parameters were “hand” adjusted. I am sure that there are more optimal parameters but that’s quite different matter.

Chapter 30.6 How does PID controller suppress the disturbances?
Chapter 30.6.1 Introduction
The two and three-inertial objects are used as before.  We don’t test simple one-inertial because PI control is better than PID here.  The additional disturbance z(t)=+0.5 or z(t)=-0.5 occures at their inputs in 70 sec. The optimal Kp, Ti  and Td  parameters are choosed.  They are optimal on the grounds of the x(t) input, not z(t) input. The z(t) response will be better if they are choosed on the grounds of the z(t) disturbance!

Chapter 30.6.2 Two-inertial object, Kp=10 Ti=7sec Td=1.5 sec and positive disturbance z(t)=+0.5
Call Desktop/ PID/16_regulacja_typu_PID/26_2T_Kp10_I7_D1.5_+zakl.zcos Fig. 30-52
Disturbance  z(t)=+0.5 heating type occures  in 70 sec
Click “start” Fig. 30-53
You see the fast set point x(t) response and the good postive disturbance z(t)=+0.5  suppresion. The additional heating z(t)=+0.5  was compensated by the control signal sPID(t) drop ΔsPID(t)=-0.5 in steady state.
Note
Control signal sPID(t) line covers disturbance z(t)=+0.5 line after 80 sec here.

Chapter 30.6.3 Two-inertial object, Kp=10 Ti=7sec Td=1.5 sec and negative disturbance z(t)=-0.5
Call Desktop/PID/16_regulacja_typu_PID/27_2T_Kp10_I7_D1.5_-zakl.zcos Fig. 30-54
Disturbance  z(t)=-0.5 cooling type occures  in 70 sec
Click “start” Fig. 30-55
The disturbance additional cooling type z(t)=-0.5  was compensated by the control signal increase ΔsPID(t)=+0.5 in steady state. (heating increase)

Chapter 30.6.4 Three-inertial object, Kp=10 Ti=7sec Td=2 sec and positive disturbance z(t)=+0.5
Call Desktop/PID/16_regulacja_typu_PID/28_3T_Kp10_I7_D2_+zakl.zcos. Fig. 30-56
Disturbance  z(t)=+0.5 heating type occures  in 70 sec
Click “start” Fig. 30-57
Object is more complicated than before but the control system behaviour is surprisingly good.

Chapter 30.6.5 Three-inertial object, Kp=10 Ti=7sec Td=2 sec and negative disturbance z(t)=-0.5
Call Desktop/PID/16_regulacja_typu_PID/29_3T_Kp10_I7_D2_-zakl.zcos Fig. 30-58
Disturbance  z(t)=-0.5 cooling type occures  in 70 sec
Click “start” Fig. 30-59

Chapter 30.7 P, PD, PI i PID controllers comparison
Chapter 30.7.1 Introduction
This same set point x(t) step type will be given for P, PD, PI and PID control systems.
There will be controlled the objects
two-inertial
three-inertial
The opimal (or “pseudoptimal”)  Kp, Ti and Td parameters were “handy” chosen in the earlier experiments.

Chapter 30.7.2 Control system with the two-inertial objects
Call Desktop/PID/16_regulacja_typu_PID/30_por_2T_P_PI_PID.zcos Fig. 30-60
You tested these systems in the chapters:
– 26  P control
– 27 PD control
– 29 PI control
– 30 PID control
There are the only poor versions with one input x(t) and  objects outputs yP(t), yPD(t), yPI(t) i yPID(t).
Click “start” Fig. 30-61
Black yP(t) of the P control is the worst. The oscillations and the setting time are the biggest.
There isn’t steady null control error e(t)=0.
Green yPD(t) of the  PD control has the best dynamics. The response is almost rectangle.
There isn’t steady null control error e(t)=0 too.
Blue yPI(t) of the PI guarantes steady null control error e(t)=0, but the dynamics isn’t impressive.
There are oscillations and a big setting time.
Red yPID(t)  of the  PID control is the best. It assure steady null control error e(t)=0, small oscillations and short setting time.
These dynamical qualities are a little worse than PD control.
Finally compare PID and his poor relation P

Chapter 30.7.3 Control system with the three-inertial objects
Call Desktop/PID/16_regulacja_typu_PID/31_por_3T_P_PI_PID.zcos Fig. 30-62
Click “start” Fig. 30-63
The object is more complicated now and and there is worse dynamic than previous.

Chapter 30.8 PID control summary
PID is all the controllers king. Even the word PID or controller is the same for some people. As a vacuum cleaner and electroluks.
The PID idea isn’t the effect of the finespun mathematical considerations but the effect of the life observation. The pilot of the ship tries to provide ship course despite the disturbances as squall or waves.
The man uses subconsciously PID algorithm in every day life .
P component – immediate reaction typical for young people
I component – reaction considering the history. Don’t be hot-headed. Something is small but if this something is in a long time we are reacting and waiting for effects. This behaviour is typical for old experienced people.
D component- foresight. Something is small but its speed is big. We are feeling trend and we make some decisions.