matlab

© All Rights Reserved

13 views

matlab

© All Rights Reserved

- 1727.UCD3138 Control Theory
- PID Control
- simulink
- Laser Target Systemaccv1.0.1.1
- Control
- Ddc
- InTech-Magnitude Optimum Techniques for Pid Controllers
- A Review on Dynamic Control of Parallel Kinematic Machine 37 PAGINI
- paper6
- SoLucion Control
- 06_chapter1
- control systems Transfer function
- 2001_On-Line Relay Identification, Assessment and Tuning of PID Controller
- Project
- Auto Tuning for Pid Controllers
- type-2-step
- Slide Mode Control (SMC)
- Process control lecture 36_Dr Pratik N Sheth_BITS.pdf
- Autmation 2
- PID CONTROLLER TUNNING.pdf

You are on page 1of 18

Classical Control Design with MATLAB is illustrated by means of an example of the

design of a dc servomotor control system.

The transfer function of the dc motor is given by:

H(s) =

80

s(s 2 + 24 s + 48 )

I

+ Ds

s

K (1 + j TD )(1 + jTI )

C ( j ) =

j

C ( s) = P +

or

to achieve the following specifications for the closed loop step response:

Rise time < 0.5s

Overshoot < 10%

We shall work through the following steps for the design:

A. Calculating the required open loop frequency response.

B. Determining the PID parameters.

C. Plotting the step response of the closed loop.

D. Fine-tuning the design to achieve the specifications

First, we use the design specifications to calculate the natural frequency and damping

factor for the closed loop system. For a rise time tr = 0.5 s, overshoot Mp = 0.1 :

=> n = 3.6 rad/s

=> = 0.591

Now use the design relations from the lecture notes to specifiy the open loop crossover

frequency and phase margin:

=> 2c = 2n 4 4 + 1 2 2 => c = 2.60 rad/s

1 2n

=> m = tan

=> m = 1.02 rad

c

Anthony Bright

Page 1

04/ 18/ 02

We will use a Bode plot to help select the controller parameters for the system. First we

will look at the frequency response of the dc motor.

You can write transfer functions in MATLAB by entering the numerator and

denominator polynomials of a rational transfer function as vectors of coefficients in

descending powers of s.

For example, to enter the dc motor transfer function given in the problem statement, you

would enter the numerator and denominator polynomials as two row vectors and define

the system as a transfer function model:

>>num=[80]; den=[1 24 48 0];

>>H=tf(num,den)

Transfer function:

80

------------------s^3 + 24 s^2 + 48 s

>>bode(H)

Anthony Bright

Page 2

04/ 18/ 02

The bode plot shows a crossover frequency of 1.4 rad/s. The crossover frequency must be

raised to 2.60 rad/s to speed up the time response.

First, find the magnitude and phase of the dc motor at the crossover frequency :

>>[magH,phaseH]=bode(H,2.60)

magH =

0.4117

phaseH =

-146.5225

At 2.60 rad/s, the combined phase of the controller and process must give a phase margin

of 1.02 rad (59o )

The phase lead added by the controller at 2.60 rad/s must be -180 + 59 +147 = 26o

( C ( j c ) = 0.44 rad) and the gain added by the controller at 2.60 rad/s must equal the

1

reciprocal of the dc motor gain C ( j c ) =

= 2.43 .

.412

We can now calculate the controller parameters, assuming that T I = 10T D by solving

2

C ( j c ) =

K 1 + 2c TD2 1 + 2c TI2

c

=> TD = 0.256 s ; => TI = 2.56 s

=> K = 0.780

So the PID controller is given by

2

(0.256 s + 1)( 2.56s + 1) 0.512 s + 2.20s + 0.780

C ( s) = 0.780

=

s

s

Transfer function:

0.512 s^2 + 2.4 s + 0.78

-----------------------s

Now check the phase margin and crossover frequency of our design with the open loop

bode plot

