99
Classical and Modern Control Qazi Ejaz Ur Rehman Avionics Engineer Graduate Research Assistant Aerospace & Astronautics Department Institute of Space Technology Islamabad December 18, 2015

Classical and Modern Control Theory

Embed Size (px)

Citation preview

Page 1: Classical and Modern Control Theory

Classical and Modern Control

Qazi Ejaz Ur RehmanAvionics Engineer

Graduate Research AssistantAerospace & Astronautics Department

Institute of Space TechnologyIslamabad

December 18, 2015

Page 2: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

2/95

Outline1 Introduction

AdministrationBasic MathLaplace

2 Overview3 Modeling

ElectricalMechanical

4 Frequency (continous)Analysis

5 Time (Continous)Analysis

6 Software7 Optional8 Labs9 Matlab Commands10 Quiz

Page 3: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

3/95

IntroductionContact

• Office No.: 051-907-5504 %

• E-mail: [email protected] 1

• Office hours: After 11:00 am

[email protected]

Page 4: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

4/95

IntroductionText Book

Page 5: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

5/95

IntroductionText Book

Page 6: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

6/95

CalculusIntegration by parts

2

2 Link

Page 7: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

7/95

Linear AlgebraPartial fraction expansion

3

3 Link

Page 8: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

8/95

Linear AlgebraDeterminants

Here’s an easy illustration that shows why the determinantof a matrix with linear dependent rows is 0

M =

[a b2a 2b

]⇒ |M| = a(2b)− 2b(a) = 0

Let’s look at a 3x3 example.

Page 9: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

9/95

Linear AlgebraDeterminants

M =

a b c2a 2b cd e f

⇒ |M| = a(2bf − 2ce)− b(2af − 2cd) + c(2ae − 2bd) = 0Let’s change the order of rows

M =

d e fa b c2a 2b c

⇒ |M| = d(2bc − 2bc)− e(2ac − 2ac) + f (2ab − 2ab) = 0Let’s change the order of rows again

M =

d e f2a 2b ca b c

⇒ |M| = a(2ce − 2bf )− b(2dc − 2af ) + c(2db − 2ae) = 0In other words, if we have dependent rows, then thedeterminant of the matrix is 0

Page 10: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

10/95

Linear AlgebraAdjoint of matrix

4

4 Link

Page 11: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

11/95

Linear AlgebraInverse of matrix

A−1 = 1|A|(Adjoint of A)

Page 12: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

12/95

Laplace TransformTables

Page 13: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

13/95

Laplace TransformTables

5

5 Link

Page 14: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

14/95

Laplace TransformTables

6

6 Link

Page 15: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

15/95

Laplace TransformPlot of simple first order equationLet H(s) = 1

s+10 ,We’ve plotted the magnitude of H(s)below, i.e., |H(s)|. Other possible 3D plots are ∠ H(s),Re(H(s)) and Im(H(s)) respectively. Notice that |H(s)|goes to ∞ at the pole s = -10.

Page 16: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

16/95

Laplace Transform3-D code for Transfer functions

1 a=−40;c=40;b=1;2 g=a : b : c ;3 h=g ;4 [ r , t ]=meshgr id ( g , h ) ;5 s=r+1 i∗ t ;6 Hs=1./( s+10) ; %t r a n s f e r f u n c t i o n7 mesh ( r , t , abs (Hs ) ) ;8 ho ld on9 f o r omega=g

10 Hjw = 1 ./ (1 i∗omega + 10) ; %f r e qu en c y domain11 p l o t 3 (0 , omega , abs (Hjw ) , ’ ro ’ ) ;12 end13 g=4;14 l i n e ( [ a c+4∗g ] , [ 0 0 ] , [ 0 0 ] ) % x a x i s15 l i n e ( [ 0 0 ] , [ 0 c+8∗g ] , [ 0 0 ] ) % y a x i s16 l i n e ( [ 0 0 ] , [ 0 0 ] , [ 0 0 . 5 ] ) ; % z a x i s17 ho ld on ;18 p l o t 3 (0 , 0 , 1 )19 %t e x t f o r xyz axe s20 t e x t ( ’ I n t e r p r e t e r ’ , ’ l a t e x ’ , ’ S t r i n g ’ , ’ $\ s igma$ ’ , ’ P o s i t i o n ’ , [ c

+4∗g 0 0 ] , ’ Fon tS i z e ’ , 20) ; % x a x i s21 t e x t ( ’ I n t e r p r e t e r ’ , ’ l a t e x ’ , ’ S t r i n g ’ , ’ $ j \omega$ ’ , ’ P o s i t i o n ’ , [−3

c+6∗g 0 ] , ’ Fon tS i z e ’ , 20) ; % y a x i s22 t e x t ( ’ I n t e r p r e t e r ’ , ’ l a t e x ’ , ’ S t r i n g ’ , ’ $ |H( s ) | $ ’ , ’ P o s i t i o n ’ , [ 0

0 0 . 5 ] , ’ Fon tS i z e ’ , 20) ; % z a x i s23 a x i s ( [ a−g c+g a−g c+g 0 0 . 4 ] )24 v iew (100 ,36)

