Manually Tuning a System from Scratch
As Kp increases, you approach the commanded position faster, and thus overshoot by a greater amount. The opposite is also true. Kd reduces the oscillations over a period of time after the initial rise. When Kp decreases, Kd becomes dominant; and when decreasing Kd, Kp becomes dominant.
When tuning your system, it is necessary to find a comfortable balance between Kp and Kd such that there is adequate response time, which is primarily controlled by Kp; and minimal overshoot, which is primarily controlled by Kd; without having to increase or decrease the gains too much. Increasing or decreasing the gains too much can create an unstable system, and possibly damage the motor. Ki is used to correct for steady-state position error, and is typically the last step.
Complete the following steps to achieve a critically damped system from scratch:
- Launch MAX.
- Expand Devices and Interfaces.
- Expand NI–Motion Devices, and then expand the item for the appropriate motion device.
- Expand Calibration in the configuration tree, and select Servo Tune.
- Select the Control Loop tab.
- Set the integral gain (Ki) to 0. Set the proportional gain (Kp) to a reasonable starting value, such as 25.
- Set the derivative gain (Kd) to a reasonable starting value, such as Kp * 2, or 50.
- Click the Step Response tab to examine the Step Response plot. The Step Response plot shows a significant overshoot. If the plot does not show a significant overshoot, increase the proportional gain by factors of 1.5 to 2 until the Step Response plot yields an overshoot.
- After achieving overshoot, attempt to damp the system to reduce maximum overshoot and settling time, while still trying to maintain a low rise time.
- Click the Control Loop tab and begin with a typical value for the derivative gain of Kp * 2.
- Increase the derivative gain by factors of 1.5 to 2 until the oscillations diminish or the system begins buzzing.
- When you hear buzzing from the motor, reduce Kd and proceed to the next step.
Tip If at any time the system is buzzing, the gains are too high. Reduce the gains and continue.
- If the system is slow to respond to commands, increase the proportional gain and derivative gain by factors of 1.5 to 2 until you are satisfied with the step response. High rise time, peak time, and settling time are indicative of a sluggish machine. You can tweak your step response by adjusting the proportional gain or derivative gain.
- If your system continues buzzing and you are unable to achieve a favorable step response after adjusting Kp and Kd, adjust the derivative sampling period (Td). Increase Td by 2, and adjust Kp and Kd accordingly. Depending on the step response graph you get out of the new settings, you may need start over at step 5.
- After achieving a satisfactory step response, you can alleviate any steady state error using the integral gain (Ki). Not all systems need integral gain. Use the Step Response plot to determine the steady-state following error. If the final position at steady state is not the same as the commanded position, the solution may be to use integral gain. Adjust Ki, starting at 1, and increase incrementally by 1 or 2 until the steady state error on the step response is eliminated.
Tip Remember that if you increase Ki too much, your system may become unstable.