Parameter Tuning Guide for Position Controller with Cascaded Structure

Introduction

In this document, the basic steps of tuning PID position controller with cascaded structure are explained. As shown in Fig. 1, the cascaded structure is basically made of two controlling loops. The inner controlling loop is responsible for controlling the velocity while the outer controlling loop is responsible for controlling the position.

Figure 1

Fig. 1: Cascaded position control structure

Measuring units of gains of position controller are: kP [rpm/ticks],

kI [rpm/(ticks*s]

kD [rpm*s/ticks]

Measuring units of gains of velocity controller are: kP [mNm/rpm],

kI [mNm/(rpm*s]

kD [mNm*s/rpm]

Control Basics

Tuning the position controller with cascaded structure is pretty straight forward. Cascaded controller is usually used in PI-P form, i.e. inner loop (velocity control loop) is only using the proportional part of its PID controller and the outer loop (position controlling loop) is only using its proportional and integral part. The other form is P-PI form, i.e. inner loop is using proportional and integral part and outer loop uses only proportional part. The inner velocity control loop is responsible for calculating the torque reference. As a result the integral limit of the velocity controller should be set to the maximum torque of your torque actuator (in mNm). Moreover, the outer position control loop is responsible for controlling the reference velocity, and consequently its integral limit should be set to the maximum velocity of your system (in rpm).

Tuning Concept in Brief

For tuning the cascaded structure, we should first focus on the inner (velocity) loop. As it is the inner controlling loop, it should be faster than the outer position loop. However, if all parameters of the outer position controller are set to 0, the inner loop will be disconnected from the user position commands. As a result, we can increase the kP of both position and velocity controllers with a ratio of 10 (kP_velocity = 10 * kP_position). Once the real position started to follow the reference position, we can stop increasing the kP_position, and only focus on increasing kP_velocity. At this stage, we can increase (sharpen) the velocity controller as much as possible. As a rule of thumb, increase kP_velocity until you get close to the instability margin (at this margin, you will feel a vibration effect and some acoustic noise which is caused by controller sharpness). Now, you can reduce kP_velocity to 90% of its value to increase the stability margin, and remove vibration noise.

Once the velocity controller (the inner controlling loop) is tuned, it is time to tune the position controller (the outer controlling loop). To tune the position controller loop, we should start with the P part of its PID controller. Increase kP_position until the entire position control gets close to instability margin. At this state, you will feel a vibration (or acoustic noise) which is because of too sharpened position control. At this step, reduce kP_position to its 90% to increase the stability margin and remove the vibration/acoustic noise.

So far, the proportional parts of both inner velocity loop and outer position loop are tuned, and we can focus on integrator part of the outer position or inner velocity loop (depends on chosen structure of controller). Increasing the integrator constant will remove the steady state error, but at the same time, it adds some overshoot at step responses. As a rule of thumb, you can increase kI step by step until the following two conditions are met at the same time:

  • the steady-state error is eliminated in a short enough period of time
  • the overshoot is in its acceptable range

In the following section, the explained tuning concept is divided in separate systematic steps.

Tuning Steps

Step 1.
Set the PID constants of both controllers equal to 0. By default, the integral limit of the velocity controller should be set to motor maximum torque in [mNm], and the integral limit of position controller should be set to motor maximum velocity in [rpm].

Important

from this step forth, the step response of position controller should always be evaluated.

Step 2.
In this step, the kP constant of the velocity controller should be tuned. Increase the kP of both position and velocity controllers with a ratio of 10 (kP_velocity = 10 * kP_position). Once the real position starts to follow the reference position, stop increasing the kP_position and only focus on increasing the kP_velocity. Increase (sharpen) the velocity controller as much as possible. As a rule of thumb, increase kP_velocity until you get close to the instability margin (at this margin, you will feel a vibration effect and some acoustic noise which is because of controller sharpness). Now, you can reduce kP_velocity to 90% of its value to increase the stability margin, and remove vibration noise.
Step 3.
Now that the velocity controller is tuned, it is time to tune the parameters of the PID position controller. Start with kP_position, and increase it until you again get close to the instability margin, and then reduce kP_position to its 90%. So far, the proportional parts of both inner velocity loop and outer position loop are tuned.
Step 4.
In this step, increase kI to eliminate the steady state error. As a suggestion start with kI equal to 0.01, and in each step, increase it with a factor of 2. Increase kI step by step until the following two conditions are met at the same time:
  • the overshoot is in its acceptable range
  • the steady-state error is eliminated in a short enough period of time