You are on page 1of 15

De Montfort University

PID Control for a 1-


DOF Mass Spring
Damper
ENGD3038- Dynamics and Control

Nizamuddin Patel
22/03/2018
ENGD3038 – Dynamics and Control

Contents
1. Introduction ....................................................................................................................................... 2
Equipment used ......................................................................................................................................... 2
Methodology.............................................................................................................................................. 2
2. Identify parameters of the 1DoF systems using approach described in Section 3 of the lab
instruction. ................................................................................................................................................. 3
Identification of the 1DoF system parameters ...................................................................................... 3
3. Plot transient responses for different values of the proportional gain Kp (in one coordinate
system) using the Matlab ‘plot’ command for the proportional controller investigated in Sections 2.2 . 4
4. Evaluate the parameters of the transient responses (OS%, peak t , r t , s t , ss e ) and describe how
they are affected by the gain Kp. ............................................................................................................... 4
5. Plot transient responses in one co-ordinate system for changing Ki values and another co-
ordinate system for changing Kd values using the Matlab ‘plot’ command for the PID controller
investigated in Section 2.3. ........................................................................................................................ 5
6. Evaluate the parameters of the transient response (OS%, peak t , r t , s t , ss e ) and describe how
they are affected by gains Ki and Kd. ......................................................................................................... 6
7. For the PID controller in configuration 2.3, derive the closed-loop system transfer function and
investigate how the location of poles changes with the changes of gains Kp, Ki, and Kd using MATLAB. 7
Closed loop transfer function ................................................................................................................ 7
Pole 1 ..................................................................................................................................................... 8
Pole 2 ..................................................................................................................................................... 9
Pole 3 ................................................................................................................................................... 10
8. Conclusions ...................................................................................................................................... 10
Appendix .................................................................................................................................................. 11
Graphs .................................................................................................................................................. 12
Chapter 4.......................................................................................................................................... 12
Chapter 5.......................................................................................................................................... 13
Matlab Code......................................................................................................................................... 14
Chapter 7a ........................................................................................................................................ 14
Chapter 7b........................................................................................................................................ 14
Chapter 7c ........................................................................................................................................ 14

De Montfort University 1 P15219444


ENGD3038 – Dynamics and Control

1. Introduction
This report has been written to verify the theory behind the one degree of freedom configuration
dynamic model. The experiment conducted consists of an electric motor with an attached inertia load
in the form of mass, Analysis is taken of transient dynamics of the system using dynamic system
transfer function.

Transient dynamics analysis is a method of looking at the dynamic response of a structure under
general time dependent loads. In this analysis the time-varying displacement, stress, strains and forces
are determined in a structure when it responds to a combination of harmonic, static and transient
loads.1

Conclusions will be drawn from the experimental study into how the following three variables affect
the damping factor, overshoot, rise time, peak time and settling time

1. Kp – Proportional Gain
2. Ki – Integral Gain, Ti Integral Time Constant
3. Kd – Derivative Gain, Td Derivative Time Constant

Equipment used
 ECP M205 system
 ECP rectilinear plant

Methodology
The book produced by M. Goman and B. Ulanicki referenced, provided a step by step onto how to use
the software and these instructions were used to get the results for this report.

In summary the ECP control box and PC were turned on and the ECP executive programme was used
to instruct the rectilinear software to operate and provide data to be analysed.

1Ansys.stuba.sk. (2018). STRUCTURAL: Chapter 5: Transient Dynamic Analysis (UP19980818). [online] Available
at: http://www.ansys.stuba.sk/html/guide_55/g-str/gstr5.htm [Accessed 20 Feb. 2018].

De Montfort University 2 P15219444


ENGD3038 – Dynamics and Control

2. Identify parameters of the 1DoF systems using approach described in Section 3 of the lab
instruction.

The three parameters which will have an effect on the rectilinear system are:
 Natural Frequency – The oscillating frequency which is not subjected to damping ommitance
 Damping factor – Frequency response of a second order differential equation
 Effective mass – for use in calculating identification of the one degree of freedom system

Figure 1: MATLAB graph showing open loop

Identification of the 1DoF system parameters

𝑌𝑃𝑒𝑎𝑘 −𝑌𝑠𝑡𝑒𝑎𝑑𝑦 𝑠𝑡𝑎𝑡𝑒 16.72−9.477


