Monday, September 19, 2011

DC Motor Speed Modeling in Matlab


DC Motor Speed Modeling in Matlab


DC MOTOR MODELLING

A common actuator in control systems is the DC motor. It directly provides rotary motion and, coupled with wheels or drums and cables, can provide transitional motion. The electric circuit of the armature and the free body diagram of the rotor are shown in the following figure:

For this example, we will assume the following values for the physical parameters.

  • moment of inertia of the rotor (J) = 0.01 kg.m^2/s^2
  • damping ratio of the mechanical system (b) = 0.1 Nms
  • electromotive force constant (K=Ke=Kt) = 0.01 Nm/Amp
  • electric resistance (R) = 1 ohm 
  • electric inductance (L) = 0.5 H
  •  input (V): Source Voltage


The motor torque, T, is related to the armature current, i, by a constant factor Kt. The back emf, e, is related to the rotational velocity by the following equations:


In SI units (which we will use), Kt (armature constant) is equal to Ke (motor constant).



Next, we will start to modelling with Newton's law and Kirchoff's law. These laws applied to the motor system give the following equations:




The transfer function of the model is derived as follows:



The denominator and numerator is given by:


MATLAB representation:

J=0.01;
b=0.1;
K=0.01;
R=1;
L=0.5;
num=K;
den=[(J*L) ((J*R)+(L*b)) ((b*R)+K^2)];
motor=tf(num,den);
step(motor,0:0.1:10);
title('Step Response for the Open Loop System');
xlabel('Time in s')
ylabel('Speed in rad/s')
The response of the system as shown in figure:
PID controller Design: 

The PID controller tuning is done manually by changing the Kp, Ki and Kd values. 
J=0.01;
b=0.1;
K=0.01;
R=1;
L=0.5;
num=K;
den=[(J*L) ((J*R)+(L*b)) ((b*R)+K^2)];
motor=tf(num,den);

Kp=100;
Ki=100;
Kd=10;
PID=tf([Kd Kp Ki],[1 0]); 
sys_closed=feedback(PID*motor,1);
step(sys_closed)
title('Closed loop response')

The closed loop response is given by the


Tune the parameters and find out the better response.




No comments:

Post a Comment