DC motors are widely used in small and large industries. Control of DC motor's parameters is much simpler than an AC motor. There are different methods to control DC motor; in this experiment Armature controlled dc motor is discussed. An experiment is carried out to model an armature controlled dc motor. The mathematical model is derived from the dc motors schematics shown in figure 1.
Dc machine's parameters are given in table 1. Once the mathematical model of dc motor is obtained than matlab is used to create simulink model of the dc motor and output is observed. Once dc motor is modelled in simulink than PID (proportional Integral Derivate) controller is added to the model. Also set point is used with PID controller and output is than plotted and results are observed.
Fig 1 Schematic of armature controlled dc motor.
Resistance: R = 0.2 ohms
Tachometer gain Ks = 1
Inductance: L = 0.01 H
Proportional gain: Kp = 20
Torque constant: Ka = 6e-5Nm/A
Integral gain: Ki = 100
Back emf const: Kb = 5.5e-2 V.sec/rad
Derivative gain: Kd = 0.1
Inertia: J = 5.4e-5 Kgm^2
Friction coefficient: b = 4 e-4
Table 1 Dc motor parameters
Close loop control system is designed in simulink using feedback strategy. Dc motor's output (speed) is compared with applied set point to calculate the error between the set point and measured output. Once error is calculate than PID controller is used in order to produce the modified value of input variable u (t).PID controller equations are given below:
The value of gains (Kp Ki Kd) are already selected and given in table 1 for this experiment. Set point r (t) and Load torque d (t) (disturbance) are given below:
Whole experiment is divided into three parts. In first part mathematical model is derived. In second part model is simulated with PID controller and finally in third part of experiment simulink model is modified and input and output ports are used in simulink and modified model is then simulated again.
Part 1: Mathematical model of armature controlled dc motor
From dc motor model given in fig 1 following equations are derived:
Input voltage:
Back Electro motive force:
Torque developed by the motor:
Load Torque:
Taking Laplace transform of above equations:
Fig 2 simulink model of dc motor
Part 2: Simulation of the close loop system using From Workspace and To Workspace.
Simulink model
Fig 3. Simulink Model with using Workspace and To Workspace.
Simulink model of the close loop system is shown above in fig (3). Simulink model is designed using all derive equation in Part 1 of this simulation experiment. Also PID (Proportional, Integral, Derivate) controller is added to the close loop system is order to produce the manipulated values of armature voltage u (t). A "From Workspace" block is used for input set point r (t), which is defined in M-file of the above simulink model, given in table 2. In order to plot the required variables four "To Workspace" blocks are added to simulink model. All "Workspace" block are given variable name, which are used in Matlab to plot the simulation results. In next part M-file is created in order to simulate the designed model.
(ii) M-file for fig (3) simulink Model
In this section M-file is created for the designed simulation model given in fig (3). M-file is given below in table 2. All the variables defined in the simulink model are defined in m-file and are given required values.
%% M-file for Simulink model of armature controlled Dc motor using To and From Workspace model.
%%
clear;clf; % clear all previous data and figures
%% Armature controlled Dc Motor's Parameters are defined here.
R=0.2; % Motor resistance (Ohms)
L=0.01; % Inductance (H)
Ka=6.0*10^(-5); % Torque constant (Nm/A)
Kb=5.5*10^(-2);% Back emf (v)
J=5.4*10^(-5); % Inertia (Kg.m^2)
b=4.0*10^(-4); % friction coefficient
Ks=1; % Feedback Tachometer gain
Kp=20; Ki=100; Kd=0.1; % PID controller gain values are defined.
%% Setting up the desired value for simulation time.
t=(0:0.001:3)'; % Time is set to the required value (0 to 3) sec with steps equal to 0.001.
%% Setting up the desired set point for Dc motor and also Load disturbance.
r1=[100*ones(1001,1);50*ones(1000,1);150*ones(1000,1)]; % Set point Matrix
d1=[0.1*ones(501,1);0.2*ones(2000,1);0.1*ones(500,1)]; % Load disturbance Matrix
r=[t r1]; % Set Point (rad/sec)
d=[t d1]; % Load disturbance (Nm)
%% inputs and outputs calculated in simulink model are plotted in matlab. All figures are plotted on same page using command subplot (511).
subplot(511),plot(T,r1);ylabel('r(t)(rad/sec)') ; % set point
subplot(512),plot(T,d1);ylabel('d(t)(Nm)'); % load disturbance
subplot(513),plot(T,w);ylabel('w(t)(rad/sec)');% output angular frequency.
subplot(514),plot(T,Tm);ylabel('Tm(Nm)'); % develop torque
subplot(515),plot(T,u);xlabel('t(sec)');ylabel('u(t)'); % armature voltage
Table 2. M-file for Workspace model
Input set point r (t) and Load disturbance d (t) are created in m-file. For set point r (t) values are set according to equation (3) . Simlarly load disturbance d (t) values are are set according to equation (4). Model is simulated for 3 seconds with the sampling steps equal to 0.001 seconds. In next section m-file and simulink model are simulated and results are plotted.
(iii) Results:
In this section set point r (t), load disturbance d(t), output angular frequency w (t), developed Torque Tm and Armature volatge u (t) are plotted in one figure. Figure including all parameters is given below in fig (4).
Fig (4) simulation results for workspace model
It can be seen in above fig (4) set point r (t) and load disturbace d(t) are in accordance with defined vslues in m-file as well as equation (3) and equation (4).
Part 3: Simulate model using input and output ports.
(i) In this section of report simulation model derived earlier in part 2 is modified so it can be called from matlab m-file without need of running simulink. Modified model is given below in fig (5).
Fig (5) simulink model using input and out ports.
In order to run simulink model through m-file, few changes are made to previously designed model. "From workspace" blocks are now replaced with input ports and all "To workspace" blocks are replaced with output ports. After making these changes to simulink model, system is now saved and closed. M-file is also modified in next section and simulink model shown in fig (5) is simulated through m-file of simulink model.
(ii) In this section m-file created in part 2 is modified, in order to call the modified saved simulink model through m-file and all the results are then plotted in one figure.
%% M-file Armature controlled Dc motor using input and output ports.
%%
clear;clf; % Clear all previous data and figures
%% Armature controlled Dc Motor's Parameters
R=0.2; % Motor resistance (Ohms)
L=0.01; % Inductance (H)
Ka=6.0*10^(-5); % Torque constant (Nm/A)
Kb=5.5*10^(-2);% Back emf (v)
J=5.4*10^(-5); % Inertia (Kg.m^2)
b=4.0*10^(-4); % friction coefficient
Ks=1; % Tachometer gain
Kp=20; Ki=100; Kd=0.1; % PID gains
%% setting up required simulation time and step size.
t1=(0:0.001:3)'; % Time (sec) is set from 0 to 3 sec with 0.001 step.
%% Setting up the input set point (r(t)) and Load disturbance (d(t)).
r1=[100*ones(1001,1);50*ones(1000,1);150*ones(1000,1)]; % Set point Matrix
d1=[0.1*ones(501,1);0.2*ones(2000,1);0.1*ones(500,1)]; % Load disturbance Matrix
r=[t1 r1]; % Set Point (rad/sec)
d=[t1 d1]; % Load disturbance (Nm)
%% Setting up to call the saved simulink model ('CW2DCsimFN_261108') without opening simulation model separately, using "sim" function.
[T X Y]=sim('CW2DCsimFN_261108',[t1],[],[t1,r1]); % Where "T" is returned time vector,"X" is Return state in matrix and "Y" is returned Output.
%% Plotting all the required parameters of Dc motor.
subplot(511),plot(T,r1);axis([0 3 0 175]);ylabel('r(t)(rad/sec)'); % input set point
subplot(512),plot(T,Y(:,1));axis([0 3 0 0.25]);ylabel('d(t)(Nm)');% Load disturbance
subplot(513),plot(T,Y(:,2));axis([0 3 -10 200]);ylabel('w(rad/sec)');% Output Angular frequency
subplot(514),plot(T,Y(:,3));axis([0 3 0 0.5]);ylabel('Tm(Nm)');% Developed Torque
subplot(515),plot(T,Y(:,4));axis([0 3 -6000 14000]);xlabel('t(sec)');ylabel('u (t) V'); % Armature voltage
Table 3 Modified m-file to call the simulink model
Modified m-file is given in table 3. A "sim" function is used in order to call the saved simulink model without opening the simulink. Dc motor's set point and other parameters are kept same as part 2. Modified simulink model's file name is typed in "sim" function in m-file. Input and output ports are plotted on one figure using "subplot" command. Plotted results are shown in next section.
(iii) Results
Modified m-file is simulated and simulink model is called within the m-file without opening the simulink model. Results are plotted and are given in fig (6).
Fig (6) Dc motor parameters using "sim" function in m-file
Results produced in part 3 (fig 6) are exactly same as in part 2 (fig 5). In fig (6) set point r (t), load disturbance d (t), output angular frequency w (t), torque developed Tm and armature voltage u (t) are plotted.
Discussion
An armature controlled dc motor uses the armature current as the control variable. In dc motor stator field can be established by a field coil and current or permanent magnet. For this simulation experiment, mathematical equations for armature current, voltage, develop torque and back electromotive force are derived from the schematic of armature controlled dc motor. All equations are derived and then Laplace transform is applied all equations in order to create the close loop systems. Matlab is used in this simulation experiment to create close loop system with PID controller. PID controller calculates the error and produces the manipulated value of armature voltage which is then fed to the dc motor. Dc motor set point, load disturbance and other variables are defined in m-file. Simulink model has to be in pause state in order to run m-file. However there is easier way to simulate the system by calling the saved simulink model in m-file. This way requires few changes to existing simulink and m-file; however there is no need to run simlink separately if this method is used. Both methods uses same input variables therefore produce exactly same results as proved in part 2 and part 3 of this simulation experiment.
Conclusion
Matlab function "sim" can be used to call the saved simulink model in m-file in order to perform simulation without opening the simulink model.
PID controller calculates the error and produces the manipulated values of armature voltage which is then fed back to motor.
Dynamic behaviour of a system can be simulated by deriving the mathematical model of the system and the mathematical model then can be simulated by using simulation software (Matlab).