PID question
Tapperman
Posts: 319
Analog equivalent to digital PID:
I was reading the write up on the sticky about PID ... very cool presentation BTW ... and I happened across a 'filter' circuit discussion for A/D sampling. They gave a circuit that I care little about the subject at hand ... but, noticed something in the design.
Well, to make a short story long, I noticed the circuit (see attach) has what appears to be all 3 elements in its feedback loop. Am I off base here?
... Tim
PS - feedback for the coefficient seems to be negative?
I was reading the write up on the sticky about PID ... very cool presentation BTW ... and I happened across a 'filter' circuit discussion for A/D sampling. They gave a circuit that I care little about the subject at hand ... but, noticed something in the design.
Well, to make a short story long, I noticed the circuit (see attach) has what appears to be all 3 elements in its feedback loop. Am I off base here?
... Tim
PS - feedback for the coefficient seems to be negative?
Comments
I was happy about that because the discrete time approach seemed like it made the calculus aspects digestible. I never figured out a way to do that for a general audience with Laplace domain expressions like what's in your attachment.
As for your filter, I do remember tuning those back in college (15 years ago now), and recall something about expressing it with a second order polynomial in the denominator for PID tuning... Hmmm, it might take more hours than I have to refresh on that right now... Ah, here we go, a Google Search for PID and Sallen-Key delivered this nugget:
http://books.google.com/books?id=3WvnAgAAQBAJ&pg=PA517&lpg=PA517&dq=PID+sallen+Key&source=bl&ots=ibWMtC2DGR&sig=_i0jCJLnlt7E4Z-UD9W1AUqqNlM&hl=en&sa=X&ei=mQTtU-C5FpD_oQT_jYGgBg&ved=0CBwQ6AEwADgK#v=onepage&q=PID%20sallen%20Key&f=false
Like limiting the amount the integral term can accumulate, limiting the history to a certain number of samples is another way of preventing the integral term from accumulating too much under certain conditions, and you can still limit the final value it adds up to. You would want to take enough samples so that they add up to a high enough value to take over when proportional is unable to push the system past that minute error and all the way to the set point. You'll want to adjust the value of Ki so that it tends to correct the system to the set point. If Ki x I can get too large, you might see overshoot (over correction) and even oscillation (over correct in one direction, then over correct in the other direction) around the set point.
Andy
Andy,
Before you make any changes ... would you 'consider' looking at my moon tracker?
I have the same issues when tracking ... However, since my robot doesn't know where the moon really is ... I can not use 'proportional', as the difference between where it is and where it should be is not known. So, I rely on the integral of 'errors' (you'll have to see how I define 'error', in my application) to tell me where the moon is.
Clearing after a period of time or limiting its size or only the last 3 etc, may be the wrong suggestion ... depending on the application. But, those techniques may work well in others.
http://forums.parallax.com/showthread.php/133265-Lunar-Tracker?p=1289327#post1289327
... Tim
@macrobeak
I’m responding to your message because I had the very same question about the integral that you have. And since most of us drive cars, I thought I’d use this as an analogy to help explain what I discovered about that single element, of the three terms in the feedback loop.
If you drive a car that has a ‘cruise control’ built in … then you are using a form of PID. After you set the speed, the control attempts to keep your speed constant.
But we drive on terrain that is not always flat, chances are you may have to adjust the throttle. And, when the car must go up a gentle incline … the accumulated error increases and adds more throttle. When the slope changes back to level, the accumulated error goes down (by adding negative errors) and the car continues at a speed where the instant error is zero … but the accumulated error is not zero. In fact, while the cruise control is being used, the accumulated error never reaches zero. As long as you have throttle, you have accumulated error.
I hope this helps visualize PID as I see it. After all, I could be wrong.
... Tim
PS - If loads were always constant ... we would have no need for PID