Post on 19-Dec-2015
transcript
1
Control Systems With Embedded Implementation (CSEI)
Dr. Imtiaz HussainAssistant Professor
email: imtiaz.hussain@faculty.muet.edu.pkURL :http://imtiazhussainkalwar.weebly.com/
Lecture-6Case Study: Microcontroller based Lag-Lead Control of Inverted Pendulum
2
Outline
β’ Case Study-1: Inverted Pendulum
3
Introductionβ’ The transfer function of the pendulum is given below
β’ where R is the input position error and T is the output torque.
β’
π (π )π (π )
= 1
π 2+2π πππ βππ2
π (π )π (π )
= 1
π 2+0.69π β39.4
4
Root Locus of the System
π (π )π (π )
= 1
π 2+0.69π β39.4
5.93 -6.62
5
Design Requirements
β’ The desired parameters are:
β Rise time of 0.5 seconds or less
β Damping ratio of 0.32
β Lag gain of 92
β’ These parameters will be used as a guide to the design of a lead and lag compensator.
6
Lead Control
β’ The lead compensator is of the form
β’ where is the location of the lead zero and is the location of the lead pole.
β’ The final design of the lead compensator is given below
πΊπ (π )=π +π§π +π
πΊπ (π )=π +7
π +17.5
7
Combined Response
β’ The root locus of the plant transfer function with the effects of the lead compensator is shown in following figure.
-20 -15 -10 -5 0 5 10-25
-20
-15
-10
-5
0
5
10
15
20
25Root Locus
Real Axis (seconds-1)
Imagin
ary
Axis
(seconds-1
)
8
Lag Controlβ’ The pole and zero of the lag compensator should be close
together so as not to cause the poles to shift right, which could cause instability or slow convergence.
β’ Additionally, since their purpose is to affect the low frequency range they should be near zero
πΊπ (π )π +1.2
π +1.292
9
Lag-Lead Controlβ’ The root locus of the transfer function with the lead-lag
compensator is show in Figure Root Locus
Real Axis (seconds-1)
Imag
inar
y A
xis
(sec
onds
-1)
-20 -15 -10 -5 0 5 10-30
-20
-10
0
10
20
30
System: sysGain: 7.01Pole: -4.22 + 10.7iDamping: 0.366Overshoot (%): 29.1Frequency (rad/s): 11.5
10
Discrete-time Transfer Functionβ’ Up to this point the entire controller design has been in
continuous-time. However, the microcontroller only works in discrete-time.
β’ Therefore the controller must be converted from continuous-time to discrete-time.
β’ The Tustin method allows us to switch from continuous time to discrete time by substituting in the following equation for ,
π = 2π1β π§β1
1+π§β1
11
Error Calculation
β’ The error is calculated by subtracting the current position from the desired position and then multiplying by a scale factor which includes the gain.
β’ This value is then divided by the approximate maximum position which non-dimensionalized the error.
π =π (πππ πππ ππππβπππ )( 1000πππ πππ₯)
12
Transfer Function Implementation
β’ The transfer function is implemented by solving for the output value, the torque.
β’ where and are the coefficients obtained from the discrete transfer function, is the error in the system, is the output torque and prev and prev2 denote the previous and twice previous values, respectively.
π=ππ +ππ ππππ£+ππ ππππ£2+ππ ππππ£+ππππππ£ 2
13
Simulation of Continuous time Model
14
Analog PID Controller
π’ (π‘ )=πΎ [π (π‘ )+ 1π π
β«π (π‘ )ππ‘+π π
ππ (π‘)ππ‘ ]
π (π‘ ) π’ (π‘ )
15
Digitally implemented PID Controller
π (π§ )=[ (πΎ π+πΎ π+πΎ π )+(βπΎ πβ2πΎ π) π§β 1+πΎ π π§β1
1βπ§β1 ]πΈ(π§ )
π’ (π )=π’ [πβ1 ]+πΎ 1π [π ]+πΎ 2π [πβ1 ]+πΎ 3π [πβ2 ]
16
Digitally implemented PID Controller (Microcontrollers)
π’ (π )=π’ [πβ1 ]+πΎ 1π [π ]+πΎ 2π [πβ1 ]+πΎ 3π [πβ2 ]
17
Digitally implemented PID Controller (CPLD or FPGA)
π’ (π )=π’ [πβ1 ]+πΎ 1π [π ]+πΎ 2π [πβ1 ]+πΎ 3π [πβ2 ]
18
END OF LECTURE-6
To download this lecture visithttp://imtiazhussainkalwar.weebly.com/