Anthony Bright

Page 3

04/ 18/ 02

>>margin(C*H)

Now we check the closed loop behaviour of the system.

First find the closed loop transfer function Q(s):

>> Q=feedback(C*H,1)

Transfer function:

40.99 s^2 + 175.9 s + 62.42

-----------------------------------------s^4 + 24 s^3 + 88.99 s^2 + 175.9 s + 62.42

feedback(forward path transfer function, feedback path transfer function)

In our case we have unity feedback.

Anthony Bright

Page 4

04/ 18/ 02

Plot the step response of the closed loop system for 0 < t < 4 s

>>step(Q,4)

The step response meets the rise time requirement (< 0.5 s) but not the overshoot

specification (<10%)

Anthony Bright

Page 5

04/ 18/ 02

You have found that the controller design did not meet design specs. We would like to be

able to try different values for the controller parameters and examine the results.

%

%Enter H(s)

num=[80];den=[1 24 48 0];

H=tf(num,den);

%Enter C(s)

P=2.20;I=0.780;D=0.512;

num=[D P I];den=[1 0];

C=tf(num,den);

%Plot closed loop step response

Q=feedback(C*H,1);

step(Q,4)

>> PID_tune

Anthony Bright

Page 6

04/ 18/ 02

Part II. State Space Design

We will carry out the same design as in Part I using State Space Methods.

The state space equations describing the dc motor are:

d

=

dt

d

= 4i

dt

di

= 24i 12 + 20v

dt

Our task is to design a state space control scheme to achieve the following specifications

for the closed loop step response :

Rise time < 0.5s

Overshoot < 10%

We shall work through the following steps for the design:

A. Entering the state space representation of the system.

B. Implementing full state feedback with pole placement.

C. Implementing full state feedback with optimal control.

D. Implementing feedback with a state observer

Enter the state space matrices, with x = , u = v, y =

i

>>A=[0 1 0;0 0 4;0 12 24];B=[0 0 20];C=[1 0 0];D=0;

>>H=ss(A,B,C,D)

a =

x1

x2

x3

x1

0

0

0

x1

x2

x3

u1

0

0

20

x2

1

0

-12

x3

0

4

-24

b =

Anthony Bright

Page 7

04/ 18/ 02

c =

y1

x1

1

y1

u1

0

x2

0

x3

0

d =

Continuous-time system.

The command ss created a state space model of the system. We can now look at the

frequency response bode(H), step response step(H), and so forth, just as we did for the

transfer function models in Part I.

With full state feedback, the feedback gain can be evaluated using pole placement or the

LQR method.

B. Pole Placement

First determine the dominant closed loop pole positions.

What values of the dominant poles will give the appropriate time response ( <10%

overshoot, <0.5 s settling time => = 0.6, n = 3.6 rad/s)?

>>p=[-2.2 + 2.8j, -2.2 2.8j, -22];

Find the full state feedback gain to place these poles

>>K=place(A,B,p)

place: ndigits= 15

K = 3.6437

0.7756

0.1200

The command place matches the eigenvalues of the closed loop system matrix Af = A-BK

with the chosen poles. It also measures the number of digits accuracy in the position of the

closed loop poles.

Next, the reference gain Kr is determined

>>N=inv([A B;C D])*[zeros(length(B),1);1];

>>Nx=N(1:length(B));Nu=N(length(B)+1); Kr= Nu + K*Nx

Kr = 3.6437

The closed loop system can now be defined in state space form

>>Q=ss(A-B*K,B*Kr,C-D*K,D*Kr);

Anthony Bright

Page 8

04/ 18/ 02

>>step(Q)

First choose the weighting parameters of the performance index

>>Q=[10 0 0;0 0 0;0 0 0];R=.1;

This choice weights the motor angle with a factor of ten and the control input with a factor

of 0.1. Solve the linear quadratic regulator with Matlab function lqr

