System Modeling
System Modeling
System Modeling
SYSTEM
1. Modeling
a. System Modeling
The first step in the control design process is to develop appropriate
mathematical models of the system to be controlled. These models may be
derived either from physical laws or experimental data. In this section, we
introduce the state-space and transfer function representations of dynamic
systems. We then review some basic approaches to modeling mechanical
and electrical systems and show how to generate these models in
MATLAB for further analysis.
b. Dynamic Systems
Dynamic systems are systems that change or evolve in time according
to a fixed rule. For many physical systems, this rule can be stated as a set
of first-order differential equations:
(1)
In the above equation, is the state vector, a set of variables
representing the configuration of the system at time . For instance, in a
simple mechanical mass-spring-damper system, the two state variables
could be the position and velocity of the mass. is the vector of
external inputs to the system at time , and is a (possibly nonlinear)
function producing the time derivative (rate of change) of the state
vector, , for a particular instant of time.
The state at any future time, , may be determined exactly given
knowledge of the initial state, , and the time history of the inputs,
, between and by integrating Equation (1). Though the state variables
themselves are not unique, there is a minimum number of state
variables, , required in order to capture the "state" of a given system and
to be able to predict the system's future behavior (solve the state
equations). is referred to as the system order and determines the
dimensionality of the state-space. The system order usually corresponds
to the number of independent energy storage elements in the system.
The relationship given in Equation (1) is very general and can be used
to describe a wide variety of different systems; unfortunately, it may be
very difficult to analyze. There are two common simplifications which
make the problem more tractable. First, if the function does not depend
explicitly on time, i.e. , then the system is said to be time
invariant. This is often a very reasonable assumption because the
underlying physical laws themselves do not typically depend on time. For
time-invariant systems, the parameters or coefficients of the function are
constant. The state variables, , and control inputs, , however, may
still be time dependent.
The second common assumption concerns the linearity of the system.
In reality, nearly every physical system is nonlinear. In other words, is
typically some complicated function of the state and inputs. These
nonlinearities arise in many different ways, one of the most common in
control systems being "saturation" in which an element of the system
reaches a hard physical limit to its operation. Fortunately, over a
sufficiently small operating range (think tangent line near a curve), the
dynamics of most systems are approximately linear. In this case, the
system of first-order differential equations can be represented as a matrix
equation, that is, .
Until the advent of digital computers (and to a large extent thereafter),
it was only practical to analyze linear time-invariant (LTI) systems.
Consequently, most of the results of control theory are based on these
assumptions. Fortunately, as we shall see, these results have proven to be
remarkably effective and many significant engineering challenges have
been solved using LTI techniques. In fact, the true power of feedback
control systems are that they work (are robust) in the presence of the
unavoidable modeling uncertainty.
(4)
where the parameter is a complex frequency variable. It is very
rare in practice that you will have to directly evaluate a Laplace transform
(though you should certainly know how to). It is much more common to
look up the transform of a time function in a table such as the one found
here: Laplace Transform Table
The Laplace transform of the nth derivative of a function is particularly
important:
(5)
(6)
(7)
e.
where and are the Laplace Transforms of and ,
respectively. Note that when finding transfer functions, we always assume
that the each of the initial conditions, , , , etc. is zero. The
transfer function from input to output is, therefore:
f. (8)
It is useful to factor the numerator and denominator of the transfer
function into what is termed zero-pole-gain form:
g. (9)
The zeros of the transfer function, , are the roots of the
numerator polynomial, i.e. the values of such that . The poles of
the transfer function, , are the roots of the denominator
polynomial, i.e. the values of such that . Both the zeros and
poles may be complex valued (have both real and imaginary parts). The
system Gain is .
Note that we can also determine the transfer function directly from the
state-space representation as follows:
(10)
h. Mechanical Systems
Newton's laws of motion form the basis for analyzing mechanical
systems. Newton’s second law, Equation (11), states that the sum of the
forces acting on a body equals the product of its mass and
acceleration. Newton's third law, for our purposes, states that if two
bodies are in contact, then they experience the same magnitude contact
force, just acting in opposite directions.
i. (11)
When applying this equation, it is best to construct a free-body diagram
(FBD) of the sysetm showing all of the applied forces.
The free-body diagram for this system is shown below. The spring
force is proportional to the displacement of the mass, , and the viscous
damping force is proportional to the velocity of the mass, . Both
forces oppose the motion of the mass and are, therefore, shown in the
negative -direction. Note also that corresponds to the position of
the mass when the spring is unstretched.
k.
Now we proceed by summing the forces and applying Newton’s
second law, Equation (11), in each direction. In this case, there are no
forces acting in the -direction; however, in the -direction we have:
(12)
This equation, known as the governing equation, completely
characterizes the dynamic state of the system. Later, we will see how to
use this to calculate the response of the system to any external input, ,
as well as to analyze system properties such as stability and performance.
To determine the state-space representation of the mass-spring-damper
system, we must reduce the second-order governing equation to a set of
two first-order differential equations. To this end, we choose the position
and velocity as our state variables.
(13)
The position variable captures the potential energy stored in the spring,
while the velocity variable captures the kinetic energy stored by the mass.
The damper only dissipates energy, it doesn't store energy. Often when
choosing state variables it is helpful to consider what variables capture the
energy stored in the system.
The state equation in this case is:
(14)
If, for instance, we are interested in controlling the position of the
mass, then the output equation is:
(15)
m mass 1.0 kg
k spring constant 1.0 N/m
b damping constant 0.2 Ns/m
F input force 1.0 N
m = 1;
k = 1;
b = 0.2;
F = 1;
A = [0 1; -k/m -b/m];
B = [0 1/m]';
C = [1 0];
D = [0];
sys = ss(A,B,C,D)
sys =
A=
x1 x2
x1 0 1
x2 -1 -0.2
B=
u1
x1 0
x2 1
C=
x1 x2
y1 1 0
D=
u1
y1 0
The Laplace transform for this system assuming zero initial conditions
is
(16)
and, therefore, the transfer function from force input to displacement
output is
(17)
m. Entering Transfer Function Models into MATHLAB
Now we will demonstrate how to create the transfer function model
derived above within MATLAB. Enter the following commands into
the m-file in which you defined the system parameters.
s = tf('s');
sys = 1/(m*s^2+b*s+k)
sys =
---------------
s^2 + 0.2 s + 1
Note that we have used the symbolic s variable here to define our transfer
function model. We recommend using this method most of the time;
however, in some circumstances, for instance in older versions of
MATLAB or when interfacing with SIMULINK, you may need to define
the transfer function model using the numerator and denominator
polynomial coefficients directly. In these cases, use the following
commands:
num = [1];
den = [m b k];
sys = tf(num,den)
sys =
---------------
s^2 + 0.2 s + 1
Like Newton’s laws for mechanical systems, Kirchoff’s circuit laws are fundamental
analytical tools for modeling electrical systems. Kirchoff’s current law (KCL) states that
the sum of the electrical currents entering a node in a circuit must equal the sum of electrical
currents exiting the node. Kirchoff’s voltage law (KVL) states that the sum of voltage
differences around any closed loop in a circuit is zero. When applying KVL, the source
voltages are typically taken as positive and the load voltages are taken as negative.
We will now consider a simple series combination of three passive electrical elements: a
resistor, an inductor, and a capacitor, known as an RLC Circuit.
Since this circuit is a single loop, each node only has one input and one output; therefore,
application of KCL simply shows that the current is the same throughout the circuit at any
given time, . Now applying KVL around the loop and using the sign conventions indicated
in the diagram, we arrive at the following governing equation.
(18)
We note that that the governing equation for the RLC circuit has an analogous form to the
mass-spring-damper mechanical system. In particular, they are both second-order systems
where the charge (integral of current) corresponds to displacement, the inductance
corresponds to mass, the resistance corresponds to viscous damping, and the inverse
capacitance corresponds to the spring stiffness. These analogies and others like them turn out
to be quite useful conceptually in understanding the behavior of dynamical systems.
The state-space representation is found by choosing the charge on the capacitor and current
through the circuit (inductor) as the state variables.
(19)
where,
(20)
The state equation is, therefore:
(21)
We choose the current as ouput as follows:
(22)
The transfer function representation may be found by taking the Laplace transform as we did
for the mass-spring-damper or from the state-space equation as follows:
(23)
(24)
The RLC state-space and transfer function models can be entered into MATLAB using the
same procedure as discussed for the mass-spring-damper system above.
SYSTEM IDENTIFICATION
In this section, we have seen how to model systems using basic physical principles; however,
often this is not possible either because the parameters of the system are uncertain, or the
underlying processes are simply not understood. In these cases, we must rely on experimental
measurements and statistical techniques to develop a system model, a process known
as system identification.
System identification may be performed using either time-domain or frequency-domain data,
see the Introduction: System Identification page for further details. A couple of system
identification activities can also be found from the Hardware tab located at the top of this
window.
Also refer to MATLAB’s System Identification Toolbox for more information on this
subject.
SYSTEM CONVERSIONS