Optimizing PLL Performance with the PID Advisor and Auto Tune

Introduction

LabOne provides two tools that save time and improve performance for anybody working with the UHF-PID controller: The PID Advisor and the Auto Tune feature. They allow automation of the feedback parameter tuning required to achieve the best PID (proportional-integral-derivative) controller performance. In this blog post, we’ll show you an example that demonstrates the power of both of these tools. The goal of the example is to map the good phase noise properties of one of the UHFLI’s internal oscillators to an external voltage-controlled oscillator (VCO). First, we’ll use the PID Advisor to set up a phase-locked loop (PLL) between the internal and external oscillators with a well-defined bandwidth. Second, we’ll let LabOne minimize the phase noise of the VCO with the Auto Tune feature. These methods are general and optimize the workflow in most PID and PLL applications such as laser phase stabilization, MEMS gyroscopes or atomic force microscopy.

Procedure

Setup

Figure 1 shows how we connected the VCO (Mini-Circuits ZX95-368+) to the UHFLI Lock-in amplifier. The VCO generates an oscillating signal on its RF out connector which we connect to Signal Input 1. The oscillation frequency changes with the voltage applied to the VCO VTUNE input. We control this voltage via the DC offset on the UHFLI Signal Output 1. By using the fast Signal Output 1 instead of an Auxiliary Output to control VTUNE we minimize the loop delay. Figure 2 shows a diagram of the complete feedback loop including the functional blocks inside the UHFLI. 

setup_VCO_new

Figure 1: Setup to transfer the low phase noise of an internal oscillator to an external voltage-controlled oscillator (VCO).

Loop_block_diagram

Figure 2: Block diagram of the feedback loop stabilizing the VCO.

Characterize the VCO

One key parameter of the VCO is the tuning sensitivity, which is the slope of the frequency vs. control voltage curve. We need this parameter to simulate the VCO behavior with the PID Advisor. We start with a measurement of the tuning sensitivity and compare it to the value found in the data sheet. This is a good way of checking that the setup works correctly.

We’ll have demodulator 4 track the VCO frequency for that measurement. From the Lock-in tab, we set demodulator 4 to External Reference mode and choose Signal Input 1 as the input signal. A green light next to the frequency value indicates that the demodulator 4 has successfully locked to the VCO signal. In the Sweeper tab, we selected Signal Output 1 offset as the sweep parameter, 0 to 1.5 V as the sweep range, and we added demodulator 4 oscillator frequency to the plot. Note that the standard sweep speed is a bit too high for the reference tracking to follow. This problem is easy to spot by performing a bidirectional sweep and checking if both directions give the same result. If they don’t, the best is to change the settling time in the Advanced mode of the Settings subtab. We chose a settling time of 1 second as highlighted in Figure 3. The figure also shows the result of our Sweeper measurement from which we read a VCO tuning sensitivity of about 6.7 MHz/V, close to the specified value of 6 MHz/V. We can also see that a voltage of 1.0 V generates a frequency of about 345 MHz. We’ll choose these two values as the operating point of our feedback loop.

Result_Sweeper_marks

Figure 3: VCO frequency vs. control voltage measured with the Sweeper.

Set up the Feedback Loop with the PID Advisor

Setting demodulator 4 to External Reference mode established a phase-locked loop that let the internal oscillator follow the external one – but we want to have just the opposite. The next thing to do is therefore to turn External Reference mode off again, and to fix the demodulator 4 frequency manually at 345 MHz. Then we open the PID tab and make the basic settings for our control loop in the left column: The PID input is Demodulator 4 Theta, the setpoint is 0°, and the PID output is Signal Output 1 offset. We choose center, lower limit, and upper limit of 1.0 V, -0.5 V, and 0.5 V, respectively. We also enabled Phase Unwrap, which allows the PID to track phase differences up to ±11520° instead of just ±180°. With this feature, phase-locked loops can be operated at much larger bandwidth, and remain locked more reliably when phase fluctuations occur. It represents a clear advantage of digital over analog PID technology.

The next step is to find the right proportional (P) and integral (I) gain parameters. However, the actual parameter of interest is usually the bandwidth of the feedback loop and not the gain parameters, and calculating one from the other is not easy. With the PID Advisor you can simply choose a target bandwidth and it will propose a set of feedback gain parameters fitting that bandwidth. For the PID Advisor to give us good advice, we need to tell it what we connected to the UHFLI. This means we select VCO as the device under test (DUT) model and set the gain to 6.7 MHz/V as determined previously.

