maxon white paper: Dual loop control

A way to fight drivetrain oscillations and compensate gearbox backlash.

Positioning of mechanical loads with an electrical drive can generally be done with a control system consisting of a PID position controller cascaded with a fast-current control loop. In cases when gearheads, spindles or belt systems are used to transmit motor rotation to the load, the imperfections of these transmission elements may negatively affect load position control performance. A typical imperfection for gearheads is backlash – lost motion caused by gaps between teeth of different stages within the gearbox. In situations when long shafts or complex transmission mechanisms are used, the mechanical connection between the motor and the load may have only finite stiffness. In such cases, the aforementioned PID position control scheme may excite resonant oscillations or induce effects known as "chattering" and "hunting" in which the load position never settles at the desired value but oscillates around it. In the worst case, the control loop may become unstable. In such cases, a more sophisticated control system must be employed.

If very precise load positioning is required, it is recommended to add an encoder at the load side for direct measurement of the load position. Such drive systems therefore contain two encoders:

  • One “auxiliary” encoder, mounted on the motor shaft, ideally integrated with the motor in a motor combination.
  • One “main” encoder mounted on the load to be positioned.

When two encoders are present in the system, both position measurements may be used for feedback control in order to achieve improved performance of the load position control and suppress negative effects caused by the imperfections of the mechanical drivetrain. This type of control, where the feedback from both the motor and the load position is used, is called dual loop control. Such a control structure, which allows for high performance position control even with an imperfect mechanical drivetrain, is available with maxon’s EPOS4 line of positioning controllers for DC and EC motors (Figure 1). To fight mechanical resonance and backlash, the scheme is augmented with a second-order filter and a gain scheduler. The EPOS4 commissioning software “EPOS Studio” offers a wizard for full automatic tuning of this complex control algorithm. In addition, it is possible to export Bode diagrams of the drivetrain transfer function that may be used for expert analysis or manual calculation of optimal control parameters.

Control architecture

Figure 2 shows the cascaded structure implemented in EPOS4 for dual loop position control. The innermost loop regulates the motor current via field-oriented control (FOC). The second innermost ("auxiliary") loop

regulates the motor speed based on the measurements from the auxiliary encoder, while the outermost ("main") loop regulates the load position based on the measurements from the main encoder.

A more detailed view of the EPOS4 dual loop controller structure is shown in Figure 3. The main loop consists of a proportional (P) controller, a gain scheduler acting on the proportional controller’s gain, and a second-order filter ("main loop filter") acting on the outputs of the main loop. The inputs of the main loop controller are the reference load position, velocity, and acceleration, coming from a path planner, and the load position measured by the main sensor. The main loop controller is executed at 833 Hz, a third of the auxiliary loop’s execution frequency of 2.5 kHz. The auxiliary loop consists of a proportional-integral (PI) controller with feedforward (FF) and an observer estimating the motor speed from the position data of the auxiliary sensor and the current measurements.

Gain scheduler

The main mechanism that EPOS4 dual loop controller uses to eliminate "chattering" and "hunting" caused by backlash is the gain scheduler. In order for the controller to be aggressive and deliver tight position reference tracking, the P-gain of the main loop controller should be high. However, when the controller is too aggressive, it may happen that the position never exactly reaches the desired value but starts oscillating around it. This may be avoided by reducing the aggressiveness of the controller. The gain scheduler reconciles these conflicting requirements by making the main loop controller’s P-gain dependent on the load position tracking error. When the error is large, the P-gain is also large, making the controller aggressive, which leads to quick reduction of the tracking error. As the tracking error is reduced, so is the P-gain, such that when the load position approaches the target, the controller is not too aggressive and does not cause oscillations, despite the presence of backlash in the drivetrain.

Main loop filter

When the connection between the motor and the load is not stiff enough, the dual loop controller has to eliminate oscillations induced in the drivetrain. These oscillations happen at a fixed frequency, called the resonant frequency, that depends on the elasticity, damping and geometry of the coupling. Even a small excitation of the drivetrain at this frequency may cause significant amplification of oscillations. In order to prevent this, the EPOS4 dual loop controller uses a second order notch filter. The notch filter is designed in such a way that it suppresses the resonant frequency and the frequency range around it in the control signal coming from the controller. This prevents generation of harmonic oscillations in the drivetrain.

