DC Motor Control Position
DC Motor Control Position
Control Theory
Universidade do Minho
Description
DC motors that use feedback control are called DC servomotors. They are known to have precise angular position and have a quick response. This paper will
focus on the modeling and position control of a DC motor with permanent magnets. We first develop the differential equations and the Laplace domain transfer
function model of the system DC motor/Load. Next we will apply the parameters of the Maxon DC motor 2140.937, identify the parameters of a PID controller
using simulation, and make an introduction of the implementation.
The electric equivalent circuit of the armature and the free-body diagram of the rotor are shown in the following figure 1. The parameters are describe in the
table. This analysis is valid for DC motors with permanent magnets.
1 - The permanent magnets in the motor induce the following back emf Ve in the armature: Ve = Ke . = Ke . ´ (1)
The motor produces the following torque, which is proportional to the motor current i(t) T = Kt . i(t) (2)
Assuming there are no electromagnetic losses and no mechanical losses : mechanical power is equal to the electrical power T . ´ = Ve . i(t) (3)
substituting by equations (1) and (2) => Kt . i(t) . = Ke . . i(t) => we will consider Kt = Ke = K (4)
2 - From the Kirchhoff´s law voltage, in the armature circuit : = R i(t) + L di(t)/dt + Ve (5)
3 - From the Newton´s Law T = T rotor + T load + T viscous = Jm. ´´ + T load + b ´ (6)
1
1.2 - The Laplace domain transfer function model
From equations (5) and (1) From equation (6) T = Jm .´´ + b. ´ + Tload
= R i(t) + L di(t)/dt + Ve = R i(t) + L di(t)/dt + K
Applying Laplace transform
Applying Laplace transform V(s) = R. I (s) + L.s. I (s) + K.(s)
=> V(s) – K.(s) = (Ls + R) I(s) => T(s) = Jm.s². (s) + B.s.(s) + Tload(s)
Figure 2 Figure 3
Joining the both previous block diagrams, and assuming from equation (1) K . = K . ´, then from Laplace K.(s) = K.s.(s), we get the open-loop equivalent
block diagram of the system DC motor/Load of figure 4.
If we consider T Load = 0 ,
(s) = .
=> this is the open loop transfer function of DC motor, without load. (7)
L/R is the electrical time constant, and J/b is the mechanical time constant. Usually L/R << Jm /b , so we can neglect (Ls + R). With this consideration, we
obtain the simplified block diagram of figure 5.
2
1.3 - Controlled model with feedback
To control the position of the motor, the system must be closed with a feedback, and a controller C(s) has to be added.
The structure of the model have to be reduced and simplified to a better analysis of the model as to capture important characteristics.
In a first step, the TLoad(s) is removed from the minor feedback ( in blue in figure 7), to be able further to eliminate this minor feedback,
and have a single main feedback from output to input.
Figure 7
Simplifying the minor feedback transfer function in order to obtain an equivalent open-looptransfer function :
(8)
The “blue” feedback can know be replace by the equivalent open-loop transfer function
The motor chosen to make the simulation is the Maxon DC motor 2140.937, with the following characteristics :
3
Replacing the motor characteristics in the block diagram of figure 8 :
Figure 9
Figure 9a
3 - The project
The control will be provided with a PID controller, this one implemented by software using an Arduino Uno board. It will command and H bridge driver by a
PWM signal. In the figure the schema of the system. The PWM is bipolar, 7 bits define the value of the PWM, and the 8º bit define the dir ection of the rotation.
So the Value of the PWM will have a range between -127 and + 127.
Figure 10
The incremental encoder is a Baumer BHK 16.24K 1000-B6-9, 1000 pulses per revolution, with operation speed max. 12000 rpm, higher than max motor speed.
The max continuous of the motor is 13.5E-3 Nm (Trotor + Tload + Tviscous), Tload max = ( 13.5E-3 Nm – Trotor – Tviscous ), but to simplify we will consider a
Tload of 13.5E-3Nm. The stall torque of the DC motor is 31.9E-3 Nm.
Design requirements
We will want to be able to position the motor very precisely, thus the steady-state error of the motor position should be zero when given a commanded
position. We will also want the steady-state error due to a constant disturbance to be minus to 0.01 rad. The other performance requirement is that the motor
reaches its final position very quickly without no overshoot. In this case, we want the system to have a settling time of 40 ms for a position of 100 radians. If we
simulate the reference input by a 100 units step input, then the motor position output should have:
The function of the PID controller is to add poles and zeros to the original open-loop transfer function, allowing us to reshape the root locus in order to place the
closed-loop poles at the desired locations and to get desired response of our system. But first we choose to simulate in Matlab.
4
4 - Simulation
The following block diagram has been designed with Simulink/Matlab. The controller is PID parallel controller with a transfer function : Kp + Ki/s + Kds .
The values of Kp, Ki, and Kd will be changed in order to get the better response, i.e, quick response minus of 0.5s reach 100 radians, no overshoot, and an error
of 0.02%. First, we change the parameter Kp to increase the settling time… saturation limit -127/127
Figure 11
To find the optimize parameters for the PID controller, we must start with set only the parameter Kp (P controller). This parameter will reduce the rise time. The
Ki parameter will be added if there is a steady-state error, and the Kd parameter must be added if there is oscillation.
Angle Angle
No-Load No-Load
step Input = 1 step Input = 1
Kp = 1 Kp = 120
Ki = 0 Ki = 0
Kd = 0 Kd = 0
Angle Error
No-Load No-Load
step Input = 1 step Input = 1
Kp = 120 Kp = 120
Ki = 0 Ki = 0
Kd = 1.1 Kd = 1.1
If we increase the step input from 1 in previous analysis, to 200, we observe a linear rise time because of the controller saturation. In the block diagram of figure
11, a saturation box was inserted with the following parameters : negative saturation -127, positive saturation +127.
Angle
No-Load
step Input = 200
Kp = 120
Ki = 0
Kd = 1.1
Figure 16
5
Next the analysis with a load of 13.5E-3 Nm, that´s the maximum continuous torque of our DC motor, and using the same previous parameters for the PD
controller ( Kp=120, Kd=1.1). We can observe that we have now a steady-state error. If we insert a Ki=500 parameter the steady state error is eliminate but we
still have an unwanted response because of the overshoot.
Angle Angle
Figure 17 Figure 18
In figures 19,20 and 21 the response with different amplitude of input step, and with the PD controller ( Kp=120, Kd=1.1). The steady-state error seems to be the
same in the 3 cases, around 0.1 rad.
Adding the integral factor Ki/s to the controller, the error is eliminated in steady state but the overshoot is increased. We have to choose if we can have a fixed
error of 0.1 rad, or if we can have an overshoot. It depends of the application, but for sure it´s better to have neither of them. Another kind of controller have to
be dimensioned, like for example the serial PID controller . This controller has the advantage to easily control the position of its poles and
zeros, that are easily identified analyzing the previous equation : two poles at positions - .Td and 0, two zeros at -1/Td and at -1/Ti.
windup
if an integration factor Ki/s is added, the output will continue to increase or decrease as long as there is an error (difference between set point and
measurement) until the output reaches its upper or lower limit, i.e., saturation. The result will be an excessive overshooting. The solution is to cut-off the
integrator factor Ki/s when saturation is reached.
Applying the formulas in annex A to the closed loopp block diagram of the system in figure 8, we obtain the Servo command and regulation equation (9) that
allows to study the stability of the system :
(9)
(10)
Error in steaty-state
= 1 + (120+1.1s). = 1+ = =
6
Replacing in equation (10)
= =
Root Locus
We can verify that all the fractions of equations (9) and (10) have a common denominator
By adding zeros or/and poles via the controller C(s), the root locus can be modified in order to achieve a desired response.
if we replace C(s) by Kc.C´(s) then
(11)
Figure 22 – Root locus and step response analysis, for different PID parameters
Conclusion
References :
http://ctms.engin.umich.edu/CTMS/index.php?example=MotorPosition§ion=SystemModeling
http://ctms.engin.umich.edu/CTMS/index.php?example=MotorSpeed§ion=SystemModeling
7
ANNEX
Matlab code
% P-control
numD = [120]; denD = [1]; D = tf(numD, denD);
subplot(4,2,1); rlocus(series(D,G)); title('P-Control')
cltf = feedback(series(D,G), [1], -1);
hold on; plot(real(roots(cltf.den{:})), imag(roots(cltf.den{:})), 'rx'); hold off;
subplot(4,2,2); step(cltf*10,0.4); title('P-Control Kp = 120'); % amplitude step = 10, time 0.4 s
% PD-control
numD = [1.1 120]; denD = [1]; D = tf(numD, denD);
subplot(4,2,3); rlocus(series(D,G)); title('PD-Control')
cltf = feedback(series(D,G), [1], -1);
hold on; plot(real(roots(cltf.den{:})), imag(roots(cltf.den{:})), 'rx'); hold off;
subplot(4,2,4); step(cltf*10,0.4); title('PD-Control Kp=120 Ki = 1.1');
% PI-control
numD = [1 100]; denD = [1 0]; D = tf(numD, denD);
subplot(4,2,5); rlocus(series(D,G)); title('PI-Control')
cltf = feedback(series(D,G), [1], -1);
hold on; plot(real(roots(cltf.den{:})), imag(roots(cltf.den{:})), 'rx'); hold off;
subplot(4,2,6); step(cltf); title('PI-Control');
% PID-control
numD = conv([1 200+200j], [1 200-200j]); denD = [1 0]; D = tf(numD, denD);
subplot(4,2,7); rlocus(series(D,G)); title('PID-Control')
cltf = feedback(series(D,G), [1], -1);
hold on; plot(real(roots(cltf.den{:})), imag(roots(cltf.den{:})), 'rx'); hold off;
subplot(4,2,8); step(cltf); title('PID-Control');