Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
64 views

Identification: 2.1 Identification of Transfer Functions 2.1.1 Review of Transfer Function

Transfer Function is a type of the mathematical models of dynamic systems. Can be used for control system design.

Uploaded by

Sucheful Ly
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
64 views

Identification: 2.1 Identification of Transfer Functions 2.1.1 Review of Transfer Function

Transfer Function is a type of the mathematical models of dynamic systems. Can be used for control system design.

Uploaded by

Sucheful Ly
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 29

EE 499: Control System Design

2. Identification
2.1 Identification of Transfer Functions 2.1.1 Review of Transfer Function What is Transfer Function? Transfer function is a type of the mathematical models of dynamic systems.
y (t ) : the output of the dynamic system being studied x (t ) : the input of the dynamic system

System Model: mathematical description of the dynamic relationship between the input and output of the system. For example, a differential equation can be considered as a mathematical model from the system point of view. Differential equation:
d ( n ) y (t ) d ( n 1) y (t ) + a + ... + a 0 y (t ) n 1 dt n dt n 1 d ( m ) x(t ) d ( m 1) x(t ) = bm + b + ... + b0 x (t ) m 1 dt m dt m 1 Transfer Function b s m + bm 1 s m 1 + ... + b0 H (s) = m n a n s + a n 1 s n 1 + ... + a0 (Can you convert between the differential equation and transfer function) How to use Transfer function: (1) If a given input signal x (t ) is applied to a system described by transfer function H ( s ) , the output generated by this input through the system can be obtained by three steps: find the Laplace transform of the input signal X ( s ) = L( x(t )) ; Calculate the Laplace transform of the output signal Y ( s ) = H ( s ) X ( s ) ; calculate the output using inverse Laplace transform y (t ) = L1 (Y ( s )) . (2) H ( s ) contains all the dynamic characteristics of the dynamic system being studied: stability (poles location in the s-plan), static gain, system response speed. can be used for control system design. an

2.1.2 Open-loop Step Response First Order plus Delay Model: H ( s ) =


K : static gain T : time constant
K e s Ts +1

delay, when a change in the input occurs, its effect on the output will not take place (seconds) later

2-1

EE 499: Control System Design Response to a step input: Assume H ( s ) =


5 e 0.5 s 2 s +1

Time constant: 2 second Static gain: 5 Delay: 0.5 second How to examine its step response (Use Simulink): establish system connection, modify element parameters, specify the output data and sampling period in Scope, plot the output data in MatLab.

5 2s+1 Step Transfer Fcn Transport Delay Scope

5 4.5 4 3.5 3 2.5 2 1.5 1 0.5 0

10

2.5 e 0.5 s ? (1) Build the s + 0.5 5 e 0.5 s . Can you see simulink model; (2) Simulate The same as H ( s ) = 2 s +1

What are the gain and time constant: H ( s ) =

this by standardizing the model?

2-2

EE 499: Control System Design Can you simulate H ( s ) =


H (s) =
2

5( s +1) e 0.5 s using Simulink? (3s +1)(2 s +1)

5s + 5 e 0.5 s 6 s + 5s + 1

5s+5 6s2+5s+1 Step Transfer Fcn Transport Delay Scope

5 4.5 4 3.5 3 2.5 2 1.5 1 0.5 0

10

12

14

16

18

20

2-3

EE 499: Control System Design 2.1.3 From Step Response to Transfer Function Can we use a first order plus delay model to approximate the above system?
5s+5 6s2+5s+1 Step Transfer Fcn Transport Delay Sum Transport Delay1 Scope1

5 4s+1 Step1 Transfer Fcn1

Can we approximate a sequence of a step response measurements using a first-order plus delay model?
6

-1 0 2 4 6 8 10 12 14 16 18 20

First: What is your estimation of the delay? Approximately 5 second. Second: Can you build a simulink model (first order plus 5 second delay)? Third: Can you plot the measurements and the simulation results together? Fourth: Can you examine their difference and determine how to change the parameters to make them closer?

2-4

EE 499: Control System Design

5 3s+1 Step Transfer Fcn Transport Delay Scope

-1 0 2 4 6 8 10 12 14 16 18 20

What is the problem? A little faster than the measurement! Lets increase the time constant.

5 4.2s+1 Step Transfer Fcn Transport Delay Scope

-1 0 2 4 6 8 10 12 14 16 18 20

