Skip to content

PID Tab

The PID tab is only available if the HF2-PID Quad PID Controller option is installed on the HF2 Series Instrument (the installed options are displayed in the Device tab).

Note

Some settings in the PID tab are interdependent with settings that are accessible from other tabs. If the PID output controls a certain variable, e.g. Signal Output Offset, this variable will be shown as read-only where it appears in other tabs (i.e. in the Lock-in tab for this case).

Features

  • Four fully programmable proportional, integral, derivative (PID) controllers
  • PID Advisor with multiple DUT models, transfer function, and step function modeling
  • More than 5 kHz regulation bandwidth
  • Input parameters: demodulator data, auxiliary inputs, oscillator frequency
  • Output parameters: output amplitudes, oscillator frequencies, auxiliary outputs and DIO

Description

The PID tab is the main control center for the feedback loop controllers in the instrument. Whenever the tab is closed or an additional one of the same type is needed, clicking the following icon will open a new instance of the tab.

Table 1: App icon and short description
Control/Tool Option/Range Description
PID Features all control, analysis, and simulation capabilities of the PID controllers.

The PID tab (see Figure 1) consists of four identical side-tabs, each of them providing access to the functionality of one of the four PID controllers and the associated PID Advisor.

Figure 1: LabOne UI: PID tab

With their variety of different input and output connections, the LabOne PID controllers are extremely versatile and can be used in a wide range of different applications including laser locking or high-speed SPM. Figure 2 shows a block diagram of all PID controller components, their interconnections and the variables to be specified by the user.

Figure 2: PID controller block diagram

Setting up a Control Loop

Depending on the application there are a number of ways to set up a control loop. Let’s consider a few different approaches and see how the Advisor can help to reduce the effort and improve on the result and understanding of the setup.

Manual Setup

In cases where the transfer function of the device under test (DUT) is unknown and only little noise couples into the system from the environment, a manual approach is often the quickest way to get going. For manual configuration of a new control loop it is recommended to start with a small value for P and set the other parameters (I, D) to zero. By enabling the controller one will then immediately see if the sign of P is correct and if the feedback is acting on the correct output parameter for instance by checking the numbers (Error, Shift, Out) displayed in the PID tab. A stepwise increase of the integral gain I will then help to zero the PID error signal completely. Enabling the derivative gain D can increase the speed of the feedback loop, but it can also cause an instable feedback loop behavior . Monitoring the PID error in the Plotter Tab in parallel can be a great help at this stage. The math tools offered by the Plotter allow us to display the standard deviation and the average value of the error. These values should be minimized by tweaking the PID parameters and the associated histogram should have a symmetric (ideally Gaussian) envelope.

In order to characterize the feedback loop quantitatively, you can measure the step response in the Data Acquisition Tab. To do that measurement, change the PID setpoint manually after you have configured the DAQ Trigger level half way in between the old and new setpoint. DAQ Delay and Duration are chosen to roughly match the expected bandwidth. For a step response curve with fine time resolution, the PID data rate should be high enough.

PID Advisor

For many experimental situations the external device or DUT can be well approximated by a simple model. The LabOne PID Advisor allows you to simulate the behavior of a number of different DUT types in a feedback loop and choose feedback gain parameters based on the simulation. The DUTs are characterized by a model function with a number of parameters found on the Advisor sub-tab. All models include a setting for the delay that occurs outside the instrument. Depending on the targeted servo bandwidth, the external delay can often be the limiting factor and should be sensibly chosen.

Note

The delay specified for each model is the earliest possible response to a stepwise change of the instrument output to be seen on the instrument input. It describes the causality of the system and does not affect the shape of the DUT transfer function. Standard coaxial cables cause a signal delay of about 5 ns/m.