>>[K,S,e]=lqr(A,B,Q,R)

K =

10.0000

2.2273

S =

2.8273

0.3817

0.0500

0.3817

0.0774

0.0111

0.3267

0.0500

0.0111

0.0016

e =

-21.8628

-4.3360 + 4.2180i

-4.3360 - 4.2180i

Anthony Bright

Page 9

04/ 18/ 02

The values of the feedback gain vector K are the optimum values to minimize the

performance index. The matrix S is the solution of the associated Riccati equation and the

e vector contains the closed loop eigenvalues (poles). The closed loop response follows as

before

>>Kr= Nu + K*Nx

>>Q=ss(A-B*K,B*Kr,C-D*K,D*Kr); step(Q)

D. Observer Design

Full state feedback of the servo motor requires simultaneous measurement of motor

angular position, angular velocity and motor current. Typically all of these are not

measured. So we need to include an observer to estimate the state of the system. We will

choose the observer poles to be twice as fast as the system poles:

>>pe=2*e

pe =

-43.7256

-8.6720 + 8.4359i

-8.6720 - 8.4359i

>>L=place(A,C,pe)

Anthony Bright

Page 10

04/ 18/ 02

L =

1.0e+003 *

0.0371

-0.0329

1.3527

Note that the place function solves A-BK, so we need to invert the A and C matrices to

find the column vector L.

The observer gain L is now incorporated into an augmented state space description of

both the system state and the observer state:

>>Ae=[A -B*K;L*C A-L*C-B*K];Be=[B*Kr;B*Kr];

>>Ce=[C -D*K; 0 0 0 C-D*K];De=[D*Kr;D*Kr];

>>Q=ss(Ae,Be,Ce,De);

>>step(Q);title('LQR Design with observer')

The upper reponse curve corresponds to the measured output y = ; the lower curve to

the estimated output y = . Overshoot 4%, rise time 0.38s, the observer does an excellent

job!

Anthony Bright

Page 11

04/ 18/ 02

Before you come to the conclusion that the problem is solved and you can take the rest of

the evening off, you should just check the closed loop response of the other two state

variables, the motor speed and the motor current i. For example to find the closed loop

step response of the motor current, we change the output matrix:

>>C=[0 0 1];Ce=[C -D*K2; 0 0 0 C-D*K2];

>>Qi=ss(Ae,Be,Ce,De);step(Qi)

The motor current exceeds 4 amps for a short duration. This current level could burn out

the motor windings. We need to relax some of the design specifications and penalize

large values of current in our weighting matrix Q.

Fine tune the observer-based state space control scheme for rise time < 1.5 s,

overshoot < 10%, motor speed < 1 rad/s and motor current < 2 amps. The M-file

stspace_tune.m given on the next page may be helpful:

Anthony Bright

Page 12

04/ 18/ 02

%

%Enter state space matrices

A=[0 1 0;0 0 4;0 -12 -24];B=[0 0 20]';C=[1 0 0];D=0;

H=ss(A,B,C,D);

% LQR design

Q=[10 0 0;0 0 0;0 0 0];R=0.1;

[K,S,e]=lqr(A,B,Q,R);

% Reference Gain

N=inv([A B;C D])*[zeros(length(B),1);1];

Nx=N(1:length(B));Nu=N(length(B)+1); Kr= Nu + K*Nx;

%Observer Design

% place observer poles

p=2*e; L=place(A',C',p)';

% closed loop state space form

Ae=[A -B*K;L*C A-L*C-B*K];Be=[B*Kr;B*Kr];

Ce=[C -D*K; 0 0 0 C-D*K];De=[D*Kr;D*Kr];

% Step Response

Q=ss(Ae,Be,Ce,De);step(Q)

Anthony Bright

Page 13

04/ 18/ 02

Part III. Digital Control Design

We continue the servomotor design with digital control. The transfer function of the dc

motor is given by:

80

H ( s) =

2