Good Enough! 2-5

EE 499: Control System Design 2.1.4 Step Response Experiment Design for Non-linear Systems The non-linearity is introduced in this case by the MatLab Fcn which is output=sin(input). Question: Should we still apply a step and use the step response to identify the model?

MAT LAB Function Step MATLAB Fcn

5 3s+1 Transfer Fcn Transport Delay Scope

When a unit step is applied, the response is


4 . 5 4 3 . 5 3 2 . 5 2 1 . 5 1 0 . 5 0 0

1 0

1 2

1 4

1 6

1 8

2 0

What the linear approximation is? H ( s ) =

4.2 s e 3s +1

2-6

EE 499: Control System Design

4.5 4 3.5 3 2.5 2 1.5 1 0.5 0 0 2 4 6 8 10 12 14 16 18 20

However, when a 0.5 step is applied, the response is


2.5

1.5

0.5

0 0 2 4 6 8 10 12 14 16 18 20

The corresponding linear approximation is H ( s ) =

4 .8 s e 3s +1

2-7

EE 499: Control System Design

2.5

1.5

0.5

0 0 2 4 6 8 10 12 14 16 18 20

The linear approximation is different when the magnitude of the step input is different. It is correct because of the non-linearity! Which one is what we need? How to design the experiment? Operating Point: Assume that the desired output is 4.2. Experiment or experience should tell us approximately what input will generate this output. In this example, it is 1. Control: If no uncertainties and/or disturbances, u=1 should approximately generates 4.2 output. If uncertainties and/or disturbances exist, the input should vary about u=1. How to Design Step Response Experiment? Assume the amplitude of the variation will be approximately in the range 0.25 . We would like to consider the approximation in an input range from 0.75 to 1.25 to linearize the system. Hence, we should first apply u=0.8 and after the response reaches the steady-state value and then change the input to 1.25. The increase in the output can be considered a step response caused by a 0.5 step. An linear approximation can thus be obtained. Designed Experiment: Step: 0.8 applied at t=0. Step 1: 0.4 added at t=20

2-8

EE 499: Control System Design

5 4.5 4 3.5 3 2.5 2 1.5 1 0.5 0 0 5 10 15 20 25 30 35 40

2-9

EE 499: Control System Design The 0.5 Step Response to be approximated by a linear model is

1.4

1.2

0.8

0.6

0.4

0.2

0 0 2 4 6 8 10 12 14 16 18 20

The linear approximation is thus H ( s ) =


1.4

2.48 s e 3s +1

1.2

0.8

0.6

0.4

0.2

10

12

14

16

18

20

Project One: A system is described by d ( 2) y (t ) dy (t ) dx(t ) 6 +5 + y (t ) = (5 + 5 x(t )) sin(u (t )) . 2 dt dt dt Simulate its step response and obtain a linear approximation of the system suitable for u = (0.75, 1.25) . 2-10

EE 499: Control System Design 2.2 Identification of Difference Equations: 2.2.1 Review of Difference Equation Discrete-time system: instant k corresponds to time t = kT where T is the sampling period y ( k ) : output at t = kT u ( k ) : input at t = kT Difference equation:
y ( k ) a1 y ( k 1) ... a p y ( k p ) = b1u ( k 1) +... + bq u ( k q ) y ( k ) = a1 y (k 1) + ... + a p y (k p ) + b1u (k 1) +... + bq u ( k q )

or

1 Systems Impulse Transfer Function H ( z ) =

b1 z 1 + b2 z 2 + ... + bq z q a1 z 1 + a 2 z 2 + ... + a p z p

