Adaptive control theory: Pole-Placement and Indirect STR

download Adaptive control theory: Pole-Placement and Indirect STR

of 48

Transcript of Adaptive control theory: Pole-Placement and Indirect STR

  • 7/31/2019 Adaptive control theory: Pole-Placement and Indirect STR

    1/48

    NATIONAL CHENG KUNG UNIVERSITY

    Department of Mechanical Engineering

    ADAPTIVE CONTROL

    HOMEWORK 5

    Instructor: Ming Shaung Ju

    Student: Nguyen Van Thanh

    Student ID: P96007019Department: Inst. of Manufacturing & Information Systems

    Class: 1001- N164400 - Adaptive Control

    November 25, 2011

    http://class-qry.acad.ncku.edu.tw/qry/classmate.php?syear=0100&sem=1&co_no=N164400&class_code=http://class-qry.acad.ncku.edu.tw/qry/classmate.php?syear=0100&sem=1&co_no=N164400&class_code=
  • 7/31/2019 Adaptive control theory: Pole-Placement and Indirect STR

    2/48

    Adaptive Control Theory HW5 Page 1

    Contents

    Problem 1 ...................................................................................................................... 2

    Problem 2 .................................................................................................................... 13

    Problem 3 .................................................................................................................... 37

  • 7/31/2019 Adaptive control theory: Pole-Placement and Indirect STR

    3/48

    Adaptive Control Theory HW5 Page 2

    Problem 1

    Consider a process

    Transfer function of the process:

    ( ) = 0+ 12+ 1+ 2=( ) ( )

    Transfer function of the desired closed-loop system:

    ( ) = 02+ 1+ 2=( )

    ( )

    Where,

    0= 0.17611= 1.32052= 0.4966

    A general linear controller:

    ( ) = ( ) ( )

    Our job is to define three polynomials: R, S and T.

    (a) Design a controller in which the stable zero of process model is canceled.

    Step 1 :

  • 7/31/2019 Adaptive control theory: Pole-Placement and Indirect STR

    4/48

    Adaptive Control Theory HW5 Page 3

    We can see that

    ( ) = + 100 + 10= 0 = 10= 0.081180.1172 = 0.6927 | | = 10< 1 = += + 100

    += + 10

    =

    0

    deg ( ) = 2, deg ( ) = 1 Let deg ( ) = 2 deg ( ) 1 = 22 1 = 3 deg ( ) = deg ( ) deg ( ) = 3 2 = 1

    deg ( )

    deg ( ) ,deg ( ) = deg (

    ) 1

    deg ( ) = 1

    deg ( 0) = deg ( ) deg ( +) 1 = 2 1 1 = 0 Choose 0( ) = 1 = +,deg ( ) = deg ( ) = 1 deg ( ) = 0 = 1

    ( ) = +( ) = + 1

    0= + 0.6927

    Step 2 :

    The Diophantine equation:

    + = ++ += 0 + + = 0

  • 7/31/2019 Adaptive control theory: Pole-Placement and Indirect STR

    5/48

    Adaptive Control Theory HW5 Page 4

    + 0= ( 2+ 1+ 2) + 0( 0+ 1) = ( 2+ 1+ 2)

    2+ (

    1+

    00) +

    2+

    01=

    2+

    1+

    2

    By comparing coefficients of this equation, we obtain

    0= 110 = 1.06911= 220 = 1.4556

    Step 3 :

    = + 0 += = 0 = 0= 000 = 00

    =

    0 = 1

    00

    = 1.5026

    The controller:

    ( ) = ( ) ( )

    is thus characterized by the polynomials:

    ( ) = + 0.6927

    ( ) = 1.0691 1.4556 ( ) = 1.5026 Plug these polynomials into the controller:

    ( ) = ( ) ( )

  • 7/31/2019 Adaptive control theory: Pole-Placement and Indirect STR

    6/48

    Adaptive Control Theory HW5 Page 5

    ( + 0.6927) ( ) = 1.5026 ( ) (1.0691 1.4556) ( ) (1 + 0.6927 1) ( ) = 1.5026 ( ) (1.0691 1.4556 1) ( )

    ( ) + 0.6927 (

    1) = 1.5026 ( ) 1.0691 ( ) + 1.4556 (

    1)

    ( ) = 0.6927 ( 1) + 1.5026 ( ) 1.0691 ( ) + 1.4556 ( 1) (b) Design a controller in which no zero of process model is canceled. Choose a properdelay d0.

    Step 1 :

    No zero of process model is canceled

    = += 1

    deg(

    +)

    = 0 = = 0+ 1 = = = (deg ( ) = deg ( ) = 1)

    Transfer function of the desired closed-loop system:

    ( ) =

    0+

    12+ 1+ 2=

    ( )

    ( )

    Parameter is chosen such that ( = 1 ) = 1 = 1+++ = 0.8877 deg ( ) = 2, deg ( ) = 1

    Let deg ( ) = 2 deg ( ) 1 = 22 1 = 3

    deg ( ) = deg (

    ) deg (

    ) = 3 2 = 1

    deg ( ) deg ( ) ,deg ( ) = deg ( ) 1 deg ( ) = 1 deg ( 0) = deg ( ) deg ( +) 1 = 2 0 1 = 1

    Choose 0( ) = + 0( | 0| < 1)

  • 7/31/2019 Adaptive control theory: Pole-Placement and Indirect STR

    7/48

    Adaptive Control Theory HW5 Page 6

    Poles of the closed-loop system:

    ( ) = 0 2+ 1+ 2= 0 1= 0.6603 + 0.24632= 0.6603 0.2463

    | 1| = | 2| = 0.7047 0.7047 | 0| < 1 Again, 0( ) = + 0(0.7047 | 0| < 1)

    = += 1 = = + 1( ) =

    0+

    1

    Step 2 :

    The Diophantine equation:

    + = ++ += 0 + + = 0 ( 2+ 1+ 2)( + 1) + ( 0+ 1)( 0+ 1) = ( + 0)( 2+ 1+ 2)

    3+ ( 1+ 1+ 00) 2+ ( 11+ 2+ 01+ 10) + ( 21+ 11)= 3+ ( 0+ 1) 2+ ( 2+ 10) + 20

    By comparing coefficients of this equation, we obtain

    1+ 1+ 00= 0+ 111+ 2+ 01+ 10= 2+ 1021

    +

    11=

    20

    1+ 00= 0 1+ 111+ 10+ 01= 2+ 2+ 1021+ 11= 20

  • 7/31/2019 Adaptive control theory: Pole-Placement and Indirect STR

    8/48

    Adaptive Control Theory HW5 Page 7

    1= 0.8802 0+ 0.08300= 1.0222 0+ 0.36111= 1.1169 00.68200.7047 | 0| < 1

    Step 3 :

    ( ) = 0= ( + 0) = 0.8877 + 0.8877 0(0.7047 | 0| < 1) The controller:

    ( ) = ( ) ( )

    is thus characterized by the polynomials:

    ( ) = + 1 ( ) = 0+ 1

    ( ) = ( + 0) = + 0 Where

    1= 0.8802 0+ 0.08300= 1.0222 0+ 0.36111= 1.1169 00.68200.7047 | 0| < 1= 0.8877 Plug these polynomials into the controller:

    ( ) = ( ) ( )

    ( + 1) ( ) = ( + 0) ( ) ( 0+ 1) ( ) (1 + 11) ( ) = ( + 01) ( ) ( 0+ 11) ( ) ( ) + 1( 1) = ( ) + 0( 1) 0( ) 1( 1)

  • 7/31/2019 Adaptive control theory: Pole-Placement and Indirect STR

    9/48

    Adaptive Control Theory HW5 Page 8

    ( ) = 1( 1) + ( ) + 0( 1) 0( ) 1( 1) (c) Simulate above designs when command is a square wave of amplitude 1 and period

    of 25 sampling periods. Test the effect of step disturbance on the tracking

    performance. You may try step with different magnitude. ( for simulating let a 0 = 0.8 )

    Figure 1. Block diagram of sys with stable cancellation

    Figure 2. Command & output, with stable zero cancellation

    1

    Out1

    t0.z

    z+r1

    T/R

    s0.z+s1

    z+r1

    S/R

    Disturbance

    MATLABFunction

    CommandCmd & OptClock

    b0.z+b1

    z +a1.z+a22

    B/A

  • 7/31/2019 Adaptive control theory: Pole-Placement and Indirect STR

    10/48

    Adaptive Control Theory HW5 Page 9

    Figure 3. Command & output, with stable zero cancellation, and step disturbance

    Figure 4. Command & output, with no zero cancellation

  • 7/31/2019 Adaptive control theory: Pole-Placement and Indirect STR

    11/48

    Adaptive Control Theory HW5 Page 10

    Figure 5. Command & output, with no zero cancellation, and step disturbance

    (d) Compare the tracking performance, ringing of input and disturbance rejection of the

    two designs. Discuss on the effect of time delay on the performance of the adaptive

    controller. Plot y(t), u c(t) vs. t and u(t), e(t) vs. t.

    Plot y(t), u c(t): we can see through Fig. 2 to Fig. 5. Two controllers have very same

    performance (tracking and disturbance).

    Discuss on the effect of time delay on the performance of the adaptive controller: we

    should choose the time delay as small as possible. When the time delay is large that

    means the output signal lags phase to the command signal. Hence, the performance of

    the system is not good.

    From Fig. 6 and Fig.8, the control input signal with stable zero cancellation design has a

    severe oscillation (ringing) compare to that of no zero cancellation design

  • 7/31/2019 Adaptive control theory: Pole-Placement and Indirect STR

    12/48

    Adaptive Control Theory HW5 Page 11

    Figure 6. Control input signal with stable zero cancellation design

    Figure 7. Error between u c(t) and y(t), with stable zero cancellation design

  • 7/31/2019 Adaptive control theory: Pole-Placement and Indirect STR

    13/48

    Adaptive Control Theory HW5 Page 12

    Figure 8. Control input signal with no zero cancellation design

    Figure 9. Error between u c(t) and y(t), with no zero cancellation design

  • 7/31/2019 Adaptive control theory: Pole-Placement and Indirect STR

    14/48

    Adaptive Control Theory HW5 Page 13

    Problem 2

    Consider a process

    (a) Design an indirect STR in which the stable zero of process model is canceled.

    Transfer function of the process:

    ( ) = 0+ 12+ 1+ 2=( ) ( )

    Where, parameters {a1, a2, b0, b1} are unknown constants.

    Transfer function of the desired closed-loop system:

    ( ) = 02+ 1+ 2=( ) ( )

    Where,

    0= 0.17611= 1.32052

    = 0.4966

    A general linear controller:

    ( ) = ( ) ( )

  • 7/31/2019 Adaptive control theory: Pole-Placement and Indirect STR

    15/48

    Adaptive Control Theory HW5 Page 14

    Step 1 : Estimate the coefficients of the polynomials A and B i.e. {a1, a2, b0, b1}, by

    using the RLS:

    ( ) = 1(

    1) 2(

    2) + 0(

    1) + 1(

    2) = (

    1)

    ( 1) = [ ( 1) ( 2) ( 1) ( 2) ] = [ 1 2 0 1] The RLS with exponential forgetting is given by

    ( ) = ( 1) + ( ) ( ) ( ) = ( ) (

    1) (

    1)

    ( ) = ( 1) ( 1) + ( 1) ( 1) ( 1) 1 ( ) = ( ( ) ( 1)) ( 1)/

    Step 2 :

    With the stable zero of process model is canceled (this step for only define the degree of

    the polynomials)

    ( ) = + 100 + 10= 0 = 10 | | = 10< 1 | 1| < | 0| = += + 100 += + 10= 0

  • 7/31/2019 Adaptive control theory: Pole-Placement and Indirect STR

    16/48

    Adaptive Control Theory HW5 Page 15

    deg ( ) = 2, deg ( ) = 1 Let deg ( ) = 2 deg ( ) 1 = 22 1 = 3

    deg ( ) = deg (

    ) deg (

    ) = 3 2 = 1

    deg ( ) deg ( ) ,deg ( ) = deg ( ) 1 deg ( ) = 1 deg ( 0) = deg ( ) deg ( +) 1 = 2 1 1 = 0 Choose 0( ) = 1

    = +,deg ( ) = deg ( ) = 1 deg ( ) = 0 = 1 ( ) = +( ) = + 10= + 1

    The Diophantine equation:

    + = ++ += 0 + + = 0

    + 0=

    ( 2+ 1+ 2) + 0( 0+ 1) = ( 2+ 1+ 2) 2+ ( 1+ 00) + 2+ 01= 2+ 1+ 2 By comparing coefficients of this equation, we obtain

    0= 1101= 220

    = + 0 += = 0

  • 7/31/2019 Adaptive control theory: Pole-Placement and Indirect STR

    17/48

    Adaptive Control Theory HW5 Page 16

    = 0= 000 = 00 =

    0 = 1

    00

    =

    0

    ( ) = +( ) = + 10= + 1 Step 3 : Calculate the control law

    ( ) = ( ) ( )

    ( ) +

    1(

    1) =

    0( )

    0( )

    1(

    1)

    ( ) = 1( 1) + 0( ) 0( ) 1( 1) Repeat steps 1, 2 and 3 at each sampling period.

    (b) Design an indirect STR in which no zero of process model is canceled. Choose a

    proper delay d 0.

    Step 1 : Estimate the coefficients of the polynomials A and B i.e. {a1, a2, b0, b1}, by

    using the RLS:

    ( ) = 1( 1) 2( 2) + 0( 1) + 1( 2) = ( 1) ( 1) = [ ( 1) ( 2) ( 1) ( 2) ]

    = [

    1 2 0 1]

    The RLS with exponential forgetting is given by

    ( ) = ( 1) + ( ) ( ) ( ) = ( ) ( 1) ( 1)

  • 7/31/2019 Adaptive control theory: Pole-Placement and Indirect STR

    18/48

    Adaptive Control Theory HW5 Page 17

    ( ) = ( 1) ( 1) + ( 1) ( 1) ( 1) 1 ( ) = ( ( ) ( 1)) ( 1)/

    Step 2 :

    No zero of process model is canceled = += 1deg ( +) = 0 = = 0+ 1 = = = (deg ( ) = deg ( ) = 1)

    Transfer function of the desired closed-loop system:

    ( ) = 0+ 12+ 1+ 2=( ) ( )

    Parameter is chosen such that ( = 1 ) = 1 = 1+++ deg ( ) = 2, deg ( ) = 1

    Let deg (

    ) = 2 deg (

    ) 1 = 2

    2 1 = 3

    deg ( ) = deg ( ) deg ( ) = 3 2 = 1 deg ( ) deg ( ) ,deg ( ) = deg ( ) 1 deg ( ) = 1

    deg ( 0) = deg ( ) deg ( +) 1 = 2 0 1 = 1 Choose

    0( ) = +

    0( |

    0| < 1)

    Poles of the closed-loop system:

    ( ) = 0 2+ 1+ 2= 0 1= 0.6603 + 0.24632= 0.6603 0.2463 | 1| = | 2| = 0.7047

  • 7/31/2019 Adaptive control theory: Pole-Placement and Indirect STR

    19/48

    Adaptive Control Theory HW5 Page 18

    0.7047 | 0| < 1 Again, 0( ) = + 0(0.7047 | 0| < 1)

    =

    += 1

    = = +

    1( )

    = 0+ 1 The Diophantine equation:

    + = ++ += 0 + + = 0 ( 2+ 1+ 2)( + 1) + ( 0+ 1)( 0+ 1) = ( + 0)( 2+ 1+ 2)

    3+ ( 1+ 1+ 00) 2+ ( 11+ 2+ 01+ 10) + ( 21+ 11)= 3+ ( 0+ 1) 2+ ( 2+ 10) + 20

    By comparing coefficients of this equation, we obtain

    1+ 1+ 00= 0+ 111+ 2+ 01+ 10= 2+ 1021

    +

    11=

    20

    1+ 00= 0 1+ 111+ 10+ 01= 2+ 2+ 1021+ 11= 20 1010.7047

    | 0| < 1

    ( ) = 0= ( + 0) (0.7047 | 0| < 1) Step 3 :The controller:

    ( ) = ( ) ( )

  • 7/31/2019 Adaptive control theory: Pole-Placement and Indirect STR

    20/48

    Adaptive Control Theory HW5 Page 19

    is thus characterized by the polynomials:

    ( ) = + 1 ( ) =

    0+

    1

    ( ) = ( + 0) = + 0 Plug these polynomials into the controller:

    ( ) = ( ) ( )

    ( + 1) ( ) = ( + 0) ( ) ( 0+ 1) ( )

    (1 + 11) ( ) = ( + 01) ( ) ( 0+ 11) ( ) ( ) + 1( 1) = ( ) + 0( 1) 0( ) 1( 1) ( ) = 1( 1) + ( ) + 0( 1) 0( ) 1( 1) Repeat step 1, 2 and 3 at each sampling period.

    (c) Simulate above designs using following process parameters [a1, a2, b0, b1] = [-

    1.3735, 0.7006, 0.1231, 0.07712] and initial guess of above parameter vector [0, 0,

    0.01, 0.2]. The command is a square wave of amplitude 1 and period of 25 sampling

    periods. You may test the effect of disturbance on the tracking performance. Either

    stochastic or deterministic disturbance can be used.

    c.1. Stable zero cancellation:

    From the true model, we can find the true R, S and T.

    0= 110 = 0.43051= 220 = 1.6572

  • 7/31/2019 Adaptive control theory: Pole-Placement and Indirect STR

    21/48

    Adaptive Control Theory HW5 Page 20

    = 0 = 100 = 0= 1.4305 ( ) = +( ) = + 1

    0= +

    1= + 0.6265

    ( ) = 1( 1) + 0( ) 0( ) 1( 1) ( ) = 0.6265 ( 1) + 1.4305 ( ) 0.4305 ( ) + 1.6572 ( 1) A function is written in Matlab can solve this problem:

    function [estmtd_theta,yhat,ue,e,re1,se0,se1,te0] =

    adtvCtrolHw5_STR1(uc,u,y,lambda)

    am1 = -1.3205; am2 = 0.4966;

    bm0 = 0.1761;

    numOfCoeffs = 4; % number of coefficents

    alpha = 100;

    t = length(y);

    j=1;

    phi_1(:,j)=[0;u(1:t-1,j)];

    phi_2(:,j)=[0;0;u(1:t-2,j)];

    phi_3(:,j)=[0;-y(1:t-1,j)];

    phi_4(:,j)=[0;0;-y(1:t-2,j)];

    phi = [phi_1(:,j) phi_2(:,j) phi_3(:,j) phi_4(:,j)];

    [M,N] = size(phi);

    P = alpha*eye(N); % initial condition for projection matrix

    estmtd_theta(1,:) = [0.01 0.2 0 0]; % inital condition for [b0 b1 a1

    a2]

    yhat = zeros(1,t); % estimated value

    re1 = zeros(1,N);

  • 7/31/2019 Adaptive control theory: Pole-Placement and Indirect STR

    22/48

    Adaptive Control Theory HW5 Page 21

    se0 = zeros(1,N);

    se1 = zeros(1,N);

    te0 = zeros(1,N);

    % initial conditions for three polynomials

    re1(1) = estmtd_theta(1,2)/estmtd_theta(1,1);

    se0(1) = (am1 - estmtd_theta(1,3))/estmtd_theta(1,1);

    se1(1) = (am2 - estmtd_theta(1,4))/estmtd_theta(1,1);

    te0(1) = bm0/estmtd_theta(1,1);

    e = zeros(1,t);

    ue(1) = 0;

    for i = 2:M-numOfCoeffs+1;

    z = P*phi(i,:)';

    K = z/(lambda + phi(i,:)*z);

    yhat(i) = phi(i,:)*estmtd_theta(i-1,:).';

    e(i) = y(i) - phi(i,:)*estmtd_theta(i-1,:).';

    estmtd_theta(i,:) = estmtd_theta(i - 1,:) + e(i)*K.';

    P = (P - K*z.')/lambda;

    re1(i) = estmtd_theta(i,2)/estmtd_theta(i,1);

    se0(i) = (am1 - estmtd_theta(i,3))/estmtd_theta(i,1); se1(i) = (am2 - estmtd_theta(i,4))/estmtd_theta(i,1);

    te0(i) = bm0/estmtd_theta(i,1);

    ue(i) = - re1(i)*ue(i-1) + te0(i)*uc(i) - se0(i)*yhat(i) -

    se1(i)*yhat(i-1);

    end

    end

  • 7/31/2019 Adaptive control theory: Pole-Placement and Indirect STR

    23/48

    Adaptive Control Theory HW5 Page 22

    Figure 10. Output

    Figure 11. Error between process output and estimated output

  • 7/31/2019 Adaptive control theory: Pole-Placement and Indirect STR

    24/48

    Adaptive Control Theory HW5 Page 23

    Figure 12. Output with step disturbance

    Figure 13. Error between process output and estimated output

  • 7/31/2019 Adaptive control theory: Pole-Placement and Indirect STR

    25/48

    Adaptive Control Theory HW5 Page 24

    c.2. No zero cancellation:

    0( ) = + 0(0.7047 | 0| < 1) 1

    +

    1+

    00=

    0+

    111+ 2+ 01+ 10= 2+ 1021+ 11= 20

    1+ 00= 0 1+ 111+ 10+ 01= 2+ 2+ 1021+ 11= 20 ( ) = 0= ( + 0) ( = 0.8795, 0.7047 | 0| < 1)

    Controller:

    ( ) = ( ) ( )

    ( ) = 1( 1) + ( ) + 0( 1) 0( ) 1( 1) A function in Matlab can solve this problem:

    function [estmtd_theta,yhat,ue,e,re1,se0,se1,te0] =adtvCtrolHw5_STR2(uc,u,y,lambda)

    numOfCoeffs = 4; % number of coefficents

    beta = 0.8795;

    a0 = 0.8;

    am1 = -1.3205; am2 = 0.4966;

    t = length(y);

    j=1;

    phi_1(:,j)=[0;u(1:t-1,j)];

    phi_2(:,j)=[0;0;u(1:t-2,j)];

    phi_3(:,j)=[0;-y(1:t-1,j)];

    phi_4(:,j)=[0;0;-y(1:t-2,j)];

  • 7/31/2019 Adaptive control theory: Pole-Placement and Indirect STR

    26/48

    Adaptive Control Theory HW5 Page 25

    phi = [phi_1(:,j) phi_2(:,j) phi_3(:,j) phi_4(:,j)];

    [M,N] = size(phi);

    alpha = 100;

    P = alpha*eye(N); % initial condition for projection matrix estmtd_theta(1,:) = [0.01 0.2 0 0]; % inital condition for [b0 b1 a1

    a2]

    yhat = zeros(1,t); % estimated value

    re1 = zeros(1,N);

    se0 = zeros(1,N);

    se1 = zeros(1,N);

    te0 = zeros(1,N);

    te1 = zeros(1,N);

    % initial conditions for three polynomials

    re1(1) = estmtd_theta(1,2)/estmtd_theta(1,1) - ((estmtd_theta(1,2) -

    a0*estmtd_theta(1,1))*(am2*estmtd_theta(1,1)^2 -

    am1*estmtd_theta(1,1)*estmtd_theta(1,2) + estmtd_theta(1,2)^2))/ ...

    (estmtd_theta(1,1)*(estmtd_theta(1,4)*estmtd_theta(1,1)^2 -

    estmtd_theta(1,3)*estmtd_theta(1,1)*estmtd_theta(1,2) +

    estmtd_theta(1,2)^2)); se0(1) = (estmtd_theta(1,1)*(a0*estmtd_theta(1,4) -

    estmtd_theta(1,3)*estmtd_theta(1,4) - a0*am2 + estmtd_theta(1,4)*am1)

    - estmtd_theta(1,2)* ...

    (estmtd_theta(1,4) - am2 + a0*estmtd_theta(1,3) - a0*am1 +

    estmtd_theta(1,3)*am1 -

    estmtd_theta(1,3)^2))/(estmtd_theta(1,4)*estmtd_theta(1,1)^2 -

    estmtd_theta(1,3)*estmtd_theta(1,1)*estmtd_theta(1,2) +

    estmtd_theta(1,2)^2);

    se1(1) = (estmtd_theta(1,1)*(estmtd_theta(1,4)*am2 -

    estmtd_theta(1,4)^2 - a0*estmtd_theta(1,3)*am2 +

    a0*estmtd_theta(1,4)*am1) ...

    - estmtd_theta(1,2)*(a0*estmtd_theta(1,4) -

    estmtd_theta(1,3)*estmtd_theta(1,4) - a0*am2 +

  • 7/31/2019 Adaptive control theory: Pole-Placement and Indirect STR

    27/48

    Adaptive Control Theory HW5 Page 26

    estmtd_theta(1,4)*am1))/(estmtd_theta(1,4)*estmtd_theta(1,1)^2 -

    estmtd_theta(1,3)*estmtd_theta(1,1)*estmtd_theta(1,2) +

    estmtd_theta(1,2)^2);

    te0(1) = beta; te1(1) = beta*a0;

    e = zeros(1,t);

    ue(1) = 0;

    for i = 2:M-numOfCoeffs+1;

    z = P*phi(i,:)';

    K = z/(lambda + phi(i,:)*z);

    yhat(i) = phi(i,:)*estmtd_theta(i-1,:).';

    e(i) = y(i) - phi(i,:)*estmtd_theta(i-1,:).';

    estmtd_theta(i,:) = estmtd_theta(i - 1,:) + e(i)*K.';

    P = (P - K*z.')/lambda;

    re1(i) = estmtd_theta(i,2)/estmtd_theta(i,1) -

    ((estmtd_theta(i,2) - a0*estmtd_theta(i,1))*(am2*estmtd_theta(i,1)^2

    - am1*estmtd_theta(i,1)*estmtd_theta(i,2) + estmtd_theta(i,2)^2))/ ... (estmtd_theta(i,1)*(estmtd_theta(i,4)*estmtd_theta(i,1)^2 -

    estmtd_theta(i,3)*estmtd_theta(i,1)*estmtd_theta(i,2) +

    estmtd_theta(i,2)^2));

    se0(i) = (estmtd_theta(i,1)*(a0*estmtd_theta(i,4) -

    estmtd_theta(i,3)*estmtd_theta(i,4) - a0*am2 + estmtd_theta(i,4)*am1)

    - estmtd_theta(i,2)* ...

    (estmtd_theta(i,4) - am2 + a0*estmtd_theta(i,3) - a0*am1 +

    estmtd_theta(i,3)*am1 -

    estmtd_theta(i,3)^2))/(estmtd_theta(i,4)*estmtd_theta(i,1)^2 -

    estmtd_theta(i,3)*estmtd_theta(i,1)*estmtd_theta(i,2) +

    estmtd_theta(i,2)^2);

  • 7/31/2019 Adaptive control theory: Pole-Placement and Indirect STR

    28/48

    Adaptive Control Theory HW5 Page 27

    se1(i) = (estmtd_theta(i,1)*(estmtd_theta(i,4)*am2 -

    estmtd_theta(i,4)^2 - a0*estmtd_theta(i,3)*am2 +

    a0*estmtd_theta(i,4)*am1) ...

    - estmtd_theta(i,2)*(a0*estmtd_theta(i,4) -

    estmtd_theta(i,3)*estmtd_theta(i,4) - a0*am2 +

    estmtd_theta(i,4)*am1))/(estmtd_theta(i,4)*estmtd_theta(i,1)^2 -

    estmtd_theta(i,3)*estmtd_theta(i,1)*estmtd_theta(i,2) +

    estmtd_theta(i,2)^2);

    te0(i) = beta;

    te1(i) = beta*a0;

    ue(i) = - re1(i)*ue(i-1) + te0(i)*uc(i)+ te1(i)*uc(t-1) -

    se0(i)*yhat(i) - se1(i)*yhat(i-1);

    end

    end

    Figure 14. Output

  • 7/31/2019 Adaptive control theory: Pole-Placement and Indirect STR

    29/48

    Adaptive Control Theory HW5 Page 28

    Figure 15. Error between process output and estimated output

    Figure 16. Output with step disturbance

  • 7/31/2019 Adaptive control theory: Pole-Placement and Indirect STR

    30/48

    Adaptive Control Theory HW5 Page 29

    Figure 17. Error between process output and estimated output with step disturbance

    (d) Plot y and u c vs. t, u vs. t and estimated process parameters vs. t. Compare the

    tracking performance, ringing of input and disturbance rejection of the two designs.

    Discuss on the effect of time delay on the performance of the adaptive controller.

    d.1. Stable zero cancellation:

  • 7/31/2019 Adaptive control theory: Pole-Placement and Indirect STR

    31/48

    Adaptive Control Theory HW5 Page 30

    Figure 18. u c and y_estimated vs time

    Figure 19. u (control input is computed from controller law) vs time

  • 7/31/2019 Adaptive control theory: Pole-Placement and Indirect STR

    32/48

    Adaptive Control Theory HW5 Page 31

    Figure 20. Estimated process parameters

  • 7/31/2019 Adaptive control theory: Pole-Placement and Indirect STR

    33/48

    Adaptive Control Theory HW5 Page 32

    Figure 21. u c and y_estimated vs time with step disturbance

    Figure 22. u (control input is computed from controller law) vs time with step

    disturbance

  • 7/31/2019 Adaptive control theory: Pole-Placement and Indirect STR

    34/48

    Adaptive Control Theory HW5 Page 33

    Figure 23. Estimated process parameters

    d.2. No zero cancellation:

    Figure 24. u c and y_estimated vs time

  • 7/31/2019 Adaptive control theory: Pole-Placement and Indirect STR

    35/48

    Adaptive Control Theory HW5 Page 34

    Figure 25. u (control input is computed from controller law) vs time

    Figure 26. Estimated process parameters

  • 7/31/2019 Adaptive control theory: Pole-Placement and Indirect STR

    36/48

    Adaptive Control Theory HW5 Page 35

    Figure 27. u c and y_estimated vs time with step disturbance

    Figure 28. u (control input is computed from controller law) vs time with step

    disturbance

  • 7/31/2019 Adaptive control theory: Pole-Placement and Indirect STR

    37/48

    Adaptive Control Theory HW5 Page 36

    Figure 29. Estimated process parameters with step disturbance

    From Fig. 19 and Fig.25, the control input signal with stable zero cancellation design

    has a severe oscillation (ringing) compare to that of no zero cancellation design

    Two controllers have very same performance (tracking and disturbance).

    Discuss on the effect of time delay on the performance of the adaptive controller: we

    should choose the time delay as small as possible. When the time delay is large that

    means the output signal lags phase to the command signal. Hence, the performance of

    the system is not good.

  • 7/31/2019 Adaptive control theory: Pole-Placement and Indirect STR

    38/48

    Adaptive Control Theory HW5 Page 37

    Problem 3

    Solution :

    I will take only one case in P2: the stable zero of the process model is canceled

    Matlab code:

    clear all ; close all ; clc;

    % define command signal

    Ts = 0.5; Tuc = 25*Ts;

    fuc = 1/Tuc;

    t = 0:Ts:100;

    uc = square(2*pi*fuc*t);

    w = 1; % frequency

    % variations

    delta_a1 = 0.13735;

    delta_a2 = 0.07006;

    delta_b0 = 0.01231;

    delta_b1 = 0.007712;

  • 7/31/2019 Adaptive control theory: Pole-Placement and Indirect STR

    39/48

    Adaptive Control Theory HW5 Page 38

    % define a1, a2, b0, b1

    a1 = -1.3735 + delta_a1*sin(w*t);

    a2 = 0.7006 + delta_a2*sin(w*t);

    b0 = 0.1231 + delta_b0*sin(w*t);

    b1 = 0.07712 + delta_b1*sin(w*t);

    % parameters of the desired closed-loop system

    am1 = -1.3205; am2 = 0.4966;

    bm0 = 0.1761;

    % Rq = q + r1

    r1 = b1./b0;

    % S(q) = s0*q + s1

    s0 = (am1 - a1)./b0;

    s1 = (am2 - a2)./b0;

    % T(q) = t0*q

    t0 = bm0./b0;

    % define input u(t) and process output y(t)

    u(1) = 0; u(2) = 0; y(1) = 0; y(2) = 0;

    n = length(t);

    for i = 3:n

    y(i) = -a1(i)*y(i-1) - a2(i)*y(i-2) + b0(i)*u(i-1) + b1(i)*u(i-

    2);

    u(i) = -r1(i)*u(i-1) + t0(i)*uc(i) - s0(i)*y(i) - s1(i)*y(i-1);

    end ;

    % call function

    lambda = 1;

    [estmtd_theta,yhat,ue,e,re1,se0,se1,te0] ...

    = adtvCtrolHw5_STR1(uc',u',y',lambda);

  • 7/31/2019 Adaptive control theory: Pole-Placement and Indirect STR

    40/48

    Adaptive Control Theory HW5 Page 39

    figure(1);

    plot(t(1:198),y(1:198),t(1:198),yhat(1:198));

    xlabel( 'Time, sec' );

    ylabel( 'Output' );

    legend( 'Process output' , 'Estimated output' );

    figure(2);

    plot(e); grid on ;

    xlabel( 'Time, sec' );

    ylabel( 'Error' );

    figure(3);

    plot(t(1:198),uc(1:198), '--' ,t(1:198),yhat(1:198));

    xlabel( 'Time, sec' );

    ylabel( 'uc(t) & y-estimated(t)' ); legend( 'uc(t)' , 'y-estimated(t)' );

    figure(4);

    plot(ue);

    xlabel( 'Time, sec' );

    ylabel( 'Control input signal' );

    figure(5);

    plot(t(1:198),estmtd_theta(:,1),t(1:198),b0(1:198), '--' , ...

    t(1:198),estmtd_theta(:,2),t(1:198),b1(1:198), '--' , ...

    t(1:198),estmtd_theta(:,3),t(1:198),a1(1:198), '--' , ...

    t(1:198),estmtd_theta(:,4),t(1:198),a2(1:198), '--' );

    grid on ;

    xlabel( 'Time, sec' );

    ylabel( 'Process parameters' );

    legend( 'b0-estimated' , 'b0' , 'b1-estimated' , 'b1' , 'a1-

    estimated' , 'a1' , ... 'a2-estimated' , 'a2' );

  • 7/31/2019 Adaptive control theory: Pole-Placement and Indirect STR

    41/48

    Adaptive Control Theory HW5 Page 40

    Figure 30. Output (delta = 10% of true value, w = 1 rad/sec)

    Figure 31. Error between process and estimated output (delta = 10% of true value, w =

    1 rad/sec)

  • 7/31/2019 Adaptive control theory: Pole-Placement and Indirect STR

    42/48

    Adaptive Control Theory HW5 Page 41

    Figure 32. Command signal and estimated output (delta = 10% of true value, w = 1

    rad/sec)

    Figure 33. Control input signal (delta = 10% of true value, w = 1 rad/sec)

  • 7/31/2019 Adaptive control theory: Pole-Placement and Indirect STR

    43/48

    Adaptive Control Theory HW5 Page 42

    Figure 34. True and estimated parameters (delta = 10% of true value, w = 1 rad/sec)

    Figure 35. Output (delta = 15% of true value, w = 2 rad/sec)

  • 7/31/2019 Adaptive control theory: Pole-Placement and Indirect STR

    44/48

    Adaptive Control Theory HW5 Page 43

    Figure 36. Error between process and estimated output (delta = 15% of true value, w =

    2 rad/sec)

    Figure 37. Command signal and estimated output (delta = 15% of true value, w = 2

    rad/sec)

  • 7/31/2019 Adaptive control theory: Pole-Placement and Indirect STR

    45/48

  • 7/31/2019 Adaptive control theory: Pole-Placement and Indirect STR

    46/48

    Adaptive Control Theory HW5 Page 45

    Figure 40. Output (delta = 10% of true value, w = 1 rad/sec, lambda = 0.98)

    Figure 41. Error between process and estimated output (delta = 10% of true value, w =

    1 rad/sec, lambda = 0.98)

  • 7/31/2019 Adaptive control theory: Pole-Placement and Indirect STR

    47/48

    Adaptive Control Theory HW5 Page 46

    Figure 42. Command signal and estimated output (delta = 10% of true value, w = 1

    rad/sec, lamda)

    Figure 43. Control input signal (delta = 10% of true value, w = 1 rad/sec, lambda = 1)

  • 7/31/2019 Adaptive control theory: Pole-Placement and Indirect STR

    48/48

    Figure 44. True and estimated parameters (delta = 10% of true value, w = 1 rad/sec,

    lambda = 0.98)

    From all of figures above, we can see, it is very similar between weighted and un-

    weighted design in this case. Because, the process parameters change as a sine function.

    When frequency and variation increase the performance of the system is not good, even

    maybe not stable.