DC Motor Modeling Using MATLAB
DC Motor Modeling Using MATLAB
Experiment # 4
System Modeling by MATLAB & Labview
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 V= K I . K : is constant (resistor).
Model Representation:
1
Control Systems Lab
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. If you are unfamiliar with the basics of
DC motor modeling, consult any basic text on physical modeling. 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 i induced by
the applied voltage,
EQ.1.1
where Km, 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,
EQ.1.2
where Kb, the emf constant, also depends on certain physical properties of the motor.
So R ,L, Km and Kb are parameters which be given by the datasheet of the motor.
2
Control Systems Lab
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,
EQ.1.3
EQ.1.4
or, solving for the applied voltage and substituting for the back emf,
EQ.1.5
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,
EQ.1.6
and the second for the resulting angular rate,
EQ.1.7
Now EQ 1.6 and 1.7 are differential equations and together describe my DC Motor
system.
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.
L
Some experts said that for many motors the armature time constant is
R
negligible and therefore:
W ( s) Km Km kM
.
V ( s) JRS ( K b K m K f R) JR 1 S m
[1 S ( )]( K b K m K f R)
Kb Km K f R
In time domain
d
m (t ) k M Va (t ).
dt
3
Control Systems Lab
Km
Where kM = is the DC Gain
RK f K m K b
RJ
τm = is the motor time constant
RK f K m K b
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 (i or w) and we found that
(t )
w(t ) S θ (s) = W(s)
t
then the transfer function that relates the voltage (input) with angle (position) is
( s) Km kM
V ( s) S (( LS R)( JS K f ) K m K b ) S (1 S m )
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.
R Kb
0 1
i L L
i L
K m Kf
w 0 w 0 Vapp (t )
t J J
0 1 0 0
i
y (t ) 0 0 1 w 0Vapp (t )
4
Control Systems Lab
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 x is called the state variable , u 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 1.6 & 1.7 represent a system (DC Motor) and the state variables are
i & w and the input is Vapp . Matrix A is the coefficient of the state variables (i, w) ,
Matrix B is the coefficient of the input Vapp. The output y is the output of the system
and here we can choose between i or w to be the output or both and we chose the
speed of the motor w to be our output and represent it as y=w by matrix C and D.
By Matlab:
By labview:
by using construct transfer function model from control design and
simulation library as shown in the figure.
5
Control Systems Lab
By Labview:
6
Control Systems Lab
Parallel : This command is used to combine two transfer functions that are
in parallel. For example, if G(s) is in the forward path and H(s) is in the
feedback path, they could be combined with the command
“T=parallel(G,H)”.
By Labview:
7
Control Systems Lab
By Labview:
8
Control Systems Lab
By Labview:
by using construct state space model from control design and simulation
library as shown in the figure
By Labview:
9
Control Systems Lab
By Labview:
11