s( s + 24 s + 48)

We shall work through the following steps for the design:

A. Emulating the continuous design with a discrete PID controller

IT

D

C (z) = P +

+ (1 z 1 )

1

1 z

T

B. Implementing discrete state space feedback

>>fs=20;T=1/fs;

>>P=2.44;I=0.864;D=0.567;

>>Cz=tf([(P+I*T+D/T) (P+2*D/T) D/T],[1 -1 0],T)

Transfer function:

13.82 z^2 - 25.12 z + 11.34

--------------------------z^2 - z

Sampling time: 0.05

Notice that the addition of the sample time T to the transfer function command tf creates

a discrete time model of the PID controller.

Anthony Bright

Page 14

04/ 18/ 02

Now we convert the continuous process transfer function to the equivalent discrete

transfer function using the c2d (continuous-to-discrete) command applying a zero order

hold to the input:

>>Hs=tf(80,[1 24 48 0]);Hz=c2d(Hs,T,'zoh')

Transfer function:

0.001259 z^2 + 0.003814 z + 0.0006928

------------------------------------z^3 - 2.232 z^2 + 1.533 z - 0.3012

Sampling time: 0.05

Now we find the step response. The output of the system is continuous, but we can find

the sampled output from the discrete closed loop transfer function:

>>Qz=feedback(Cz*Hz,1);step(Qz);

If we compare this response to the results for the continuous control system (Part I), the

rise time is reduced slightly but the overshoot is increased.

Anthony Bright

Page 15

04/ 18/ 02

The continuous state space equations for the system can be converted to discrete form

and state feedback strategies applied to the discrete system.

First find the equivalent discrete state model for the process:

>>A=[0 1 0;0 0 4;0 -12 -24];B=[0 0 20]';C=[1 0 0];D=0;

>>Hc=ss(A,B,C,D);

>>Hd=c2d(Hc,T,'zoh');

>>Ad=Hd.a

>>Bd=Hd.b

Ad =

1.0000

0

0

0.0492

0.9586

-0.3426

0.0034

0.1142

0.2734

Bd =

0.0013

0.0690

0.5710

To apply the optimal control LQR method for the state feedback gain, choose the

weighting parameters of the objective function

>>Q=[10 0 0;0 0 0;0 0 ];R=0.1;

Now solve the discrete linear quadratic regulator with Matlab function dlqr

>>[K,S,e]=dlqr(Ad,Bd,Q,R)

K =

8.4950

2.0222

0.3007

S =

61.7350

7.6247

1.0043

7.6247

1.5544

0.2236

1.0043

0.2236

0.0328

e =

0.7875 + 0.1689i

0.7875 - 0.1689i

0.3350

Anthony Bright

Page 16

04/ 18/ 02

>>N=inv([Ad-eye(3) Bd;C D])*[zeros(length(Bd),1);1];

>>Nx=N(1:length(Bd));Nu=N(length(Bd)+1); Kr= Nu + K*Nx

Kr = 8.4950

The observer is designed by pole placement. Choose estimator poles to be one half the

value of the system poles (making them about twice as fast in the discrete domain), and

solve for the estimator gain:

>>pe=e/2, L=place(Ad',C',pe)'

pe =

0.3938 + 0.0845i

0.3938 - 0.0845i

0.1675

place: ndigits= 15

L =

1.2769

7.0198

-3.3579

Write the augmented discrete state space equations for both the state variables and the

estimates of the state variables and plot the step response:

>>Ae=[Ad -Bd*K;L*C Ad-L*C-Bd*K];Be=[Bd*Kr;Bd*Kr];Ce=[C -D*K];De=D*Kr

>>Q=ss(Ae,Be,Ce,De,T);step(Q)

Anthony Bright

Page 17

04/ 18/ 02

The response is practically identical to the results from the continuous state space system

and leaves open the same questions about the behavior of the other state variables.

