Presentation is loading. Please wait.

Presentation is loading. Please wait.

Modeling and Simulation Dr. Mohammad Kilani

Similar presentations


Presentation on theme: "Modeling and Simulation Dr. Mohammad Kilani"— Presentation transcript:

1 Modeling and Simulation Dr. Mohammad Kilani
Class 7 State Space Modeling

2 Example First Order Systems Example from Class 2 Slides
qi

3 Introductory Example 1 The cylindrical tanks were discussed previously. The differential equations can be written in the matrix form shown. The resulting equation is a first order differential equation between the two state variables, h1 and h2. qi1 q1 q2 qi2

4 Introductory Example 1 Suppose that the system outputs we are interested in are the values of the flow rates through the pipes q1 and q2 qi1 q1 q2 qi2

5 Introductory Example 2 In the mechanical system shown, one needs to specify the values of x1 and x2, which change independently of one another to fully describe the configuration of the system. Assuming that the masses move without friction and applying Newton's second law to mass m1 and mass m2, we have Can we model this system on the form of m1 m2 x1 x2 k2 k1 k3

6 Introductory Example 2 Applying Newton's second law to mass m1 and mass m2, Define the following variables Then we have the following equations for the state variables x1, x2, x3, x4 m1 m2 x1 x2 k2 k1 k3 f1 f2

7 Introductory Example 2 m1 m2 x1 x2 k2 k1 k3 f1 f2

8 State and State Variables
qi1 q1 q2 qi2 The state of a dynamic system is the smallest set of variables (called state variables) such that knowledge of these variables at t = to, together with knowledge of the input for t ≥ to, completely determines the behavior of the system for any time t ≥ to. Thus, the state of a dynamic system at time t is uniquely determined by the state at time to and the input t ≥ to and is independent of the state and input before to. In dealing with linear time-invariant systems, we usually choose the reference time to to be zero. m1 m2 x1 x2 k2 k1 k3 f1 f2

9 State and State Variables
qi1 q1 q2 qi2 The state variables of a dynamic system are the variables making up the smallest set of variables that determines the state of the dynamic system. If at least n variables x1 x2, …, xn are needed to completely describe the behavior of a dynamic system (so that, once the input is given for t ≥ to and the initial state at t = to is specified, the future state of the system is completely determined), then those n variables are a set of state variables. It is important to note that variables that do not represent physical quantities can also be chosen as state variables. m1 m2 x1 x2 k2 k1 k3 f1 f2

10 State Vector and State Space
qi1 q1 q2 qi2 If n state variables are needed to completely describe the behavior of a given system, then those state variables can be considered the n components of a vector x called a state vector. A state vector is thus a vector that uniquely determines the system state x(t) for any time t ≥ to , once the state at t = to is given and the input u(t) for t ≥ to is specified. The n-dimensional space whose coordinate axes consist of the x1-axis, x2-raxis, ... , xn-axis is called a state space. Any state can be represented by a vector (a point) in the state space. m1 m2 x1 x2 k2 k1 k3 f1 f2

11 State Space Equations In state-space analysis, we are concerned with three types of variables that are involved in the modeling of dynamic systems: input variables, output variables, and state variables. The state-space representation for a given system is not unique, except that the number of state variables is the same for any of the different state-space representations of the same system. If a system is linear and time invariant and if it is described by n state variables, r input variables, and m output variables, then the state equation will have the form and the output equation will have the form

12 State Space Equations If we use vector-matrix expressions, these equations can be written as where

13 State Space Equations Matrices A, B, C, and D are called the state matrix, input matrix, output matrix, and direct transmission matrix, respectively. Vectors x, u, and y are the state vector, input vector, and output vector, respectively. The elements of the state vector are the state variables. The elements of the input vector u are the input variables. (If the system involves only one input variable, then u is a scalar.) The elements of the output vector y are the output variables. (The system may involve one or more output variables.)

14 State Space Equations A block diagram representation of the state and output equations is shown. (In the figure, double-line arrows are used to indicate that the signals are vector quantities.) In a state-space representation, a system is represented by a state equation and an output equation. The system is described by a first-order vector-matrix differential equation. The state-space representation utilizes a mathematical representation that is different from the transfer function representation, in which the dynamics of the system are described by the input and the output, but the internal structure is put in a black box.

15 Example In the system shown, the displacement y of the mass is the output, and the external force u is the input. The displacement y is measured from the equilibrium position in the absence of the external force. Obtain a state-space representation of the system.

16 Example In the system shown, the displacement y of the mass is the output, and the external force u is the input. The displacement y is measured from the equilibrium position in the absence of the external force. Obtain a state-space representation of the system. Since y(0),dy/dt(0), and u(t) ≥ 0 completely determine the system behavior for t ≥ 0, we choose y(t) and dy/dt(t) as state variables

