EETimes

Embedded Systems November 2000 Vol13_12

Issue link: http://dc.ee.ubm-us.com/i/71849

Contents of this Issue

Navigation

Page 20 of 189

Don Morgan The Control Loop In this se ri es on motion conu·ol, we have already discussed permane nt magnet brushed and brushless motors, PWM, and seve ral control techniques. This month, we will exam- ine some of the details behind the controller algorithms involved in pro- portional-integral-de rivative (PID) d esigns. I'll introduce and defin e some terminology, as well as provide some generally accepted tuning tech- niques for these algorithms. Many controllers a re availabl e on the ma rke t. You may even be design- ing your own . The descriptions pro- vided he re will apply generally, but pecifi c implementations of the algo- ri thms vary, as does terminology. The control loop In Figure 1, we have a simple block diagram of a sys tem featuring a con- trol and a machine. The drive, or power converte r, is the device used to a pply powe r to a system. We di s- cus ed such a sys tem in Ia t month 's column. ("Hijacked !" October 2000, p. 149.) Disturbance is a tet·m we' ll use to identify the interactive and reactive elements involved in the machine. This may include changes in load, tempe rature, fri ction , or whatever might affect the performance of the machine. The plant is responsible for the system response; it is usually passive and dissi- pates power. In our case it is some kind of motor connected to a load. A motor integrates the drive from the power con- verter and is thus something like a low pass filter with inherent phase lag. Feedback can come from different types of sensors. It's specific to the activity of the machine and could be anything from an accelerometer to a laser. In the system we' ll be looking at, feedback comes from an encoder. The heart of the conu·oller lies in the implementation of control laws. If you say the output of a black box is equal to one-half the input, thi is that box's control law. A number of elements are missing from this alg01ithm, including sat·ura- tion control fo(l the integral term and filtering for the derivative term, but the fundamental concept should be appar- ent. Note that dt is the rate at which we update the PWM generator in the drive. This rate is dependent on the application. You would need a faster servo update rate to servo, say, a feath- er than you would for a battleship. Tuning a PID controller is pretty straightforward, once you know how to start and what steps to follow. The standard equation for PID control is: U[t] = Kd de + K pe[t] + K; Jx= 1 cit x=O e[x ]dx In thi s equation, e is th e e rroL Erro r is derived from th e feedback. Kp, K;, and Kd each represent a constant coeffi cie nt. The subscripts represent tha t with whi ch th e coefficient is associated . A pseudocode snippe t fo r this algorithm might look like this: error = cmd - actl; sum = oldsum + error; U Because phase lag is so important to the stability of a servo system, let's take a moment to clarify its meaning. A phase lag might be described as delay between a reference signal and a mea- sured signal. In signal processing, we sometimes call this phase angle, phase delay, or phase displacement. Pe ri odic signals are often mea- Kp*error + Ki*sum*dt + Kd*(error-olderror)/dt; olderror = error; oldsum = sum; sured in degrees or radians. In Figure 2a, you see two square waves. The top wave is marked in degrees. Now, sup- pose one of the waves in Figure 2a is the input to a black box and the other wave is tl1e output. The box does noth- ing to the signal. It doesn't even delay it. These two signals are in jJhase, which means they begin at tl1e same point and both edges are po itive. Figure 2b illustrates a black box wi th a fixed delay. If we input our Embedded Systems Programming NOVEMBER 2000 19 Phase lag

Articles in this issue

Archives of this issue

view archives of EETimes - Embedded Systems November 2000 Vol13_12