4. Controllers

In addition to standard instruments, Labber also provides special controller instruments for implementing functionality such as PID controller loops. The controller instruments works by reading an input value from a separate instrument such as a thermometer, applying a controller logic to regulate temperature (for example), and then sending the controller output value to another instruments such as a heater.

_images/PID-controller.png

The user interface for the PID Controller driver.

4.1. Controller operation

To use the controller functionality, start by adding a controller instrument to the Instrument server by clicking the Add Instrument-button in the Instrument server toolbar. Labber provides a built-in PID controller, and additional custom controllers can be created as described in Section ControllerDriver. In addition to the usual sections and settings specific to the particular driver, a controller driver also have a number of extra settings related to running the controller loop. An example of the built-in PID Controller driver dialog is shown in Fig. PID, with the controller settings seen in the right-hand side of the figure. The dialog contains the following settings:

Enabled:
If checked, the controller loop will run in the background and call the input/output instruments at a fixed interval set by the Period-setting.
Period:
Intended controller loop period, in seconds.
Measured period:
Actual controller period, which may be different than the set period depending on the time it takes to read/write the input/output values from/to the instruments.
Input signal:
Input signal for the optimizer.
Input value:
Current input value.
Output signal:
Output signal for the optimizer.
Output value:
Current output value.

To set up the controller, first start the instrument driver by clicking the Start-button. Next, select the proper Input and Output signals from the pull-down controls. Finally, set the intended controller period, make sure that both the Input and Output instruments are running, and then press the Enabled checkbox to start the controller. The controller loop will now run in the background and call the input/output instruments at a fixed interval set by the Period-setting.

4.2. Improving controller performance

If the controller needs to run at a high repetition rate, set the Period control to 0.0 to run the controller loop continuously without gaps. The actual controller loop period will not be zero due to the time it takes to read/write values from the instruments.

Note that the updating the user interface introduces a slightly delay, so for the fastest operation it is advised to run the controller with its dialog window closed. The measured controller loop period can be probed even if the controller window is closed by expanding the PID Controller/Controller settings items in the main Instrument server dialog.