Fine tune the observer-based digital state space control scheme for rise time <

1.5 s, overshoot < 10%, motor speed < 1 rad/s and motor current < 2 amps.

The following M-file may be helpful:

%

% Enter sample time

fs=20;T=1/fs;

% LQR design

A=[0 1 0;0 0 4;0 -12 -24];B=[0 0 20]';C=[1 0 0];D=0;

Hc=ss(A,B,C,D);Hd=c2d(Hc,T,'zoh');

Ad=Hd.a;Bd=Hd.b;

Q=[10 0 0;0 0 0;0 0 0];R=0.1;

[K,S,e]=dlqr(Ad,Bd,Q,R)

% Reference Gain

N=inv([Ad-eye(3) Bd;C D])*[zeros(length(Bd),1);1];

Nx=N(1:length(Bd));Nu=N(length(Bd)+1); Kr= Nu + K*Nx;

% place estimator poles

pe=e/2; L=place(Ad',C',pe)';

% closed loop state space form

Ae=[Ad -Bd*K;L*C Ad-L*C-Bd*K];Be=[Bd*Kr;Bd*Kr];Ce=[C -D*K];De=D*Kr

% Step Response

Q=ss(Ae,Be,Ce,De,T);step(Q)

Anthony Bright

Page 18

04/ 18/ 02

- 1727.UCD3138 Control TheoryUploaded bywwahib2
- PID ControlUploaded byapi-3778950
- simulinkUploaded byAhmet Yazıcı
- Laser Target Systemaccv1.0.1.1Uploaded byShoumik Roychoudhury
- ControlUploaded byalehap
- DdcUploaded byBala Srivas
- InTech-Magnitude Optimum Techniques for Pid ControllersUploaded byTruong Nguyen
- A Review on Dynamic Control of Parallel Kinematic Machine 37 PAGINIUploaded byAdi Dan
- paper6Uploaded byAwal Onggaa Saputra
- SoLucion ControlUploaded bylurafa1
- 06_chapter1Uploaded byhananwar
- control systems Transfer functionUploaded byTharakaKaushalya
- 2001_On-Line Relay Identification, Assessment and Tuning of PID ControllerUploaded byademargcjunior
- ProjectUploaded byFrancisco Gomez
- Auto Tuning for Pid ControllersUploaded by69mike
- type-2-stepUploaded byjacobwatson
- Slide Mode Control (SMC)Uploaded byJaol1976
- Process control lecture 36_Dr Pratik N Sheth_BITS.pdfUploaded byManik Bansal
- Autmation 2Uploaded byKent M
- PID CONTROLLER TUNNING.pdfUploaded bySanni Tajudeen Olugbenga
- Intelligent Computation of Controller Using Optimisation Techniques for a Nonlinear Chemical ProcessUploaded byGlan Devadhas
- g 61215058Uploaded bymadsoneng
- Pfc 5169Uploaded byAdriana Paez
- 1 Self Tuning Fuzzy PID Controller for a Chemical Process.pdfUploaded byGlan Devadhas
- PID ControllerUploaded byRolando Albuquerque Martins
- Advanced control theory presentationUploaded byJustin Jose P
- Comparison Between Neural Network Based PI and PID ControllersUploaded by安勇正
- 2014-PP- Adaptive Fuzzy PID Control for Servo Motor Direct-drive Pump ControlUploaded byPhanHatham
- ee3304-hw3-slnUploaded bymulat
- DC MOTOR CONTROL BY ARMATURE CONTROL METHODUploaded byRaj Lakhwani