𝑂𝑆 = = = 0.7642 = 76.42%
𝑌𝑠𝑡𝑒𝑎𝑑𝑦 𝑠𝑡𝑎𝑡𝑒 9.477

𝐼𝑛(𝑂𝑆) 𝐼𝑛(0.7642 )
𝛾=| |=| | = 0.0856 (𝑟𝑎𝑑𝑖𝑎𝑛𝑠)
𝜋 𝜋

γ 0.0856
z= = = 0.08529
√1 + γ2 √1 + (0.0856)2

𝜋√1 + 𝛾 2 𝜋√1 + 0.08562


𝜔𝑛 = = = 19.83
𝑡𝑝(𝑥 𝑎𝑥𝑖𝑠 𝑝𝑒𝑎𝑘) 0.159
𝑘𝑠𝑝𝑟𝑖𝑛𝑔 800
𝑚𝑒𝑓𝑓 = 2
= = 2.0344
𝜔𝑛 (19.83)2
𝐶𝑒𝑓𝑓 = 2 × 𝑧 × 𝜔𝑛 × 𝑚𝑒𝑓𝑓 = 2 × 0.0852881 × 19.83 × 2.0344 = 6.881410988

De Montfort University 3 P15219444


ENGD3038 – Dynamics and Control

3. Plot transient responses for different values of the proportional gain Kp (in one coordinate
system) using the Matlab ‘plot’ command for the proportional controller investigated in
Sections 2.2

Figure 2: MATLAB graph for proportional controller in section 2.2

Figure 2 shows the collective results from MATLAB using different controller configurations for 0.02,
0.04 and 0.06. To view the separate graphs refer to appendix chapter 4. The displacement (mm) is also
shown in the form of a demand signal. The demand signal stays consistent which shows that the axis
and results have been plotted accurately. As the position, Kp, increases so does the frequency of
oscillations; the damping ratio however, decreases.

4. Evaluate the parameters of the transient responses (OS%, peak t , r t , s t , ss e ) and describe
how they are affected by the gain Kp.
Kp 0.02 0.04 0.06
Ypeak 7.56 12.58 15.78 For Kp @ 0.02 (see appendix chapter 4)
YStable 4.16 6.654 15.53 𝑃𝑒𝑎𝑘 𝑡𝑖𝑚𝑒 = 𝑡𝑝𝑒𝑎𝑘 = 0.133 𝑠
tr Rising time 0.079 0.07 0.062
OS% Overshoot 82.21% 89.05% 0 𝑌𝑃𝑒𝑎𝑘 − 𝑌𝑠𝑠
𝑂𝑆 = × 100
ess Steady Error 11.37 8.876 0 𝑌𝑠𝑠
ts Setting time 1.549 3.002 0
7.56 − 4.16
Demand line 15.53 15.53 15.53 × 100
tp Peak time 0.133 0.124 0.106 4.16
= 82.21%
Table 1: Parameters effected when Kp is changed
Time rise:
The transient response impacted the steady state
𝑡𝑟 = ( 90%𝑡𝑝𝑒𝑎𝑘 − 10%𝑡𝑝𝑒𝑎𝑘 )
error, as Kp increased, the steady state error
decreased. This shows that there is a relationship 𝑡𝑟 = 0.106 − 0.027 = 0.079𝑠
between the demand line and the stable line. Figure 2
Settling time:
which shows the graphs stacked together it is easy to
see that the overshoot is significant, this is proven by 𝑡𝑠 = 𝑡0 ± 2%
calculation as the difference between Kp0.02 and
Kp0.04 is 7%. As Kp increased, the peak time and the 𝑡𝑠 = 1.549𝑠
rising time decreased. The most important effect Kp Steady state error:
has had is the frequency of oscillations and the
decreased damping factor. The Y peak and Y stable 𝑒𝑠𝑠 = 𝑌𝑠𝑠 − 𝐷𝑒𝑚𝑎𝑛𝑑 𝑙𝑖𝑛𝑒
correspondingly and slowly increased to the demand 15.53 − 4.16 = 11.37 degrees
line as Kp increased.

De Montfort University 4 P15219444


ENGD3038 – Dynamics and Control

5. Plot transient responses in one co-ordinate system for changing Ki values and another co-
ordinate system for changing Kd values using the Matlab ‘plot’ command for the PID controller
investigated in Section 2.3.

Figure 3: Stacked graphs showing the change in Kd


