Modelling and Simulation of A DC Motor Drive
Modelling and Simulation of A DC Motor Drive
Modelling and Simulation of A DC Motor Drive
1 Introduction
A simulation model of the DC motor drive will be built using the Matlab/Simulink
environment. This assignment aims to familiarise you with basic features of Simulink and
to demonstrate modelling approaches applicable to electric drives. After this assignment,
you will be able to:
1. Model and simulate a DC motor drive in the Matlab/Simulink environment;
2. Tune the current and speed controllers using a model-based approach;
3. Explain effects of the pulse-width modulation (PWM) on control performance.
The model of the DC motor is first built and tested in Section 2. Detailed step-by-step
instructions are given for creating the model. In Section 3, the motor model is augmented
with models for the DC-DC converter and PWM. In Section 4, the current and speed
controllers are added to the model.
1/12
ELEC-E8405 Electric Drives Assignment 2
2 DC Motor Model
2.1 Dynamic Equations
First, a simulation model of the permanent-magnet DC motor will be built. The following
state equations are taken as a starting point:
dia
La = ua − Ra ia − kf ωM (1a)
dt
dωM
J = kf ia − TL (1b)
dt
The armature voltage ua and the load torque TL are the inputs of the model. The armature
current ia and the angular rotor speed ωM are the outputs of the model. Rating and
parameters of the motor are given in Table 1.
(a) (b)
Figure 1: Blocks needed to build the DC motor model: (a) Drag and drop these blocks from the Library
Browser to your model; (b) Rename the input and output signals by selecting their names and typing
new names. Double click the Sum and Gain blocks and specify them according to the figure.
2/12
ELEC-E8405 Electric Drives Assignment 2
3/12
ELEC-E8405 Electric Drives Assignment 2
4/12
ELEC-E8405 Electric Drives Assignment 2
the figure. Specify the voltage step block so that the voltage is stepped to its rated value
120 V at t = 0.1 s. The load torque should be stepped to its rated value at t = 0.3 s.
Simulate the model, for example, using the menu: Simulation→Run. After the simu-
lation, you can plot the results in the Matlab workspace using the following commands:
subplot(2,1,1); % Divides the figure to two subplots
plot(ia.time,ia.data); grid on;
%IN = 20; % Rated current
%plot(ia.time,ia.data/IN); % This would plot the p.u. current
xlabel('Time (s)'); ylabel('Current (A)');
subplot(2,1,2);
plot(wM.time,wM.data); grid on;
xlabel('Time (s)'); ylabel('Speed (rad/s)');
It is practical to write and save these commands as a script (e.g., using the name fig.m)
and then run the script by typing its name (fig) in the workspace. This way you can
easily edit and reuse your scripts. The simulation results should look similar to those
shown in Fig. 7. If they look different, you should debug your model.
Figure 5: Configuration parameters. Set the new values for the parameters Stop time and Max step size.
5/12
ELEC-E8405 Electric Drives Assignment 2
Figure 7: Rated voltage step at t = 0.1 s and rated load torque step t = 0.3 s.
6/12
ELEC-E8405 Electric Drives Assignment 2
qA
1
dA
0
t
qB carrier
A ia 1
dB
Udc ua 0
B t
ua
N
Udc
ua,ref
qA
ua,ref
PWM qB 0
Tsw t
(a) (b)
Figure 9: (a) Equivalent circuit of the four-quadrant DC-DC converter. The potentials A, B, and N
are marked in the circuit. The positions of the bi-positional switches in the figure correspond to the
switching states qA = 1 and qB = 0, and the output voltage is ua = Udc . (b) Example waveforms in
unipolar PWM.
7/12
ELEC-E8405 Electric Drives Assignment 2
(a)
(b)
Figure 10: (a) Simulink implementation of unipolar PWM. (b) Motor model with unipolar PWM and
converter model. Specify the Repeating Sequence block by setting Tsw*[0 0.5 1] for the Time values and
[1 0 1] for the Output values. The Zero-Order Hold block represents sampling synchronised to the PWM
(set the value Tsw/2 for the Sampling period parameter). You can assign the values for the variables Udc
and Tsw either via masking the subsystem (as was done in the case of the DC motor) or simply via the
Matlab workspace (i.e., type Udc = 140 and Tsw = 200e-6 in the workspace).
8/12
ELEC-E8405 Electric Drives Assignment 2
4. Augment your simulation model with unipolar PWM and converter models.
Your model should look similar to the model in Fig. 10(b). Simulate the model
and show the results in your report. Briefly comment on differences compared
to the previous simulation, where an ideal voltage source was assumed. Submit
this version of your simulation model to MyCourses.
5. Plot the waveforms of the actual current ia and the synchronously sampled
current ia k in the same subplot. Show also the waveform of the voltage ua.
You can plot the results using the following script:
subplot(2,1,1)
plot(ia.time,ia.data); grid on; hold on;
stairs(ia k.time,ia k.data,'r'); % Discrete signal
axis([0.15 0.1504 9 11]); % Controls axis scaling
xlabel('Time (s)'); ylabel('Current (A)');
subplot(2,1,2)
plot(ua.time,ua.data); grid on;
axis([0.15 0.1504 −10 150]);
xlabel('Time (s)'); ylabel('Voltage (V)');
4 Cascaded Control
The control system of the DC motor is shown in Fig. 11. The control structure is cascaded:
the outer loop is the speed control loop and the inner loop is the current-control loop.
For simplicity, the switching harmonics due to the PWM will be omitted in the following
(but the voltage saturation will be taken into account).
Save the simulation model you have made, and copy it using a new name for the
following changes. You can remove the PWM and converter models. In order to speed up
your simulations, open the Configuration Parameters window and set 1e-4 for the Max
step size parameter.
Udc
ωM,ref
Speed TM,ref 1 ia,ref qA , qB
controller kf Current ua,ref
controller PWM
ia
ua ia
ωM
Figure 11: Cascaded control system of the DC motor. In the following, PWM and converter models are
omitted for simplicity.
9/12
ELEC-E8405 Electric Drives Assignment 2
controller using the following script, which you should run before starting the simulation:
clear; % Removes variables from the workspace
%% Parameter estimates
Ra = 0.5; % Armature resistance
La = 2.5e−3; % Armature inductance
kf = 0.35; % Flux constant
J = 1e−3; % Moment of inertia
%% Gains of the 2DOF PI current controller
alphac = 2*pi*500; % Closed−loop bandwidth
kpc = alphac*La; % Proportional gain
kic = alphacˆ2*La; % Integral gain
r = kpc − Ra; % Active resistance
Umax = 140; % Saturation: upper limit
Umin = −140; % Saturation: lower limit
%% Gains of the 2DOF PI speed controller (for Section 4.2)
%alphas = 0.1*alphac; % Closed−loop bandwidth
%kps = ...; % Proportional gain
%kis = ...; % Integral gain
%b = ...; % Active damping
%TN = 7; % Rated torque
%Tmax = 2*TN; % Saturation: upper limit
%Tmin = −2*TN; % Saturation: lower limit
Test your model using a 1-Nm 100-Hz square-wave torque reference. The results should
look similar to those in Fig. 13.
6. Calculate the theoretical rise time of the torque and compare it to the simulated
rise time.
(a) (b)
Figure 12: (a) Torque control. For testing the model, specify the Signal Generator block to generate the
square wave with an amplitude of 1 Nm and a frequency of 100 Hz. (b) 2DOF PI current controller with
anti-windup. Set Umax for the upper limit and Umin for the lower limit in the Saturation block.
10/12
ELEC-E8405 Electric Drives Assignment 2
0
7. A term proportional to the measured speed is subtracted from the output TM,ref
0
of the PI speed controller, i.e. TM,ref = TM,ref −bωM , where b is the active damping
constant. Derive the transfer function G0 (s) from TM,ref
0
to the angular speed ωM
assuming the current control to be ideal (i.e., the torque equals its reference).
Based on this result, give the tuning equations for the 2DOF PI speed controller.
8. Tune the speed controller of your simulation model for the closed-loop band-
width αs = αc /10. Test your model using the square-wave speed reference,
whose amplitude is 160 rad/s and frequency is 4 Hz. Generate the rated load
torque step at t = 0.3 s. Show results of this simulation in your report. Show
also the figures describing the main level of your simulation model and the
implemented speed controller. Submit this version of your Simulink model to
MyCourses (including your initialisation script).
9. This problem aims to illustrate the robustness of the closed-loop control scheme
against parameter errors. Generally, resistances depend on temperature (about
0.4%/K) and inductances may vary due to the magnetic saturation. Change the
actual armature resistance in the motor model to 150% of its original value and
the actual armature inductance to 70% of its original value, but do not change
the values in the control system. Simulate the model. Show the results and
comment on them in your report. After this problem, restore these parameter
values back to their original values.
10. This problem aims to illustrate the importance of the anti-windup scheme. Re-
move the anti-windup in the speed controller (but do not remove the saturation
of the controller output). Show results of your simulation and comment on them.
Figure 13: Testing of the torque controller with a 1-Nm 100-Hz square-wave torque reference.
11/12
ELEC-E8405 Electric Drives Assignment 2
Figure 14: Cascaded control. Specify the Signal Generator block to generate the square wave with an
amplitude of 160 rad/s and a frequency of 4 Hz. Specify the Step block to generate the rated torque step
at t = 0.3 s.
Give Us Feedback
In order to improve this assignment, please give us feedback. In order to estimate the
student workload, we would also be happy to know how many hours did you use to do
this assignment. All other comments are also welcome.
12/12