- Xcos BeginnersUploaded bygtorrentes1
- lab2Uploaded byRizkie Denny Pratama
- Rta i InstallUploaded byRizkie Denny Pratama
- low-cost data acquisition system arduino 1.pdfUploaded byRizkie Denny Pratama
- Characteristics of the Hypocrites * Ibn Al QayimUploaded byMohamed
- Control Example Using MatlabUploaded byRizkie Denny Pratama
- 3582905-Ruqyah-1Uploaded byToenjol Surya
- Lec5 Robot SensorsUploaded byIsuru Pasan Dasanayake
- Job Application Form TemplateUploaded byRizkie Denny Pratama
- trtergtUploaded byDeborah Rocha
- GP2D12_15Uploaded byKrlos D Knight
- Job ApplUploaded byRizkie Denny Pratama
- HapticMaster_vanderlindeUploaded byRizkie Denny Pratama
- Makeblock 1DOF RobotUploaded byMakeblock
- Tiny Hydraulic Power Supply (Durfee).pdfUploaded byRizkie Denny Pratama
- hb-eng-h.pdfUploaded byRizkie Denny Pratama
- 551150 Leseprobe EnUploaded byRizkie Denny Pratama
- Sci Lab MatlabUploaded byyavob
- QUBE-Servo LQR Control Workbook (Student)Uploaded byRizkie Denny Pratama
- RBucher_ScilabTecUploaded byRizkie Denny Pratama
- AIP JournalUploaded bySanjiv Cr
- Robert WearableRobotsUploaded byJairo Pérez Pérez
- MIT2 017JF09 ControlUploaded bybalu402
- Maturity Level (PO1 - PO2 - PO4)Uploaded byRizkie Denny Pratama
- Control Objectives (PO1 - PO2 - PO4)Uploaded byRizkie Denny Pratama

- 2010_PittsProgramUploaded byMansourLassoued
- Big Study Links Good Teachers to Lasting GainUploaded byi_smurfzyou
- A Comparison and Contrast in Both as Worn by Hester and DimmesdaleUploaded byourskrish
- ArchaelCellsUploaded byraghumedasani
- README.txtUploaded bySamira Namuche
- Descartes cow and others domestications of the visual2.pdfUploaded bySofia Sanchez
- Magnetic Levitation in New Technology and Future GadgetsUploaded byAbhishek Upadhyay
- Details of CC Pavement designUploaded byRajesh Babu
- Definitons, Theorems and PostulatesUploaded byDestiny Litaoen
- Gas-sizing.pdfUploaded byChetan Churi
- n55_australian_dietary_guidelines.pdfUploaded byAldrin Ray Huenda
- rootkitsUploaded bylasa4
- Hasth Bashist Part OneUploaded byMohammed Abdul Hafeez, B.Com., Hyderabad, India
- Dentin Regeneration by Dental Pulp Stem Cell Therapy With BMP2Uploaded bydrhiteshchopra
- Torus-pyramid-NOC: Regular Topology of Grid-Pyramid For Network-On-ChipUploaded byJournal of Computing
- hw_200904.docxUploaded byAli Mhamadi AliHamada Chahidi
- Rule: Airworthiness Directives: ATR Model ATR42 and ATR72 AirplanesUploaded byJustia.com
- DescartesUploaded byDiana Anghel
- CV-17440828-938246-muhammadusman-mirza.docxUploaded bydestiner_1871
- Infection on Male Reproductive OrganUploaded byLear Kaht
- DMG produktu katalogasUploaded byAstravita Uab
- chap 2Uploaded byWajeehaWasim
- PfizerUploaded bysam142000
- Yukta Automation (1)Uploaded byMonishSachin
- Determination of Total Antioxidant Content of Centipeda CunninghamiiUploaded byThomas Wu
- 03_KINEMATICSUploaded bysurya_kotni
- Amsterdam DRUG TRAFFICKINGUploaded bymrFate
- Girder Moments in Simply Supported SkewUploaded byYONAS GOSA
- The 5 Most Dangerous Wolves Preying on Christians | PJ MediaUploaded bychinkshady
- Bahan Ajar Language ReserachUploaded byDioba

## Much more than documents.

Discover everything Scribd has to offer, including books and audiobooks from major publishers.

Cancel anytime.