Figure 3 shows the stacked graph showing the different results when Kd is changed. Appendix chapter
5 shows the graph response when Kp=0.04, Ki=0.4 and Kd=0.02.

Figure 3 shows varied results, however the trend remains the same, in which it follows the demand
signal very closely. Ypeak (displacement) for Kd0.002 is higher than the other two Kd values. Kd at
0.002 also has more oscillations than the other two, where Kd 0.004 and 0.006 only has two. The
earliest settlement time was met by Kd=0.004.

Figure 4: Stacked graph showing change in Ki

Figure 4 shows a very visible difference when Ki is changed. Ki at 2.0 has the most noticeable in that
the Tpeak, and the Trise are quicker than the other two. Ki at 2.0 has a Ypeak of almost double that of
Ki at 1.0. There are lower oscillations as Ki decreases.

De Montfort University 5 P15219444


ENGD3038 – Dynamics and Control

6. Evaluate the parameters of the transient response (OS%, peak t , r t , s t , ss e ) and describe how
they are affected by gains Ki and Kd.
Kd 0.002 0.004 0.006
Ypeak 89.8 80.28 82.18
YStable 74.12 74.14 73.88
tr Rising time 0.071 0.106 0.133
OS% Overshoot 21.28% 8.237% 11.23%
ess Steady Error 0.14 0.03 0
ts Setting time 0.434 0.257 0.469
Demand line 74.26 74.14 74.14
tp Peak time 0.142 0.177 0.257
Table 2: Parameters for changes in Kd

Refer to appendix chapter 5 figure b for graph.

From table 2 it can be noted that Ystable and Trise gradually increases as Kd increases. Ypeak
decreases after an initial high at 0.002. OS increased after the sudden drop between 0.002 and 0.004.
The irregular results for OS and Ypeak could be due to experimental errors, this could be reduced by
repeating tests as well as experimenting with more Kd values. The steady state decreases with Kd. The
peak time increases with Kd.

Ki 0.04 1.0 2.0


Ypeak 74.44 87.89 102.8
YStable 74.44 74.18 74.17
tr Rising time 0.266 0.133 0.089
OS% Overshoot 0.4% 18.48% 38.60
ess Steady Error 0.3 0 0.03
ts Setting time 0.3988 0.584 0.584
Demand line 74.14 74.14 74.14
tp Peak time 0.673 0.239 0.168
Table 3: Parameters for changes in Ki

Table 3 shows the changes in parameters when Ki is changed. Ypeak increases as Ki increases, this is
the opposite from the change in Kd seen in Table 2. Overshoot increases as Ki increases. The settling
time is pretty much identical for all Ki values especially for Ki= 1.0 and 2.0. There is not much of a
change in steady state error apart from the nil value in 1.0, but this could be due to an error. The time
it takes to reach the peak figure decreases as Ki increases. This suggests that as Ki increases, Ypeak and
the time it takes to get to Ypeak increases. This is opposite to the Kd results in table 2.

De Montfort University 6 P15219444


ENGD3038 – Dynamics and Control

7. For the PID controller in configuration 2.3, derive the closed-loop system transfer function and
investigate how the location of poles changes with the changes of gains Kp, Ki, and Kd using
MATLAB.

Figure 5: Transfer funtion for closed loop system

Figure 5 was inputted into Simulink.

Closed loop transfer function

1
𝐾ℎ𝑤∗ 5714.43
𝑚1
𝑃𝑙𝑎𝑛𝑡 𝑡𝑟𝑎𝑛𝑠𝑓𝑒𝑟 𝑓𝑢𝑛𝑐𝑡𝑖𝑜𝑛 = 𝑐 𝑘 = 𝑠2 +(3.382)𝑠+(393.236)
𝑠2 +( 1 )𝑠+( 1 )
𝑚1 𝑚1
1
𝐾𝑝 × 𝐾ℎ𝑤 × 𝑚
1
𝐺𝑜𝑝𝑒𝑛 =
𝑐 𝑘
𝑠2 +( 1 )𝑠 + ( 1)
𝑚1 𝑚1
1
(𝟎. 𝟎𝟐) × 11625.45 × 2.0344
𝐺𝑜𝑝𝑒𝑛 =
(𝑠 2 + 3.382𝑠 + 393.236)
Gopen (s)
Gclosed (s) =
1 + Gopen (s)
114.28
𝐺𝑜𝑝𝑒𝑛 1+ 2
(𝑠 + 3.418𝑠 + 492.6)
𝐺𝑐𝑙𝑜𝑠𝑒𝑑 = =
1 + 𝐺𝑜𝑝𝑒𝑛 114.28
1+ 2
(𝑠 + 3.418𝑠 + 492.6)