The most simple approach to modeling is to assume a DUT with a unity transfer function by using All Pass. The low-pass filters allow for limiting the bandwidth, to set an overall gain and a damping for the second order filter. With a Gain set to 1 and a Delay set to 0, All Pass can be used to model the PID controller independent of the external device. Resonator Frequency is a model that applies well in situations with a passive external component, e.g. a AFM cantilever or a quartz resonator, whose frequency should be tracked by a PLL over time. In cases where the amplitude of the resonator signal needs to be stabilized with a second control loop (automatic gain control), the Resonator Amplitude model is the right choice. Setting the resonance frequency and the Q factor, both can be obtained before by a frequency scan over the resonance using the Sweeper Tab, allows the Advisor to estimate the gain and low-pass behavior of the resonator. Internal PLL is used whenever an external oscillating signal is provided that shall be followed by one of the internal oscillators. The VCO setting describes a situation where the input variable of the DUT is a voltage and the output is a frequency. The gain parameter specifies how much voltage change on the input causes how much frequency shift on the VCO output. In case the frequency of the VCO can be tracked by using the external reference mode, one can easily measure this gain with the Sweeper Tab by scanning the Auxiliary Output voltage and displaying the resulting oscillator frequency. The gain is given by the slope of the resulting line at the frequency of interest.

With a model and parameters set to best describe the actual measurement situation, one can now continue by defining a target bandwidth for the entire control loop and the Advise Mode, i.e. the feedback gain parameters that shall be used for the control operation. Whenever the input signal is derived from one of the demodulators it is convenient to activate the box next to target bandwidth. With that in place the Advise algorithm will automatically adjust the demodulator bandwidth to a value about 5 times higher than the target bandwidth in order to avoid to be limited by demodulation speed. The Advisor algorithm will now calculate a target step response function that it will try to achieve by adjusting the feedback gain parameters in the next step. Before doing so in case of a newly set up DUT model, the algorithm will first try to estimate the PID parameters by using the Ziegler-Nichols method. When there has been a previous run, the user can also change the parameters in the model manually which will the be used as new start parameters of the next Advise run. Starting from the initial parameters, the Advisor will then perform a numerical optimization in order to achieve a least-squares fit of the calculated step response to a target step response determined from the Target Bandwidth. The result is numerically characterized by an achieved bandwidth (BW) and a phase margin (PM). Moreover, the large plot area on the right can be used to characterize the result by displaying transfer functions, magnitude and phase, and step responses between different signal nodes inside the loop. Once the modeling is completed one can copy the resulting parameters to the physical PID by clicking on .

Table 2: DUT transfer functions
Name Function Parameters
All pass \(H(s)=g\)
  1. Gain \(g\)
Low-pass 1st \(H(s)=g\frac{1}{t_c s + 1} = g\frac{\omega_n}{s +\omega_n}\)
  1. Gain \(g\)
  2. Filter bandwidth (BW) \(f_{-3dB}=\omega_n/2\pi\)
Low-pass 2nd \(H(s)=g\frac{\omega^2_n}{s^2+2\omega_n\zeta s+\omega^2_n}\)
  1. Gain \(g\)
  2. Resonance frequency \(f_{res}=\omega_n/2\pi\)
  3. Damping ratio \(\zeta\) with \(f_{-3dB}=2\zeta f_{res}\)
Resonator frequency \(H(s)= -360^{\circ} \frac{t_c}{t_c s+1}\) with \(t_c=\frac{1}{2\pi BW}=\frac{2Q}{2\pi f_{res}}\)
  1. Resonance frequency \(f_{res}\)
  2. Quality factor \(Q\)
Resonator amplitude \(H(s)=g\frac{\omega / (2Q)}{s+\omega /(2Q)}\) with \(\omega=2\pi f_{res}\)
  1. Gain \(g\)
  2. Resonance frequency \(f_{res}\)
  3. Quality factor \(Q\)
Internal PLL \(H8s)=-\frac{360^\circ}{s}\)
VCO \(H(s)=g\frac{360^\circ}{s(t_c s+1)}\) with \(t_c=\frac{1}{2\pi f_{res}}\)
  1. Gain \(g\) (Hz/V)
  2. Bandwidth (BW) \(f_{-3dB}\)

