Figure 2: SIMULINK model representing the application of autotuner to determine the ultimate gain.
The amplitude of the relay autotuner pulse signal h is 0.1 for which the system becomes marginally stable. And, the sustained oscillation of the plant is obtained by this relay auto tuner value. The ultimate gain Kcu according to equation (1) is 7.96. (A=0.016, Pu=3.73)
Following figure 3 highlights the close loop system response and the relay autotuner response from which the ultimate gain is determined. A manual switch is implemented to switch from relay autotuner mode to linear control mode (figure 2).
 Figure 3: Plot showing the close loop system dynamic response with the relay input. 
From table 2, the tuning parameters for the P, PI, and PID controllers are calculated.
P Controller:
The gain value is 3.98. Figure (4) shows the SIMULINK model when Pcontroller is used. In addition, by using the gain parameter, the close loop system response to the step input is depicted in figure 5.
PI Controller: The gain is 3.582 and integral time is 3.12.
 Figure 4: SIMULINK model representing the application of P controller to control the plant. 
 Figure 5: Close loop system response when P controller is in action. 
In figure (6), the response curve is obtained by using the gain and integral time values.
 Figure 6: Close loop system response when PI controller is in action. 
PID Controller: The gain, integral time, and derivative time are 4.776, 1.865, and 0.466 respectively. In figure (7), the response curve obtained by using the gain, integral time and derivative time values.
 Figure 7: Close loop system response when PID controller is in action. 
By comparing the above responses due to the implementation of P, PI and PID controllers, the PID gives the finest result having the highest gain value of 4.776 among the three controllers. And, comparing figures 5 and 6, although only P controller shows better response than the PI which has a gain value of 3.98, but the DC gain is not 1.
2. When the plant transfer function is
For a=2: The numerator and denominator of the transfer function are [1] and [1 4 5 2] respectively. The amplitude of the relay autotuner pulse signal h is 0.1 for which the system becomes unstable. The ultimate gain Kcu according to equation (1) is 17.45. (A=0.0073, Pu=2.87). Figure 8 shows the signal generated by the relay autotuner (green) and response from the plant (blue) which shows sustained oscillations.
Figure 8: Plot showing the close loop system dynamic response due to the relay input pulse.
P Controller: The gain value is 8.73.
Figure 9: Close loop system response when P controller is in action.
PI Controller: The gain is 7.853 and integral time is 2.392.
Figure 10: Close loop system response when PI controller is in action.
PID Controller: The gain, integral time, and derivative time are 10.47, 1.435, and 0.359 respectively.
 Figure 11: Close loop system response when PID controller is in action. 
From figures 9, 10 and 11, using PID controller shows best performance among the three controllers. Although the overshoot in using PID is little higher than the P controller, nevertheless PID shows faster dynamic plant response than P controller. And, it is again noticeable that PID controller gain value 10.47 which is the highest among the others. PI controller which has the lowest gain 2.392 shows poor performance.
For a=10: The numerator and denominator of the transfer function are [1] and [1 12 21 10] respectively. The amplitude of the relay autotuner pulse signal h is 0.1 for which the system becomes unstable. The ultimate gain Kcu according to equation (1) is 227.48. (A=0.00056, Pu=1.44). Figure 12 highlights the sustained oscillation of the plant due to the implementation of the relay autotuner.
 Figure 12: Plot showing the close loop system dynamic response due to relay input.
P Controller: The gain value is 113.74.
 Figure 13: Close loop system response when P controller is in action. 

PI Controller: The gain is 102.366 and integral time is 1.2.
 Figure 14: Close loop system response when PI controller is in action. 
PID Controller: The gain, integral time, and derivative time are 136.488, 0.72, and 0.18 respectively.
 Figure 15: Close loop system response when PID controller is in action. 