De Montfort University 7 P15219444


ENGD3038 – Dynamics and Control

Pole 1

Figure 6: Pole map

Refer to appendix chapter 7a for the MATLAB code used to get figure 6.

The blue pole represents Kp=0.02, the green represents Kp=0.04 and red Kp=0.06. As Kp increases so
does the imaginary sections of the poles, which suggests the angle decreases. The decrease in the
angle leads to an increase of the frequency of oscillations of a real physical system. It also suggests a
decreased damping ratio and therefore a bigger overshoot in the system that is being analysed. The
pole system shows the overshoot has increased as the damping has decreased. Kp plays an important
part as the frequency response changes significantly.
As the poles are on the left hand side, it shows that the system is stable.

De Montfort University 8 P15219444


ENGD3038 – Dynamics and Control

Pole 2

Figure 7: PID system pole positions chand in Kd

Refer to appendix chapter 7b for MATLAB code for figure 7.


1
𝐾ℎ𝑤∗ 5714.43
𝑚1
𝑃𝑙𝑎𝑛𝑡 𝑡𝑟𝑎𝑛𝑠𝑓𝑒𝑟 𝑓𝑢𝑛𝑐𝑡𝑖𝑜𝑛 = 𝑐 𝑘 = 𝑠2 +(3.382)𝑠+(393.236)
𝑠2 +( 1 )𝑠+( 1 )
𝑚1 𝑚1

Due to the system having a PID controller in place the equation will be slightly different…
𝐾1 𝐾𝑝 𝑠 + 𝐾𝑖
𝐾𝑝 + = = 𝐶𝑃𝐼
𝑠 𝑠
𝑃𝐶𝑃𝐼
𝐺𝑐𝑙𝑜𝑠𝑒𝑑 = =
1 + 𝑃𝐶𝑃𝐼 + 𝑃𝐶𝐷
5714.436 0.4
𝑠 2 + 3.418𝑠 + 492.6 (0.04 + 𝑠 )
=
5714.436 0.4 5714.436
1+ 2 ∗ (0.04 + 𝑠 ) + 2 ∗ 0.004𝑠
𝑠 + 3.418𝑠 + 492.6 𝑠 + 3.418𝑠 + 492.6

Figure 7 shows the pole positions under the change in Kd. The complex poles are on the left hand side,
which impacts the stability and the speed of the system. The increase in Kd causes less oscillations
which in turn potentially decrease the speed of the system. When the gain Kd increases, the dominant
real poles are hardly moving left

De Montfort University 9 P15219444


ENGD3038 – Dynamics and Control

Pole 3

Figure 8: Pole positions change in Ki

Refer to appendix chapter 7c for MATLAB code of figure 8.

The colour coding is similar to the one mentioned for figure 6. A change in Ki values show the majority
of poles are on the right hand side, which suggests the system is unstable, this is useful if the purpose
of the system requires oscillations such as generators. It also shows that an increase in Ki has led to
high speeds being inputted into the system, this can be seen as the red dot (ki = 0.06) is far left.

8. Conclusions
 Damping ratio is a crucial factor which allows prediction whether the system will have an
overshoot or be damped.
 As the values for Kp, Ki and Kd changed, it allowed a better understanding of overshooting and
whether it will occur.
 increasing in Kp will cause more oscillations within the system
 An Increase in Kp will cause more peaks and greater settling times
 Increasing the Kd will increase the damping effect, which will lead to a decrease in oscillations
 An increase in Kd will cause rise time to increase and a decrease in overshooting
 Increasing Ki will increase Ypeak, overshoot and settling time
 Increasing Ki decreases rise time and eliminates steady state error
 We concluded when analysing a PID controller that the Kp which is the proportional will cause
a reduction in the steady state error whereas increasing the integral term will cause the
elimination of the steady state error
 The main of conducting analysis on a PID controller was to improve stability, accuracy and
disturbance rejection
 Overall the experiment was a success apart from the anomalies mentioned earlier.

De Montfort University 10 P15219444


