Control Tutorials For MATLAB and Simulink - Motor Speed - Simulink Modeling
Control Tutorials For MATLAB and Simulink - Motor Speed - Simulink Modeling
SYSTEM
CONTROL
PID Related
Tutorial
ROOT LOCUS Links
FREQUENCY
Simulink
Basics
STATE-SPACE
Modeling
DIGITAL w/
Simulink
DC Motor
SIMULINK
Activity
MODELING
Related
CONTROL
External
SIMSCAPE Links
Simulink
Modeling
Video
Simscape
Video
Contents
Physical setup
Physical setup
For this example, we will assume that the input of the system is the voltage
source ( ) applied to the motor's armature, while the output is the rotational
speed of the shaft . The rotor and shaft are assumed to be rigid. We further
assume a viscous friction model, that is, the friction torque is proportional to
shaft angular velocity.
(1)
In SI units, the motor torque and back emf constants are equal, that is,
; therefore, we will use to represent both the motor torque
constant and the back emf constant.
This system will be modeled by summing the torques acting on the rotor
inertia and integrating the acceleration to give velocity. Also, Kirchoff's laws
will be applied to the armature circuit. First, we will model the integrals of the
(3)
(4)
To build the simulation model, open Simulink and open a new model
window. Then follow the steps listed below.
Label the input line "d2/dt2(theta)" and the output line "d/dt(theta)" as
shown below. To add such a label, double-click in the empty space just
below the line.
Insert another Integrator block above the previous one and draw lines
to and from its input and output terminals.
Label the input line "d/dt(i)" and the output line "i".
Next, we will apply Newton's law and Kirchoff's law to the motor system to
(6)
Insert two Gain blocks from the Simulink/Math Operations library, one
Change the label of this Gain block to "Inertia" by clicking on the word
"Gain" underneath the block.
Similarly, edit the other Gain's value to "1/L" and its label to
"Inductance".
Insert two Add blocks from the Simulink/Math Operations library, one
Edit the signs of the Add block corresponding to rotation to "+-" since
Edit the signs of the other Add block to "-+-" to represent the signs of
Now, we will add in the torques which are represented in the rotational
equation. First, we will add in the damping torque.
Insert a Gain block below the "Inertia" block. Next right-click on the
block and select Rotate & Flip > Flip Block from the resulting menu to
flip the block from left to right. You can also flip a selected block by
holding down Ctrl-I.
Set the Gain value to "b" and rename this block to "Damping".
Tap a line (hold Ctrl while drawing or right-click on the line) off the
"Damping" block.
Draw a line from the "Damping" block output to the negative input of the
Insert a Gain block attached to the positive input of the rotational Add
Edit its value to "K" to represent the motor constant and Label it "Kt".
Continue drawing the line leading from the current Integrator and
Now, we will add in the voltage terms which are represented in the electrical
equation. First, we will add in the voltage drop across the armature
resistance.
Insert a Gain block above the "Inductance" block and flip it from left to
right.
Set the Gain value to "R" and rename this block to "Resistance".
Tap a line off the current Integrator's output and connect it to the input
Draw a line from the "Resistance" block's output to the upper negative
Edit it's value to "K" to represent the motor back emf constant and Label
it "Ke".
Tap a line off the rotational Integrator's output and connect it to the "Ke"
block.
Add In1 and Out1 blocks from the Simulink/Ports & Subsystems library
The final design should look like the example shown in the figure below.
then save the model. Your model should appear as follows. You can also
download the file for this system by right-clicking here and selecting Save
link as .... We use this model in the DC Motor Speed: Simulink Controller
Design section.
Building the model with Simscape
In this section, we alternatively show how to build the DC Motor model using
Open a new Simulink model and insert the following blocks to represent the
electrical and mechanical elements of the DC motor.
Connect and label the components as shown in the following figure. You can
rotate a block in a similar manner to the way you flipped blocks, that is, by
right-clicking on the block then selecting Flip Block from the Rotate & Flip
menu.
Complete the design of the DC motor Simscape model by assigning values
to the physical parameters of each of the blocks to match our assumed
Resistance = R [Ohm]
Inductance = L [H]
Inertia = J [kg*m^2]
The Rotational Damper block serves to model the viscous friction of the
motor. This type of friction model was chosen because it is linear. In most
cases real friction is more complicated than this. If you wish to employ a
more complicated friction model, for instance to add Coulomb friction to the
model, then you may use the Rotational Friction block from the
Simscape/Foundation Library/Mechanical/Rotational Elements library.
Also note that in the above you generated a DC Motor model from the
individual mechanical and electrical aspects of the motor. The Simscape
The physical parameters must now be set. Enter the following commands at
the MATLAB prompt.
J = 0.01;
b = 0.1;
K = 0.01;
R = 1;
L = 0.5;
These values are the same ones listed in the physical setup section.
You can then save these components in a single subsystem. Select all of
the blocks and then select Create Subsystem from Selection after right-
clicking on the selected portion. You can also change the subsystem block
Three Out1 blocks and one In1 block from the Simulink/Ports &
Subsystems library
The Controlled Voltage Source block serves as the power source for the
motor where you can externally define the voltage signal by connecting an
input to the block.
Simulink signals. In our case, we can leave the units undefined since the
input and output of each of the conversion blocks have the same units. In
general, the Simscape blockset is employed to model the physical plant,
The Solver Configuration block is employed for defining the details of the
Next, connect and label the components so that they appear as in the figure
below. Double-click on the lines which are connected to the Out1 blocks and
label them "Current", "Position", and "Speed". Also double-click on the In1
from Selection after right-clicking on the selected portion. Also label the
subsystem and signals as shown in the following figure.
You can download the complete model file by right-clicking here and
selecting Save link as ..., but note that you will need the Simscape addition
to Simulink in order to run the file.
Note that the two models generated above will behave equivalently as long
as they are built using the same parameter values. The difference between
them is then only the ease with which they are built and interfaced with, and
how transparent they are in presenting information to the user.
If you would like to actually run the models developed above and use them
to simulate and develop control algorithms, you may continue on to the DC
Motor Speed: Simulink Control page.
Published with MATLAB® 9.2