Problem
I have a brushless motor all properly configured, with its feedback devices well calibrated and with the commutation validated as well. The only remaining thing is to tune the 3 motion loops (torque, velocity and position) but I have no idea on the steps that I need to follow to do that. What are the basic guidelines in order to tune the different loops?
Clarifications
- This article provides basic guidelines to allow an unexperienced user to tune the motion loops of his/her motor. The instructions will be very basic and there will be no stability or control theory explanations.
Steps
Torque loop
The torque loop is usually the easiest motion loop to tune since its controller only has proportional (Kp) and integral (Ki) gains. In order to tune it, one needs to follow the following steps:
- Start by setting both Kp and Ki to 0 in case they are not already.
- Start increasing Kp in order to increase the amplitude of the actual value signal wave. you can do this by typing the value directly, moving the slider or using the arrows. Once you start increasing Kp you will see something similar to the following:
- Keep increasing Kp until it reaches its maximum amplitude. There will be a point in which the amplitude of the signal does not change, that is when you need to stop increasing Kp. If you keep doing it you will only introduce additional unstable oscillations into the signal. The maximum amplitude reached will usually fall short of the amplitude of the demand value signal but that is normal. In the example case, the maximum amplitude looks like the following:
- Start increasing Ki until the amplitude of the actual value signal equals the demand signal. Increase Ki just enough to reach the required amplitude, beyond that point you will only introduce more oscillations and initial overshoot to the signal. In our example, the final result is:
Velocity loop
The velocity loop is normally the second easiest loop to torque since it is usually only tuned with Kp and Ki gains (even though there are several additional options available). When tuning the velocity loop, we will make the distinction of tuning a motor with and without a load on the motor shaft.
No load
Tuning a motor without load is the easier option since it involves smaller gains and usually, you will only need the proportional one. In order to tune it, do the following:
- Start by setting all the gains besides the Integral Limit to 0 (you can leave the latter one at 1000 for example to start with):
- Start increasing Kp and sooner or later you will see the motor starting to move:
- Increase the proportional gain until the demand speed signal is reached. Normally with Kp you can get to the maximum speed but if in your case it is not possible, try increasing Ki until the target is reached. However, in systems without load it is rare to use integral gain when tuning velocity.
It is important not to mistake not reaching the desired speed due to a lack of insufficiently large Kp and Ki gains when in reality it is a matter of motor configuration. Please check the following article when you see that even though you increase Kp and Ki indefinitely you still don't reach the target speed:
Why does my brushless motor not reach rated speed?
With load
When adding a load to the shaft of the motor, the motor will performing as well as it was before when you tuned it without load: it might accelerate slower, maximum reached speed might be smaller or the motor might not move at all. However, all this can be easily solved by working a little bit further with the gains:
- First of all, check the current performance of the velocity loop with the gains that you got when tuning the motor without load. In the case of our example it looked like the following:
- Increase Kp and check if both the acceleration and maximum reachable speed increase. Increase it until there are no significant changes or when unstable oscillations are introduced in the system. If the performance is still not enough, start increasing Ki as well until you get the desired behavior. It should get to the point that you reach the required speed following the desired profile accelerations/decelerations. In the case of our example, only Kp was needed:
Position loop
The position loop is almost always the loop that is the hardest to tune of the 3. This is because it normal requires the 3 components of the PID controller (Kp, Ki and Kd) and sometimes additional gains as well. However, most of the times you can tune it with Kp, Ki and Kd. For the position loop, we will make the distinction as well of tuning the loop with and without load.
No load
Tuning a motor without load is the easier option since it involves smaller gains. In order to tune it, please do the following:
- Start by setting all the gains besides the Integral Limit to 0 (you can leave the at its default value of 32768 for example to start with):
- Increase slightly both derivative and proportional gain so that you can get the system to start moving (even though it might be slow and not precise yet). Start with the derivative gain and the add the proportional gain. Be careful if you are tuning a VCA since these actuators seem be sensitive to the derivative gain which you might only need to increase the smallest amount possible in order to stabilize the motion. You can use some reference values like the following in order to get you started:
- From this starting point, start increasing the proportional gain until the target is reached or a steady state value is reached which might usually be under the target value.
- Once that steady state is reached, proceed to add some integral gain so that the target value is properly reached in the fastest time possible. Watch out to not over-increase the integral gain too much or you might introduce overshoots and steady oscillations around the target.
With load
When adding the load, it is most likely that the gains that you tuned for the motor without the load will not really perform perfectly now. This is very system dependent but usually, you will find 2 cases:
- Stable motion turns to unstable motion but the target is reached --> in this case, what you will most likely need to do is increase the derivative gain of the PID controller in order to soften the oscillations and overshoots that are now present in the system once the load is added. If after increasing the derivative gain the system's response is too slow, you will need to increase back the proportional and integral gains so that you get the response as fast as you need it to be.
- Target is not reached directly --> in this case, you will need to work first mostly on the integral gain of the PID controller so that you are able to fully reach the target. If you need the response to be faster you can add some proportional gain for the startup as well. In addition to this, just like in the other case, if overshoots and oscillations are introduced, you need to increase the derivative gain later in order to ensure the most stable motion possible.
In our example, the system turned out to be the first case, which as we have explained can be solved like in the following steps:
- Check performance of the PID controller tuned without load once the load is added to the motor.
- Increase derivative gain in order to reduce overshoot and oscillations around the target.