16
Computer Project 2: Multiple State-Space Control ECE 5115 Controls II: State Space Control Systems Dr. Provence December 4, 2015 Team Final Count Down Michelle Dang Julia London Tiffany Yao

Control Systems Lab 2

Embed Size (px)

Citation preview

Page 1: Control Systems Lab 2

Computer Project 2: Multiple State-Space Control

ECE 5115

Controls II: State Space Control Systems

Dr. Provence

December 4, 2015

Team Final Count Down

Michelle Dang

Julia London

Tiffany Yao

Page 2: Control Systems Lab 2

Team Final Count Down 1

1 Executive Summary To ensure a system operates efficiently control system may be implemented to keep cancel out or

compensate for any instabilities within the system. This can be accomplished by using

mathematical models to describe a system or process, which can then be edited using computer

simulations.

2 IntroductionFor a system to be stable the output eigenvalues from its transfer function must all be negative.

The objective of a controller is to stabilize a system, which included making sure all of the

system’s eigenvalues are negative. The eigenvalues can be found analyzing a transfer function

like the one in Equation 2.1.

β1 sn−1+β2 s

n−2…+ βr s0

sn+α 1sn−1+α 2 s

n−2…+α rEquation 2.1

The controller that will be used in this lab is a State-Space Controller. Figure 2.1 displays the

original set up for an open loop state-space system.

Figure 2.1 – A state space represented system

Each of the gains, A, B, C, and D are matrixes and generally the D matrix is zero. A controller

type state space model can be derived using the transfer function from Equation 1 and arranging

the coefficients of the transfer function as seen in Equation 2.2 below.

Page 3: Control Systems Lab 2

Team Final Count Down 2

x=[ 0 1 0 ⋯ 00 0 1 ⋯ 00 0 0 ⋱ 0⋮ ⋮ ⋱ ⋱ 1

−αr −α r−1 −αr−2 ⋯ −α1]A

x+[000⋮1]B

U (s) (2.2a)

Y (s )=[ βn βn−1 βn−2 ⋯ β1 ]C x (2.2b)

The subtext for each matrix in Equation 2, along with the controller ‘K’ matrix in Equation 2.3

below,

K= [K1 K2 K3 ⋯ Kn ] (2.3)

indicates how are all used within the block diagram for the state-space control system. Figure 2.2

displays a state-space controller system set up.

Figure 2.2 – The general format for a State-Space controller systems

With this set up, the matrix calculation to find the new ‘A’ controller matrix was derived and can

be seen in Equation 2.4 below.

Ac=A¿−B¿∗K ¿ ¿¿¿ (2.4)

The system can then be simulated back as the system seen in Figure 2 but with AC in place of A

to control the system.

A state-space system can also be represented in a form called observer-type companion form.

The system set up can be seen in Equation 2.5.

Page 4: Control Systems Lab 2

Team Final Count Down 3

x=[0 0 0 ⋯ −α r1 0 0 ⋯ −αr−1

0 1 0 ⋱ −αr−2

⋮ ⋮ ⋱ ⋱ ⋮0 0 ⋯ 1 −α1

]A

x+[βnβn−1

βn−2

⋮β1

]B

U (s) (2.5a)

Y (s )=[ 0 0 0 ⋯ 1 ]C x (2.5b)

The state allows the observation of the systems input/output relationship. Both the observer-type

and controller-type companion forms for the systems were derived from Control System II:

State-Space Control Systems, lecture.

3 BackgroundThe goal of this lab is to explore State-Space control systems by observing one aspect of the

system seen in Figure 3.1.

Figure 3.1 – A plant system math mathematical model set up in Simulink

The outputs of this system are the Pitch Rate, The Speed Change and the Angle of Attack. One

of these outputs will be observed to see if certain methods, other than that seen in Lab 1, can

control the system. This analyzation will be accomplished using MATLAB simulations.

4 Solution

Page 5: Control Systems Lab 2

Team Final Count Down 4

Initially the lab ask for the stability, eigenvalues, and zeros of each of the outputs state in section

3. To find these values the transfer functions from each output were extracted. Equation 4.1

displays the transfer function for Angle of Attack.

−0.1 s3−9.95 s2+7.55 s−87.31s4+ .5 s3+18 s2+25.31 s−39.24

(4.1)

Equation 4.2 displays the transfer function for Speed of Change.

−s3−0.1 s2+209.5 s−83.38s4+.5 s3+18 s2+25.31 s−39.24

(4.2)

Equation 4.3 displays the transfer function for the Pitch Rate.

−9 s3−0.5 s2−112.1 .5 ss4+.5 s3+18 s2+25.31 s−39.24

(4.3)

Next, using the transfer functions from each system, the eigenvalues and zeros can be found

using the ‘zpkdata’ function in MATLAB.

The output values for each system can be seen in the following tables.

Table 4.1 displays the eigenvalues and zeros of the Angle of Attack.

