0% found this document useful (0 votes)
12 views32 pages

Chapter 1

The document outlines a course on Modeling and Simulation, covering mathematical modeling of dynamic systems, mechanical and electrical systems, fluid and thermal systems, and simulation techniques. It discusses the definitions and representations of dynamic systems, including linear and nonlinear systems, transfer functions, block diagrams, and state-space representations. Additionally, it addresses the importance of linearization for analyzing nonlinear systems and provides examples and methodologies for modeling various dynamic systems.

Uploaded by

hanahelbatal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views32 pages

Chapter 1

The document outlines a course on Modeling and Simulation, covering mathematical modeling of dynamic systems, mechanical and electrical systems, fluid and thermal systems, and simulation techniques. It discusses the definitions and representations of dynamic systems, including linear and nonlinear systems, transfer functions, block diagrams, and state-space representations. Additionally, it addresses the importance of linearization for analyzing nonlinear systems and provides examples and methodologies for modeling various dynamic systems.

Uploaded by

hanahelbatal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 32

Modeling and Simulation

ME405
Lectures by
Dr. Magdy Roman
Topics to be covered…
Chapter 1 Mathematical Modeling of Dynamic Systems
Chapter 2 Modeling of Mechanical Systems
Chapter 3 Modeling of Electrical Systems
Chapter 4 Modeling of Fluid and Thermal Systems
Chapter 5 Simulation of Dynamic Systems
Chapter 1
Mathematical Modeling of Dynamic
Systems
This chapter provides the student with an overview of different types of mathematical
modeling of dynamic systems.
2.1 Introduction
A mathematical model of a dynamic system is defined as a set of equations that
represents the dynamics of the system accurately, or at least fairly well.
Note that:
• A mathematical model is not unique to a given system. A system may be
represented in many different ways and, therefore, may have many mathematical
models, depending on one’s perspective.
• The dynamics of many systems, whether they are mechanical, electrical, thermal,
economic, biological, and so on, may be described in terms of differential
equations. Such differential equations may be obtained by using physical laws
governing a particular system—for example, Newton’s laws for mechanical systems
and Kirchhoff’s laws for electrical systems.
In general, consider a linear system whose output is y(t) and input is x(t) and contains
coefficients of values a, b, c, ….,z. If the dynamics of the system produce a first-order
differential equation, it would be represented as
System
variables
dy
a + b y( t ) = c x ( t )
System dt
coefficients
If the dynamics of the system produce a second-order differential equation, it would
be represented as 2
d y dy
a 2
+ b + c y( t ) = e x ( t )
dt dt
If the dynamics of the system produce a third-order differential equation, its
representation would be
d3y d2y dy
a 3 +b 2 +c + e y( t ) = f x ( t )
dt dt dt
2.1.1 Linear versus nonlinear system
The systems described by the above equations are called linear systems because they
have a linear relationship between the input and the output. Nonlinear equation
those which contain nonlinear function in their differential equations such as,

d2y dy
a 2 + b + c y( t ) 2 = e x ( t )
dt dt
or
d2y dy
a 2 + b + c y( t ) = e cos(x ( t ))
dt dt
or
d2y dy
a 2 + b x ( t ) + c y( t ) = e x ( t )
dt dt
A system is called linear if it obeys the principle of superposition. The principle of
superposition states that,
“the response produced by the simultaneous application of two different inputs is
the sum of the two individual responses”.
Hence, for the linear system, the response to several inputs can be calculated by
treating one input at a time and adding the results.

Figure 2-1 Principle of superposition


2.1.2 Linear Time-Invariant Systems and Linear Time-Varying Systems
Linear systems that are represented by differential equations whose coefficients are
constants are called linear time-invariant (LTI) systems. On the other side, Linear
systems whose coefficients are functions of time are called linear time-varying
systems. An example of a time-varying system is an aircraft whose mass is
continuously changing due to fuel consumption.
2.1.3 Simplicity versus accuracy
In obtaining a mathematical model, we must make a compromise between
having a simple model or accurate but more complex model. This is done by ignoring
certain inherent physical properties of the system (for ex. Nonlinearities).
Note that:
• We must be well aware that a simple linear model, which gives good result in low-
frequency operations, may not be valid at sufficiently high frequencies. For example,
the mass of a spring may be neglected in low frequency operations, but it becomes an
important property of the system at high frequencies.

2.2 Common Standard Models for Dynamic Systems


There are three common standard methods of representing dynamic system
model:
• Transfer function
• Block diagram
• State-space representation
2.2.1 Transfer functions
The transfer function of a linear, time-invariant, differential equation system is
defined as the ratio of the Laplace transform of the output to the Laplace transform
of the input under the assumption that all initial conditions are zero.
Consider the linear time-invariant system defined by the following differential
equation:

where y is the output of the system and x is the input. Note that for all causal systems
(proper transfer function) n>=m. A causal system is the system that its output
depends on the present and past values of the input (not future values). Classically,
nature or physical reality has been considered to be a causal system.
The transfer function of this system is

By using the concept of transfer function, it is possible to represent system dynamics