Page 17: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

17/95

Laplace TransformPlot of Second order equationLet H(s) = s+5

(s+10)(s−5) . We’ve plotted the magnitude ofH(s) below, i.e., |H(s)|. Other possible 3D plots are ∠H(s),Re(H(s)) and Im(H(s)), respectively. Notice that |H(s)|goes to ∞ at the pole s = -10 and 5 while it converges todown at the zero s=-5.

Page 18: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

18/95

Laplace TransformLaplace Transform of integration and derivative

For more details on how the Laplace transform forintegration is 1/s and Laplace transform for derivative is sthen seehttp://www2.kau.se/yourshes/AB28.pdf

Page 19: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

19/95

Control SystemsFREQUENCY (Continous) and Time

Page 20: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

20/95

Control SystemsIntroduction

Among mechanistic systems, we are interested in linearsystems. Here are some examples:

1 Filters (analog and digital2 Control sysytems

• A control system is an interconnection of componentsforming a system configuration that will provide adesired system response

• An open loop control system utilizes an actuatingdevice to control the process directly without usingfeedback uses a controller and an actuator to obtainthe desired response

• A closed loop control system uses a measurement ofthe output and feedback of this signal to compare itwith the desired output (reference or command)

Page 21: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

21/95

Control SystemsIntroduction

• To understand and control complex systems, one mustobtain quantitative mathematical models of thesesystems

• It is therefore necessary to analyze the relationshipsbetween the system variables and to obtain amathematical model

• Because the systems under consideration are dynamicin nature, the descriptive equations are usuallydifferential equations

• Furthermore, if these equations are linear or can belinearized, then the Laplace Transform can be used tosimplify the method of solution

Page 22: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

22/95

Control SystemsIntroduction

Control system analysis and design focuses on three things:1 transient response2 stability3 steady state errors

For this, the equation (model), impulse response and stepresponse are studied. Other important parameters aresensitivity/robustness and optimality. Control systemdesign entails tradeoffs between desired transient response,steady-state error and the requirement that the system bestable.

Page 23: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

23/95

Control SystemsAnalysisThe analysis of control systems can be done in thefollowing nine ways:

1 equation2 poles/zeros/controllability/observability3 stability4 impulse response5 step response6 steady-state response7 transient response8 sensitivity9 optimality

The design of control systems can be done in the followingways:

1 Pole placement (PID in frequency and time, statefeedback in time)

Back to immediate slide

Page 24: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

24/95

ModelingRLC Circuit

Ldi(t)

dt + Ri(t) +1C q(t) = v(t) (1)

i(t) =dq(t)

dt (2)

⇒ Ld2q(t)

dt2 + R dq(t)

dt +1C q(t) = v(t)

⇒ Lq(t) + Rq(t) +1C q(t) = v(t)

Page 25: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

25/95

Modeling Series RLC CircuitState Space Representation

Let,

x1 = q(t)

x2 = x1 = q(t)

x2 = q(t)

Substituting,

Lq(t) + Rq(t) +1C

q(t) = v(t)

Lx2 + Rx2 +1C

x1 = v(t)

Now Write,

x1 = x2

x2 = −1

LCx1 −

RL

x2 +1L

v(t)[x1x2

]=

[0 1− 1

LC − RL

][x1x2

]+

[01L

]v(t)

Page 26: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

26/95

ModelingC parallel with RL circuit

iC = −iL + u(t)

⇒ C dvCdt = −iL + u(t)

⇒ dvCdt = − 1

C iL +1C u(t)

VC = VL + iLR

= LdiLdt + iLR

solve for diLdt

Page 27: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

27/95

ModelingC parallel with RL circuit

Starting off with differential equations, we go to state space

dvCdt = − 1

C iL +1C u(t)

diLdt = 1

LvC −1LiLR[

VC˙iL

]=

[0 − 1

C1L −R

L

] [VCiL

]+

[1C0

]u(t)

Page 28: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

28/95

ModelingConstant acceleration model

s(t) = a

∫ t

t0

s(τ) dτ =

∫ t

t0

a dτ

s(τ)|tt0 = a τ |tt0s(t)− s(t0) = at − at0

∫ t

t0

s(τ)dτ −

∫ t

t0

s(t0)dτ =

∫ t

t0

aτdτ −

∫ t

t0

at0dτ

s(τ)|tt0 − s(t0)τ |tt0 =12

a τ2|tt0 − at0τ |tt0

s(t)− s(t0)− s(t0)t + s(t0)t0 =12

at2 −12

at02 − at0t + at0

2

let initial time t0 = 0, initial distance s(t0) = 0, and some initial velocity s(t0) = vi , to get thefamiliar equation,

s(t) = vi t +12

at2

If we take the derivative with respect to t, we get vf = vi + at

Page 29: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

29/95

ModelingConstant acceleration model

• The equations s = vi t + 12at2 and vf = vi + at can be

written in state space as,[svf

]=

[0 t0 1

] [sivi

]+

[12 t2t

]fm

and writing in terms of states x and input u, we get,

xt =

[xtxt

]=

[0 t0 1

] [xt−1xt−1

]+

[ 12 t2mtm

]u

• Note that we have used f = ma, and the input u is theforce f

Page 30: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

30/95

ModelingDC Motor cont..

vb = Kbω

= Kb θ

Differential equations

Ldidt

+ Ri = v − vb 1

J θ + b θ = Km i 2

R: electrical resistance 1 ohmL: electrical inductance 0.5H

J: moment of inertia 0.01 kg.m2

b: motor friction constant 0.1 N.m.s

Kb : emf constant 0.01 V/rad/secKm: torque constant 0.01 N.m/AmpLab 2

Laplace Domain

LsI(s) + RI(s) = V (s)− Vb(s) (3)

J s2θ + bsθ = Km I(s) (4)

where Vb(s) = Kbω(s) = Kb sθsolving equation 3 and 4 simultaneouslyangular distance (rad)

G1(s) =θ(s)

V (s)=

Km

[( Ls + R)( Js + b) + KbKm ]

1s

angular rate (rad/sec)

Gp(s) =ω(s)

V (s)= sG1(s) =

= Kb

L J s2 + ( L b + R J )s + ( R b + KbKm )

Page 31: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

31/95

ModelingDC Motor cont..

G1(s) =θ(s)

V (s)=

1s

Km[(Ls + R)(Js + b) + KbKm]

Gp(s) =θ(s)

V (s)=

Km[(Ls + R)(Js + b) + KbKm]

Note that we have set Td ,TL,TM = 0 for calculating G1(s) and Gp(s).

Page 32: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

32/95

ModelingDC Motor cont..

A motor can be represented simply as an integrator. Avoltage applied to the motor will cause rotation. When theapplied voltage is removed, the motor will stop and remainat its present output position. Since it does not return toits initial position, we have an angular displacement outputwithout an input to the motor.

Page 33: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

33/95

Frequency (continous) : analysisIntroduction

• Known as classical control, most work is in Laplacedomain

• You can replace s in Laplace domain with jω to go tofrequency domain

Page 34: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

34/95

Frequency (continous): analysisTest Waveform

Page 35: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

35/95

Frequency (continous): analysisSystems: 1st order

dydt + a0y = b0r

sY (s)− y(0) + a0Y (s) = b0R(s)

sY (s) + a0Y (s) = b0R(s)− y(0)

Y (s) =b0

s + a0R(s) +

y(0)

s + a0

• It is considered stable if the natural response decays to0, i.e., the roots of the denominator must lie in LHP,so a0 > 0

• The time constant τ of a stable first order system is1/a0

• In other words, the time constant is the negative ofthe reciprocal of the pole

Page 36: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

36/95

Frequency (continous): analysisSystems: 1st order

Page 37: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

37/95

Frequency (continous): analysisSystems: 1st order

Page 38: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

38/95

Frequency (continous): analysisSystems: 2nd order

Let G(s) =ω2

ns(s+2ζωn)

Y (s) =

(X(s)− Y (s)

)G(s)

Y (s) = E(s)G(s)

Y (s) + Y (s)G(s) = X(s)G(s)

⇒Y (s)

X(s)=

G(s)

1 + G(s)

=ω2

ns2 + 2ζω2

ns + ω2n

=b0

s2 + 2ζω2ns + ω2

n

ζ is dimensionless damping ratio and ωn is the natural frequency or undamped frequency

Page 39: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

39/95

Frequency (continous): analysisSystems: 2nd order

The poles can be found by finding the roots of thedenominator of Y (s)

X(s)

s1,2 =−(2ζωn)±

√(2ζωn)2 − 4ω2

n

2

=−(2ζωn)±

√(4ζ2ω2

n)− 4ω2n

2

=−(2ζωn)± 2ωn

√ζ2 − 1

2= −ζωn ± ωn

√ζ2 − 1

= −ζωn ± jωn

√1− ζ2

Page 40: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

40/95

Frequency (continous): analysisSystems: 2nd order

Formulas:

%OS = e−ζπ/√

1−ζ2 × 100Notice that % OS only depends on the damping ratio ζ

Page 41: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

41/95

Frequency (continous): analysisSystems: 2nd order: Damping

Page 42: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

42/95

Frequency (continous): analysisSystems: 2nd order: DampingUnderdamped system

• Pole positions for an underdamped (ζ < 1) secondorder system s1, s2 = −ζωn ± jωn

√1− ζ2

when plotted on the s-plane

Page 43: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

43/95

Frequency (continous): analysisSystems: 2nd order

1 Rise Time Tr : The time required for the waveform to go from 0.1 ofthe final value to 0.9 of the final value

2 Peak Time Tp : The time required to reach the first, or maximum,peak

• % overshoot: The amount that the waveformovershoots the steady-state or final, value at the peaktime, expressed as a percentage of the steady-statevalue

3 The time required for the transient’s damped oscillations to reach andstay within 2% of the steady-state value

Page 44: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

44/95

Frequency (continous): analysisSystems: types

Relationships between input, system type, static errorconstants and steady-state errors.

Page 45: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

45/95

Frequency (continous): analysisThe Characteristics of P, I, and D Controllers

• A proportional controller (Kp) will have the effect ofreducing the rise time and will reduce but nevereliminate the steady-state error.

• An integral control (Ki) will have the effect ofeliminating the steady-state error for a constant or stepinput, but it may make the transient response slower.

• A derivative control (Kd) will have the effect ofincreasing the stability of the system, reducing theovershoot, and improving the transient response.

The effects of each of controller parameters, Kp, Kd , andKi on a closed-loop system are summarized in the tablebelow.

Page 46: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

46/95

Frequency (continous): analysisThe Characteristics of P, I, and D Controllers

CL RESPONSE RISE TIME OVERSHOOT SETTLING TIME S-S ERRORKp Decrease Increase Small Change DecreaseKi Decrease Increase Increase EliminateKd Small Change Decrease Decrease No Change

Note that these correlations may not be exactly accurate, because Kp , Ki , and Kd are dependent oneach other. In fact, changing one of these variables can change the effect of the other two. For thisreason, the table should only be used as a reference when you are determining the values for Ki , Kpand Kd .

u(t) = Kpe(t) + Ki

∫e(t)dt + Kp

dedt

Page 47: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

47/95

Frequency (continous): analysisEffect of poles and zeros

Page 48: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

48/95

Frequency (continous): analysisEffect of poles and zeros

• The zeros of a response affect the residue, oramplitude, of a response component but do not affectthe nature of the response, exponential, damped,sinusoid, and so on

Starting with a two-pole system with poles at -1 ± j2.828,we consecutively add zeros at -3, -5 and -10. The closerthe zero is to the dominant poles, the greater its effect onthe transient response.

Page 49: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

49/95

Frequency (continous): analysisEffect of poles and zeros

T (s) =(s + a)

(s + b)(s + c)=

As + b +

Bs + c

=(−b + a)/(−b + c)

s + b +(−c + a)/(−c + b)

s + c

if zero is far from the poles, then a is large compared to band c, and

T (s) ≈ a[1/(−b + c)

s + b +1/(−c + b)

s + c

]=

a(s + b)(s + c)

If the zero is far from the poles, then it looks like a simplegain factor and does not change the relative amplitudes ofthe components of the response.

Page 50: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

50/95

Frequency (continous): analysisRoot locus

Representation of paths of closed loop poles as the gain isvaried.

Page 51: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

51/95

Frequency (continous): analysisRoot locus

• The root locus graphically displays both transientresponse and stability information

• The root locus can be sketched quickly to get an ideaof the changes in transient response generated bychanges in gain

• The root locus typically allows us to choose the properloop gain to meet a transient response specification

• As the gain is varied, we move through differentregions of response

• Setting the gain at a particular value yields thetransient response dictated by the poles at that pointon the root locus

• Thus, we are limited to those responses that existalong the root

Page 52: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

52/95

Frequency (continous): analysisNyquist

Determine closed loop system stability using a polar plot ofthe open-loop frequency responseG(jω)H(jω) as ωincreases from -∞ to ∞

Page 53: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

53/95

Frequency (continous): analysisRouth Hurwitz

Find out how many closed-loop system poles are in LHP(left half-plane), in RHP (right half-plane) and on the jωaxis

Page 54: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

54/95

Frequency (continous): analysisPerformance Indeces cont.

• A performance index is a quantitative measure of theperformance of a system and is chosen so thatemphasis is given to the important systemspecifications

• A system is considered an optimal control system whenthe system parameters are adjusted so that the indexreaches an extremum, commonly a minimum value

Page 55: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

55/95

Frequency (continous): analysisPerformance Indeces cont.

ISE =

∫ T

0e2(t)dt integral of square of error

ITSE =

∫ T

0te2(t)dt integral of time multiplied by square of error

IAE =

∫ T

0|e(t)|dt absolute magniture of error

ITAE =

∫ T

0t|e(t)|dt integral of time multiplied by absolute of errorr

• The upper limit T is a finite time chosen somewhatarbitrarily so that the integral approaches asteady-state value

• It is usually convenient to choose T as the settlingtime Ts

Page 56: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

56/95

Frequency (continous): analysisPerformance Indeces cont.

Optimum coefficients of T(s) based on the ITAE criterionfor a step input

s − ωn

s2 + 1.4ωns + ω2n

s3 + 1.75ωns2 + 2.15ω2ns + ω3

n

s4 + 2.1ωns3 + 3.4ω2ns2 + 2.7ω3

ns + ω4n

s5 + 2.8ωns4 + 5.0ω2ns3 + 5.5ω3

ns2 + 3.4ω4ns + ω5

n

s6+3.25ωns5+6.60ω2ns4+8.60ω3

ns3+7.45ω4ns2+3.95ω5

ns+ω6n

Page 57: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

57/95

Frequency (continous): analysisPerformance Indeces cont.

Optimum coefficients of T(s) based on the ITAE criterionfor a ramp input

s2 + 3.2ωns + ω2n

s3 + 1.75ωns2 + 3.25ω2ns + ω3

n

s4 + 2.41ωns3 + 4.93ω2ns2 + 5.14ω3

ns + ω4n

s5 + 2.19ωns4 + 6.50ω2ns3 + 6.30ω3

ns2 + 5.24ω4ns + ω5

n

Page 58: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

58/95

Frequency (continous): analysisBlock diagram

Open loop transfer function

T1(s) =Y1(s)

R(s)= Gc(s) Gp(s) H(s)

Closed loop transfer function

T1(s) =Y (s)

R(s)= Gc(s) Gp(s) H(s)

Page 59: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

59/95

Time (Continous)Introduction

Write your models in the form below:

x(t) = Ax(t) + Bu(t)

y(t) = Cx(t) + Du(t)

Here,A is called the system matrixB is called the Input matrixC is called the output matrixD is is called the Disturbance matrix

A & B are also called as Jacobin matrix

Page 60: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

60/95

Time (Continous)Overview

In the next few slides, let’s look at some aspects of analysisin TIME (continuous). During this analysis, therelationship between classical control vs modern control willalso become clear:

' classical control vs modern control( transfer function vs state space (matrix)( poles vs eigen values( asymptotic stability vs BIBO stability

' Other aspects, only possible in modern control include:

( controllability( observability( senstivity

Page 61: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

61/95

Time (Continous)Overview1. transfer function vs state space

x(t) = Ax(t) + Bu(t)

y(t) = Cx(t) + Du(t)

sX = AX + BU Take Laplace Transform

sX− AX = BU(sI− A)X = BU

⇒ X = (sI− A)−1BU⇒ Y = C(sI− A)−1BU + DU

G(s) =YU = C(sI− A)−1BU + D

= Cadjoint(sI− A)

det(sI− A)B + D

Page 62: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

62/95

Time (Continous)Overview

2. poles vs eigen values

Normally, D = 0, and therefore,

G(s) = Cadjoint(sI− A)

det(sI− A)B

• The poles of G(s) come from setting its denominator,equal to 0, i.e., let det(sI-A) = 0 and solve for roots

• But this is also the method for finding the eigenvaluesof A!

• Therefore, (in the absence of pole-zero cancellations),transfer function poles are identical to the systemeigenvalues

Page 63: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

63/95

Time (Continous)Overview

3. asymptotic stability vs BIBO stability

• In classical control, we say that a system is stable if allpoles are in LHP (left-half plane of Laplace domain)

• This is called Asymptotic stability• In modern control, a system is stable if the systemoutput y(t) is bounded for all bounded inputs u(t)

• This is called BIBO stability• Considering the relationship between poles andeigenvalues, then eigenvalues of A must be negative

Page 64: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

64/95

Time (Continous)Overview

4. controllability

The property of a system when it is possible to take the statefrom any initial state x(t0) to any final state x(tf ) in a finitetime, tf − t0 by means of the input vector u(t), t0 ≤ t ≤ tf

A system is completely controllable if the system state x(tf ) attime tf can be forced to take on any desired value by applying acontrol input u(t) over a period of time from t0 to tf

Page 65: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

65/95

Time (Continous)Overview

4. controllabilitycont..

Page 66: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

66/95

Time (Continous)Overview

4. controllability cont..

Page 67: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

67/95

Time (Continous)Overview

4. controllability cont..

• The Solution to u(t), u(t), ..., un−2(t), un−1(t) canonly be found if Pc is invertible

• Another way to say this is that Pc is full rank• x (n)(t) is the state that results from n transitions ofthe state with input present

• Anx(t) is the state that results from n transitions ofthe state with no input present

• PC is therefore called the controllability matrix

Page 68: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

68/95

Time (Continous)Overview4. controllability cont..

Simple example with 2 states, i.e., n = 2,

A =

[−2 1−1 −3

], B =

[10

]PC = [B AB] =

[1 −20 −3

]|PC | = −1 6= 0⇒ controllable

In Matlab,

1 A=i n p u t ( ’A= ’ ) ;2 B=i n p u t ( ’B= ’ ) ;3 P=c t r b (A,B) ; %rank (P)4 unco=l e n g t h (A)−rank (P) ;5 i f unco == 06 d i s p ( ’ System i s c o n t r o l l a b l e ’ )7 e l s e8 d i s p ( ’ System i s u n c o n t r o l l a b l e ’ )9 end

Page 69: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

69/95

Intro. to Matlab

1 The name MATLAB stands for MATrix LABoratory.2 MATLAB was written originally to provide easy access

to matrix software developed by the LINPACK (linearsystem package) and EISPACK (Eigen systempackage) projects.

3 MATLAB has a number of competitors. Commercialcompetitors include Mathematica, TK Solver, Maple,and IDL.

4 There are also free open source alternatives toMATLAB, in particular GNU Octave, Scilab, FreeMat,Julia, and Sage which are intended to be mostlycompatible with the MATLAB language.

5 MATLAB was first adopted by researchers andpractitioners in control engineering.

Page 70: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

69/95

Intro. to Matlab

1 The name MATLAB stands for MATrix LABoratory.2 MATLAB was written originally to provide easy access

to matrix software developed by the LINPACK (linearsystem package) and EISPACK (Eigen systempackage) projects.

3 MATLAB has a number of competitors. Commercialcompetitors include Mathematica, TK Solver, Maple,and IDL.

4 There are also free open source alternatives toMATLAB, in particular GNU Octave, Scilab, FreeMat,Julia, and Sage which are intended to be mostlycompatible with the MATLAB language.

5 MATLAB was first adopted by researchers andpractitioners in control engineering.

Page 71: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

69/95

Intro. to Matlab

1 The name MATLAB stands for MATrix LABoratory.2 MATLAB was written originally to provide easy access

to matrix software developed by the LINPACK (linearsystem package) and EISPACK (Eigen systempackage) projects.

3 MATLAB has a number of competitors. Commercialcompetitors include Mathematica, TK Solver, Maple,and IDL.

4 There are also free open source alternatives toMATLAB, in particular GNU Octave, Scilab, FreeMat,Julia, and Sage which are intended to be mostlycompatible with the MATLAB language.

5 MATLAB was first adopted by researchers andpractitioners in control engineering.

Page 72: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

69/95

Intro. to Matlab

1 The name MATLAB stands for MATrix LABoratory.2 MATLAB was written originally to provide easy access

to matrix software developed by the LINPACK (linearsystem package) and EISPACK (Eigen systempackage) projects.

3 MATLAB has a number of competitors. Commercialcompetitors include Mathematica, TK Solver, Maple,and IDL.

4 There are also free open source alternatives toMATLAB, in particular GNU Octave, Scilab, FreeMat,Julia, and Sage which are intended to be mostlycompatible with the MATLAB language.

5 MATLAB was first adopted by researchers andpractitioners in control engineering.

Page 73: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

69/95

Intro. to Matlab

1 The name MATLAB stands for MATrix LABoratory.2 MATLAB was written originally to provide easy access

to matrix software developed by the LINPACK (linearsystem package) and EISPACK (Eigen systempackage) projects.

3 MATLAB has a number of competitors. Commercialcompetitors include Mathematica, TK Solver, Maple,and IDL.

4 There are also free open source alternatives toMATLAB, in particular GNU Octave, Scilab, FreeMat,Julia, and Sage which are intended to be mostlycompatible with the MATLAB language.

5 MATLAB was first adopted by researchers andpractitioners in control engineering.

Page 74: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

70/95

Intro. to SimulinkAn essential part of Matlab

1 The name Simulink stands for Simulations and links2 Old name was Simulab3 Simulink is widely used in automatic control and

digital signal processing for multidomain simulationand Model-Based Design.

Page 75: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

71/95

Intro. to Matlab

Toolboxes to be used in this course are1 Simulink2 Mupad (Symbolic math toolbox)3 Control System toolbox

• Sisotool / rltool• PID tunner• LtiView

4 System Identification toolbox5 Aerospace toolbox6 Simulink Control Design7 Simulink Design Optimization8 Simulink 3D animation9 GUI development10 Report Generation

Page 76: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

72/95

Plotting step response manuallyInstead of using the step command to plot step response,the following manual method can be used for betterunderstanding:

1 %t ime2 t s t a r t = 0 ;3 t s t e p = 0.01 ;4 t s t o p = 3 ;5 t = t s t a r t : t s t e p : t s t o p ;6 %s t ep r e s pon s e7 CF . SR_b = CF .TF_b ;8 CF . SR_a = [CF .TF_a 0 ] ; %no t i c e t ha t we ’ ve added a z e r o as the

l a s t term to c a t e r f o r m u l t i p l i c a t i o n wi th 1/ s9 CF . SR_eqn = t f (CF . SR_b ,CF . SR_a) ;

10 [CF . SR_r , . . .11 CF . SR_p , . . .12 CF . SR_k ] = r e s i d u e (CF . SR_b ,CF . SR_a) ;13 %amp l i tude o f s t e p r e s pon s e14 CF . SR_y =CF . SR_r (1 )∗exp (CF . SR_p(1)∗ t )+ . . .15 CF . SR_r (2 )∗exp (CF . SR_p(2)∗ t ) + . . .16 CF . SR_r (3 )∗exp (CF . SR_p(3)∗ t ) ;1718 p l o t ( t , CF . SR_y) ;19 g r i d on20 x l a b e l ( ’ Time ( s e c ) ’ )21 y l a b e l ( ’Wheel a n g u l a r v e l o c i t y rad / se c ) ’ ) ;22 t i t l e ( ’DC motor s t ep r e s pon s e ’ ) ;

Back to the slide 58

Page 77: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

73/95

Lab1Learn to Record and Share YourResults Electronically

• Learn how to make a website and put your results onit

• Website files must not be path dependent, i.e, if I copythem to any location such as a USB, or differentdirectory, the website must still work

• The main file of the website must be index.html• Many tools are available, but a good cross-platformopen source software is kompozer available fromhttp://www.kompozer.net/

Page 78: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

74/95

Lab1Learn to Extend Existing Work in aControls Topic

Make groups, pick a research topic, create a website withfollowing headings:

1 Introduction2 Technical Background3 Expected Experiments4 Expected Results5 Expected Conclusions

Present your website. Every group member will be quizzedrandomly. Your final work will count towards your lab exam.

Page 79: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

75/95

Lab1Gain Effect on Systems

Page 80: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

76/95

Lab1Second order Systems Vs Third order systems

Page 81: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

77/95

Lab2Mathematical Modeling of Motor

• The model we will use will be for a DC motor as givenin this slides on Back to Motor Modelling Slide

• Use the following default values for the 6 constantsneeded to model the DC motor:

Km 0.01 Nm/AmpKb 0.01 V/rad/sL 0.5 HR 1 ω

J 0.01 kg m2

b 0.1 N m s

• Enter in Matlab

Page 82: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

78/95

Lab2Mathematical Modeling of Motor

1 %( a ) t r a n s f e r f u n c t i o n2 CF .TF_b = Km; %numerator3 CF .TF_a = [ L∗J L∗b+R∗J R∗b+Kb∗Km] ; %

denominator4 CF . TF_eqn = t f (CF .TF_b ,CF .TF_a) ; %

equa t i on5 %(b ) f i n d impu l s e r e s pon s e6 impu l s e (CF . TF_eqn) ;7 %( c ) f i n d s t ep r e s pon s e8 s t e p (CF . TF_eqn) ;

Optionally, see this slide on plotting step response manually

Page 83: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

79/95

Lab 2Parameters identification

1 u=inpu t ( ’ u=’ ) ; % how many t imes you wantto run loop

2 f o r g=1:u3 kd=inpu t ( ’ kd=’ ) ;4 kp=inpu t ( ’ kp=’ ) ;5 k i=i npu t ( ’ k i= ’ ) ;6 s=t f ( ’ s ’ ) ;7 b=[kd∗ s^2+kp∗ s+k i ] / [ s ] ; %[ kd∗ s^2+kp∗ s+k i

] / [ s ] ;8 G=b/( s^2+10∗ s+20+b )9 %f i g u r e ( g )

10 s t e p (G) , g r i d on11 [ wn , z ]=damp(G) ;12 l=s t e p i n f o (G) ;13 end

Page 84: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

80/95

LabDisturbance Rejection Phenomenon

1 c l e a r a l l2 c l c3 %% wi thout d i s t u r b a n c e4 f o r ka=50:50:3005 q=ka∗500;6 f r=t f ( [ q ] , [ 1 1020 20000 0 ] ) ;7 h=t f ( [ 1 ] ) ;8 a=feedback ( f r , h ) ;9 %s t ep ( a ) , t i t l e ( ’ w i thout d i s t u r b an c e ’ ) ;

10 %% with d i s t u r b a n c e11 f r 1=t f ( [ 1 ] , [ 1 20 0 ] ) ;12 h1=t f ( [ q ] , [ 1 1000 ] ) ;13 b=feedback ( f r 1 , h1 ) ;14 e=q+1000;15 g=t f ( [ 1 e ] , [ 1 1020 20000 q ] ) ;16 f i g u r e ( ka )17 s t ep ( g )18 l=s t e p i n f o ( g )19 pause20 c l e a r a l l21 c l c22 end

Page 85: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

81/95

Lab2Mathematical Modeling

Figure :Train system

Figure : Free body diagram

In this example, we will consider a toy train consisting of anengine and a car. Assuming that the train only travels inone dimension (along the track), we want to apply controlto the train so that it starts and comes to rest smoothly,and so that it can track a constant speed command withminimal error in steady state.

Page 86: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

82/95

Lab2Mathematical Modeling

ΣF1 = F − k(x1 − x2)− µM1gx1 = M1x1 (1)ΣF2 = k(x1 − x2)− µM2gx2 = M2x2 (2)

Page 87: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

83/95

Lab2Mathematical Modeling in Simulink

Parameters are: M1=1 kg; M2=0.5kg; k=1; F=1; µ=0.02;g=9.8;

Page 88: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

84/95

Lab2Mathematical Modeling

Figure : Boeing

Assume that the aircraft is in steady-cruise at constantaltitude and velocity; thus, the thrust and drag cancel outand the lift and weight balance out each other. Also,assume that change in pitch angle does not change thespeed of an aircraft under any circumstance (unrealistic butsimplifies the problem a bit). Under these assumptions, thelongitudinal equations of motion of an aircraft can bewritten as:

Page 89: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

85/95

Lab2Mathematical Modeling

α = µΩσ[−(CL + CD0 )α+ (1/µ− CL)q − (Cw Sinγe)θ + CL]

q = µΩ/2in

[[CM − η(CL + CD0 )]α+ [CM + σCM(1− µCL)]q

+(ηCW sinγe)δ3)

](1)

θ = Ωq

Where:α=Angle of attack, q=Pitch rate, θ=Pitch angle, δ=Elevator deflectionangle, µ = ρSc

4m , CT=Coefficient of thrust, CD=Coefficient of Drag,CL=Coefficient of lift, CW=coefficient of weight, CM=coefficient of pitchmoment , γe = Flight path angle

ρ = Density of airS = Planform area of the wingc = Average chord lengthm= Mass of aircraft

Ω = 2Uc

U =equilibrium flight speed, σ = 11+µCL

, in=Normalized moment of inertia,η = µσC = constant nu

Page 90: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

86/95

Lab2Mathematical Modeling

Before finding transfer function and the state-space model,let’s plug in some numerical values to simplify the modelingequations (1) shown in previous slide.

α = −0.313α + 56.7q + 0.232δe

q = −0.0139α− 0.426q + 0.0203δe (2)

θ = 56.7q

These values are taken from the data from one of theBoeing’s commercial aircraft.Obtained open-loop transfer function will be

θ(s)

δe(s)=

1.151s + 0.1774s3 + 0.739s2 + 0.921s

Page 91: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

87/95

Lab2Closed loop tf...Closed loop transfer function will be

θ(s)

δe(s)=

Kp(1.151s + 0.1774)

s3 + 0.739s2 + (1.151KP + 0.921)s + 0.1774KP

commands to be used are conv and cloop i.e.code

1 Kp=[1 ] ; % Ente r any nume r i c a l v a l u ef o r the p r o p o r t i o n a l ga i n

2 num=[1.151 0 . 1 7 7 4 ] ;3 num1=conv (Kp , num) ;4 den1=[1 0 .739 0 .921 0 ] ;5 [ numc , denc ]= c l oop (num1 , den1 ) ;6 s t e p (numc , denc )

Page 92: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

88/95

Lab2Proportional Controller DesignThe design requirements are

• Overshoot: Less than 10%• Rise time: Less than 2 seconds• Settling time: Less than 10 seconds• Steady-state error: Less than 2%

As it is known

ζωn ≥4.6Ts

ωn ≥1.8Tr

ζ ≥√

(lnMp/π)2

1 + (lnMp/π)2

whereMp=Maximum overshootvalues found to be are ωn = 0.9 and ζ = 0.52

Page 93: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

89/95

Lab2Root locus

code

1 num=[1.151 0 . 1 7 7 4 ] ;2 den=[1 0 .739 0 .921 0 ] ;3 Wn=0.9;4 z e t a =0.52;5 r l o c u s (num , den )6 s g r i d ( zeta ,Wn)7 a x i s ([−1 0 −2.5 2 . 5 ] )

Page 94: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

90/95

Lab2Lead Compensator in editer

Gc(s) = Kcs − z0s − p0

Z0=zerop0=poleZ0 < P0

code

1 num1=[1.151 0 . 1 7 7 4 ] ;2 den1=[1 0 .739 0 .921 0 ] ;3 num2=[1 0 . 9 ] ; den2=[1 2 0 ] ;4 num=conv (num1 , num2) ;5 den=conv ( den1 , den2 ) ;6 Wn=0.9; z e t a =0.52;7 r l o c u s (num , den )8 a x i s ([−3 0 −2 2 ] )9 s g r i d ( zeta ,Wn)

10 [K, p o l e s ]= r l o c f i n d (num , den )11 de =0.2 ;12 [ numc , denc ]= c l oop (K∗num , den ,−1) ;13 s t ep ( de∗numc , denc )

Page 95: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

91/95

Lab2Lead Compensator design using sisotool

Sisotool for designing PD compensater, lead compensateror lead-lag compensater

Page 96: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

92/95

Matlab Commands UsedCommonly

For Help in Matlab type doc command_name (etc. doclinspace)

• linspace, logspace• inv, max, det• edit, who, ls, dir, cd• plot, subplot, meshgrid• contour, bar, mesh, surf• clear all, delete, clc,close all, clf, cla

• xlabel, ylabel, grid, holdon/off, axis

• roots, poly, polyval• tf, ss, tf2ss, ss2tf, zp2tf,• residue, series, parallel,• feedback, step, impulse,lsim

• cloop, bode, rlocus,margin, canon

• laplace, diff, int, fourier

for more commands visit Link

Page 97: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

93/95

QuizTotal time of 10-15 min.

x =1M

∑cart

Fx =1M

(F − N − bx) (1)

θ =1I

∑pend

τ =1I

(−Nlcosθ − Plsinθ) (2)

N = m(x − l θ2sinθ + l θcosθ) (3)

P = m(l θ2cosθ + l θsinθ) + g (4)

where

• (M)=mass of the cart=0.5 kg• (m)= mass of the pendulum= 0.2 kg• (b)=coefficient of friction for cart=0.1

N/m/sec• (l)=length to pendulum center of

mass=0.3 m• (I)= mass moment of inertia of the

pendulum= 0.006 kg.m2

• (F)=force applied to the cart• (x)=cart position coordinate• (theta)=pendulum angle from vertical

(down)

Alternative Quiz Link

Page 98: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

94/95

QuizSolution

Page 99: Classical and Modern Control Theory

Classical and ModernControl

Qazi Ejaz Ur RehmanAvionics Engineer

IntroductionAdministration

Basic Math

Laplace

Overview

ModelingElectrical

Mechanical

Frequency(continous)Analysis

Time(Continous)Analysis

Software

Optional

Labs

MatlabCommands

Quiz

95/95

Thank you

Email