Auto-tuning procedure

To facilitate commissioning, maxon provides the EPOS Studio commissioning software with an auto-tuning wizard for calculation and validation of the dual loop controller. The auto-tuning procedure consists of two fully automatic experiments.

  • The first experiment causes motor position oscillations that serve to determine the inertia and friction seen by the motor, as well as the motor torque constant. Based on the identified parameters, the auxiliary loop controller and observer parameters are calculated.
  • The second experiment is used to calculate the parameters of the main loop controller including the notch filter. In this experiment, a Pseudo-Random Binary Sequence (PRBS) signal is used to excite the plant. PRBS signals have the nice properties that they are periodic, such that data from different periods can be averaged, and that the magnitude of their Fourier transform is flat over the whole spectrum, which leads to good transfer function identification. Based on the resulting input-output data, the transfer function of the system that the main loop controller should regulate is identified. EPOS Studio provides a Bode plot of this transfer function. A typical plot is shown in Figure 4. This plot provides valuable information to the control practitioner. It shows if there is a resonant peak and its frequency, which may be used to deduce control limitations. The magnitude and phase data corresponding to the Bode plot can be exported, which can be used for further analysis or controller synthesis. Based on the identified transfer function, the parameters of the main loop controller, gain scheduler and the notch filter are automatically calculated.

EPOS Studio also gives the possibility to set a part, or all of the dual loop controller parameters manually, if further optimization of control performance is required.

Performance compared to single loop controller

In order to illustrate the advantages of using EPOS4 dual loop controller, its performance is compared to that of the EPOS4 single loop PID position controller. The latter uses the encoder on the load for control and the one on the motor for commutation only

Tests are done on a mechanical system with two different couplings between motor and load:

  • The first coupling is a gear connection suffering significant backlash (Figure 5).
  • The second coupling consists of a soft elastic spring exhibiting an underdamped resonance (Figure 6).

The load consists of a motor that can be commanded to apply a disturbance torque. The two EPOS4 controllers connected to the two motors are commanded via EPOS Studio. Experimental data is recorded with EPOS Studio’s "Data Recorder" tool.

In both experiments, the test motor is an EC-4pole 30 motor from maxon combined with an encoder with 500 counts per turn (“cpt”) and a maxon GP 32 HP gearbox with 14:1 reduction. A maxon EC-max 40 motor with a 7500 cpt encoder serves as a load.

To evaluate reference tracking performance, a reference load position trajectory with trapezoidal speed profile is used. To ensure identical initial conditions for single and dual loop control, the load is initially positioned such that the gear connection is engaged in the opposite direction with respect to the target position. In this way, the controller must take up the slack due to backlash before moving the load towards the target position.

Figure 7 shows the load position profile and the tracking error during the experiment with single and dual loop control. As the figure shows, because of the slack due to backlash, for the first few milliseconds the error for single and dual loop grows equally. However, dual loop control is faster at overcoming the slack and exhibits an overall smaller tracking error.

Figure 8 shows the load position profile and the tracking error during the experiment with single and dual loop control and the setup with elasticity. With dual loop control, except for a small overshoot, the mechanical system does not resonate, and the peak tracking error is about a sixth than with single loop control.


The dual loop control architecture of the maxon EPOS4 positioning controller has been presented. This architecture employs encoders on both motor and load to achieve better performance than when only one encoder is available. The scheme also includes a gain scheduler, to avoid chattering and hunting, and a second-order filter, which can be designed as a notch filter to avoid exciting mechanical resonances. The EPOS Studio software offers a powerful collection of wizards and tools, including an auto-tuning feature for the dual loop controller. This feature can be used to completely and automatically parametrize the dual loop controller, but also to gather important information about the mechanical drivetrain that can be used to further optimize control performance by manual adjustment of the parameters. The dual loop position controller has been compared to a single loop position controller in terms of reference tracking performance. Overall, it is found that the dual loop architecture allows tighter control of the load position in situations when the drivetrain is elastic or has significant backlash.

Back to the news overview

USA (East Coast)

maxon precision motors, inc.

125 Dever DriveTaunton, MA 02780, United States
+1/508 677 0520

USA (West Coast)

maxon precision motors, inc.

1065 East Hillsdale Blvd, Suite 210Foster City, CA 94404, United States
+1/650 524 8822 +1/650 372 9395