by algebraic equations in s.
Example 2.1
Find the transfer function of a system that is described by the following differential
equation: 2
d y dy dx
5 2
+ 7 + 3 y ( t ) = 10 + 4 x(t)
Solution dt dt dt
Taking the Laplace transform for both sides of the equation,
5 s 2 Y(s) + 7 s Y(s) + 3 Y(s) = 10 s X(s) + 4 X(s)
(5 s 2 + 7 s + 3)Y(s) = (10 s + 4)X(s)
then,
Y(s) 10 s + 4
G (s) = = 2
Example 2.2 X(s) 5 s + 7 s + 3

Find the transfer function of a PID controller that has the following control law,

Solution
Taking the Laplace transform for both sides of the equation,
Kp 1
U(s) = K p E (s) + E (s) + K p Td s E (s)
Ti s
U (s) 1
= K p (1 + + Td s)
E (s) Ti s
2.2.2 Block diagram
A block diagram of a system is a pictorial representation of the functions performed
by each component and of the flow of signals.
In a block diagram each system component
is represented by a block which has input
signal and output signal. The transfer Input X(s) Transfer Output Y(s)
functions of the components are usually Function
entered in the corresponding blocks, G(s)
which are connected by arrows to indicate
the direction of the flow of signals. Every Figure 2-2 Block representation
block output is equal to the block transfer
function multiplied by the input signal,
that is Y(s) = G(s) . X(s)
The block diagram model has the following advantages:
• it depicts the interrelationships that exist among the various components.
• it is easy to form the overall block diagram for the entire system by merely
connecting the blocks of the components according to the signal flow.
• it is possible to evaluate the contribution of each component to the overall
performance of the system.
• the functional operation of the system can be visualized more readily by examining
the block diagram than by examining the physical system itself.
▪ Summing Point is a circle with a cross indicating a
summing or subtraction operation. It is important that
the quantities being added or subtracted have the same
dimensions and the same units.

▪ Branch Point is a branch point from which the signal


from a block goes concurrently to other blocks or
summing points.

2.2.2.1 Block diagram and transfer function of closed-loop system


Figure 2-3 shows an example of a block diagram of a closed-loop system.
The output C(s) and input R(s) are
related as follows: since

Figure 2-3 Closed-loop system


2.2.2.2 Block diagram manipulation
In system analysis, we frequently need to calculate the equivalent block and transfer
function of cascaded and parallel connected systems.


(a)

(b)
Figure 2-4 (a) Cascaded (b) Parallel systems

A complicated block diagram involving many feedback loops can be simplified by a


step-by-step rearrangement. Simplification of the block diagram by rearrangements
considerably reduces the labor needed for subsequent mathematical analysis. This can
be undertaken using the block diagram transformation theorems. Table 2-1
summarizes these theorems.
Table 2-1 Block diagram transformation theorems
Example 2.3
Consider the system shown in Figure 2-5. Simplify this diagram.

Figure 2-5 Multiple-loop system

Solution
2.2.2.3 Block diagram of multi-input system
When two inputs are present
in a linear time-invariant
system the superposition
principle is used. Each input
can be treated independently
of the other, and the outputs
corresponding to each input
alone can be added to give the
complete output. Figure 2-6 Multi-input system
Consider the system shown in Figure 2-6. First we consider the disturbance D(s) only
and assume that the reference input R(s) is zero. We then calculate the response CD(s)
to the disturbance only. This response can be found from
Now we consider the reference input R(s) and assume that the disturbance is zero.
Then the response CR(s) to the reference input R(s) can be obtained from

The response to the simultaneous application of the reference input and disturbance
can be obtained by adding the two individual responses.
2.2.3 State-space representation
A state-space representation is a mathematical model of a physical system as a set of
input, output and state variables related by first-order differential equations.
The state-space representation can be used in modeling linear or nonlinear, time
invariant or time varying, single or multi input/output systems.

State variables: The state variables of a dynamic system are the smallest set of
variables such that knowledge of these variables at t=t0 , together with knowledge of
the input variable for t ≥ t0 , completely determines the behavior of the system for any
time t ≥ t0.

The minimum number of state variables of a system is equal to the system order

For a system of order n the state vector is

Note that: The state variables can be chosen


in so many different ways so that the state-
space representation is not unique.
State-Space Equations: A set of n simultaneous, first-order differential equations with
n variables, where the n variables to be solved are the state variables.

u1(t) y1(t)
x1(t)
u2(t) y2(t)
x1(t)
. .
. . .
. . .
. Figure 2-7 MIMO system
ur(t) ym(t)
xn(t)

Assume a time-varying, nonlinear, multi-input, multi-output system of order n.


Assume also that there are r inputs u1(t), u2(t), …. , ur(t) and m outputs y1(t), y2(t), … ,
ym(t). We define n state variables x1(t), x2(t), …. , xn(t), the state space representation
is given by:
State variables Input variables

State equations
State variables Input variables

Output equations

The above form is the general form. For linear multi-input, multi-output, time-invariant
system the state-space representation becomes in the form

where,

A is called the state matrix,


