Embedded Systems October 2000 Vol13_11

Issue link:

Contents of this Issue


Page 103 of 181

When I presented the code fOI" a diffe rential element I mentioned that the output is proportional to the posi- tion change divided by the sample time. If the position is changing at a con tant rate but your sample time vari es from sample to sample, you will get noise on your diff erential term. Since the differential gain is usually high, this noise wi ll be ampli fi ed a great deal. When you use diffe rential control you need to pay close attention to even sampling. I'd say that you want the sampling interval to be consistent to within 1 % of the total at all times- the clo er the bette r. If you can't set the hardware up to e nforce the sam- pling interval, design your software to sample with very high priority. You do n't have to actually execute the con- troller W;ilh such rigid precision-just make sure the actual ADC conversion happens at the right time. It may be best to put all yOUI" sampling in an ISR or ve!")' high-priority task, th en execute the control code in a more relaxed manner. Differential control suffe rs from noise problems because noise is usual- ly spread relatively evenly across the frequency spectrum. Control com- mands and plant outputs, however, usually have mo t of their content at lower frequencies. Proportional con- trol passes noise through unmolested . In tegral control averages its input sig- nal, which tends to kill noise . Differential control enhances high fre- quency signal , so it enhances noise. Look at the differential gains that I've set on the plants above, and think of what will happen if you have noise that makes each sample a little bit differ- ent. Multip ly that little bit by a diffel" - FIGURE 13 2.5 2 I j ~ "- c: 1.5 11 ,i 'v; 1.5 ' 0 1 1 - 0.5 0 0 2 Time _ __ • pGain = 2, iGain • pGain = 5, iGain pGain = 2, iGain pGain = 2, iGain Input 3 4 = 0.01 = 0.01 = 0.005 = 0.002 5 '" ential gain of 2,000 and think of what it means. Yo u can low-pass filte r your diffe r- -:. -:. -:. . '. ---- ential o utput to reduce the noise, but this can severely affect its usefu lness. The th eory behind how to do this and how to determine if it will work is beyond th e scope of thi s articl e. Probably the be t that you can do abo ut this problem is to look at how likely you are to see any noise, how much it will cost to get quiet inputs, and how badly you need the high per- formance that you ge t from differe n- tial control. Once you 've worked this Ollt, you can avoid differential con- trol altogethe r, talk your hardware folks into getting you a lower noise input, or look fo r a control systems expe rt. The full text of the PID conu"oller code i shown in Listing 1 and is avail- able at html. 102 oaOBER 2000 Embedded Systems Programming

Articles in this issue

Archives of this issue

view archives of EETimes - Embedded Systems October 2000 Vol13_11