1
$\begingroup$

I'm struggling to see how Integral gain is used for motor positioning (with an encoder on the shaft).

Suppose we have an AC motor connected to a winch which drives an object forwards and backwards. At 0 speed and 0 torque, there is no movement.

Now, using Proportional gain, we can drive the motor to a position and as it approaches the setpoint, the output to the motor decreases. The motor hopefully lands close to the setpoint.

If we use Integral gain, where the error accumulates, when we reach the setpoint the value of I is still high and the motor overshoots (even with very little ki). This wouldn't be a problem if the motor required a non-zero voltage to maintain its position (e.g. using the motor as a hoist).

A basic solution I've come up with is to use Integral gain to "push" the motor to its setpoint (effectively correcting the steady-state error), and when the motor is "close enough" to the setpoint, set the output to 0.

Is this a commonly used method? Are there any other approaches?

$\endgroup$

1 Answer 1

1
$\begingroup$

At 0 speed and 0 torque, there is no movement.

Correct, but, consider what would happen if the winch was not perfectly level when it was installed. In that case, the object would pull on the winch, like a car trying to roll downhill if left in neutral.

If your winch were setup to only use a proportional gain, then the position would "droop" from the ideal/setpoint until such a position was reached that the object's torque matched the torque provided by the proportional controller's output.


Even if your winch were perfectly level before installation, the system will have friction, and that friction will prevent a purely proportional controller from ever achieving the desired setpoint. At some point, the proportional gain simply won't result in enough torque to overcome the system friction and get to target.

You could increase the proportional gain to push the system closer to target, but this is a bad idea because it's going to make your system way more sensitive to large steps in command position, to the point that you could drive your system unstable.

Besides stability issues, the integral term automatically pushes the system for you - an integral term "watches" the error. If it "looks" at error and sees you're not in position, then it automatically pushes a little harder.

Once the integral term sees you're in position, it stops increasing the applied force. Whatever it had been applying is retained, and this is what makes up for position droop.

It is possible for an integral term to send you into instability, but that would only happen if the integral gain were too large for your system and you can get the same instability from a strictly proportional controller if the proportional gain is too high.

If you're struggling to tune the system, then I would refer you to the Ziegler-Nichols method. From that page,

This tuning rule is meant to give PID loops best disturbance rejection.

It yields an aggressive gain and overshoot – some applications wish to instead minimize or eliminate overshoot, and for these this method is inappropriate. In this case, the equations from the row labelled 'no overshoot' can be used to compute appropriate controller gains.

If that's not quite what you're looking for, then I would highly recommend some form of model-based control, like a feed-forward controller. You can use both feed-forward and PID (and I have, to great success!)

Feed-forward control allows you to exploit your knowledge of the system to get better performance by being proactive, rather than waiting for setpoint errors to appear as in a reactive PID controller. For example, if you know you want to accelerate your 10 kg load at 1 m/s^2, then you already know the winch should output (10*1) = 10 N of force. You don't need to wait for the position errors to appear before applying that 10 N of force.

Once you're using feed-forward, you apply PID control to whatever error is left, and in this way your PID controller is only really making up for modeling errors. The PID controller will make up for any friction you failed to account for, any errors in your load mass (e.g., if it's 9 kg instead of 10 kg), etc. Your PID controller is no longer doing the "heavy lifting" of getting the bulk positioning response, so it should be much less sensitive to large step changes. Since it's only performing a positioning error adjustment, you can tune the PID controller much more aggressively than if it were trying to also perform the bulk motion.

$\endgroup$
6
  • $\begingroup$ Thanks for your answer. In reality, I'm testing this with an AC motor with no load on the shaft, so at 0 speed/torque there is no movement. I am finding that Integral gain helps "push" the motor to its target position, but then it overshoots. Even with very little Ki, what's to stop it from overshooting, as there will be non-zero Integral as it passes the setpoint. Did my idea of setting the output to 0 (turning off the motor) seem sensible? $\endgroup$
    – 19172281
    Apr 8, 2020 at 13:11
  • 1
    $\begingroup$ @19172281 - One of my favorite lines is, "If it's stupid, and it works, then it's not stupid." That said, if all you have is a motor with no load, then you're probably wasting your time trying to tune a positioning controller. PID controllers don't "know" anything about the systems dynamics, which means that the performance will vary (sometimes dramatically) when the system configuration is changed. My advice would be to wait until you've got a system to test to start doing any tuning. $\endgroup$
    – Chuck
    Apr 8, 2020 at 14:18
  • $\begingroup$ Without a load and using Proportional gain only, the motor follows its generated trajectory very well, and lands close enough to its target position. Perhaps my problem is trying to use Integral gain where it's not needed. Even so, hypothetically, in a system where 0 speed/torque = no movement, how would you use Integral gain, as it will always overshoot? Are there other methods to the one I suggested? $\endgroup$
    – 19172281
    Apr 8, 2020 at 14:28
  • $\begingroup$ I've also decided to use Integral gain only at the end of the trajectory, where the setpoint is constant. I don't think it's of any use when the setpoint changes so frequently. Is that a valid observation? Cheers $\endgroup$
    – 19172281
    Apr 8, 2020 at 14:32
  • $\begingroup$ @19172281 - Again, let me preface this by saying that I'm worried you're wasting your time tuning a position controller for a decoupled motor. That said, the Ziegler-Nichols tuning method I linked in the answer should help you find the gains you need to get the performance you want, but generally PID controllers will always overshoot at least once and again you're going to find performance variations as your step changes vary in magnitude. $\endgroup$
    – Chuck
    Apr 8, 2020 at 14:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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