Note

It is recommended to use the Advisor in a stepwise approach where one increases the free parameters from P to PI, to PID . This can save time because it prevents optimizing into local minima. Also it can be quite illustrative to see which of the feedback parameters leads to which effect in the feedback behavior.

Note

The low-pass filter in the differential part is implemented as an exponential moving average filter described by \(y_t=(1-\alpha)\cdot y_{t-1}+\alpha x_t\) with \(\alpha = 2^{-dshift}\), \(x_t\) the filter input, and \(y_t\) the filter output. The default value for dshift is 0 which corresponds to a disabled filter. On the UI the filter properties can be changed in units of bandwidth or a time constant.

In case the feedback output is a voltage applied to sensitive external equipment it is recommended to make use of the center value and the upper and lower limit values. This will guarantee that the output stays in the defined range even when the lock fails and the integrator goes into saturation.

Functional Elements

Table 3: PID tab: PID section
Control/Tool Option/Range Description
Enable ON / OFF Enable the PID controller
Input Select input source of PID controller
Demodulator X Demodulator cartesian X component
Demodulator Y Demodulator cartesian Y component
Demodulator R Demodulator magnitude component
Demodulator Theta Demodulator phase
Aux Input Auxiliary Input
Aux Output Internal value of Auxiliary Output
Modulation Index Modulation depth
Dual Frequency Tracking \|Z(i+1)\|-\|Z(i)\| Used in dual frequency tracking applications
Demod X(i+1)-X(i) Used in dual frequency tracking applications
Demod \|Z(i+1)-Z(i)\| Used in dual frequency tracking applications
Oscillator Frequency Oscillator frequency
Input Channel index Select input channel of PID controller.
Setpoint Mode Defines the source of the PID setpoint value.
Fixed Setpoint is manually set.
Aux Input 1 Setpoint is supplied by Auxiliary Input 1.
Aux Input 2 Setpoint is supplied by Auxiliary Input 2.
PID Output 4 Setpoint is supplied by the output of another PID.
Setpoint numeric value PID controller setpoint
Filter BW numeric value Bandwidth of the demodulator filter used as an input.
Filter Order Selects the filter roll off between 6 dB/oct and 48 dB/oct of the current demodulator.
1 1st order filter 6 dB/oct
2 2nd order filter 12 dB/oct
3 3rd order filter 18 dB/oct
4 4th order filter 24 dB/oct
5 5th order filter 30 dB/oct
6 6th order filter 36 dB/oct
7 7th order filter 42 dB/oct
8 8th order filter 48 dB/oct
Harmonic 1 to 1023 Multiplier of the for the reference frequency of the current demodulator.
Output Select output of the PID controller
Output 1 Amplitude Feedback to the main signal output amplitude 1
Output 2 Amplitude Feedback to the main signal output amplitude 2
Oscillator Frequency Feedback to any of the internal oscillator frequencies
Aux Output Offset Feedback to any of the 4 Auxiliary Output's Offset
DIO (int16) Feedback to the DIO as a 16 bit word
Output Channel index Select output channel of PID controller.
Center numeric value After adding the Center value to the PID output, the signal is clamped to Center + Range and Center - Range.
Range numeric value Set the range of the PID controller output relative to the center
Default Out numeric value Set the value for the default output if the PID is disabled.
Default Out Enable ON / OFF Enable the default value when PID is off.
P (Hz/deg) numeric value PID proportional gain P
I (Hz/deg/s) numeric value PID integral gain I
D (Hz/deg*s) numeric value PID derivative gain D
Rate RT load dependent PID sampling rate and update rate of PID outputs. Needs to be set substantially higher than the targeted loop filter bandwidth.