Order of the system: p and q Model Parameters: a i (i =1,.2,..., p ) and b j ( j =1,.2,..., q ) T Parameter Vector: = (a1 , a 2 ,..., a p , b1 , b2 ,..., bq ) How to use the Impulse Transfer function or Difference Equation: (3) Predict the future outputs (4) System Characteristics: stability, static gain, system response speed, frequency response can be used for controls system design. 2.2.2 Parameter Estimation and Structure Identification Problems Given: data pair sequence (u (1), y (1)), (u (2), y ( 2)),..., (u ( N ), y ( N )) Parameter Estimation: assume a pair of p and q , i.e. assume a model structure; find a which can give the best prediction as evaluated by a given criterion such as the minimization of the sum of the squared prediction errors. Structure Identification: determine the best pair of p and q . Typically, the structure can not be identified without estimating the parameters. Parameter Estimation and Structure Identification Procedure: (1) Assume an initial pair of orders; (2) Estimate the parameters associated with the model structure (orders); (3) Use an order determination criterion to judge the sufficiency of the orders (model structures). (For example, after the parameters associated with the model structure are estimated, we can calculate the prediction errors for (k ) = y(k ) different time instant k: e( k ) = y ( k ) y u ( k q ) where the hat 1 y ( k 1) +... +a p y (k p ) +b1u ( k 1) +... +b a q indicates an estimate. If the model is adequate, the prediction error sequence should be white noise.) If the model is adequate, stop and use the order pair and the estimated parameters. Otherwise, increase the orders and go (2) again to estimate the parameters. Order Determination Criteria: Many One Order Determination Criterion (Residual Analysis): determine the correlation functions of the prediction error sequence. Assume 2-11

EE 499: Control System Design


( k ) is known for all (k = L +1,..., N ) where e( k ) = y ( k ) y L = max( p, q ) , i.e., e( L +1), e( L + 2),..., e( N ) have been calculated

based on the estimated parameters. Calculate the correlation functions of the residual (prediction error) sequence
N 0 1 e(k )e(k + 0) N L 0 k = L +1 r (0) = N 1 e 2 (k ) N L k = L +1 N 1 1 e(k )e(k + 1) N L 1 k =L +1 r (1) = N 1 e 2 (k ) N L k =L +1

. Or
N j 1 e ( k )e ( k + j ) N L j k = L +1 r ( j) = ( j = 1,2,., , , ) N 1 2 e (k ) N L k = L +1

( r (0) =1) r ( j ) ~ j Then plot . If r ( j ) is small for all j except for j = 0 , we

may accept the model. Example: clear; L=5;N=1000;for k=1:1000;e(k)=rand-0.5;end; % generate a white noise sequence from 1 to 1000 r(0+1)=1;for j=1:10;r(j+1)=0;for k=L+1:Nj;r(j+1)=r(j+1)+e(k)*e(k+j);end; r(j+1)=r(j+1)/(N-L-j);end % calculate the correlation function r ( j ) as r(j+1) to avoid zero index for j=1 to 10 for k=1:11;lag(k)=k-1;end;plot(lag, r) % plot r ( j ) ~ j

2-12

EE 499: Control System Design

1.2

0.8

0.6

0.4

0.2

-0.2 0 1 2 3 4 5 6 7 8 9 10

2.2.3 Least Squares Method for Parameter Estimation Given: (1) data pair sequence (u (1), y (1)), (u (2), y ( 2)),..., (u ( N ), y ( N )) (2) the order pair p and q Observation Equation:

(Can you construct the observation vector ( k ) for any given model structure?) is the used as the estimate of the parameter vector, Prediction Equation: assume then

a1 ... a p y(k ) = ( y(k 1),..., y(k p), u(k 1),..., u(k q)) = (k ) b1 ... b q

2-13

EE 499: Control System Design

1 a ... a p (k ) = ( y(k 1),..., y(k p), u(k 1),..., u(k q)) = (k ) y b1 ... bq
Observation Equations: What is the first observation equation we can have? The minimal k, denoted as k 0 , we are going to use to write the first observation equation should make k p 1 and k q 1 . Define L = max( p, q ) . It can be seen that k 0 = L + 1 . For example, if ( p = 2, q = 3) , then L = 3 and k 0 = 4 . Hence, we will have the following observation equations
y ( 4) =( 4) y (5) =(5) ....... y ( N ) =( N )

Matrix Observation Equation (Matrix Expression of the Observation Equations): The observation equations give the following matrix equation:

y(4) (4) y(5) (5) = .. .. y( N ) ( N )


2-14

EE 499: Control System Design

y(4) (4) y(5) (5) Denote Y = . . . , = . . . . Then the matrix equation can be written as y( N ) ( N )
Prediction Equations and Matrix Expression of Prediction Equations
( 4) = y ( 4) (5) = y (5)

Y =

....... ( N ) = y ( N )

= Y