Analyzing above figures 13, 14 and 15, it is seen again the plant response obtained by the implementation of PID controller shows promising result which has the highest gain value 136.488. In case of the PI controller, the system is unstable during first 30 seconds (approximately) and then it gets settle down. The gain value of the PI is 102.366 which is the lowest among the three controllers.
For a=50: The numerator and denominator of the transfer function are [1] and [1 52 101 50] respectively. The amplitude of the relay autotuner pulse signal h is 500 for which the system becomes unstable. The ultimate gain Kcu according to equation (1) is 5095.54. (A=0.000025, Pu=0.69). In this case, increasing the value of ‘a’ to 50 also increases the amplitude of the relay autotuner to 500 for which the system shows sustained oscillations. Following plot 16 shows the marginal stability of the system.
Figure 16: Plot showing the close loop system dynamic response due to relay input.
P Controller: The gain value is 2547.77.
 Figure 17: Close loop system response when P controller is in action. 
PI Controller: The gain is 2292.99 and integral time is 0.575.
 Figure 18: Close loop system response when PI controller is in action. 
 Figure 19: Close loop system response when integral time is set 2 seconds for the PI controller. 
PID Controller: The gain, integral time, and derivative time are 3057.32, 0.345, and 0.086 respectively.
 Figure 20: Close loop system response when PID controller is in action. 
From the above figures 17, 18, 19 and 20, increasing the value of ‘a’ also increases the gain of each controllers. And, finally it is understood vividly that the response of the plant due to the implementation of PID controller is much better than the other two controllers. The application of PI controller in this case makes the system totally unstable (figure 18). To see further to get the system stability, integral time was increased to 2 seconds (figure 19) and after around 15 seconds the system settles down to magnitude 1.
3. When the plant transfer function is
 Figure 21: SIMULINK model for the system when a time delay block is added before the plant. 
When Ï„ is 0.5
The numerator and denominator of the transfer function are [1] and [1 1] respectively. The amplitude of the relay autotuner pulse signal h is 0.1 for which the system becomes unstable. The ultimate gain Kcu according to equation (1) is 3.27. (A=0.039, Pu=1.67). Here, a time delay is added before the plant which obviously makes the system dynamics little more complex than previous cases. Figure 21 shows the plant response with transport delay when relay autotuner is applied.
 Figure 21: Plot showing the close loop system sustained oscillation due to relay input.

P Controller: The gain value is 1.63.
 Figure 22: Close loop system response when P controller is in action. 
PI Controller: The gain is 1.47 and integral time is 1.39.
 Figure 23: Close loop system response when PI controller is in action. 
PID Controller: The gain, integral time, and derivative time are 1.962, 0.835, and 0.209 respectively.
 Figure 24: Close loop system response when PID controller is in action. 
By examining figures 22, 23 and 24, implementing PI controller gives better performance than P controller in this case. But the gain value is less than gain of P. The DC gain of the plant is low in case of using P controller with respect to unit step input. The response of the plant is best while using PID controller which gets the highest gain value among the other controllers.
When Ï„ is 1.0 The numerator and denominator of the transfer function are [1] and [1 1] respectively. The amplitude of the relay autotuner pulse signal h is 0.1 for which the system becomes unstable. The ultimate gain Kcu according to equation (1) is 2.022. (A=0.063, Pu=3). The sustained oscillation of the plant due to the relay autotuner application is shown by following figure 25.
 Figure 25: Plot showing the close loop system sustained oscillation due to relay input. 
P Controller: The gain value is 1.011.
 Figure 26: Close loop system response when P controller is in action. 
PI Controller: The gain is 0.9099 and integral time is 2.5.
 Figure 27: Close loop system response when PI controller is in action. 
PID Controller: The gain, integral time, and derivative time are 1.2132, 1.5, and 0.375 respectively.
 Figure 28: Close loop system response when PID controller is in action. 
Again by examining figures 26, 27 and 28, implementing PI controller gives better performance than P controller. However, the gain value is less than gain of P. The DC gain of the plant is low in case of using P controller with respect to unit step input which is around 0.5. The response of the plant is best while using PID controller which gets the highest gain value among the other controllers. It is also worth mentioning that increasing the time delay correspondingly decreases the gain of the controllers.
When Ï„ is 3.0 The numerator and denominator of the transfer function are [1] and [1 1] respectively. The amplitude of the relay autotuner pulse signal h is 0.1 for which the system becomes unstable. The ultimate gain Kcu according to equation (1) is 1.36. (A=0.094, Pu=7.28). Figure 29 shows the plant response to the relay autotuner which behaves as marginally stable.
 Figure 29: Plot showing the close loop system sustained oscillation due to relay input. 