The numerical precision of the controller is influenced by the loop filter sampling rate. If the target bandwidth is below 1 kHz is starts to make sense to adjust this rate to a value of about 100 to 500 times the target bandwidth. If the rate is set too high for low bandwidth applications, integration inaccuracies can lead to non linear behavior.
Error numeric value Error = Set point - PID Input
Shift numeric value Difference between the current output value Out and the Center. Shift = P*Error + I*Int(Error, dt) + D*dError/dt
To Advisor Copy the current PID settings to the PID Advisor.
Table 4: PID tab: Advisor sub-tab
Control/Tool Option/Range Description
Advise Calculate the PID coefficients based on the used DUT model and the given target bandwidth. If optimized values can be found the coefficients are updated and the response curve is updated on the plot.

Only PID coefficients specified with the advise mode are optimized. The Advise mode can be used incremental, means current coefficients are used as starting point for the optimization unless other model parameters are changed in-between.
Progress The percentage of design algorithm already done when the Advisor is in progress.
Target BW (Hz) numeric value Target bandwidth for the closed loop feedback system which is used for the advising of the PID parameters. This bandwidth defines the trade-off between PID speed and noise.
Advise Mode Select the PID coefficients that are optimized. The other PID coefficients remain unchanged but are used during optimization. This enables keeping selected coefficients at a fixed value while optimizing the rest.

The advise time will increase significantly with the number of parameters to be optimized.
P Only optimize the proportional gain.
I Only optimize the integral gain.
PI Only optimize the proportional and the integral gain.
PID Optimize the proportional, integral, and derivative gains.
Filter BW numeric Value Defines the low-pass filter characteristic of the selected demodulator input.
Auto Bandwidth ON / OFF Adjusts the demodulator bandwidth to fit best to the specified target bandwidth of the full system. If disabled, a demodulator bandwidth too close to the target bandwidth may cause overshoot and instability.

In special cases the demodulator bandwidth can also be selected smaller than the target bandwidth.
Filter Order Selects the filter roll off between 6 dB/oct and 48 dB/oct of the modelled demodulator.
1 1st order filter 6 dB/oct
2 2nd order filter 12 dB/oct
3 3rd order filter 18 dB/oct
4 4th order filter 24 dB/oct
5 5th order filter 30 dB/oct
6 6th order filter 36 dB/oct
7 7th order filter 42 dB/oct
8 8th order filter 48 dB/oct
Harmonic 1 to 1023 Multiplier of the for the reference frequency of the modelled demodulator.
DUT Model Type of model used for the external device to be controlled by the PID.

