0
\$\begingroup\$

How do you diagnose a PID controller that seems to work perfectly for a few minutes, then decays?

I've tuned a PID controller using the Ziegler–Nichols method. I found my Ku of -1 and Tu of 1.142. I then plugged these values into the classic ZN PID formula. My process variable is a target speed, and within seconds of starting it, the controller maintains this speed perfectly. However, I log the errors for each component, and after a few minutes, the integral error slowly builds. When it reaches around 7, after about 15 minutes of running, then the controller quickly decays, and the velocity drops to zero.

I've tried adjusting my Ku and Tu, and re-running through ZN, but the same thing happens. I'm not sure what I'm doing wrong, especially since it runs virtually perfect at the start. It has almost no over or undershoot, but yet the integral errors builds up. Is this a rounding error? Should I reset this periodically or would that be a hack? What might I be doing wrong?

\$\endgroup\$
  • 1
    \$\begingroup\$ More details would be needed. Is this a commercial product or something you built? Sounds like the integral is hitting a power rail maybe? And why does it keep growing? What happens if you turn off the integral function? P-only. \$\endgroup\$ – George Herold Aug 30 '17 at 15:00
  • \$\begingroup\$ @GeorgeHerold It's something I built. It's essentially a type of motor. The controller times a magnetic pulse to maintain a certain rotor velocity. However, the process variable is non-linear. If I disable the integral component, then it's stable near indefinitely, but it never reaches the target speed. \$\endgroup\$ – Cerin Aug 30 '17 at 15:03
  • \$\begingroup\$ Yo do need a feedforward path. It's a combined system, the controller just balances the error, while the setpoint value can be feed forward through a LUT calculation. So, even P control is possible. \$\endgroup\$ – Marko Buršič Aug 30 '17 at 15:34
  • \$\begingroup\$ @Cerin, your PID is implemented in software? What about Marko's answer below? \$\endgroup\$ – George Herold Aug 30 '17 at 17:54
0
\$\begingroup\$

Poor PID implementation algorithm, or what's more probable cause is that sample rate is too high for selected precision of floating point unit. When you accumulate the float numbers, their mantissa and exponent have to be shifted to add numbers. At high sample rate, the integrator increment is very small compared to the accumulated variable, so it is rounded.

| improve this answer | |
\$\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.