P Controller: The gain value is 0.678.
 Figure 30: Close loop system response when P controller is in action. 
PI Controller: The gain is 0.612 and integral time is 6.067.
 Figure 31: Close loop system response when PI controller is in action. 
PID Controller: The gain, integral time, and derivative time are 0.816, 3.64, and 0.91 respectively.
 Figure 32: Close loop system response when PID controller is in action. 
Finally by observing figures 30, 31 and 32, implementing PI controller gives better performance than P controller although the gain value is less than gain of P. The DC gain of the plant is low in case of using P controller with respect to unit step input which is around 0.4. The response of the plant is best while using PID controller which gets the highest gain value among the other controllers. Again, it is worth noticeable that increasing the time delay correspondingly decreases the gain of the controllers and further degrades the overall system response to the unit step input.
Part 02 (Implementation of the Relay Autotuner on Physical Plant)
Implementation of the Relay Autotuner on Water Tank System Simulations have shown some beautiful aspects of implementing relay autotuner for tuning PID controller to obtain desired system performance. In this section, a relay autotuner is implemented to find the sustained oscillations of the physical water tank system. In EEEL155 lab, a SIMULINK model is there for water tank level control. For this experiment, this model has been modified to accommodate the relay controller which is shown in figure 33. For the three configurations of the PID controller: P, PI and PID, experiments are carried out to understand and verify the ZieglerNichols’s PID tuning method.
The amplitude of the relay autotuner pulse signal h is 10 for which the water tank system becomes marginally stable. The ultimate gain Kcu according to equation (1) is 25.52. (A=0.499, Pu=2.43)
Following figure 34 highlights the close loop system response and the relay autotuner response from which the ultimate gain is determined. A manual switch is implemented to switch from relay autotuner mode to linear control mode (figure 33).
 Figure 33: SIMULINK model to study the effect of relay autotuner on physical water tank experimental test rig. 
 Figure 34: Plot showing the close loop system dynamic response due to the relay input pulse. 
P Controller: The gain value is 12.76.
 Figure 35: Water tank close loop system response when P controller is implemented. 
PI Controller: The gain is 11.48 and integral time is 2.03.
 Figure 36: Water tank close loop system response when PI controller is implemented. 
PID Controller: The gain, integral time, and derivative time are 15.31, 1.22, and 0.3 respectively.
 Figure 37: Water tank close loop system response when PID controller is implemented. 
By observing the figures 35, 36 and 37, it can be stated that the tuning method by ZieglerNichols works well not only in simulations but also in experiment in a qualitative sense. Using PI and PID controllers with the water tank system achieve DC gain 1 after some oscillations whereas only P controller fails to achieve the gain 1. Nonetheless, implementing P controller decreases overshoots which are seen in case of PI and PID controllers. At the end of this report, it is worth to be noted that the results obtained in the experiment could be much better by further tuning the PID controller parameters as in this case the parameters are taken only based on the ZieglerNichols empirical formulae which are sometimes inefficient for nonlinear systems.
References
[1] Kutsuhiko Ogata, Modern Control Engineering, fifth edition, Pearson Education, Inc., publishing as Prentice Hall, 2010.
[2] Antonio Flores T., Relay Feedback Auto Tuning of PID Controllers, October 4, 2007.
#Blog #Blogger #Relay #AutoTuning #Matlab #Simulink #PIDcontrol #ZieglerNichols 
what is the Pu ?
ReplyDeletePu refers to the oscillation period of the close loop system
DeleteCould you demonstrate how to set up the relay block to produce pulse like above?
ReplyDeleteCan you explain how to set up the relay block please?
ReplyDeleteYou can find the relay block from the Simulink library. Based on your model, you need to adjust the parameters in the relay block.
DeleteDo you have any guide on how to adjust the relay?
DeleteI meant how do you know the turn on point and turn off point?
DeleteHi, thanks for your question. You need to test with different parameters for the relay. For example, for this specific article, relay is used to tune the PID controller. So, it depends on the application or your designed system. I am not certain if there is any general guide on turning on/off the relay.
DeleteHi, how did you tune your PID parameters, if you used the code can you please share it?
ReplyDelete