The question I am asking is that, what is the effect on stability of increasing or decreasing both the sample time and lagging of error signal to PID. Does it helps in stability or degrade it?
2 Answers
A PID can provide great control, but it's a very unsophisticated technique -- it only understands error and correction. The longer you wait between measurements, the larger your error will be each time. (No surprises here, right? It's the difference between moving 60 miles every hour and moving 1 mile every minute.)
The best performance that you can get from a PID happens when it runs (1) as fast as your sensor can supply accurate measurements, or (2) as fast as your actuator can make accurate adjustments -- whichever is slower. If your sensor measurements aren't updating between PID ticks, your PID will overcompensate. If your actuators aren't updating between PID ticks, you will notice that your PID gains only work for a limited range of the output (e.g. it works fine at 75% thrust but goes crazy at 55% or 95%).
Regarding accuracy: it may be necessary to average out individual measurements from a noisy sensor, which sacrifices the sample rate. If that's the case, there really isn't much you can do here except lower your maximum speed. You can experiment a bit to see how much averaging is sufficient for your application, but you can't really get around the limitations of the hardware itself.
-
$\begingroup$ Could you elaborate that bit in the last line of your second paragraph? About actuators being slower creating limited effective PID range? $\endgroup$– a-JaysOct 19, 2015 at 17:26
-
$\begingroup$ Sure. Think of the lag as a non-linear effect on your system, similar to a dead band or a stick-slip cycle. In that scenario, the $K_d$ component can line up with that lag effect over some range; you can tune as normal and things will appear to work fine. But when you move out of that range, things will seem to be out of tune again. There are many, many nonlinear effects to watch out for (like I said, PID is very unsophisticated), but I mentioned this one because it relates to lag. $\endgroup$– IanOct 19, 2015 at 18:58
-
$\begingroup$ Interesting! That makes me want to revisit PID controllers in a more critical and contrasted analysis. Any directions you could recommend? $\endgroup$– a-JaysOct 21, 2015 at 3:43
-
$\begingroup$ Most of what I know comes from hands-on testing, not the literature. (And with a hardware system that's already set in stone, your options are limited: to slow down the PID frequency, decrease the operating range, or try to improve your actuation model -- usually some hack -- to make things fit what a PID expects.) I'd look for articles on finding the proper PID frequency for a given system. $\endgroup$– IanOct 21, 2015 at 16:46
In general, a system that is "discrete" will always be less stable, the less samples per time, the less stable it will be.
Imagine you are driving a car. You are only allowed to turn the steering wheel every 10 minutes. Can you keep the car on a curvy road this way?
To expand the example to answer your second question: don't drink and drive. If your sensors are lagging, your ability to control the car are evidently reduced.
-
$\begingroup$ ok, so the sample rate is proportional to stability; but the sensors on high sensitivity gives more noise while on lower sensitivity(lagging signal) gives less error. So what do to with that. that is: non lagging => noise. lagging => lesser noise. $\endgroup$ Oct 9, 2015 at 11:01