Embedded Systems October 2000 Vol13_11

Issue link:

Contents of this Issue


Page 105 of 181

Tuning The nice thing about tuning a PID contro ller is that you don't need to have a good understanding of formal control theory to do a fa irly good job of it. About 90% of the closed-loop controller applications in the world do ~~m· ~·~M·~·~~ 1.2 , , ., , , 0.8 .a ., ~ Q. E ~ 0.4 0.2 0 , I - "I - - • pGain = 2. iGain Command __ • pGain = 1. iGain 2 3 TIme 4 = 0.1 - - • pGain = 2. iGain = 0.05 _ pGain = 2. iGain = 0.02 = 0.02 Lo.......,,-..,.....- _______ _ 0 5 6 ~ 0.6 ______ very well indeed with a controller that is only tuned fairly weI l. If you can, hook your system up to some test equipment, or write in some debug code to allow you to look at the appropriate variables. If your system is slow enough you can spi t the appro- ~ ________________________ priate variable out on a erial port and graph them with a spreadsheet. You want to be able to look at the drive output and the plant output. In addi- tion, you want to be able to apply some sort of a square-wave signal to the command input of your system. It is fairly easy to write some test code that will generate a sui table test command. Once you get the setup ready, set ~~ all gains to zero. If you suspect that you will not need differential control (like the motor and gear example or th e thermal system) then skip down to the section that discusses tuning the proportional gai n. Otherwise start by adjusting your differential gain. The way the controllel' is coded you FIGURE 1 Motor and gear with PI control and windup' ." .... , '. , 1.5 - - Command Posit ion - - • Drive __ • Control I i ' r :1 :;:; .;;; c: o ~ 0.5 ···f - ----~~-..;..-~--=:::::===----..;.'I I! :;1 :ii I I -----:----- 01 o -0.5 Io....,-~.--- .. --. 5 o :!! :ii ~. I "-".,.-~-_-_41 1 ___ .. I , 10 Time I 15 20 ,!I '!! 'I, II f ~ ; Ii cannot use differential con 0'0 1 alone. Set your proportional gain to some small value (one or less) . Check to see how the system works. If it oscillates with proportional gain you should be able to cure it with differential gain. Start with about 100 times more differential gain than proportional gain. Watch your dlive signal. Now start increasing the differential gain until you see oscilla- tion, excessive noise, or excessive (more than 50%) overshoot on the drive or plant output. Note that the oscillation from too much diffe rential gain is much faster than the oscillation from not enough. I like to push the gain up until the system is on the verge of oscil- lation then back the gai n off by a facto r of two or four. Make sure the drive sig- nal still looks good. At this poin t your system will probably be responding very sluggishly, so it's time to tune the pro- portional and integral gains. If it isn't set already, set the propor- tional gain to a starting value between 1 and 100. Your system will probably either show terribly slow performance or it will oscillate. If you see oscilla- tion, drop the proportional gain by factors of eight or 10 until the oscilla- tion stops. If you don't see oscillation, increase the proportional gain by fac- tors of eight or 10 until you start see- ing oscillation or excessive overshoot. As with the differential cono'oller, I usually tune right up LO the point of 104 OCTOBER 2000 Embedded Systems Programming

Articles in this issue

Archives of this issue

view archives of EETimes - Embedded Systems October 2000 Vol13_11