PID Loop Descriptions
The following are common variables relating to the PID control loop.
Kp (Proportional Gain)
The proportional gain (Kp) determines the contribution of restoring force that is directly proportional to the position error. This restoring force functions in much the same way as a spring in a mechanical system.
Each sample period, the PID loop calculates the position error, which is the difference between the instantaneous trajectory position and the primary feedback position, and multiplies the position error by Kp to produce the proportional component of the 16-bit DAC command output.
An axis with too small a value of Kp is unable to hold the axis in position and is very soft. Increasing Kp stiffens the axis and improves its disturbance torque rejection. However, too large a value of Kp often results in instability.
Ki (Integral Gain)
The integral gain (Ki) determines the contribution of restoring force that increases with time, ensuring that the static position error in the servo loop is forced to zero. This restoring force works against constant torque loads to help achieve zero position error when the axis is stopped.
Each sample period, the position error is added to the accumulation of previous position errors to form an integration sum. This integration sum is scaled by dividing by 256 prior to being multiplied by Ki.
In applications with small static torque loads, this value can be left at its default value of zero (0). For systems having high static torque loads, this value should be tuned to minimize position error when the axis is stopped.
Although non-zero values of Ki cause reduced static position error, they tend to cause increased position error during acceleration and deceleration. This effect can be mitigated through the use of the Integration Limit parameter. Too high a value of Ki often results in servo loop instability. National Instruments therefore recommends that you leave Ki at its default value of zero until the servo system operation is stable. Then you can add a small amount of Ki to minimize static position errors.
Kd (Derivative Gain)
The derivative gain (Kd) determines the contribution of restoring force proportional to the rate of change (derivative) of position error. This force acts much like viscous damping in a damped spring and mass mechanical system. A shock absorber is an example of this effect.
The PID loop computes the derivative of position error every derivative sample period. A non-zero value of Kd is required for all systems that use torque block amplifiers, where the command output is proportional to motor torque, for the servo loop operation to be stable. Too small a Kd value results in servo loop instability.
With velocity block amplifiers, where the command output is proportional to motor velocity, it is typical to set Kd to zero or a very small positive value.
Kv (Velocity Feedback)
You can use a primary or secondary feedback encoder for velocity feedback. Setting the velocity feedback gain (Kv) to a value other than zero (0) enables velocity feedback using the secondary encoder, if configured, or the primary encoder if a secondary encoder is not configured.
Kv is used to scale this velocity feedback before it is added to the other components in the 16-bit DAC command output. Kv is similar to derivative gain (Kd) except that it scales the velocity estimated from encoder resources only. The derivative gain scales the derivative of the position error, which is the difference between the instantaneous trajectory position and the primary feedback position. Like the Kd term, the velocity feedback derivative is calculated every derivative sample period and the contribution is updated every PID sample period.
Velocity feedback is estimated through a combination of speed-dependent algorithms. Velocity is measured based on the time elapsed between each encoder count.
Vff (Velocity Feedforward)
The velocity feedforward gain (Vff) determines the contribution in the 16-bit DAC command output that is directly proportional to the instantaneous trajectory velocity. This value is used to minimize following error during the constant velocity portion of a move and can be changed at any time to tune the PID loop.
Velocity feedforward is an open-loop compensation technique and cannot affect the stability of the system. However, if you use too large a value for Vff, following error can reverse during the constant velocity portion, thus degrading performance, rather than improving it.
Velocity feedforward is typically used when operating in PIVff mode with either a velocity block amplifier or substantial amount of velocity feedback (Kv). In these cases, the uncompensated following error is directly proportional to the desired velocity. You can reduce this following error by applying velocity feedforward. Increasing the integral gain (Ki) also reduces the following error during constant velocity but only at the expense of increased following error during acceleration and deceleration and reduced system stability. For these reasons, increasing Ki is not a recommended solution.
Tip In PIVff mode, the Kd and Kv gains are set to zero. |
Velocity feedforward is rarely used when operating in PID mode with torque block amplifiers. In this case, because the following error is proportional to the torque required, rather than the velocity, it is typically much smaller and does not require velocity feedforward.
Aff (Acceleration Feedforward)
The acceleration feedforward gain (Aff) determines the contribution in the 16-bit DAC command output that is directly proportional to the instantaneous trajectory acceleration. Aff is used to minimize following error (position error) during acceleration and deceleration and can be changed at any time to tune the PID loop.
Acceleration feedforward is an open-loop compensation technique and cannot affect the stability of the system. However, if you use too large a value of Aff, following error can reverse during acceleration and deceleration, thus degrading performance, rather than improving it.
Kdac
Kdac is the Digital to Analog Converter (DAC) gain. Use the following equation to calculate Kdac:
20 V represents the ±10 V range in the motion controller.
Ga
Ga is the Amplifier Gain.
Kt
Kt is the Torque Constant of the motor. Kt is represented in Newton Meters per Amp.
1/J
1/J represents the motor plus load inertia of the motion system.
Ke
Ke represents the conversion factor to revolutions. This may involve a scaling factor.