. 
PID Tuning:

100 Count Step Commanded
(Trapezoidal move, 1e10 accel, decel, vel) 
Green  Commanded Position Yellow  Actual Position Red  Position Error White  DAC Output 
GOAL: To find the largest Kd value that can be used to command a step without getting any oscillation and then turn down Kd to a fixed amount (approx. 1/3 of the limit value).
Starting with a small Kd (what is a good value to start with?), command a step. Look and listen for oscillation. If you can see oscillation in MoScope or hear or see an objectionable oscillation from the motor, turn Kd down and repeat. If you can not find oscillation, turn Kd up and repeat. Stop when you find the largest Kd you can command a step with and get no oscillation. After you find this limit Kd value, turn it down a fixed amount. I find setting Kd to 1/3 of the limit value is a decent place to start. You can try turning Kd down less if you need more performance. Keep in mind that the less you turn down Kd, the less stable your system will be. At some point, if Kd is too large, you will get oscillation (buzzing, humming, etc). Remember that if you are tuning for production, you will get a stage that is less stable at some point. Leave your self some breathing room for this stage by not pushing Kd too much.
Small, high frequency oscillations sometimes are hard to see on position plots. DAC output plots can sometimes be easier to see the oscillation. Remember, you are looking to find the limits of how high you can turn up Kd, not to find the most accurate motion. A Trust TA 9000 will be used for the following examples, unless noted (http://www.trustautomation.com).
Acceptable motion on 100 count step move 
Green  Commanded Position Yellow  Actual Position Red  Position Error White  DAC Output 


Excessive oscillation on 100 count step move 
Green  Commanded Position Yellow  Actual Position Red  Position Error White  DAC Output 


In this example instability is found, both in MoScope and very audibly at Kd > 6000. Let's turn down Kd by 2/3 (6000 / 3 = 2000) and continue to tuning Kp.
GOAL: To turn up Kp until there is half the overshoot of a step command.
When tuning Kp, look for two things as a sign of a Kp limit: Ringing of 45 oscillations on step command Buzzing or other undesirable audible noises
Pay attention to the control output levels (DAC output). When the control output starts clipping, the actual position will start oscillating. To get a fair idea of how resonant the actual position is, keep the control output out of clipping. To do this, lower the size of the step command. An example:
image here


Excessive oscillation on 100 count step move 
Green  Commanded Position Yellow  Actual Position Red  Position Error White  DAC Output 


Acceptable overshoot (26%) on 100 count step move 
Green  Commanded Position Yellow  Actual Position Red  Position Error White  DAC Output 


Reducing the commanded step improves the settling picture somewhat. During tuning, attention should be paid to keeping the clipping of the DAC. Keeping the DAC command out of clipping (mostly) reduces the number of overshoots from 9+ (above) to 7/8 with no change in Kp.
Once you have tuned Kp, start to tune Ki. Set ImaxMoving
and ImaxRest to the same value as Output Limit. In this case Output Limit
is 32767.
 ImaxMoving
= ImaxRest = Output Limit = 32767
Ki is the last closed loop parameter, so we will want to turn up Ki until we get the specified overshoot. Turning up Ki will close the steady state error.
Acceptable overshoot (50%) on 100 count step move 
Green  Commanded Position Yellow  Actual Position Red  Position Error White  DAC Output 


In a PID system, the proportional (Kp), derivative (Kd), and integral (Ki) terms all contribute to the total controller output (the three terms are added together). When a system oscillates at low frequency (the frequency varies, but is often a few Hertz lower), the integral term is likely the term that is oscillating. Kp and Kd are along for the ride are not affected. In an effort to control an oscillation due to the integral term, we can limit how much it contributes to the controller output. We limit the maximum contribution of the integral term while the stage is at rest with IMaxRest. We limit the maximum contribution of the integral term during a motion with IMaxLimit. There are several ways you can set these limits:
Full integral effect always  By setting IMaxRest and IMaxLimit equal to Output Limit, you will have no effective limit on the integral term. (IMaxRest = IMaxLimit = Output Limit)
Full integral at rest  Some systems may already
cause enough disturbances when set in motion. The integral will simply
make things worse by trying to compensate for the disturbances. If an
integral term is still needed to close steady state error, setting IMaxLimit
to zero and IMaxRest equal to Output Limit will turn off the integral
during motion, thereby enhancing stability.
To close steady state error when in motion,
(Integral is ON)
 IMaxLimit
= 0
 IMaxRest
= Output Limit
To close steady state
error when at rest, (Integral is OFF)
Half integral limit  It is possible to tune a stage so that it visually appears stable when in reality it is very unstable and may result in violent oscillation when the stage is grossly disturbed (ex: some large external force jars the stage). This is likely the result of an oscillating integral. By setting the integral limit to far less than the Output limit, integral oscillation can be damped out by the proportional and derivative terms. This is why it is important to set the integral limit to be larger than what is typically used during normally operation while also making sure that it is still significantly less than the output limit. It is often good to start with half of the output limit.
  Copyright © 20012021 Motion Engineering 