A detailed description of the transfer function for each model is found in the previous section.
All Pass The external device is modelled by an all pass filter. Parameters to be configured are delay and gain.
LP 1st The external device is modelled by a first-order low-pass filter. Parameters to be configured are delay, gain and filter bandwidth.
LP 2nd The external device is modelled by a second-order low-pass filter. Parameters to be configured are delay, gain, resonance frequency and damping ratio.
Resonator Frequency The external device is modelled by a resonator. Parameters to be configured are delay, center frequency and quality factor.
Internal PLL The DUT is the internal oscillator locked to an external signal through a phase-locked loop. The parameter to be configured is the delay.
VCO The external device is modelled by a voltage controlled oscillator. Parameters to be configured are delay, gain and bandwidth.
Resonator Amplitude The external device is modelled by a resonator. Parameters to be configured are delay, gain, center frequency and quality factor.
Delay numeric value Parameter that determines the earliest response for a step change. This parameter does not affect the shape of the DUT transfer function.
Gain numeric value Parameter that determines the gain of the DUT transfer function.
BW (Hz) numeric value Parameter that determines the bandwidth of the first-order low-pass filter respectively the bandwidth of the VCO.
Damping Ratio numeric value Parameter that determines the damping ratio of the second-order low-pass filter.
Res Freq numeric value Parameter that determines the resonance frequency of the of the modelled resonator.
Q numeric value Parameter that determines the quality factor of the modelled resonator.
P (Hz/deg) numeric value Proportional gain P coefficient used for calculation of the response of the PID model. The parameter can be optimized with PID advise or changed manually. The parameter only gets active on the PID after pressing the button To PLL.
I (Hz/deg/s) numeric value Integral gain I coefficient used for calculation of the response of the PID model. The parameter can be optimized with PID advise or changed manually. The parameter only gets active on the PID after pressing the button To PLL.
D (Hz/deg*s) numeric value Derivative gain D coefficient used for calculation of the response of the PID model. The parameter can be optimized with PID advise or changed manually. The parameter only gets active on the PID after pressing the button To PLL.
BW (Hz) numeric value Simulated bandwidth of the full close loop model with the current PID settings. This value should be larger than the target bandwidth.
Target BW LED green/red Green indicates that the target bandwidth can be achieved. For very high PID bandwidth the target bandwidth might be only achieved using marginal stable PID settings. In this case, try to lower the bandwidth or optimize the loop delays of the PID system.
PM (deg) numeric value Simulated phase margin of the PID with the current settings. The phase margin should be greater than 45 deg for internal PLL and 60 deg for all other DUT for stable conditions. An Infinite value is shown if no unity gain crossing is available to determine a phase margin.
Stable LED green/red Green indicates that the phase margin is fulfilled and the PID system should be stable.
To PID Copy the PID Advisor settings to the PID.
Table 5: PID tab: Display sub-tab
Control/Tool Option/Range Description
Advanced Mode ON / OFF Enables manual selection of display and advice properties. If disabled the display and advise settings are automatically with optimized default values.
Display Select the display mode used for rendering the system frequency or time response.
Bode Magnitude Display the Bode magnitude plot.
Bode Phase Display the Bode phase plot.
Step Resp Display the step response plot.
Start (Hz) numeric value Start frequency for Bode plot display. For disabled advanced mode the start value is automatically derived from the system properties and the input field is read-only.
Stop (Hz) numeric value Stop frequency for Bode plot display. For disabled advanced mode the stop value is automatically derived from the system properties and the input field is read-only.
Start (s) numeric value Start time for step response display. For disabled advanced mode the start value is zero and the field is read-only.
Stop (s) numeric value Stop time for step response display. For disabled advanced mode the stop value is automatically derived from the system properties and the input field is read-only.
Transfer Function Selector Selection of the displayed transfer function of the loop. 2 presets and a manual selection are possible. In closed loop configuration all elements from output to input will be included as feedback elements.
System From Setpoint to System Output.
PID From Setpoint to PID Output.
Manual Any transfer function in the open or closed loop can be visualized.
Response In Start point for the plant response simulation for open or closed loops. In closed loop configuration all elements from output to input will be included as feedback elements.
Demod Input Start point is at the demodulator input.
Setpoint Start point is at the setpoint in front of the PID.
PID Output Start point is at PID output.
Instrument Output Start point is at the instrument output.
DUT Output Start point is at the DUT output and instrument input.
Response Out End point for the plant response simulation for open or closed loops. In closed loop configuration all elements from output to input will be included as feedback elements.
PID Output End point is at PID output.
Instrument Output End point is at the instrument output.
DUT Output End point is at the DUT output and instrument input.
Demod Input End point is at the demodulator input.
System Output End point is at the output of the controlled system.
Closed-Loop ON / OFF Switch the display of the system response between closed or open loop.
TC Mode ON / OFF Enables time constant representation of PID parameters.
Set Limits ON / OFF Switch the writing of PID limits when 'To PID' is pressed. Only applies in case of internal PLL.
Advisor Link Automatically copy cursor values displayed below to the PID advisor. To enable cursor helpers, switch Advanced Mode on and set Display to Bode Magnitude with PID Transfer Function. Cursors will be displayed in Log and dB axis scale combinations.
P Cursor value representing PID proportional gain P. Drag the plot cursor with the mouse pointer or directly insert numerical value here.
I Cursor value representing PID integral gain I. Drag the plot cursor with the mouse pointer or directly insert numerical value here.
D Cursor value representing PID derivative gain D. Drag the plot cursor with the mouse pointer or directly insert numerical value here.