Type in a target bandwidth of 5 kHz, select PI from the list of  the simulation parameters, and press Advise. As you can see in Figure 4, the Advisor then returns P and I gains and a plot of the simulated closed-loop step response. It also adjusts the demodulator filter bandwidth if necessary. Apply the Advisor results to the PID by clicking “To PID”, and then enable the PID. In the left column you find a numerical display of the PID error, i.e., the setpoint minus the measured phase, allowing you to see whether the feedback is stable.

PID tab after having run the PID Advisor and transferred the P and I parameters to the PID controller

Figure 4: PID tab after having run the PID Advisor and transferred the P and I parameters to the PID controller

It is interesting to compare the simulated loop response with a measurement. You can easily measure the step response with the LabOne Software trigger. The trick is to configure the software trigger so that it triggers on the rising flank of the demodulator 4 phase, and then to manually change the PID phase setpoint. Defining a trigger threshold somewhere between the old and new setpoint, you can obtain an experimental step response curve that is directly comparable with the simulation. Figure 5 shows the result of such a measurement. The precise agreement with the simulation demonstrates the quality of the PID Advisor simulation.

Comparison of measured and simulated step response

Figure 5: Comparison of measured and simulated step response

The stabilizing effect of the control loop on the VCO is clearly visible in the LabOne Spectrum analyzer. In Figure 6, we compare amplitude spectra of demodulator 4, one with an open and one with closed feedback loop. The 1-kHz-wide peak of the unstabilized VCO (left) compares to a spectral line less than 1 Hz wide of the stabilized VCO (right).

Figure: Power spectral density of the VCO signal without stabilization (left) and with stabilization (right) through the phase-locked loop

Figure 6: Power spectral density of the VCO signal without stabilization (left) and with stabilization (right) by the phase-locked loop

Minimize Phase Error with Auto Tune

This increase in stability is already striking, but it’s possible to even improve on that with Auto Tune. The working principle of Auto Tune is to measure the time-averaged PID error, and then to vary P and I in small steps moving in the direction of a smaller error. A good place to observe the effect of Auto Tune is the Plotter tab. In Figure 7 we configured the Plotter to display the PID error over time. If we click on the Tune button back in the PID tab, Auto Tune starts to slowly reduce the phase error until it finds a minimum. This is visible as a narrowing-down of the envelope of the blue curve in Figure 7.

Plotter_Error_reduction_marks

Figure 7: Plotter tab showing the PID error over time

We added “Histogram Std” in the Math subtab, which allows us to measure the error standard deviation accurately as highlighted in Figure 7. Auto Tune reduced the error from 2.4° to 1.3° in our case. “Histogram Std” also adds a plot of the noise distribution on the left of the Plotter. This is a valuable tool for finding the best feedback loop bandwidth, either manually or with the PID Advisor. Try to optimize the bandwidth in order to get an even, Gaussian noise distribution that is as narrow as possible. If the feedback is too slow, the distribution tends to get distorted; if the feedback is faster than necessary, the distribution just gets wider.

Discussion

These results nicely demonstrate the differences between the model-based approach of the PID Advisor and the data-based approach of Auto Tune. On the one hand, the device models allow the PID Advisor to find good parameters without prior tuning in reproducible way. Auto Tune can’t do that but needs a stable feedback setting to start from. On the other hand, the PID Advisor models don’t capture all real signal features like noise or device nonlinearity and therefore the PID Advisor result is not necessarily optimal. Auto Tune does take into account real signal features because it’s based on measurement, and can therefore often improve on the result of the PID Advisor. However, the combination of both often yields the best results. Keep in mind though that it only makes sense to use Auto Tune in presence of the real signal to be tracked. Otherwise you may end up with a feedback that is too slow to follow abrupt steps or peaks in the signal.

Conclusion

We hope that this example gave you some ideas how the UHF-PID controller can speed up PID parameter tuning for you, whatever level of precision you need. That can mean you want to capture a quick AFM scan and get parameters that just work, or it can mean that you want to minimize noise in a laser stabilization case. Find more information, e.g. on the available Advisor DUT models or on advanced options to simulate response functions, in the UHFLI User manual and the on the UHF-PID product website.