Advanced Tuning Techniques
You can use bode plots and advanced control loop parameters to fine-tune your motion control system.
Bode Plots
Bode plots display the frequency response of your system. The Calibration»Servo Tune»Bode tab in MAX plots the bode diagram for your system. To perform the bode analysis, Servo Tune oscillates the axis to identify the system and to calculate the transfer function. Gain is the measure of the amplitude difference of the input to the system and output from the system. Phase defines the time shift between the input and output. Gain is plotted in decibels (dB), and phase is plotted in degrees.
Stability in the Frequency Domain
Use bode plots to measure system stability. At low frequencies, the gain is 0 dB for most systems and diminishes as frequency increases. A rise in gain before a fall in gain indicates marginal stability. For most systems, the allowable rise in gain before falling is below 6 dB, indicating approximately 50% overshoot. You can use the bode plots to ensure that at all significant velocities are stable given the PID parameters.
Gain margin is the gain of the system when the phase is at 180 degrees. Phase margin is the difference between the actual phase and 180 degrees when the gain is at 0 dB. Typically, the phase margin must be between 35 and 80 degrees for a stable and responsive system. The phase margin value must be as large as possible within this range. The gain margin must be between 10 and 25 dB.
Advanced Control Loop Parameters
The following Control Loop parameters are often necessary when using velocity or voltage amplifiers:
- Velocity feedback gain (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.
You can use a primary or secondary feedback encoder for velocity feedback. Setting Kv to a value other than zero (0) enables velocity feedback using the secondary encoder when using dual-encoder feedback, or the primary encoder if a secondary encoder is not configured.
The velocity feedback gain scales this velocity feedback before it is added to the other components in the 16-bit DAC command output. You can use velocity feedback gain for backlash compensation if your system has gears. In this example, you can configure the primary feedback to the linear encoder on your system, and configure the secondary feedback to the rotary encoder on the shaft of the motor.
- Velocity Feedforward (Vff) determines the contribution in the 16-bit DAC command output that is directly proportional to the instantaneous trajectory velocity. Your system uses this value to minimize following error during the constant velocity portion of a move and can be changed at any time to tune the PID loop.
Because velocity feedforward is an open-loop compensation technique, it cannot affect system stability. However, if the Vff value is too large, the following error during the constant velocity portion can reverse—providing negative following error, which can degrade performance.
Velocity feedforward is rarely used when operating in PID mode with torque block amplifiers. In this case, following error is typically much smaller because it is proportional to the torque required rather than to the velocity. When operating in PID mode with torque block amplifiers, velocity feedforward is not required.
- Acceleration Feedforward (Aff) determines the contribution in the 16-bit DAC command output that is directly proportional to the instantaneous trajectory acceleration. Use Aff to minimize following error during acceleration and deceleration. You can change Aff at any time to tune the PID loop.
Because acceleration feedforward is an open-loop compensation technique, it cannot affect system stability. However, if the Aff value is too large, following error during acceleration and deceleration can reverse—providing negative following error, which can degrade performance.