13 views

Uploaded by Rizkie Denny Pratama

matlab

- 11-15nonlinear-controller1-20141-Gotovo-m.pdf
- 1375620
- 1.a New Approach to Control a Driven Pendulum With PID Method - Copy
- Cst Reference Guide
- Discussion Level Process Control
- T1_BioReactor
- tunning_controllers.pdf
- Simple analytic rules for model reduction and PID tuning.pdf
- LCS UMU - Inverted Pendulum
- 01a_104
- Tuning Control Loops
- Dc Motor Projet
- ECE382_f08_hw4soln.pdf
- Pid Controllers
- ICI2011.pdf
- Science Direct - Compound Control for Hydraulic Flight Motion Simulator
- Error
- Lec14.pdf
- Pid kids
- I_PD

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

- 11-15nonlinear-controller1-20141-Gotovo-m.pdfUploaded byTobirama Senju
- 1375620Uploaded byrevs_eee
- 1.a New Approach to Control a Driven Pendulum With PID Method - CopyUploaded byquang Nguyen
- Cst Reference GuideUploaded byJohnNash
- Discussion Level Process ControlUploaded byShahrul Ikram
- T1_BioReactorUploaded byHimanshu Jat
- tunning_controllers.pdfUploaded byJuan Pablo Martin
- Simple analytic rules for model reduction and PID tuning.pdfUploaded byfherrera_80972
- LCS UMU - Inverted PendulumUploaded byGlen Hansard
- 01a_104Uploaded byMiguelÁngelHernándezOsorio
- Tuning Control LoopsUploaded byNurgul Shuakbayeva
- Dc Motor ProjetUploaded byArT MgM
- ECE382_f08_hw4soln.pdfUploaded bycavanzas
- Pid ControllersUploaded bySrinivas Acharya
- ICI2011.pdfUploaded byVignesh Ramakrishnan
- Science Direct - Compound Control for Hydraulic Flight Motion SimulatorUploaded bysamch02
- ErrorUploaded byelektro
- Lec14.pdfUploaded byNasrullah Yusup
- Pid kidsUploaded bySamrand
- I_PDUploaded byAnonymous WkbmWCa8M
- week5-all-11-20-2017Uploaded byAland Bravo
- Standard PID Control - ManualUploaded byJustin Puscasu
- Eurotherm 3504 and 3508Uploaded bykmpoulos
- IRJET-Optimum Design of PSO based Tuning using PID Controller for an Automatic Voltage Regulator SystemUploaded byIRJET Journal
- Process AsgUploaded byYz Low
- r05320803-process-dynamics-and-controlUploaded bySRINIVASA RAO GANTA
- A Survey of Iterative Learning ControlUploaded byHao Luo
- Final Control PpUploaded bygaston
- Paper 17-Modeling and Simulation Multi Motors Web Winding SystemUploaded byEditor IJACSA
- 3203949 . Robust Decentralized Controller Design via Ai to Enhance Power System Dynamic PerformanceUploaded byrahuljacob

- Job Application Form TemplateUploaded byRizkie Denny Pratama
- Rta i InstallUploaded byRizkie Denny Pratama
- Characteristics of the Hypocrites * Ibn Al QayimUploaded byMohamed
- Job ApplUploaded byRizkie Denny Pratama
- lab2Uploaded byRizkie Denny Pratama
- low-cost data acquisition system arduino 1.pdfUploaded byRizkie Denny Pratama
- Lec5 Robot SensorsUploaded byIsuru Pasan Dasanayake
- Makeblock 1DOF RobotUploaded byMakeblock
- Tiny Hydraulic Power Supply (Durfee).pdfUploaded byRizkie Denny Pratama
- 10. Form Studi Kasus RCA.pptUploaded byIndah Yuni Puspita
- hb-eng-h.pdfUploaded byRizkie Denny Pratama
- sp_bulogUploaded byMuhammad Agung W
- 3582905-Ruqyah-1Uploaded byToenjol Surya
- trtergtUploaded byDeborah Rocha
- GP2D12_15Uploaded byKrlos D Knight
- Diagram Blok Pengaturan Kecepatan Motor DcUploaded byRizkie Denny Pratama
- 551150 Leseprobe EnUploaded byRizkie Denny Pratama
- AIP JournalUploaded bySanjiv Cr
- Control Example Using MatlabUploaded byRizkie Denny Pratama
- Pangeran DiponegoroUploaded byRizkie Denny Pratama
- QUBE-Servo LQR Control Workbook (Student)Uploaded byRizkie Denny Pratama
- Sci Lab MatlabUploaded byyavob
- RBucher_ScilabTecUploaded byRizkie Denny Pratama
- MIT2 017JF09 ControlUploaded bybalu402
- Admittance Matrix 2 ThesisUploaded byRizkie Denny Pratama
- Schaum LaplaceUploaded byRizkie Denny Pratama
- Xcos BeginnersUploaded bygtorrentes1
- Robert WearableRobotsUploaded byJairo Pérez Pérez
- HapticMaster_vanderlindeUploaded byRizkie Denny Pratama

- Swicht TPLink TL-SG5426 Hoja DatosUploaded byFernando Pajuelo Córdova
- 9035 Ifc300 Signal Converter DatasheetUploaded byWellington Machado
- Power SupplyUploaded byrezakaihani
- Managing OracleUploaded bysubra1032
- BE6PREPAREDBM3U5STDUploaded bydamian
- Matlab FrameworkUploaded bynarumugai29
- 2. Format. Engg - Cartesian Tensor Product of Some New Class of Star – in – Coloring GraphsUploaded byImpact Journals
- Wireshark GuideUploaded byFrancisco Ortiz
- The Easiest Hard ProblemUploaded byJeff Pratt
- Pre-Testing and Configuring of SmartBeam Antenna Systems Prior to Installation OverviewUploaded bywhatiaas
- Cdf - Vfs TasheelUploaded byalluse
- 1100 AM Peter Bocko Presentation for Micro-PV FinalUploaded byNadia Putri
- 01_Datasheet_Minipack_1U_Systems_48V_1_6kW__DS__CTOM0201_DS3___1___6_Uploaded byUriel Yesid Garzon Castro
- Manual Rosemount 2120 Vibrating Fork Liquid Level Switch Data1Uploaded bysivak78mduguha
- ActivInspire ReadmeUploaded byKen Griffin
- =========================================================================== =========================================================================== TEMC.doc =========================================================================== Turbo Editor MacrosUploaded bydarklol60
- 2006-07 Bren School of ICS Annual ReportUploaded byeric_kowalik
- Genealogical Searching HandoutUploaded bysequoya.library
- Sperry Marine Radar Vision MasterUploaded bykostasxave
- QSK60 Series 50hzUploaded bybacuoc.nguyen356
- Firewall OverviewUploaded byAnurag
- Good Standing CertificateUploaded byRrichard Prieto Mmallari
- c Add Manual 2015Uploaded byjimbob
- CategoriesUploaded byivan
- AQA-TT-GCE-JUN11Uploaded byAiden Harvey
- Cinema Calibration Tech ReportUploaded byNicolás Medina
- Strix Accessone Quick Start GuideUploaded byLarry Tembu
- Burtch Works Study PAP 2017Uploaded bywroin1
- Daikin siesta error code.pdfUploaded byfuturams
- Intel Pentium 4 ProcessorUploaded bychepimanca