Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "Homework 5 A linear time-invariant system is given as below:"— Presentation transcript:

1

2 Homework 5 A linear time-invariant system is given as below:
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. 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? Write the complete reduced-order model in state space form. Hint: This model must be a second order model.

3 Chapter 3 State Space Process Models Solution to Homework 5

4 Chapter 3 State Space Process Models Solution to Homework 5

5 Chapter 3 State Space Process Models Solution to Homework 5 The equivalence transformation is done, with x = T z. As the result, we obtain a state space in canonical form,

6 Solution to Homework 5 n=3  k=[1…n] m=1  j=[1…m] r=2  i=[1…r]
Chapter 3 State Space Process Models Solution to Homework 5 n=3  k=[1…n] m=1  j=[1…m] r=2  i=[1…r]

7 Solution to Homework 5 Dominant Dominant Chapter 3
State Space Process Models Solution to Homework 5 Dominant Dominant

8 Chapter 3 State Space Process Models Solution to Homework 5

9 Dynamical Behavior of Processes
System Modeling and Identification Chapter 4 Dynamical Behavior of Processes

10 System Representation Using s-Function
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.

11 System Representation Using s-Function
Chapter 4 Dynamical Behavior of Processes System Representation Using s-Function In Matlab workspace, type “edit sfuntmpl” to open the template of s-Function.

12 System Representation Using s-Function
Chapter 4 Dynamical Behavior of Processes System Representation Using s-Function function [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 outputs end function [sys,x0,str,ts]=mdlInitializeSizes; % Assignment of Sizes and Initial Conditions sizes = simsizes; sizes.NumContStates = 2; sizes.NumDiscStates = 0; % Leave unchanged sizes.NumOutputs = 1; sizes.NumInputs = 3; sizes.DirFeedthrough = 0; % Leave unchanged sizes.NumSampleTimes = 1; % Leave unchanged 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

13 System Representation Using s-Function
Chapter 4 Dynamical Behavior of Processes System Representation Using s-Function 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. Cation: input only the name of the file without extension. 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.

14 Some Hints in Writing s-Function
Chapter 4 Dynamical Behavior of Processes Some Hints in Writing s-Function 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.

15 s-Function of Single-Tank System
Chapter 4 Dynamical Behavior of Processes s-Function of Single-Tank System The single-tank system which is already familiar for us consists of one differential equation: qi V h qo v1

16 s-Function of Single-Tank System
Chapter 4 Dynamical Behavior of Processes s-Function of Single-Tank System

17 s-Function of Single-Tank System
Chapter 4 Dynamical Behavior of Processes s-Function of Single-Tank System Direct Comparison Between Component Model and s-Function Model A parameter field will appear if the s-Function block is double-clicked Enter the name of the s-Function file that is already created. Omit the extension .m

18 s-Function of Single-Tank System
Chapter 4 Dynamical Behavior of Processes s-Function of Single-Tank System Direct Comparison Between Component Model and s-Function Model

19 Chapter 4 Dynamical Behavior of Processes Homework 6 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.

20 Homework 6A qi2 qi1 hmax h a qo v
Chapter 4 Dynamical Behavior of Processes Homework 6A 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 2A. For the tanks, use the same parameters as in Homework 2A. 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.


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

Similar presentations


Ads by Google