Cost Function: Sum of Squared Prediction Errors ) = J (


k =L +1

) T (Y Y ) ( k )) 2 = (Y Y e 2 (k ) = ( y(k ) y
k =L +1

Least Squares Method:

: J ( ) = min J ( ) LS LS p+q
R

Or

) J (

=0
= LS

Least Squares Estimate: the solution of estimate is

) J (

= LS

=0 ,

i.e., the least squares

= (T ) 1 T Y LS

Summary: (1) Given: (u (1), y (1)), (u (2), y ( 2)),..., (u ( N ), y ( N )) ; Model structure including p and q

y ( k ) = a1 y ( k 1) + ... + a p y ( k p ) + b1u ( k 1) + ... + bq u ( k q )

(2) L = max( p, q ) (3) Form ( L +1),..., ( N ) and Y = ( y ( L +1), y ( L + 2),..., y ( N )) T (4) Form = (T ) 1 T Y (5) LS Example: Given model: y ( k ) = 0.95 y ( k 1) +1.5u ( k 1) + ( k ) where ( k ) is white noise (zero mean, even distribution between 0.5 to 0.5) for k=1:110;uu(k)=5*rand;yy(k)=0;end;

2-15

EE 499: Control System Design for k=11:110;yy(k)=0.95*yy(k-1)+1.5*uu(k-1)+(rand-0.5);end; %p=1,q=1,a1=0.95,b1=1.5 for k=1:100;y(k)=yy(k+10);u(k)=uu(k+10);end; % pair {u(1),y(1)},...,{u(100),y(100)};N=100 L=1; %Step 2 in Summary N=100;for k=L+1:N;UpperPhi(k-L,:)=[y(k-1) u(k-1)];UpperY(k-L)=y(k);end; UpperY=UpperY'; % Step 3 and 4 ThetaHatLS=(UpperPhi'*UpperPhi)^(-1)*UpperPhi'*UpperY; % Step 5 ThetaHatLS ThetaHatLS = 0.9494 1.4931 (An accurate Estimate!) UpperYHat=UpperPhi*ThetaHatLS; % Predicted Y plot([UpperYHat UpperY]); % Comparison between Y and Yhat
90 80 70 60 50 40 30 20 10 0 10 20 30 40 50 60 70 80 90 100

2.2.4 Examples for Formation of Regression Equation Critical Step in Least Squares Estimation: form the observation equation (regression equation) in terms of y (k ) = (k ) based on the given model structure

2-16

EE 499: Control System Design Can you form the regression equations and the least squares estimates for the following systems? y (k ) a1 y (k 1) a 2 y ( k 2) = b1u (k 3) + b2 u (k 4)
y ( k ) = b1u ( k 1) + bq u ( k q )

2.2.5 Experiment Design Example: Given model: y ( k ) = 0.95 y ( k 1) +1.5u ( k 1) + ( k ) where (k ) is white noise (zero mean, even distribution between 0.5 to 0.5) In 2.2.3, a white noise (even distribution between 0 to 5) sequence was applied as the input. What about a sin sequence is applied? for k=1:110;uu(k)=sin(k*2*3.1415926/100);yy(k)=0;end; for k=11:110;yy(k)=0.95*yy(k-1)+1.5*uu(k-1)+(rand-0.5);end; %p=1,q=1,a1=0.95,b1=1.5 for k=1:100;y(k)=yy(k+10);u(k)=uu(k+10);end; % pair {u(1),y(1)},..., {u(100),y(100)};N=100 L=1; %Step 2 in Summary N=100;for k=L+1:N;UpperPhi(k-L,:)=[y(k-1) u(k-1)];UpperY(kL)=y(k);end;UpperY=UpperY';% Step 3 and 4 ThetaHatLS=(UpperPhi'*UpperPhi)^(-1)*UpperPhi'*UpperY; % Step 5 ThetaHatLS ThetaHatLS = 0.9494 1.5360 UpperYHat=UpperPhi*ThetaHatLS; % Predicted Y plot([UpperYHat UpperY]); % Comparison between Y and YHat

2-17

EE 499: Control System Design

25 20 15 10 5 0 -5 -10 -15 -20

10

20

30

40

50

60

70

80

90

100

Still Very Good! However, if we use model


y ( k ) = 0.95 y ( k 1) +1.5u ( k 1) 0.5u ( k 2) + 0.2u ( k 3) + ( k )

