19
President University Erwin Sitompul SMI 6/1 Lecture 6 System Modeling and Identification Dr.-Ing. Erwin Sitompul President University http://zitompul.wordpress.com 2 0 1 2

Homework 5

  • Upload
    verda

  • View
    22

  • Download
    0

Embed Size (px)

DESCRIPTION

Chapter 3. State Space Process Models. Homework 5. A linear time-invariant system is given as below:. Calculate the eigenvalues and the eigenvectors of the system. - PowerPoint PPT Presentation

Citation preview

Page 1: Homework 5

President University Erwin Sitompul SMI 6/1

Lecture 6

System Modeling and Identification

Dr.-Ing. Erwin SitompulPresident University

http://zitompul.wordpress.com

2 0 1 2

Page 2: Homework 5

President University Erwin Sitompul SMI 6/2

Chapter 3 State Space Process Models

Homework 5A linear time-invariant system is given as below:

3 1 0 1

( ) 1 3 0 ( ) 0 ( )

3 5 6 4,5

t t u t

x x

0 1 0( ) ( )

0 0 1t t

y x

a) Calculate the eigenvalues and the eigenvectors of the system.b) A second order model is now wished to approximate the system.

The second and the third state are chosen to be the significant states. Perform the Order Reduction based on the chosen significant states. Regarding the Dominance Measure, which eigenvalues of the original model should be considered in the new reduced-order model?

c) Write the complete reduced-order model in state space form. Hint: This model must be a second order model.

Page 3: Homework 5

President University Erwin Sitompul SMI 6/3

Chapter 3 State Space Process Models

Solution to Homework 5det( ) 0 A I

3 1 0

det 1 3 0

3 5 6

( 3 )( 3 )( 6 ) ( 6 )

1 4

2 2

3 6

2( 6 8)( 6 )

( 4)( 2)( 6 )

Page 4: Homework 5

President University Erwin Sitompul SMI 6/4

Chapter 3

11( ) 0 A I e

11

21

31

1 1 0

1 1 0

3 5 2

e

e

e

0 1

1

1

1

e

22( ) 0 A I e

12

22

32

1 1 0

1 1 0

3 5 4

e

e

e

0 2

1

1

2

e

33( ) 0 A I e

13

23

33

3 1 0

1 3 0

3 5 0

e

e

e

0 3

0

0

1

e

1

2

3

0 0

0 0

0 0

Λ

4 0 0

0 2 0

0 0 6

1 2 3T e e e

1 1 0

1 1 0

1 2 1

State Space Process Models

Solution to Homework 5

Page 5: Homework 5

President University Erwin Sitompul SMI 6/5

Chapter 3

The equivalence transformation is done, with x = T z.

1

0.5 0.5 0

0.5 0.5 0

0.5 1.5 1

T

1

4 0 0

0 2 0

0 0 6

Λ T AT

1*

0.5

,0.5

5

B T B* 1 1 0

1 2 1

C CT

1 1 0

1 1 0

1 2 1

T

As the result, we obtain a state space in canonical form,

4 0 0 0.5

( ) ( ) ( )0 2 0 0.5

0 0 6 5

t t u t

z z

1 1 0( ) ( )

1 2 1t t

y z

State Space Process Models

Solution to Homework 5

Page 6: Homework 5

President University Erwin Sitompul SMI 6/6

1

4 0 0

0 2 0

0 0 6

Λ T AT

* 1

0.5

0.5

5

B T B

* 1 1 0

1 2 1

C CT

n=3 k=[1…n]

m=1 j=[1…m]

r=2 i=[1…r]

* *11 11

1111

c bD

* *12 21

1212

c bD

( 1)( 0.5)

( 4)

0.125

( 1)(0.5)

( 2)

0.25

* *13 31

1313

c bD

(0)( 5)

( 6)

0

* *21 11

2111

c bD

(1)( 0.5)

( 4)

0.125

* *22 21

2212

c bD

(2)(0.5)

( 2)

0.5

* *23 31

2313

c bD

(1)( 5)

( 6)

0.833

Chapter 3 State Space Process Models

Solution to Homework 5

Page 7: Homework 5

President University Erwin Sitompul SMI 6/7

1 111100M D 12.5

2 221100M D 50

3 231100M D 83.3

• Dominant

• Dominant

Chapter 3 State Space Process Models

Solution to Homework 5

1 1

2 2

3 3

1 1 0

1 1 0

1 2 1

x z

x z

x z

2 2

3 3

1 1

1 0 1

2 1 1

1 0 1

x z

x z

x z

11T

2 0 0

0 6 0

0 0 4

Λ

*

0.5

5

0.5

B

* 1 0 1

2 1 1

C

*1B

*1C

Page 8: Homework 5

President University Erwin Sitompul SMI 6/8

111 d 11

A T Λ T

1 0 2 0 1 0

2 1 0 6 2 1

2 0

8 6

*11 1B T B

1 0 0.5

2 1 5

0.5

4

* 1111C C T

1 0 1 0

2 1 2 1

1 0

0 1

s s

2 0 0.5

8 6 4u

x x

s

1 0

0 1

y x

Chapter 3 State Space Process Models

Solution to Homework 5

Page 9: Homework 5

President University Erwin Sitompul SMI 6/9

Chapter 4

Dynamical Behavior of Processes

System Modeling and Identification

Page 10: Homework 5

President University Erwin Sitompul SMI 6/10

Chapter 4 Dynamical Behavior of Processes