17 Step Response from State Space Representation using Matlab
Matlab provides the function ss , which define the system based on the state matrix, A, input matrix, B, output matrix C, and direct transmission matrix D. sys = ss(A,B,C,D) If the matrices are known, the system response for a unit-step input may be obtained using the MATLAB command step(sys) or step(A,B,C,D) These commands will generate plots of unit-step responses. The time vector is automatically determined when t is not explicitly included in the step commands.

18 Step Response from State Space Representation using Matlab
When step commands have left-hand arguments, no plot is shown on the screen. Hence, it is necessary to use a plot command to see the response curves. Consider the following examples y = step(sys,t), [y,t,x] = step(sys,t), [y,x,t] = step(A,B,C,D,iu), [y,x,t) = step(A,B,C,D,iu,t) the matrices y and x contain the output and state response of the system, respectively, evaluated at the computation time points t. (Matrix y has as many columns as outputs and one row for each element in t. Matrix x has as many columns as states and one row for each element in t.)

19 Example 3 Use MATLAB step command on state-space matrices to determine the step response of the system of the previous example with k = 6, m = 2 and b = 4. Note that the results of the previous example were as follows:

20 Example 3: MATLAB Solution using State Space Matrices
Use MATLAB step command on state-space matrices to determine the step response of the system of the previous example with k = 6, m = 2 and b = 4. >> A=[0 1;-3 -2] >> B=[0;0.5] >> C=[1 0] >> D=0 >> step(A,B,C,D)

21 Example 3: MATLAB Solution using Transfer Functions
Use MATLAB step command on the transfer function to determine the step response of the system of the previous example with k = 6, m = 2 and b = 4. >> num=1 >> den=[2 4 6] >> step(num,den)

22 Example 3 Solution Verification using 2nd Order System Step Response Curves
Verify the solution of the previous example by comparing MATLAB curves with the standard step response curves

23 Analytical Solution of the Homogeneous State Equations
Consider the solution of the scalar differential equation In solving this equation, we assume a solution of the form: Substituting the assumed solution into the differential equation we obtain The general solution is thus Satisfying the initial condition requires that C=x0 , or For an n×n diagonal matrix Λ, note the following definitions:

24 Analytical Solution of the Homogeneous State Equations
Consider the solution of the scalar differential equation In solving this equation, we assume a solution of the form: Substituting the assumed solution into the differential equation we obtain The general solution is thus Satisfying the initial condition requires that bC=x0 , or b-1bC=b-1x0 or C=b-1x0. Setting C = x0 and b b = 1, we obtain Consider the solution of the the vector-matrix differential equation By analogy, assume a solution of the form: Substituting the assumed solution into the differential equation we obtain The general solution is thus Satisfying the initial condition requires that

25 Example To determine the eigenvectors b1 and b2 we utilize the relationship For λ = λ1 = -4 we have And for λ = λ2 = 1 we have We thus have Consider the system

26 Analytical Solution of the Homogeneous State Equations
Consider the solution of the scalar differential equation In solving this equation, we may assume a solution of the form: Substituting the assumed solution into the differential equation we obtain If the assumed solution is the true solution, the equation above must hold for any t. Hence, equating the coefficients of equal powers of t, we find that the solution can be thus written as

27 Analytical Solution of the Homogeneous State Equations
Consider the solution of the vector-matrix differential equation By analogy, assume a solution of the form: Substituting the assumed solution into the differential equation we obtain If the assumed solution is the true solution, the equation above must hold for any t. Hence, equating the coefficients of equal powers of t, we find that the solution can be thus written as

28 Matrix Exponential: Differentiation Formula
It can be proved that the matrix exponential of an n × n matrix A converges absolutely for all finite t. (Hence, computer calculation for evaluating the elements of eAt by using the series expansion can easily be carried out.) The series can be differentiated term by term to obtain

29 Matrix Exponential: Exponent Sum Formulas
It can be proved that [Refer to Ogata System Dynamics, page 402].

30 Laplace Transform Approach to the Solution of the State-Space Equation
Consider the solution of the scalar differential equation The Laplace Transform solution to the equation is: Consider the solution of the vector-matrix differential equation The solution of to the homogeneous sate equation can found as: Noting that The solution is thus

31 State Transition Matrix
We can write the solution of the homogeneous state equation as where Ф(t) is an n × n matrix and is the unique solution of To verify this note that The solution for Ф(t) is obtained from the results of the previous slide as: The solution of the state equation is simply a transformation of the initial condition. Hence, the unique matrix Ф(t) = eAt is called the state transition matrix, and it contains all the information about the free motions of the system. Note that

32 Example Obtain the state-transition matrix Ф(t) and its inverse Ф-1(t) of the following system

33 Example Obtain the state-transition matrix Ф(t) and its inverse Ф-1(t) of the system For this system The state transition matrix is given by Since Hence Noting that Ф-1(t) = Ф(-t), the inverse of Ф(t) is given by


Download ppt "Modeling and Simulation Dr. Mohammad Kilani"

Similar presentations


Ads by Google