In: Electrical Engineering
The block diagram of a PMDC motor can be defined as
Where L, R are the armature inductance and resistance, J, b are the moment of inertia and viscous coefficient, Kb and Kt are the back-emf constant and torque constant. The input is the voltage called Vref and output is the angular frequency w.
The following Simulink block diagram can be utilized to model
the above system, here, we assume R = 1 ohm, L = 0.5 Henry, J =
0.01 kg*m2, b = 0.1 N*m*sec, Kb = 0.01 V/rad/sec and Kt
= 0.01 N.m/amp. The input voltage is assumed to unit step response.
The transfer function of the PID controller is
Gc(s) = Kp + Ki/s + Kd*s; where Kp, Ki and Kd are the proportional,
integral and differential gains. In this simulation, we assume Kp =
100, Ki = 200, Kd = 1.
the corresponsing step response is shown below
Now, we are going to provide the matlab code for the same. The corresponding code and plots are shown below
clear all
clc
s = tf('s');
%% constant parameters
L = 0.5; % henry
R = 1; % ohm
J = 0.01; % Kg.m^2
b = 0.1; % N.m.sec
Kb = 0.01; % V/rad/sec
Kt = 0.01; % N.m/amp
%% model the TF
G1 = 1/(L*s+R);
G2 =1/(J*s+b);
%% model the PID controller
Kp = 100;
Ki = 200;
Kd = 1;
Gc = pid(Kp,Ki,Kd);
% open-loop TF
G_ol = G1*Kt*G2*Gc;
% close-loop TF
T = feedback(G_ol,Kb);
%% compute and plot the step response
t = 0:0.1:100; % time of simulation
conIn = ones(1,length(t));
[y,t_out] = lsim(T,conIn,t);
% plot the output
figure(1)
plot(t_out,y)
grid
xlabel('Time')
ylabel('Angular frequency')
the corresponding response is shown below