Islamic University Of Gaza
Faculty of Engineering
Electrical Engineering Department
Linear Control Systems
LABORATORY
Prepared By:
Eng. Adham Maher Abu Shamla
Under Supervision:
Dr. Basil Hamed
Linear Control Systems Lab EELE (3160-3161)
Page 1 of 14
Experiment #4
System Modeling by MatLab& LabView
1) Introduction:
What is a system?
In general, the system is a collection of some elements and components that can be organized to take an input and give an output according to it. An example of a system is the DC motor that consists of coils and magnets and takes voltage as input and gives a specific motion as output, so it is a system that transforms the electric energy to a mechanical energy.
What is a plant?
Typically, control engineers begin by developing a mathematical description of the dynamic system that they want to control. The system to be controlled is called a plant. As an example of a plant, this section uses the DC motor and develops the differential equations that describe the electromechanical properties of a DC motor with an inertial load and I want to design a controller to its speed so the motor is called a plant.
What is modeling?
When we go to the real practical work we only see physical devices and our job here is to deal with these physical devices and we know that all our dealing in the university was with mathematical equations, so here we want a translator of the physical devices to a mathematical presentation.
Modeling: is the translator that represents a physical device by its equivalent equations.
In modeling we need some standard physical laws that relate our variables. For example we know that relation between the voltage and current across
a resistor is directly proportional and related by Ohm's law ๐ = ๐ ๐ผ . R: is constant (resistor).
Linear Control Systems Lab EELE (3160-3161)
Page 2 of 14
2) Model Representation:
The plant of a system can be represented by:
1. Transfer Function H(s) ,for example:
2. State Space Model (SS): is a mathematical model that consist of
simultaneous, first order differential equations and an output equation
for example:
Where A, B, C, and D are matrices of appropriate dimensions, x is the
state vector, and u and y are the input and output vectors.
3. Zero-Pole-Gain Model (ZPK) ,for example:
4. Frequency Response Model.
5. Block Diagram Model.
6. Differential Equations.
3) System Modeling: DC Motor
A simple model of a DC motor driving an inertial load shows the angular rate of the load, ๐(๐), as the output and applied voltage, ๐ฃ๐๐๐(๐ก), as the input.
The ultimate goal of this example is to control the angular rate (speed) by varying the applied voltage.
Figure 4.1: a simple model of the DC motor
Linear Control Systems Lab EELE (3160-3161)
Page 3 of 14
In this model, the dynamics of the motor itself are idealized; for instance, the magnetic field is assumed to be constant.
The resistance of the circuit is denoted by R and the self-inductance of the armature by L.
The important thing here is that with this simple model and basic laws of physics, it is possible to develop differential equations that describe the behavior of this electromechanical system.
In this example, the relationships between electric potential and mechanical force are Faraday's law of induction and Ampere's law for the force on a conductor moving through a magnetic field.
Mathematical Derivation:
The torque (๐) seen at the shaft of the motor is proportional to the current ๐(๐ก) induced by the applied voltage,
Where ๐พ๐, the armature constant, is related to physical properties of the motor, such as magnetic field strength, the number of turns of wire around the conductor coil, and so on. The back (induced) electromotive force,๐ฃ๐๐๐
is a voltage proportional to the angular rate ๐(๐ก) seen at the shaft,
Where ๐พ๐, the emf constant, also depends on a certain physical properties of the motor.
So ๐น , ๐ณ, ๐ฒ๐ ๐๐๐ ๐ฒ๐ are parameters which be given by the datasheet of the motor.
The mechanical part of the motor equations is derived using Newton's law, which states that the inertial load J times the derivative of angular rate equals the sum of all the torques about the motor shaft.
The result is this equation,
๐(๐ญ) = ๐๐ฆ โ ๐ข(๐ญ) โฏ ๐๐ช๐ฎ๐๐ญ๐ข๐จ๐ง ๐
๐๐๐๐(๐ญ) = ๐๐ โ ๐(๐ญ) โฏ ๐๐ช๐ฎ๐๐ญ๐ข๐จ๐ง ๐
๐ฑ๐๐(๐ญ)
๐๐ญ= โ ๐๐ = โ๐ฒ๐ โ ๐(๐) + ๐๐ฆ โ ๐ข(๐ญ) โฏ ๐๐ช๐ฎ๐๐ญ๐ข๐จ๐ง ๐
Linear Control Systems Lab EELE (3160-3161)
Page 4 of 14
Where ๐พ๐ is a linear approximation for viscous friction (๐พ๐ from datasheet).
Finally, the electrical part of the motor equations can be described by
Or, solving for the applied voltage and substituting for the back emf,
This sequence of equations leads to a set of two differential equations that describe the behavior of the motor, the first for the induced current,
and the second for the resulting angular rate,
Now equations 6&7 are differential equations and together describe my DC Motor system.
๐๐๐๐(๐ญ) โ ๐๐๐๐(๐ญ) = ๐๐๐ข(๐ญ)
๐๐ญ+ ๐ โ ๐ข(๐ญ) โฏ ๐๐ช๐ฎ๐๐ญ๐ข๐จ๐ง ๐
๐๐๐๐(๐) = ๐๐๐ข(๐ญ)
๐๐ญ+ ๐ โ ๐ข(๐ญ) + ๐ฒ๐ โ ๐(๐ญ) โฏ ๐๐ช๐ฎ๐๐ญ๐ข๐จ๐ง ๐
๐๐ข(๐ญ)
๐๐ญ=
๐
๐ณ๐๐๐๐(๐) โ
๐
๐ณโ ๐ข(๐ญ) โ
๐ฒ๐
๐ณโ ๐(๐ญ) โฏ ๐๐ช๐ฎ๐๐ญ๐ข๐จ๐ง ๐
๐๐(๐ญ)
๐๐ญ= โ
๐ฒ๐
๐ฑโ ๐(๐) +
๐๐ฆ
๐ฑโ ๐ข(๐ญ) โฏ ๐๐ช๐ฎ๐๐ญ๐ข๐จ๐ง ๐
Linear Control Systems Lab EELE (3160-3161)
Page 5 of 14
Transfer Function Modeling for DC motor:
By Laplace transform and substituting the value of ๐ผ(๐ ) of Eq.7 in Eq.6, we will get one differential equation with input ๐๐๐๐(๐ ) and the output is the
speed of the motor ๐(๐ ),
This T.F. describes the relation between the input voltage and the speed and by plotting the step response of it we will see how the speed will be changed and show the behavior of the motor.
Some experts said that for many motors the armature time constant ๐
๐ฟ is
negligible and therefore:
In time domain:
Where kM = bmf
m
KKRK
K
is the DC Gain.
๐m = bmf KKRK
RJ
is the motor time constant.
Also others make Kb = Km = K.
But if you don't want the speed as output, instead of it you want the angle of rotation to be the output then we think about what is the relation between
the angular displacement(angle ฮธ) and the state variable (๐ ๐๐ ๐ค) and we found that
)()(
twt
t
๐ ๐ (๐ ) = ๐(๐ )
bmf
m
KKKJSRLS
K
sV
sW
))(()(
)(
m
M
fmb
fmb
m
fmb
m
S
k
RKKKRKKK
JRS
K
RKKKJRS
K
sV
sW
1
))]((1[)()(
)(
).()( tVktdt
daMm
Linear Control Systems Lab EELE (3160-3161)
Page 6 of 14
Then the transfer function that relates the voltage (input) with angle (position) is:
State-Space Equations for the DC Motor:
Given the two differential equations derived in the last section, you can now develop a state-space representation of the DC motor as a dynamic system.
The current ๐(๐ก) and the angular rate ๐(๐ก) are the two states of the system.
The applied voltage ๐ฃ๐๐๐(๐ก), is the input to the system, and the angular
velocity ๐(๐ก) is the output.
The previous state space model represent the output as angular speed and if you want the angle (position) as output we make some understood changes.
)1()))((()(
)(
m
M
bmf
m
SS
k
KKKJSRLSS
K
sV
s
)(0100)(
)(
0
0
1
010
0
0
tVappw
i
ty
tVappL
w
i
J
K
J
KL
K
L
R
w
i
t
fm
b
Linear Control Systems Lab EELE (3160-3161)
Page 7 of 14
More Details about state space:
The state space model is one of the representation ways that define a system and as well as the transfer function defines a system by its numerator and denominator the state space defines the system by its four matrices A,B,C,D and take the form:
At first, the variable ๐ฅ is called the state variable, ๐ข is called the input of the system.
The state space can be derived from the differential equations directly, if we note that the two equations 6 & 7 represent a system (DC Motor) and the state variables are ๐ & ๐ค and the input is ๐๐๐๐ .
Matrix A is the coefficient of the state variables (๐, ๐ค), Matrix B is the coefficient of the input ๐๐๐๐.
The output ๐ฆ is the output of the system and here we can choose between
๐ or ๐ค to be the output or both and we chose the speed of the motor ๐ค to be our output and represent it as ๐ฆ = ๐ค by matrix ๐ถ ๐๐๐ ๐ท.
4) MatLab Commands & LabView Structure:
By MatLab:
๐๐: This command is used to enter transfer functions or represent the system by T.F.
For example, to enter the transfer function,5
2)(
2
s
ssH , you would type
โช ๐ป = ๐ก๐([1 2], [1 0 5]) โซ.
The first parameter is a row vector of the numerator coefficients. Similarly, the second parameter is a row vector of the denominator coefficients.
Linear Control Systems Lab EELE (3160-3161)
Page 8 of 14
By LabView:
by using construct transfer function model from control design and simulation library as shown in the figure.
By MatLab:
Series or (*): This command is used to combine two transfer functions that are in series.
For example, if ๐ป(๐ ) and ๐บ(๐ ) are in series, they could be combined with the command โช ๐ = ๐บ โ ๐ป โซ ๐๐ โช ๐ = ๐ ๐๐๐๐๐ (๐บ, ๐ป) โซ.
Linear Control Systems Lab EELE (3160-3161)
Page 9 of 14
By LabView:
By using series function from interconnected model in control design and simulation library.
By MatLab:
Parallel or (+): This command is used to combine two transfer functions that are in parallel.
For example, if ๐บ(๐ ) is in the forward path and ๐ป(๐ ) is in the feedback path, they could be combined with the commandโช ๐ = ๐๐๐๐๐๐๐๐(๐บ, ๐ป) โซ
Linear Control Systems Lab EELE (3160-3161)
Page 10 of 14
By LabView:
By using parallel function from interconnected model in control design and simulation library.
Linear Control Systems Lab EELE (3160-3161)
Page 11 of 14
By MatLab:
Feedback: This command is used to combine two transfer functions that are in feedback.
For example, if ๐บ(๐ ) is in the forward path and ๐ป(๐ ) is in the feedback path, they could be combined with the command
โช ๐ = ๐๐๐๐๐๐๐๐(๐บ, ๐ป) โซ
By LabView:
By using feedback function from interconnected model in control design and simulation library.
Linear Control Systems Lab EELE (3160-3161)
Page 12 of 14
By MatLab:
ss: This command used to represent a system by state space model and it takes the four parameter matrices A,B,C,D.
For example: ๐ ๐ฆ๐ = ๐ ๐ (๐ด, ๐ต, ๐ถ, ๐ท);
So it convert the matrices and define them as a system.
By Labview:
By using construct state space model from control design and simulation library as shown in the figure.
Linear Control Systems Lab EELE (3160-3161)
Page 13 of 14
By MatLab:
tf2ss: converts the parameters of a transfer function representation of a given system to those of an equivalent state-space representation.
[๐ด, ๐ต, ๐ถ, ๐ท] = ๐ก๐2๐ ๐ (๐๐ข๐, ๐๐๐)
Returns the A, B, C, and D matrices of a state space representation for the single-input transfer function.
By LabView:
By using convert to state space model from model conversion in control design and simulation library as shown in the figure
By MatLab:
ss2tf: converts a state-space representation of a given system to an equivalent transfer function representation.
[๐๐ข๐, ๐๐๐] = ๐ ๐ 2๐ก๐(๐ด, ๐ต, ๐ถ, ๐ท);
Returns the transfer function.
By LabView:
By using convert to transfer function model from model conversion in control design and simulation library as shown in the figure.
Linear Control Systems Lab EELE (3160-3161)
Page 14 of 14
Lab work:
1. What is the transfer function of the DC Motor if the output is: a. Speed. b. Angle.
2. Let: R= 2.0 % Ohms
L= 0.5 % Henrys
Km = 0.015 % torque constant
Kb = 0.015 % emf constant
Kf = 0.2 % N-m/s
J= 0.02 % kg.m2/s2
a. By MatLab & LabView, get the transfer function of the motor
speed.
b. By MatLab & LabView, get the state space of the motor angle.
3. Given the system :
15.0
1
)(
)(2
sssX
sY
a. By MatLab & LabView, get the state space model for it.
b. Manually, get the differential equations of the system.
Top Related