Table 4.1 – The eigenvalues and zeros for the output of Angle of Attack of the system.

ANGLE OF ATTACK

Eigenvalues Zeros

0.3318 + 4.5343J -100.167

0.3318 - 4.5343J 3.3045

-2.0774 -2.6377

0.9138 -

It can be observed from Table 4.1 that the output from the Angle of Attack portion of the system

cannot be stable considering three out of four of the eigenvalues are positive. There is also two

eigenvalues that have imaginary values, this means the system, will have oscillations with or

without a controller.

Table 4.2 displays the eigenvalues and zeros of the Speed Change system.

SPEED CHANGE

Eigenvalues Zeros

0.3318 + 4.5343J 14.6196

0.3318 - 4.5343J -14.3213

Page 6: Control Systems Lab 2

Team Final Count Down 5

-2.0774 -0.3983

0.9138 -

Table 4.2 displays the same eigenvalues as that of Table 4.1, before several other observations

can be made, the Pitch Rate’s eigenvalues and zeros must be analyzed.

Table 4.3 displays the eigenvalues and zeros of the Speed Change system.

PITCH RATE

Eigenvalues Zeros

0.3318 + 4.5343J -0.0278 + 3.5291j

0.3318 - 4.5343J -0.0278 - 3.5291j

-2.0774 0

0.9138 -

As suspected the eigenvalues are the same for the Pitch Rate. This means that as long as an

output is connected to a system, its eigenvalues will be the same, but their zeros won’t be. Thus,

if one system is stable, the other systems, should be stable as well.

The lab then asks for the output for each system using an impulse, step, and sine wave as an

input.

Figure 4.1 displays the output for the systems when there is an impulse input.

Figure 4.1 – The system output for Angle of Attack (Out (1)) Speed Change (Out (2)) and Pitch Rate (Out(3)) when the system input in a impluse.

Though it may seem as though the system levels off, when zoomed in the system is actually still

oscillating.

Page 7: Control Systems Lab 2

Team Final Count Down 6

Figure 4.2 displays the output for the system when there is a step input.

Figure 4.2 – The system output for Angle of Attack (Out (1)) Speed Change (Out (2)) and Pitch Rate (Out(3)) when the system has a step input.

The output system is the same as Figure 4.1, when zoomed in, the system is still oscillating.

Figure 4.3 displays the output of the system when the input is a sine wave.

Figure 4.3– The system output for Angle of Attack (Out (1)) Speed Change (Out (2)) and Pitch Rate (Out(3)) when the system has a step input.

It is easily see that the output of the system, when there is a sine wave imput, the systeme is still

unstable.

Next the lab asks for the state-space controller-type and observer-type companion form of the

Pitch Rate. This can be found using the Pitch Rate’s transfer funciton in Equation 4.3 and

inputting values in their respective location in Equation 2.2 and 2.5. The controller-type

companion form of the system can be seen in Equation 4.4.

Page 8: Control Systems Lab 2

Team Final Count Down 7

x=[ 0 1 0 00 0 1 00 0 0 1

−39.24 −5.69 −18 −0.5]A

x+[0001 ]B

U (s) (4.4a)

Y (s )=[−9 −0.5 −112.1 0 ]C x (4.4b)

The observer-type companion form of the Pitch Rate can be seen in Equation 4.5.

x=[0 0 0 −39.241 0 0 −5.690 1 0 −180 0 1 −0.5 ]

A

x+[ −9−0.5

−112.10 ]

B

U (s) (4.5a)

Y (s )=[ 0 0 0 1 ]C x (4.5b)

Once the two companion type forms were derived, a controller was made to so that the input was

the original system’s elevator deflection and the output was the Pitch Rate. To do this a

controller was derived using MATLAB and the Equations 2.3 and 2.4. Equation 4.6 displays the

eigenvalues that were requested to be used to develop a ‘K’ matrix for the controller system.

[−2.8 −2.4 −2−2 j −2+2 j ] (4.6)

Though these eigenvalues are negative, they aren’t near the original eigenvalues. The values in

Equation 4.6 were then input to Equation 2.4 using the ‘A’ and ‘B’ matrixes from Equation 4.4

to develop the new controller ‘A’ matrix. Equation 4.7 displays the ‘K’ values found for the

Pitch Rate’s controller.

[ 14.52 62.79 17.52 8.7 ] (4.7)

Figure 4.4 displays the controlled system’s outputs when the input is an impulse.

Page 9: Control Systems Lab 2

Team Final Count Down 8

Figure 4.4 – The controlled system’s Angle of Attack (Out (1)), Speed Change (Out (2)) and Pitch Rate (Out (3)) response to an impulse input

As suspected the system is unstable.

Figure 4.5 displays the controlled system’s outputs when the system has a step input.

Figure 4.5 – The controlled system’s Angle of Attack (Out (1)), Speed Change (Out (2)) and Pitch Rate (Out (3)) response to a step input.