Then the white noise input: clear for k=1:110;uu(k)=5*(rand-0.5);yy(k)=0;end; for k=11:110;yy(k)=0.95*yy(k-1)+1.5*uu(k-1)-0.5*uu(k-2)+0.2*uu(k-3)+(rand-0.5);end; %p=1,q=3 for k=1:100;y(k)=yy(k+10);u(k)=uu(k+10);end; % pair {u(1),y(1)},..., {u(100),y(100)};N=100 L=3; %Step 2 in Summary N=100;for k=L+1:N;UpperPhi(k-L,:)=[y(k-1) u(k-1) u(k-2) u(k-3)];UpperY(kL)=y(k);end;UpperY=UpperY';% Step 3 and 4 ThetaHatLS=(UpperPhi'*UpperPhi)^(-1)*UpperPhi'*UpperY; % Step 5 ThetaHatLS UpperYHat=UpperPhi*ThetaHatLS; % Predicted Yplot([UpperYHat UpperY]); % Comparison between Y and YHAt plot([UpperYHat UpperY]); % Comparison between Y and YHat J=(UpperYHat-UpperY)'*(UpperYHat-UpperY) ThetaHatLS = 0.9447 1.4658 -0.5061 0.1786

2-18

EE 499: Control System Design J= 7.5648


10

-5

-10

-15

-20

10

20

30

40

50

60

70

80

90

100

If the sin sequence is used: clear for k=1:110;uu(k)=sin(k*2*3.1415926/100);yy(k)=0;end; for k=11:110;yy(k)=0.95*yy(k-1)+1.5*uu(k-1)-0.5*uu(k-2)+0.2*uu(k-3)+(rand-0.5);end; %p=1,q=3 for k=1:100;y(k)=yy(k+10);u(k)=uu(k+10);end; % pair {u(1),y(1)},..., {u(100),y(100)};N=100 L=3; %Step 2 in Summary N=100;for k=L+1:N;UpperPhi(k-L,:)=[y(k-1) u(k-1) u(k-2) u(k-3)];UpperY(kL)=y(k);end;UpperY=UpperY';% Step 3 and 4 ThetaHatLS=(UpperPhi'*UpperPhi)^(-1)*UpperPhi'*UpperY; % Step 5 ThetaHatLS UpperYHat=UpperPhi*ThetaHatLS; % Predicted Yplot([UpperYHat UpperY]); % Comparison between Y and YHAt plot([UpperYHat UpperY]); % Comparison between Y and YHat J=(UpperYHat-UpperY)'*(UpperYHat-UpperY) Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 7.829732e-019. ThetaHatLS = 0.8587 -2.6191 -10.9222 2-19

EE 499: Control System Design 11.3289 J= 981.6586


20 15 10 5 0 -5 -10 -15 -20

10

20

30

40

50

60

70

80

90

100

Very Inaccurate!!! What is the problem? Input Signal: insufficient excitation A Method to Design Input (1) Determine an input which can approximately generate the desired value of the output Y0 . Denote this input as U 0 . (U 0 , Y0 ) defines the operating point. U 0 can be determined from the process knowledge or preliminary experiments. (2) Determine the acceptable deviation of the input from U 0 . That is, determine U to U 0+ U without affecting U so that the input can vary from U 0 the operation of the process. (3) Generate a white noise sequence even distributed in (-1,1) using 2*(rand-0.5) in MatLab. Denote this sequence by (1), ( 2),.... (4) Generate a sequence u (k ) = U 0 + U (k ) . Assume that the input will be changed each T second. If the noise and the disturbance are not large, you may use a small T , i.e., you can change the input fast. Otherwise, T should not be too small. Project Two: Given system

y (k ) = 0.8 y ( k 1) + u (k 3) 0.5u (k 4) + 0.2u (k 5) + (k ) where ( k ) is white noise (zero mean, even distribution between 0.5 to 0.5). Assume

that the desired output is 10 and the allowed output range is (5, 15). (1) Simulate the step response of the system. (2) Design an input sequence for Least Squares estimation experiment and simulate the output of the system produced by this input sequence.

2-20

EE 499: Control System Design (3) Find the least squares estimates of the parameters. Graphically demonstrate the accuracy of the estimation through prediction.

2.3 Model Conversion


H ( s ) H ( z ) : bi-linear z-transform H ( z ) H ( s ) : trial-and-error or optimization to make their step responses or frequency

responses close.

2-21

EE 499: Control System Design MatLab Program for LS


