Control Systems With Embedded Implementation (CSEI) Dr. Imtiaz Hussain Assistant Professor email:...

Post on 19-Dec-2015

215 views 1 download

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/