A more complicated input would not allow the system an easier chance of becoming stable.

Figure 4.6 displays the controlled system’s outputs when the system has a sine wave input.

Page 10: Control Systems Lab 2

Team Final Count Down 9

Figure 4.6 – The controlled system’s Angle of Attack (Out (1)), Speed Change (Out (2)) and Pitch Rate (Out (3)) response to a sine wave input.

For Figure 4.6 it appears as though the system shoots to infinity after about 3 seconds, which

shows that the system is still unstable.

For Figures 4.4, 4.5 and 4.6 all of the outputs were what was to be expected. For the system to be

stable, the original eigenvalues, as seen in Tables 4.1, 4.2 and 4.3, must just all be negative. The

eigenvalues used in the controller for the system, were numbers that had no relationship with the

original system. And change the input from an impulse to a sine wave, going from simple to a

more complicated input, increase the instability of the system.

5 ConclusionIn summary, the eigenvalues given to stabilize the system were unable to do so. This is because

they did not relate to the system’s original eigenvalues. And from what was learned from Lab 1,

the system can be controlled by making the system’s original eigenvalues all negative. There is a

possibility that there are other ways to use a state-space controller to control the system, but out

class has yet to learn of them.

The lab also proves that if one output of the system is unstable, then all outputs are unstable. This

was proven when the eigenvalues for each output were analyzed; they were all the same. This

means that as long as an output is connected to alternate output of a system, their controllability

and stability are related.

Page 11: Control Systems Lab 2

Team Final Count Down 10

References[1] Control Systems I: Automatic Control Systems, notes

[2] Control Systems II: State-Space Control Systems, notes

[3] "PID Controller." Wikipedia. Wikimedia Foundation [Online] Available FTP:

https://en.wikipedia.org/wiki/PID_controller

[4] "Introduction: State-Space Methods for Controller Design." Control Tutorials for MATLAB

and Simulink [Online] Available FTP: http://ctms.engin.umich.edu/CTMS/index.php?

example=Introduction&section=ControlStateSpace

Page 12: Control Systems Lab 2

Team Final Count Down 11

MATLAB Code% Controls II HW 2clear all; close all; clc; simulinkSYS=linmod('Lab2_matlab2')% State-Space Model of original systemTss=ss(SYS.a,SYS.b,SYS.c,SYS.d);% Generate transfer functions of the system[n,h]=tfdata(Tss,'v')T=tf(n,h);% Find Zeros and poles for the system[z,p,k]=zpkdata(Tss); % Function input simulations% Impulse simulationfigure(1)impulse(T);% Step simulationfigure(2)step(T);% Sine wave simulationt = 0:.1:20;u = sin(t);figure(3)lsim(T,u,t); % Save Transfer Functions to variables% Angle of AttackTAoA=tf([-.1 -9.95 7.55 -87.31],[1 .5 18 25.31 -39.24]);% Speed ChangeTSC =tf([-1 -.1 209.5 -83.38],[1 .5 18 25.31 -39.24]);% Pitch RateTPR =tf([-9 -.5 -112.1 0],[1 .5 18 25.31 -39.24]) % Convert to Controller Type companion Form for% Angle of AttackCAoAa=[0 1 0 0; 0 0 1 0; 0 0 0 1;-39.24 -5.69 -18 -.5];CAoAb=[0;0;0;1];CAoAc=[-87.31 7.55 -9.95 -.1];% convert to Controller Type companion Form for% Speed ChangeCSCa =[0 1 0 0; 0 0 1 0; 0 0 0 1;-39.24 -5.69 -18 -.5];CSCb =[0;0;0;1];CSCc =[-83.35 32.91 -.1 0];% convert to Controller Type companion Form for% Pitch RateCPRa =[0 1 0 0; 0 0 1 0; 0 0 0 1;-39.24 -5.69 -18 -.5];CPRb =[0;0;0;1];CPRc =[-9 -.5 -112.1 0]; % Eigenvalues of the Pitch RateEPR = eig(TPR);% Create controller using Pitch Rate

Page 13: Control Systems Lab 2

Team Final Count Down 12

EPRa = [-2.8 -2.4 -2-2i -2+2i];% Creating controller only using Pitch RateSysK = acker(CPRa,CPRb,EPRa);% Full system analyzationSYSca=(SYS.a-SYS.b*SysK);% Applying Pitch Rate controllerCTss=ss(SYSca,SYS.b,SYS.c,SYS.d);% Creating Transfer FunctionCTF=tf(CTss);F=eig(CTF); % Controlled Systems simulations% Impulse simulationfigure(4)impulse(CTF);title(['Controlled System: Impulse']);% Step simulationfigure(5)step(CTF);title(['Controlled System: Step']);% Sine wave simulationt = 0:.1:20;u = sin(t);figure(6)lsim(CTF,u,t);title(['Controlled System: Sine']);