Designing a digital speed controller for a DC motor By: Thu Nguyen van Dept. of Automatic Control Hanoi University of Technology Vietnam
Abstract: Controlling the speed of a DC motor is a classical problem in both electrical field and in automatic control. There have been many types of controllers from simple to complex, from analog to digital; This paper only introduces an approach to the solution. To monitor the speed and get high quality, we must control the torque of the motor by means of manipulating its armature current. Thus we have a cascade controller in which the inner loop controls the motor armature current and the outer one handles the speed. The both loops are analyzed and designed in the z-plane using the most advantage method which the z-plane provides. Modeling of the DC motor: We have a DC motor with the parameters from [1]: Moment of inertia: J= 0.012 kg.m2 Electric resistance: Ra= 250 mΩ Electric inductance: La= 4 mH
Back EMF constant: ke= 236.8 Mechanical constant: kM= 38.2 Flux ψ= 0.04 V.s The equations describing the motor are shown as follow:
Armature voltage: Back e.m.f: The Speed: Torque of the motor:
Designing the current control loop When designing the current loop, which is much faster than the speed one, the variation of the back emf eA, therefore, can be neglected. Then the current loop has the block diagram as:
Block diagram of the current control loop
numGrz(z)
Vtb
1/Ra
denGrz(z)
Ttb.s+1
Ta.s+1
Transfer Fcn
Transfer Fcn1
Discrete Filter
Zero-Order Hold
With the smallest time constant in the loop is Treg= 5 mS, I choose the sample time of the loop to be Treg/10= 0.5 mS. Then we can derive the transfer function of the open loop in S-plane as:
Using Matlab to get the transfer function of the loop in Z-plane assuming that we use the ZOH and the sample time is Tsample= 0.5 mS we obtain:
Now we are designing-finding the transfer function-of the controller. As mentioned above, the current loop must be very fast compared to the speed loop. To obtain this small time constant, I choose Deadbeat method to meet the requirement. In the Deadbeat method, the objective of the design is to have the error between the desired value, the reference, become zero after a number of cycles. Because
Then this can only achieved when GW(z) is a finite polynomial with coefficients having sum equals 1. We
have
GW(z) is a finite polynomial only when GU(z) can cancel A(z-1), this means GU(z)= L(z-1)A(z-1) where L(z-1) is a finite polynomial Then we will have
With this assume, we can find the controller from G u(z)
So the work now is to design L(z-1). We now list what we must consider when designing L(z-1): o The order of GR equals to the order of L times the order of A, for the processing speed and the size of memory of the controller, the order of L must be as low as possible o The closed loop transfer function , as mentioned above, must have its coefficients sum equals unity, this also means or
where bj is the jth coefficient of B(z-1)
o We also care about the control variable, u in this case; it must not be too large so that the cost for the regulator can be reduced and its life will be as long as possible.
With all these considerations, a first order of L(z -1) should be the bes, because a zero order L(z-1)= l0 has no effect on the control variable and a order of two may be too high. So we have:
Where
The control variable:
Thus Where
are the two coefficients of the denominator A(z -1).
In case we will choose and so that in the first two cycles, the values of the control variable, u, are the same so that it is milder. We obtain:
This yields:
Apply to this case we have:
Then the transfer function of the controller is:
The figure below is the simulation of the current control loop in Simulink We found that in the simulation condition, the performance of the loop meets the requirement that the time constant must be as small as possible. The output keeps up with the input-set point-after three cycles.
24
4
5*10^-3s+1
16*10^-3s+1
Transfer Fcn1
Transfer Fcn
num(z) den(z) Step
Zero-Order Hold
Discrete Transfer Fcn
Scope
Simulation of the current control loop
Transient response of the moment loop 1.4 1.2
Output Moment
1
0.8 0.6
0.4
0.2
0
0
0.5
1
1.5
2
2.5 Time
3
3.5
4
4.5
5 x 10
-3
Designing speed control loop Being satisfied with the performance of the current we now approach the designing of the controller for the motor speed, which is the ultimate objective of the work. Block diagram:
Block Diagram for the DC motor speed controller
W*
Vr(z)
numGrz(z)
1 Grw
denGrz(z) Zero-Order Hold1 T=Tw
Gri
Zero-Order Hold T=Ti
Vtb
1/Ra
Ttb.s+1
Ta.s+1
-K-
1
speed
J.s
W
kM*Psi
rectifier -K-
The sample time in this loop is chosen to be ten times the sample time of the current loop; Tw=10Ti= 5 ms. Since ten cycle in the current loop equals to one in speed loop whereas the settling time of the current loop is only three cycle, the current loop can be neglected when designing speed controller, in other word, we can consider its transfer function to be unit. The transfers function of the speed open loop in S-plane and in Z-plane:
Now there are two options for designing the controller: to meet the set point requirements, or to meet the noise cancelation requirements. First, I design a controller for best response to the set point signal-the input speed-trying two approaches and then I try designing for noise cancelation. The first approach to designing the controller is using a PI controller with its optimized parameters. The transfer function of the PI controller has the form:
My professor gave me a optimal value as:
and Where VS and a1 are from the open loop transfer function we are designing
That is VS= 0, 6366 and a1= -1 Therefore we have
Thus
This method yields a result that the controller is a gain and the integration is omitted, this happens because the plant itself has a integral part in it, therefore, only a proportional term is need from the controller. Apply the speed controller, which is actually a proportional with a gain of 1,5708, to the loop and simulate in Simulink, I have the curves:
Block Diagram for the DC motor speed controller
Step
Vr(z)
numGrz(z)
Vtb
1/Ra
1
denGrz(z)
Ttb.s+1
Ta.s+1
Grw
Zero-Order Hold1 T=Tw
Gri
Zero-Order Hold
-K-
speed
1 J.s
kM*Psi
rectifier
T=Ti
W
-K-
Armature Voltage
Armature Current
i
Speed response for step input
1
Speed (rad/s)
0.8
0.6
0.4
0.2
0
0
0.02
0.04
0.06
0.08
0.1 Time (s)
0.12
0.14
0.16
0.18
0.2
Armature voltage with step of speed 10 8
Armature Voltage (V)
6 4 2 0 -2 -4 -6
0
0.02
0.04
0.06
0.08
0.1 Time (s)
0.12
0.14
0.16
0.18
0.2
From the curves we can see that the speed response is quite good though it has a bit not very “perfect” in the early. There is no steady state error and the time the output reaches and stays with the reference is around 0.09 s, a quite good result. And in the second figure, we see that the armature voltage is less than 9V, while the nominal voltage of the motor and the rectifier is 24V. That is also a good result. Summary: o I have introduced an approach to designing a speed controller for DC motor with two control loop, the inner loop for moment and the outer one for speed. o The moment loop must be very fast and was designed using Deadbeat method; The speed controller was simply a gain with the optimal value
o The moment closed loop and the whole controller were modeled and simulated in Matlab/Simulink and a good result was accomplished. o It can be inferred that in the simulated condition, the controller do the work well; and the design principle can be trusted.
Reference: [1]. Quang, NP: Matlab va Simulink cho Ky su Dieu Khien Tu Dong. Khoa Hoc Ky Thuat, Ha Noi, 2008. [2]. Ibrahim, D: Microcontroller Based Digital Control. John Wiley & Sons, 2006.