clear for k=1:110;uu(k)=sin(k*2*3.1415926/100);yy(k)=0;end; for k=11:110;yy(k)=0.95*yy(k-1)+1.5*uu(k-1)-0.5*uu(k-2)+0.2*uu(k-3)+ (rand-0.5);end;%p=1,q=3 for k=1:100;y(k)=yy(k+10);u(k)=uu(k+10);end; % pair {u(1),y(1)},..., {u(100),y(100)};N=100 L=3; %Step 2 in Summary N=100;for k=L+1:N;UpperPhi(k-L,:)=[y(k-1) u(k-1) u(k-2) u(k3)];UpperY(k-L)=y(k);end;UpperY=UpperY';% Step 3 and 4 ThetaHatLS=(UpperPhi'*UpperPhi)^(-1)*UpperPhi'*UpperY; % Step 5 ThetaHatLS UpperYHat=UpperPhi*ThetaHatLS; % Predicted Yplot([UpperYHat UpperY]); % Comparison between Y and YHAt plot([UpperYHat UpperY]); % Comparison between Y and YHat J=(UpperYHat-UpperY)'*(UpperYHat-UpperY)

2-22

EE 499: Control System Design How to Obtain Discrete-Time Impulse Response h(1), h( 2),..., h( n) from Transfer Function G ( s ) 1. Find the inverse Laplace transform of G ( s ) . It will be the systems continuoustime impulse response h(t ) .
h(t ) = L1 (G ( s ))

For example: G ( s) =

1 h(t ) = e t s +1

2. Compute h(1), h( 2),..., h( n) from h(t )


kT

h( k ) =

( k 1)T

h()d =

h( kT ) + h( kT T ) T 2

where T is the sampling period For example: G ( s) =


1 h( kT ) + h(kT T ) e kT + e ( k 1)T T = T h( k ) = s +1 2 2

3. How to select T : approximately 1/5 to of the dominant time constant For example: G ( s) =
1 time constant=1 second sampling period 0.2 to 0.5 s +1

second Hence, if we use T=0.5 second


h( k ) =

e 0.5 k + e 0.5( k 1) 0.5 = 0.25(e 0.5 k + e 0.5( k 1) ) 2

4. How to select for G ( s ) =

n ? Let

nT to be 5 times of the dominant time constant

1 with T=0.5 second n = 10 s +1

for k=1:10;h(k)=0.5*(exp(-0.5*k)+exp(-0.5*(k-1)));end;h' ans = 0.8033 0.4872 0.2955 0.1792 0.1087 0.0659 0.0400 0.0243 0.0147 0.0089 2-23

EE 499: Control System Design h= [0.8033 0.4872 0.2955 0.1792 0.1087 0.0659 0.0400 0.0243 0.0147 0.0089] 5. How to handle the delay For example G ( s ) =
1 e 0.5 s delay = 0.5 second 1 step (delay=1 T) s +1

h= [0 0.8033 0.4872 0.2955 0.1792 0.1087 0.0659 0.0400 0.0243 0.0147 0.0089] 6. Estimate hmax and hmin Make the range based on your estimation about the uncertainty of the process If the range is assumed to be 20 percent hmax=1.2*h (20% up) hmin=0.8*h (20% down)
h=[0 0.8033 0.4872 0.2955 0.1792 0.1087 0.0659 0.0400 0.0243 0.0147 0.0089] hmax=1.2*h; hmin=0.8*h; n=11; smax(1)=hmax(1);for j=2:n;smax(j)=smax(j-1)+hmax(j);end;% compute s(n) y0=1;% Set-point % prepare initial values for computation convenience for k=1:100+n;u(k)=0;deltau(k)=0;end; for k=100+n:100+n+n;deltau(k)=0;end; for k=n+1:100+n;% control loop starts % sample the output y(k)=0;for j=1:n;y(k)=y(k)+h(j)*u(k-j);end; %if k>50 y(k)=y(k)+0.5+0.2*(rand-0.5); end; % constant disturbance % end of sampling the output % Start to compute the prediction of maxy(k+n)under condition deltau(k)=deltau(k+1)=...=0 yhatmax(k+1)=y(k); for j=1:n; aa=deltau(k+1-j)*hmin(j); bb=deltau(k+1-j)*hmax(j); if aa<bb aa=bb;end;yhatmax(k+1)=yhatmax(k+1)+aa; end; for i=2:n; yhatmax(k+i)=yhatmax(k+i-1); for j=1:n;aa=deltau(k+i-j)*hmin(j);bb=deltau(k+i-j)*hmax(j); if aa<bb aa=bb;end; yhatmax(k+i)=yhatmax(k+i)+aa; end; end; % End of computing the prediction % compute deltau(k) deltau(k)=(y0-yhatmax(k+n))/smax(n); % compute u(k)

