PID Controller
PID Controller
PRACTICAL 2
BY
17UEB02930
TABLE OF CONTENTS i
TOPIC 1 INTRODUCTION 1
TOPIC 2 OBJECTIVES 2
TOPIC 3 METHODOLOGY 3
3.1 PROCEDURES 3
3.2 SETUP 4
3.2.1 Experiment 1 – MATLAB simulation software 4
3.2.2 Experiment 2- LABVIEW simulation software 6
TOPIC 4 RESULTS 9
4.1 EXPERIMENT 1 – MATLAB SIMULATION 9
4.1.1 Individual PID controller experimentation 9
4.1.2 Varying result of individual PID controller 11
4.1.3 Commonly used controller types in simulation 17
4.1.4 Effect of different gain values in PID simulation 23
4.2 EXPERIMENT 2 - LABVIEW SIMULATION 30
4.2.1 Commonly used controller types in simulation 30
4.2.2 Effect of different gain values in PID simulation 33
TOPIC 5 DISCUSSIONS 39
TOPIC 6 CONCLUSION 41
REFERENCES 42
i
TOPIC 1
INTRODUCTION
PID controller was first developed in 1911 by Elmer Sperry. By the mid-1950’s, automatic PID
controllers were widely adopted for industrial use. (OMEGA, 2020)Now, it is used to read a
sensor signal, interpret and process though, then display and provide the output results. PID
controller have various application for example to regulate the temperature, flow, pressure,
speed and many other process variables. A control loop feedback mechanism is used in PID
controller to control process variable to allow more accurate and allow stabilization of the
system.
The term P in PID is known as proportional. If the error is too large and positive, the
output will be also too large and positive. Just by using proportional control will result in error
between the setpoint and the actual process value, because it requires an error to generate the
proportional response. If there is no error, there is no corrective response. The term I is known
as integral. Integral control functions to eliminate residual error by trying to eliminate the error
and increase its integral term. There will be increase in the gradient of the graph up until the
error is diminished. The term D is known as derivative. Derivative control functions to dampen
the signal. This reduces the overshoot of the system. The more rapid the change, the greater
the controlling or dampening effect.
1
TOPIC 2
OBJECTIVES
2
TOPIC 3
METHODOLOGY
3.1 PROCEDURES
1. 2 sets of experiment were conducted. Simulation of PID was done using MATLAB as
first experiment and LABVIEW software for the second experiment.
1
2. Transfer function equation was to be 𝑇(𝑆) = . This function will remain constant
𝑠2 +5𝑠+6
3
3.2 SETUP
Parallel arrangement of the system configuration is to be used for the two sets of experiment.
4
Figure 4: Scope dashboard output waveform
6
Figure 8: Input result of PID controller
2. Setup with Gain
7
• Output waveform to be obtained
8
TOPIC 4
RESULTS
9
Figure 14: Output waveform for Kp=0, Ki=0, Kd=15
As shown in figure 14 above, Kd = 0, Kp = Ki = 15. There is no response in the graph as the
derivative control only attempts only to minimize the overshoot.
Table 1: Values for individual controller that affects the output graph
Table 1 above shows the individual experiment on using single controller of P, I and D. It can
be concluded that P or I controller is most essential in PID controller for operation.
10
4.1.2 Varying result of individual PID controller
11
Figure 17: Output waveform for Kp=100, Ki=0, Kd=0
As shown in figure 17 above, Kp = 100. The waveform is underdamped. In comparison to
figure 15 and figure 16 above, the proportional control now is adequate to bring the
waveform to reach the desired output. But steady state error still exists.
12
4.1.2.2 Proportional Integral Control (PI) (Kp = 40 as constant)
13
Figure 20: Output waveform for Kp=40, Ki=30, Kd=0
As shown in figure 20 above, Ki = 30. The waveform is more underdamped as the peak
amplitude increases. The setting time is approximate to be 3 second for the system to remove
error and to reach stability. Thus, it can be concluded that the overshoot becomes larger as
integral control value increases.
14
4.1.2.3 Proportional Derivative control (PD) (Kp = 40, Ki = 0 as constant)
15
Figure 23: Output waveform for Kp=40, Ki=0, Kd=100
As shown in figure 23 above, Kd = 100. The waveform shown is almost exactly as shown in
figure 21 and figure 22 above. Therefore, the derivative control does not affect much in the
experiment conducted.
16
4.1.3 Commonly used controller types in simulation
4.1.3.1 P controller
17
4.1.3.2 I controller
18
4.1.3.3 PI controller
19
4.1.3.4 PD controller
20
4.1.3.5 PID controller
21
Table 5: Summary for experimental and theoretical for common controller type
22
4.1.4 Effect of different gain values in PID simulation
4.1.4.1 GAIN = 1
4.1.4.1.1 P controller
4.1.4.1.2 PI controller
23
4.1.4.1.3 PID controller
Figure 37: Tuned Output waveform for Kp=40, Ki=10, Kd=15, Gain=1
As shown in figure 37 above, Kp = 117.23, Ki = 140.11 and Kd = 24.49. This is a PID
controller. This is using autotuning from the software provided to obtain the best desired
output waveform. The waveform characteristics is a perfect critically damped behaviour.
24
4.1.4.2 GAIN = 5
4.1.4.2.1 P controller
4.1.4.2.2 PI controller
Figure 39 above values are Kp = 40, Ki = 10, Kd = 0. In this case, the result is like figure 38
above with using P controller alone. As the gain had substantially allow minimum steady
25
state error, there is less need for integral controller to help to correct it, but the error is lesser
compared to error with using P controller alone.
Figure 41: Tuned Output waveform for Kp=40, Ki=10, Kd=15, Gain=5
Figure 41 above values are Kp = 40, Ki =10, Kd = 15. In comparison to figure 37 tuned result
with gain = 1, the requirement for all three Kp, Ki and Kd value is much lower as the gain
increase. The waveform shows a perfect critically damped characteristic.
26
4.1.4.3 GAIN = 10
4.1.4.3.1 P controller
4.1.4.3.2 PI controller
27
4.1.4.3.3 PID controller
Figure 45: Tuned Output waveform for Kp=40, Ki=15, Kd=15, Gain=10
As shown in figure 45 above, gain = 10, Kp = 12, Ki = 14 and Kd = 2.5. It can be clearly be
seen that all three Kp, Ki and Kd best values had been obtained which are much lower
compared to figure 37 with gain = 5 and figure 41 with gain = 1. When looking closely at all
three autotuned graph, the plots of value in the response graph is the same regardless of
different gain. This means that regardless of any gain value, the gain does not affect the final
desired output, but only affect the requirement of the PID controller value.
28
It can be concluded that the with additional gain value, there is lesser value required
by the PID controller to reach its desired output. The higher the additional gain value, the
lesser the K value is required by controller. This can be clearly shown in table 6 below.
Therefore, it is easier to tune value with a higher gain.
In normal experimental with the gain, higher gain value causes a higher peak time but
also causes the waveform to have a higher peak amplitude. It also contributes to shorter
setting time. This can be seen in figure 34, figure 38 and figure 42. As compared to the tuned
results, the peak time, rise time and setting time for all different gains exhibit the same result.
29
4.2 EXPERIMENT 2 - LABVIEW SIMULATION
4.2.1.1 P controller
4.2.1.2 I controller
30
Figure 47 above shows the output graph obtain for Ki = 10, Kp =0 and Kd = 0. The
characteristics shows underdamped behaviour. The waveform produces similar result as
when simulated by using MATLAB software.
4.2.1.3 PI controller
4.2.1.4 PD controller
31
Figure 49 above shows the output graph obtain for Kp = 40, Ki =0 and Kd = 15. There still
exist steady state error as there is not integral control action to correct the error. The
waveform produces similar result as when simulated by using MATLAB software.
32
4.2.2 Effect of different gain values in PID simulation
4.2.2.1 GAIN = 1
4.2.2.1.1 P controller
33
4.2.2.1.3 PID controller
Table 7: Comparison of different controller type and parameters with input gain =1
34
4.2.2.2 GAIN = 5
4.2.2.2.1 P controller
4.2.2.2.2 PI controller
35
4.2.2.2.3 PID controller
Table 8: Comparison of different controller type and parameters with input gain =5
Controller
type Parameter MATLAB LABVIEW
Rise Time 1 0.95
Peak Time 1.5 1.55
Setting Time 2.7 3
Steady state error small small
P stability yes yes
Rise Time 1 1
Peak Time 1.5 1.55
Setting Time 2.5 3
Steady state error minimum minimum - zero
PI stability yes yes
Rise Time 0.98 1
Peak Time 0.95 0.97
Setting Time 1.05 2
Steady state error minimum minimum
PID stability yes yes
*All values in table is approximate value*
36
4.2.2.3 GAIN = 10
4.2.2.3.1 P controller
37
4.2.2.3.3 PID controller
Table 9: Comparison of different controller type and parameters with input gain =10
Controller
type Parameter MATLAB LABVIEW
Rise Time 1 0.98
Peak Time 1.7 1.65
Setting Time 2.4 3
Steady state error minimum minimum
P stability yes yes
Rise Time 1.7 1
Peak Time 1.15 1.68
Setting Time 2.4 2.8
Steady state error minimum minimum - zero
PI stability yes yes
Rise Time 1 1
Peak Time 0.98 0.98
Setting Time 1.05 1
Steady state error minimum minimum - zero
PID stability yes yes
*All values in table is approximate value*
38
TOPIC 5
DISCUSSIONS
For both experiments conducted, each experiment produces similar result. This can be proved
by the approximate result obtained as shown in table 7 – table 9. Result obtain is verified and
cross checked on one another. This ensures that the result obtain is valid and model can be used
in daily application wise. This solid result is due to the mature software which allow calculation
and design. However, the primary difference that varies the two different software is that
MATLAB processes more on the numerical and mathematical computation. LABVIEW on the
other hand provides a system design platform for testing products, instrument control.
From all the results obtained, proportional control tuning helps to compare the desired
final output value with original output value. The feedback error obtained is then multiplied
with the proportional constant value to provide corrected output. Where in case that there is no
error, proportional control does not have any output. However, a high proportional constant
value contributes to a higher overshoot and a longer setting time which makes the system
initially unstable. Using proportional control alone is not able to completely the steady state
error.
Using integral control helps to correct the steady state error. From most of the cases
from the error result of proportional control, it had increased its correction factor adequately to
remove the error. Over a period, the error value reaches zero. The period for correcting the
39
error can be shorten by increasing integral constant value. However, higher integral value
contributes to a higher overshoot which makes the system initially unstable.
Derivative control helps to minimize overshoot. Derivative control can be very useful
in times where there exist lots of overshoot due to high proportional and integral constant value.
The output of derivative control is dependent on the rate of change of error with respect to time.
Derivative control helps to kick start the output to increase system response.
40
TOPIC 6
CONCLUSION
The desired output value of simulation is to obtain a critically damped characteristic. Tuning
the controller is firstly by setting Ki and Kd values to zero and increase proportional term, Kp
until system reaches an oscillating behaviour. Then adjust the integral term, Ki to remove the
steady state error and finally adjust the derivative tern, Kd to reduce overshoot to obtain a
critically damped characteristic waveform. A suitable combination of all three controller can
allow the system to be critically damped which is the desired output response.
Proportional control function to detect feedback error by comparing desired output and
original output value. By increasing value of proportional gain allows it to be able to reach the
desired output value. However, increasing the proportional gain indirectly causes the waveform
to oscillate more and overshoot. Integral control function to take action to increase its
correction factor to correct the steady state error. However, similar to proportional control
where increasing integral gain will indirectly cause waveform to oscillate more and overshoot.
Lastly, derivative control which depends on the rate of change of error and take action to reduce
overshoot.
In the presence of additional gain amplifier, value is required for each PID controller to
reach its desired output value is lesser. The higher the additional gain value, the lesser the
requirement for each PID controller to reach the desired output value. This is proved as shown
in table 6 above. Additional gain might be very helpful to allow more oscillation. But too much
gain might cause the system to be unable to reach a critically damped behaviour. Therefore, a
suitable gain value should only be used. In comparison between MATLAB and LABVIEW
software, each software produces approximately same results. This means that the result
obtained by each software is accurate. Therefore, it can be concluded that each software is
adequate and is able to perform simulation of a PID controller in application.
41
REFERENCES
42