ENGD3038 – Dynamics and Control

References
1. Ansys.stuba.sk. (2018). STRUCTURAL: Chapter 5: Transient Dynamic Analysis (UP19980818).
[online] Available at: http://www.ansys.stuba.sk/html/guide_55/g-str/gstr5.htm [Accessed 20
Feb. 2018].

2. Ulaniki, B. and Goman, M. (2018). Error – Blackboard Learn. [online] Vle.dmu.ac.uk. Available
at:
https://vle.dmu.ac.uk/webapps/blackboard/execute/content/file?cmd=view&content_id=_38
45054_1&course_id=_460920_1 [Accessed 19 Feb. 2018].

3. S. W. Sung, J. Lee and I. Lee, Process Identification and PID Control. (1. Aufl.;1; ed.) 2009.
4. Bing.com. (2018). Cite a Website - Cite This For Me. [online] Available at:
http://www.bing.com/cr?IG=B8F502636B5E4DCDB7F6D7F855C85E6C&CID=213CB1D7500C69
EC0489BA7A51A36835&rd=1&h=XyzLH8FeL_oXP6KDbCOA6e17Ms5iiQSpASfyWO-
bSXA&v=1&r=http%3a%2f%2fengineering.nyu.edu%2fmechatronics%2fControl_Lab%2fCriag%
2fCraig_RPI%2f2001%2fPhysical_Modeling_Mechanical.pdf&p=DevEx,5063.1 [Accessed 3
Mar. 2018].

5. Bing.com. (2018). Cite a Website - Cite This For Me. [online] Available at:
http://www.bing.com/cr?IG=624898370A2E4B409A1D8040B2CE4B8B&CID=32684D4619EB69
8525B846EB184468EA&rd=1&h=SkI7W_fYRNJ9VImsVPJgClF09RQvMpjypa-
7I0R07oc&v=1&r=http%3a%2f%2ffaculty.uml.edu%2fpavitabile%2f22.451%2fDynamic_Syste
ms_Mechanical_Systems_031906_DYNSYS.pdf&p=DevEx,5042.1 [Accessed 1 Mar. 2018].

6. Blog.opticontrols.com. (2018). PID Controllers Explained | Control Notes. [online] Available at:
http://blog.opticontrols.com/archives/344 [Accessed 2 Mar. 2018].

7. Csimn.com. (2018). PID for Dummies - Control Solutions. [online] Available at:
https://www.csimn.com/CSI_pages/PIDforDummies.html [Accessed 3 Mar. 2018].

8. Wang, L. (2015). PID and predictive control of electrical drives and power converters using
MATLAB. Singapor: Wiley, IEEE Press.

De Montfort University 11 P15219444


ENGD3038 – Dynamics and Control

Appendix

Graphs

Chapter 4
Kp=0.02

Kp=0.04

(above) Kp=0.06

De Montfort University 12 P15219444


ENGD3038 – Dynamics and Control

Chapter 5
A

De Montfort University 13 P15219444


ENGD3038 – Dynamics and Control

Matlab Code

Chapter 7a
Khw=11625.45;
m1=2.0344;
c1=6.8814;
k1=800;
P=tf([1/m1],[1 (c1/m1) (k1/m1)]); %#ok<NBRAK>
Kp=[0.02 0.04 0.06];
figure;
hold;

for i=1:3
Gopen=Kp(i)*Khw*P;
Gclosed=feedback(Gopen,1);
pzmap(Gclosed);
end

Chapter 7b
khw=11625.45;
m1=2.0344;
c1=6.8814;
k1=800;
kp=0.04;
ki= 0.4;
kd=[0.002 0.004 0.006];
figure;
hold;

for i=1:3
P=tf([kp ki],[m1 c1+khw*kd(i) k1+kp*khw ki*khw]);
Gopen= P;
Gclosed= feedback(Gopen,1);
pzmap(Gclosed);
end

Chapter 7c
khw=11625.45;
m1=2.0344;
c1=6.8814;
k1=800;
kp=0.04;
ki= [0.4 1.0 2.0];
kd=0.007;
figure;
hold;

for i=1:3
P=tf([kp ki(i)],[m1 c1+khw*kd k1+kp*khw ki(i)*khw]);
Gopen= P;
Gclosed= feedback(Gopen,1);
pzmap(Gclosed);
end

De Montfort University 14 P15219444

You might also like