2-24

EE 499: Control System Design


u(k)=u(k-1)+deltau(k); yy(k-n)=y(k);uu(k-n)=u(k);% shift back so that t=1T as the start time end; % control loop ends

1.4

1.2

0.8 output

0.6

0.4

0.2

10

20

30

40

50

60

70

80

90

100

0.5 0.49 0.48 0.47 control signal 0.46 0.45 0.44 0.43 0.42 0.41

10

20

30

40

50

60

70

80

90

100

2-25

EE 499: Control System Design If you have an accurate model


1 0.9 0.8 0.7 0.6 output 0.5 0.4 0.3 0.2 0.1 0

10

20

30

40

50

60

70

80

90

100

1.5

control signal

0.5

-0.5

-1

10

20

30

40

50

60

70

80

90

100

2-26

EE 499: Control System Design If you want faster: use smax(m) to replace smax(n) where m<n Use m=4
h=[0 0.8033 0.4872 0.2955 0.1792 0.1087 0.0659 0.0400 0.0243 0.0147 0.0089] hmax=h; hmin=h; n=11; smax(1)=hmax(1);for j=2:n;smax(j)=smax(j-1)+hmax(j);end;% compute s(n) y0=1;% Set-point % prepare initial values for computation convenience for k=1:100+n;u(k)=0;deltau(k)=0;end; for k=100+n:100+n+n;deltau(k)=0;end; for k=n+1:100+n;% control loop starts % sample the output y(k)=0;for j=1:n;y(k)=y(k)+h(j)*u(k-j);end; %if k>50 y(k)=y(k)+0.5+0.2*(rand-0.5); end; % constant disturbance % end of sampling the output % Start to compute the prediction of maxy(k+n)under condition deltau(k)=deltau(k+1)=...=0 yhatmax(k+1)=y(k); for j=1:n; aa=deltau(k+1-j)*hmin(j); bb=deltau(k+1-j)*hmax(j); if aa<bb aa=bb;end;yhatmax(k+1)=yhatmax(k+1)+aa; end; for i=2:n; yhatmax(k+i)=yhatmax(k+i-1); for j=1:n;aa=deltau(k+i-j)*hmin(j);bb=deltau(k+i-j)*hmax(j); if aa<bb aa=bb;end; yhatmax(k+i)=yhatmax(k+i)+aa; end; end; % End of computing the prediction % compute deltau(k) m=4;deltau(k)=(y0-yhatmax(k+m))/smax(n); % compute u(k) u(k)=u(k-1)+deltau(k); yy(k-n)=y(k);uu(k-n)=u(k);% shift back so that t=1T as the start time end; % control loop ends

plot(yy);ylabel('output')

2-27

EE 499: Control System Design

1.4

1.2

0.8 output

0.6

0.4

0.2

10

20

30

40

50

60

70

80

90

100

0.57 0.56 0.55 0.54 control signal 0.53 0.52 0.51 0.5 0.49

10

20

30

40

50

60

70

80

90

100

How to Obtain Discrete-Time Impulse Response h(1), h( 2),..., h( n) from Impulse Transfer Function G ( z ) (1) h(k ) = Z 1 (G ( z )) (2) Select the order (3) Estimate the ranges of h( k ) for k n .

n so that

h(k ) is very small for all.

2-28

EE 499: Control System Design


1 . Assume c is uncertain but s + 2s + c in the range from 2 to 3.5. Design one interval controller and one PI controller and then simulate the step response of the closed-loop system for the cases when c = 2, 2.5, 3, and 3.5 using the design interval and PI controller. Discuss the results and draw some conclusions. (Suggestions- For PI Controller: use c=2.75 for the design. For Interval Control: Calculate the discrete-time impulse responses corresponding to c=1.5, 2.6,2.7,, and 3.5 and find the envelope in order to determine hmin and hmax.) Due: 10/31/01

Project Four: The process is given by G ( s) =

2-29

You might also like