Project 2 - Speed Control of a Direct Current (DC) motor
Script files
% Design Parameters to model a DC motor
Jm = input('Enter moment of inertia in Kg-m^2 J :');
Bm = input('Enter motor viscous friction constant in N-m-s B :');
Km = input('Enter Back EMF constant in v/rad/s Km :');
Kt = input('Enter motor torque constant in N-m/amp Kt :');
Ra = input('Enter Armature resistance in ohms Ra :');
La = input('Enter Armature inductance in Henries La :');
wc = input('Enter the Reference speed of motor wc :');
%PD control Design
% Plant matrices
A = [-Bm/Jm Kt/Jm; -Km/La -Ra/La];
B = [0; 1/La];
C = [1 0];
D = [0];
%Pole Placement Design
fn=1;
wn=2*pi*fn;
zeta = 0.5;
p1 = -zeta*wn+wn*sqrt(zeta^2-1);
p2 = -zeta*wn-wn*sqrt(zeta^2-1);
P = [p1;p2];
K = place(A,B,P);
Kp = K(1)
Kd = K(2)
Ki = input('Enter integral gain Ki :');
figure(1)
subplot(321);plot(out.time,out.Vs);grid;title('Supply Voltage (V)');
subplot(322);plot(out.time,out.Vb);grid;title('Back EMF (V)');
subplot(323);plot(out.time,out.Ia);grid;title('Armature Current (A)');
subplot(324);plot(out.time,out.t);grid;title('Torque (N-m)');
subplot(325);plot(out.time,out.w,'m--');hold;grid;title('Rotor Speed (rad/s)');
subplot(325);plot(out.time,out.wc,'b-');