B the input matrix,
C the output matrix,
D the direct transmission
matrix State Input Output
vector vector vector
Steps for representing a dynamic system in state-space
Step 1:
Determine the order of the system.
Step 2:
Define a number of state variables equal to the system order (must be independent and
not include the input).
Step 3:
Write the first-order time derivatives of the state variables.
Step 4:
Substitute in the first-order time derivatives equation for the sate variables.
Example 2.4
Determine the state-variable equations for the system modeled by the following
ODEs, where z and w are the dynamic variables and v is the input.
Solution
The first step is to determine the order of the system. The first equation is a second-
order nonlinear ODE in dynamic variables z and w, while the second equation is a first-
order nonlinear ODE in dynamic variables w and z and input v. Hence the complete
system is third order, and we need three state variables.

We define the state variables

, ,

And the single input

we write the three first-order time derivatives of the three state variables

Because we want all three right-hand sides of the above equations to be functions of
the states xi , and input u, we substitute , , and .
Example 2.5

Obtain a complete state-space representation in the matrix form for a DC motor


governed by the following equation

where, θ is the rotation angle, I is the current, ein is the input voltage, TL is the load
torque, L , R, Kb, Km, and J are the motor constants. Consider the input variables are ein
and TL. Consider also the output to be the rotation angle θ.
Solution
The first equation is a first-order linear ODE, and the second is a second-order linear
ODE. Consequently, the system is third order 3 and the system requires three state
variables.
We select

and inputs

Next, we write the three first-order state equations by taking a time derivative of each
state variable,

Substituting by the state and input variables, we get


Defining state and vector vectors as

we get

For the output

or

the above system can be written as


where

A B

C D

Example 2.6
Consider a SISO mechanical system that has the following differential equation

Where m, b, and k are the system coefficients, u is the input and y is the output. Find
the state-space representation of the system in the matrix form, then sketch the
system block diagram.
Solution
The system is of the second order, so we choose two state variables.
By differentiating we get

or

state equations

output equation

If , then the previous equations can be written in the matrix form as,
The system can be written in the standard form as,

To draw the block diagram we bring back the state and output equations
2.3 Linearization
Most real-world dynamic systems are nonlinear; that is, they are modeled by
nonlinear differential equations. There is no general, unifying theory for obtaining the
solution of a nonlinear system, and in most cases we must rely on numerical
integration schemes to obtain the system response. On the other hand, a wealth of
analysis tools exists for obtaining the solution of a linear system, design techniques
that can be applied only to linear system dynamics. Therefore, it is desirable to have a
linear system model for analysis and design purposes.
Linearization is a method for converting a nonlinear equation (or model) into a linear
model. Linearization relies on a Taylor series expansion about a nominal (or
reference) operating point, where only the first-order terms are retained. Because
second- and higher-order terms are neglected in the Taylor-series expansion for small
deviation from the nominal point. The resulting linear model is accurate only if the
system's state does not deviate too far from the nominal operating point.
Linearization relies on the Taylor series expansion as described below. Suppose we
have a nonlinear system with one state variable x, and one input variable u,

The nominal input u* (which is likely given in the problem) results in the nominal state
variables x*, which is the nominal operating point.

x* = f (x*, u* )
If x* has changed to δx+ x* and u* has changed to δu + u* system becomes,

Applying Taylor expansion on the right-hand side we get,

The first term in the right-hand side f(x*, u*) equals x , which cancel out with x on the
* *

left. Eliminating all Taylor-series terms higher than first-order yields

The above equation is the linearized model of the nonlinear system. It should be
noted that all partial derivatives are evaluated at the nominal state and input, x* and
u*, respectively.
It is important to note that the linear model is in terms of the perturbation variables
δx and δu. Therefore, the solution of the linearized model yields δx(t), which is the
time history of the state deviation from the operating point x*. If we want to estimate
the state history from the linear solution, we use x(t) = δx(t) + x*.
Example 2.7
Derive the linear model of the following nonlinear state-variable equation. Perform
the linearization about the static equilibrium state x* that results from the nominal
input u* = 2.

Solution
The first step is to obtain the nominal state x* given the nominal input u* = 2. Here
the nominal point is at static equilibrium. At static equilibrium,

solving for x* with 0 and u = u* = 2 yields

We can use MATLAB's roots command to obtain the three roots

The three roots include one real root (x = 0.2949), and two complex conjugate roots (x
= -0.1474 ±j2.2506; Because the equilibrium state must be a real number, the nominal
state is x* = 0.2949.
Then we write the linearized equation

Second we evaluate the partial derivatives at the nominal state x* and nominal input u*,

Finally, substituting the numerical values of the two partial derivatives into the
linearized model

This equation is the linearized version of the original nonlinear equation, where the
linearization has been performed about the nominal state x* = 0.2949. This value is
the equilibrium state for the nominal input u* = 2. Note that the linearized equation is
written in terms of the perturbation variables δx and δu. After getting the solution for
δx(t) if we wish to estimate x, we must add the perturbation variable to the nominal
state. x(t) = x* + δx(t).

You might also like