0
\$\begingroup\$

New to using PIDs. When normalizing a range, we would need to know the maximum and minimum of that range. Since a PID is summing the error in the I portion wouldn't the range be potentially infinite? How would we limit the output to the expected range, (-1 to 1 in my case). Would we also need to normalize the error that is passed in?

\$\endgroup\$
  • \$\begingroup\$ Yes, 'integrator wind-up' is a common problem encountered in PID controllers. The output doesn't go to infinity though! It limits at the max/min values determined by the hardware. There's been plenty published on this topic, and there are several ways of mitigating the problem. Google it. \$\endgroup\$ – Chu Dec 6 '18 at 15:19
1
\$\begingroup\$

In the textbook PID controller, the output is not limited. In a real PID controller the output has saturation limits. Normally you should at least stop integrating when the output is saturated, otherwise the integral term will "wind up" and cause a large amount of overshoot.

I write "at least" because there are other algorithmic barnacles that are often added onto the PID calculation to reduce or eliminate the overshoot or undershoot that would happen even with an ideal controller.

The "velocity" form of the PID controller relies on the output actuator to perform the integration so it does not have that particular problem, however then you have to calculate the derivative for the P term and calculate the 2nd derivative for the D term, which is not easy to do in practice.

\$\endgroup\$
  • \$\begingroup\$ So you would calculate the output. If it is out of bounds, set it to the bound, and subtract the error from the integrator? \$\endgroup\$ – Danny Dec 6 '18 at 14:56
  • \$\begingroup\$ If you're doing a discrete time calculation you can just not add the error onto the integral term if the output has hit a limit. That may be good enough. \$\endgroup\$ – Spehro Pefhany Dec 6 '18 at 14:59
  • \$\begingroup\$ I was adding the error into the integrator before calculating the output, so I would just be undoing that if I subtracted the error if output hit a limit. Is it typical to add the error after calculating output (it would only make a small difference) in which case I would then just not add it in? Thanks! \$\endgroup\$ – Danny Dec 6 '18 at 15:07
  • \$\begingroup\$ It doesn't much matter, the incremental change should be small or your control loop will probably be unstable. \$\endgroup\$ – Spehro Pefhany Dec 6 '18 at 15:08
0
\$\begingroup\$

After more research, I believe to clip the output to the maximum and minimum values and further research "integral windup" to combat the issues that will cause.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.