EETimes

Embedded Systems October 2000 Vol13_11

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

Contents of this Issue

Navigation

Page 93 of 181

{ } The reason I pass the error to the PID update routine instead of passing the command is that sometimes you want to play tricks with the error. Leaving out the error calculation in the main code makes the application of the PID more universal. This func- tion wi ll get used like this: position = ReadPLantADC(); drive = UpdatePID(&pLantPID, pLantCommand - position, position); DrivePLantDAC(drive); doubLe pTerm; Proportional Proportional control is the easiest feedback control to im pleme nt, and simple proportional control is proba- FIGURE 5 Precision actuator position vs. time . . # # # # # 0.8 , c: 0.. :;: 'iii 0 0 0.6 !1" a ., bO 0.4 1 0.2 i o o 1Il-' .-~~~ .. FIGURE 6 ,I ! ",'" lI---'--=--------~-- 0.2 ...... .. .. .. .. .. -----.-=-- , -# 0.4 Time .-# # -# - # : # # # # : # # # # # bly the most common kind of control loop. A proportional controller is just the error signal multiplied by a con- stant and fed out to the drive. The pro- portionalterm gets calculated with the following code: pTerm pid->pGain * error; return pTerm; Figure 8 shows what happens when you add proportional feedback to the motor and gear system. For small gains (kJi = I ) the motor goes to the con-ect target, but it does so quite slowly. Increasing the gain (h/I = 2) speeds up the response to a point. Beyond that point (h/I = 5, h/I = 10) the motor starts -~-- 0.6 0.8 out faster, but it overshoots the target. In the end the system doesn't settle out any quicker than it would have with lower gain , but there is more overshoot. If we kept increasing tile gain we would eventually reach a point where th e system just oscillated around the target and never settled out-the system would be unstable. The motor and gear start to over- shoot with high gains because of the delay in the motor response. If you look back at Figure 2, you can see tllat the motor position doesn't start ramp- ing up immediately. This delay, plus high feedback gain, is what causes tile ove rshoot seen in Figure 8. Figure 9 shows tile response of the Vt ----------------~ + precision actuator Witll proportional feedback only. Proportional control alone obviously doesn 't hel p th is sys- tem. There is so much delay in tile plant that no matter how low the gain is, the system will oscillate. As the gain is increased, the frequency of tile out- put will increase but the system just won't settle. Figure 10 shows what happens when you use pure proportional feed- 92 OCTOBER 2000 Embedded Systems Programming

Articles in this issue

Archives of this issue

view archives of EETimes - Embedded Systems October 2000 Vol13_11