System Representation Using s-Function We already know that in Matlab-Simulink we can construct a

mathematical model by using the available components in the Simulink library.

By using an s-Function, it is also possible to compose a model by directly using the mathematical equations of the model.

The s-Function is written according to a certain form that must be followed, so that the function can be executed.

The mathematical model can be written in differential or difference equation, making it possible to implement s-Function in both continuous and discrete systems.

To find the component shown above, in Matlab-Simulink, go to “User Defined Function”, and drag the suitable component.

Page 11: Homework 5

President University Erwin Sitompul SMI 6/11

Chapter 4 Dynamical Behavior of Processes

System Representation Using s-Function In Matlab workspace, type “edit sfuntmpl” to open the template

of s-Function.

Page 12: Homework 5

President University Erwin Sitompul SMI 6/12

Chapter 4 Dynamical Behavior of Processes

System Representation Using s-Functionfunction [sys,x0,str,ts] = model_name(t,x,u,flag); % SFUNTMPL General S-function template

switch flag,case 0, [sys,x0,str,ts]=mdlInitializeSizes; % Assignment of Sizes and Initial Conditions

case 1, sys=mdlDerivatives(t,x,u); % Return the derivatives of the states case 3, sys=mdlOutputs(t,x,u); % Return the outputsend

function [sys,x0,str,ts]=mdlInitializeSizes; % Assignment of Sizes and Initial Conditions sizes = simsizes; sizes.NumContStates = 2; sizes.NumDiscStates = 0; sizes.NumOutputs = 1; sizes.NumInputs = 3; sizes.DirFeedthrough = 0; sizes.NumSampleTimes = 1; sys = simsizes(sizes); x0 = zeros(2,1); % Assignment of Initial conditions str = []; % Leave unchanged ts = [0 0]; % Leave unchanged

function sys=mdlDerivatives(t,x,u); % Return the derivatives of the states c = 5.0; % Definition of constants d = 0.25; sys(1) = 4*u(1) - c*x(1); % First state equation sys(2) = u(2) + u(3)/x(2) + d*x(1); % Second state equation

function sys=mdlOutputs(t,x,u); % Return the outputs sys = x(2); % The output is the second state

Page 13: Homework 5

President University Erwin Sitompul SMI 6/13

The highlighted parts are the main frame of an s-function. The file itself can be written in Matlab m-file editor or in a Notepad,

and saved with a unique name, for example conic_tank.m. The same name must be inserted in the Simulink window, after

clicking the s-Function box.

Chapter 4 Dynamical Behavior of Processes

System Representation Using s-Function

The flag assignments are fixed and given by Matlab. Each flag will be called sequentially as Matlab process the simulation.

case 0, [sys,x0,str,ts]=mdlInitializeSizes; "Assignment of Sizes and Initial Conditions"

case 1, sys=mdlDerivatives(t,x,u); "Return the derivatives of the states"

case 3, sys=mdlOutputs(t,x,u); "Return the outputs"

In each section, specific variables assigned in the name of sys will be returned. For example, in section with abs(flag) == 1, sys(1) is the derivative of the states x(1). In section with abs(flag) == 3, sys(1) is the first output.

Page 14: Homework 5

President University Erwin Sitompul SMI 6/14

Type “edit” in Matlab workspace to open the m-file editor. Copy and paste the s-Function template as given on the previous

slide to the m-file. Edit the m-file, give distinctive name, and save it in your active

folder (the folder where you normally save your Matlab-Simulink file).

This time, you need to include the active folder in the path by clicking File>>Set Path in Matlab workspace so that Matlab can access your m-file properly.

You can also use Notepad to edit the m-File, but do not forget to save with the extension .m.

Chapter 4 Dynamical Behavior of Processes

Some Hints in Writing s-Function

Page 15: Homework 5

President University Erwin Sitompul SMI 6/15

v1

The single-tank system which is already familiar for us consists of one differential equation:

s-Function of Single-Tank System

qi

qo

V hi 1 2q adh

ghdt A A

Chapter 4 Dynamical Behavior of Processes

Page 16: Homework 5

President University Erwin Sitompul SMI 6/16

s-Function of Single-Tank SystemChapter 4 Dynamical Behavior of Processes

Page 17: Homework 5

President University Erwin Sitompul SMI 6/17

s-Function of Single-Tank SystemChapter 4 Dynamical Behavior of Processes

Direct Comparison Between Component Model and

s-Function Model

Page 18: Homework 5

President University Erwin Sitompul SMI 6/18

Homework 6Chapter 4 Dynamical Behavior of Processes

Construct an s-Function model of the interacting tank-in-series system and compare its simulation result with the simulation result of the component model from Homework 2.

For the tanks, use the same parameters as in Homework 2. The required initial conditions are: h1,0 = 20 cm, h2,0 = 40 cm.

v1

qi

h1 h2

v2

q1

a1 a2

qo

Deadline: The lecture session following the mid-term examination.

Send the softcopy and submit the hardcopy on time.

Page 19: Homework 5

President University Erwin Sitompul SMI 6/19

Homework 6 (New)Chapter 4 Dynamical Behavior of Processes

Construct an s-Function model of the triangular-prism-shaped tank system and compare its simulation result with the simulation result of the component model from Homework 2 (New).

For the tanks, use the same parameters as in Homework 2 (New).

NEW

v

qi1

qo

a

qi2

hmax

h

Deadline: The lecture session following the mid-term examination.

Send the softcopy and submit the hardcopy on time.