5. Measurement program¶
The Measurement program allows instrument quantities to be measured as a function of other parameters. The program is highly flexible, allowing multi-dimensional sweeps involving any instrument quantity defined in the Instrument Server. The Measurement is started by from the system tray menu (“Show Measurement Editor”) or by selecting “Window/Show Measurement Editor” from the main Instrument Server window.
5.1. Measurement configuration¶
The main measurement configuration window is shown in Fig. Stepper. The left-hand panel contains a list with instrument quantities (or Channels) involved in the experiment, the top-right section defines the sequence of Channels to sweep, while the lower-right panel shows a list of channels to measure. Measurements are easily configured by dragging Channels between the lists.
5.2. Adding channels¶
The first step for setting up a measurement is to define the Channels involved in the experiment. A Channel represents an instrument quantity on an Instrument Server, together with additional properties like name, unit, conversion factors and limits. The easiest way to define channels is to add instruments already present on an Instrument Server, which is done by clicking “Add Instruments from Server” in the main Measurement configuration window. This will bring up a dialog with options for connecting to an Instrument Server, and a list of instruments that can be added to the measurement.
There is also an option for adding channels without having the corresponding instrument previously defined on a server. Choosing the “Edit/Add Instruments...” from the menu bar will bring up a dialog where the user can select which instrument to use and how to communicate with it. In this case, the user needs to specify both the communication protocol of the instrument as well as the server address, so that the new instrument can be created on the Instrument Server when starting the measurement.
By default, the program will add channels for every quantity active in the instrument configuration. To minimize clutter and allowing an easy overview of the measurement setup, it’s advisable to remove channels that will not be controlled from an experiment. This is done by selecting a quantity and pressing the “Remove”-button below the list. Quantities can always be re-introduced later by clicking the “Add”-button. In addition, the value of any instrument quantity can by controlled by opening the Instrument driver configuration window (either by double-clicking the instrument name in the Channels list or by selecting an instrument and pressing “Show cfg...”).
Note that the Instrument driver configuration window serves different purposes in the Measurement program and in the Instrument Server. In the Instrument Server, the instrument configuration dialog is used to directly control the hardware settings, meaning that any changes to the dialog will directly affect the state of the hardware. In contrast, in the Measurement program the dialog is used to define a configuration that will be used in a specific Measurement, but no changes are made to the hardware until the measurement is started. To avoid confusion, Instrument driver configuration windows have a different background color when opened within the Measurement program and in the Instrument Server.
Channels also contain properties for describing the physical quantity measured by an instrument. The properties are set in the Channel configuration window (see Fig. Channels), which is brought up by selecting a channel and clicking the “Edit...”-button. The dialog allows the user to set channel max/min limits, and to define conversion factors between the physical quantity investigated in the experiment and the quantity measured by the instrument. An example where such a conversion is useful is when current biasing a circuit by applying a voltage over a large resistor in series with the circuit. In this case, the physical quantity would be current (with units Ampere), while the instrument quantity would be voltage. The equations for converting between physical and instrument units are defined in the text box next to the Conversion factors-controls.
5.2.1. Instrument configuration - locks¶
After the channels have been added to the Measurement configuration, the corresponding Instrument driver configuration window can be shown by double-clicking the instrument name or selecting the instrument and clicking “Show Config...”. In addition to the settings listed when describing the Instrument Server (see Section ConfigInstr), the dialog contain contains an extra checkbox (“Lock instrument on server”, under the section “Communication”) for determining whether the instrument will be used exclusively by the current experiment. If the control is checked (default behavior), no other clients can connect to or change the instrument values during the duration of the measurement. See Section OpenClients for more information about locks.
5.3. Sending and retrieving values from instruments¶
The “Set Value...”- and “Get Value”-buttons below the channel list allow the user to quickly set or retrieve the current instrument value. Note that the “Set value...”-operation will immediately send the new value to the instrument hardware.
Instrument values can also be controlled from the Instrument driver configuration window, which is opened by double-clicking the instrument name or selecting the instrument and clicking “Show Config...”. However, in contrast to the “Set/Get Value”-buttons, changing the value of a control in the Instrument driver window will only update the local value kept in the Labber configuration. The actual instrument hardware is not updated until the user clicks “Set Cfg” in the driver window, or when the measurement is started (provided that the “At Measurement Start”-option in the driver window is set to “Set config”).
5.4. Defining step sequences¶
A measurement consists of a list of Step sequences that output values to instruments in a specified order. To define a Step sequence, drag the channel to sweep from the Channels list on the left to the Step sequence list on the top right of the main Measurement configuration window. This will bring up the Basic settings-dialog for defining the range of values to output. Once defined, the step items can be re-ordered by dragging the entries within the list.
5.4.1. Step setup - Basic settings¶
The basic settings dialog allows the user to define single-point step values or basic ranges, either by defining start-stop or center-span values. The step size is specified either by setting a fixed step size, or by defining the total number of points in the step range, see Fig. StepItem. When defining the number of points in the range, the user can set the interpolation to be linear or logarithmic. Note that logarithmic interpolation only works if all values in the step range are positive.
If the channel is sweepable or if there are scaling factors defined between physical/instrument units, the dialog contains a few extra controls as described in Section AdvancedStepSetup.
5.4.2. Step setup - Advanced settings¶
The advanced settings dialog contains a few extra controls to provide better control of the step parameters. First, there is a list with step ranges, allowing multiple ranges to be defined with different step sizes (see Fig. StepConfig for an example). Use the “Add...”, “Edit...” and “Remove”-buttons to add/edit ranges, and drag the entries in the list to make the values appear in the right order. The graph in the upper-right corner of the dialog shows a visual representation of the step output values, with the step number on the y-axis and the corresponding output value on the x-axis.
In addition, the upper-left part of the dialog contain the following controls for fine-tuning the step sequence:
- Step units:
- The control sets whether the step values are given in instrument or physical units of the channel (see Section Channels). The step values are updated to reflect the unit settings whenever the control is updated. The control is only visible if physical/instrument unit conversion factors have been defined in the Channel setup dialog.
- Wait after each step:
- Time to wait after a step value has changed. Note that the actual time to wait will be the maximum of this time and the delay time between step and measure as set in the main Measurement configuration window (see Section Timing).
- Alternate step direction:
- If checked, the execution of the step sequence in multi-dimensional experiments will alternate between forward and reversed direction, eliminating the need to go back to the first step point between loops. This feature is also useful when looking for hysteresis when sweeping a field up and down.
- After last step:
- Defines the operation to perform after the step sequence has completed. Possible values are “Goto first point”, “Stay at final” or “Goto specified value”. Default behavior is “Goto first point”.
5.4.3. Step setup - Sweep mode¶
If the step channel is sweepable, the sweep mode controls provide a few extra user interface elements for controlling the sweep settings. For more information on how to write drivers that supports sweeping, see Section SweepDriver.
- Sweep mode:
- The program supports three different sweep modes:
- Sweep mode - Off:
- Sweep mode is off, step values are set directly.
- Sweep mode - Between points:
- The instrument is swept between step points, but the output is held constant while acquiring data for the log channels.
- Sweep mode - Continuous:
- In this mode, the instrument is configured to continuously sweep from the first to the last value in the step list. The log channels are being measured at the points defined in the step list, but the program will not stop sweeping the output channel while acquiring data for the log channels.
- Sweep rate, in units . The sweep rate is also shown in units . Note that the sweep rate in this dialog will overwrite the sweep rate defined in the configuration window of the corresponding instrument driver.
- Time between points:
- If sweep mode is Continuous, this text shows the typical interval between measurement points for the given sweep rate and step list.
- Use different sweep rate outside loops:
- If checked, a numerical control will appear below the checkbox, allowing the user to define a separate sweep rate for sweeping to the init/final values and for sweeping between loops. If unchecked, the program will use the common sweep rate defined in the control above when setting init/final/between loop values.
5.4.4. Step setup - Channel relations¶
One useful feature of the Advanced step configuration is the ability
to define relations between channels. For instance, imagine a situation
where we want to sweep two voltages V1 and V2 in a way that V2 is
always exactly 1.5 V higher than V1. To implement this, we first
define the step sequence for V1 as usual. Next, we create a step
configuration for V2 and switch to the advanced settings. Clicking the
“Enable channel relations” will allow us to enter an equation relating
the output of V2 to other channels. The values of other channels are
accessible through parameters, shown in the list on the right-hand side
of the dialog. The “Add...”, “Edit...” and “Remove”-buttons below
the parameter list are used to edit the parameter names. The parameter
x refers to the step values as defined in the step list in the upper
part of the dialog.
For this particular example, we would enter
p1 + 1.5 in the equation
box for channel V2 (assuming that the parameter
p1 is linked to
channel V1). The equation string can involve basic mathematical
Also, note that the raised operator () is given by two
multiplication signs (
Before starting a measurement, it is good practice to check that the relation equation produces the intended output. By default, the graph in the top-right corner of the dialog shows the step values generated by the step list, but it can also be configured to visualize the output of the relations as a function of any other channel in the measurement. The graph contents is set by the “Plot to show”-control to the left of the figure.
5.5. Log channels¶
The Log channels list defines the channels to measure at each step point. To add log channels, simply drag a channel entry from the main Channels list on the left to the Log channels list. Note that it is not possible to add the same channel to both the step and the log list.
If the checkbox “Log in parallel” is checked, the program will try to measure all channels simultaneously at each step point. If the “Log in parallel” is unchecked, the channels will instead be measured sequentially, starting with the top-most one in the list. The log channels can be reordered by dragging the items within the list.
5.5.1. Log channels limits¶
Each log channel has an associated range limit, which is defined by double-clicking the log channel or clicking the “Edit...” button below the log channel list. If the measured value falls outside the defined limits during a measurement, one of the following actions will be taken:
- No action is taken, the measurement continues as usual.
- Continue to next step item
- The measurement program stops execution of the innermost step sequence, and continues to the next item of the second step sequence.
- Stop, stay at current values
- Stop the measurement, hold all instruments at the current values.
- Stop, go to init/final configuration
- Stop the measurement, go to final values as defined in the Advanced step setup dialog (see Section AdvancedStepSetup). The default is to go to the initial values.
The Timing section in the lower-right corner of the main Measurement configuration window allows the user to set a time to wait between outputting new values to the step channels and measuring the log channels. In addition, the section gives an estimate for how long time it’ll take to run the measurement. The estimate is based on the duration of the previous experiment; the expected time needed per point can be adjusted manually, if required.
5.9. Starting a measurement¶
Once the step sequences, log channels and the log name have been defined, the measurement is ready for execution. When clicking the “Start measurement”-button in the upper-right corner of the Measurement dialog, the program will perform the following sequence:
The program will go through all step sequences to make sure that all of the step values are valid and within the min/max ranges allowed by the corresponding channels.
Next, connections will be established to the Instruments Servers of all instruments in the Channels list.
For every instrument, the program will either set or read the current the hardware configuration, depending on the value of the “At Measurement Start”-control of each instrument driver (see Section AtStartup). The recommended setting is “Set cfg”, since this will assure that instrument is hardware in the same state every time the measurement is performed. Note that the “At Measurement Start”-operation will be performed for all instruments defined in the measurement window, even for channels that aren’t used in step sequences or as log channels.
The program will perform the measurement by stepping through all the values defined in the Step sequences. The order of the step sequences define the order in which the values are outputted, starting with the values in the top-most step sequence. For example, consider a situation with two defined step sequences: one for “Channel 1” with values and one for “Channel 2” with values . There are a total of step points. If “Channel 1” occurs before “Channel 2” in the sequence list, the program will set the values in the following order:
Step No. Channel 1 Channel 2 1 1 10 2 2 10 3 3 10 4 1 20 5 2 20 6 3 20
On the other hand, if “Channel 2” occurs before “Channel 1”, the step order will be:
Step No. Channel 1 Channel 2 1 1 10 2 1 20 3 2 10 4 2 20 5 3 10 6 3 20
The values of all log channels are measured at each step point.
When the measurement is finished, the program will close the connections to all instruments and all Instrument Servers and return to the main Measurement configuration window. The new log will be available for viewing in the Log Browser window (see Chapter BrowserDlg)
Figure Measuring depicts the dialog shown when a measurement is running. The list on the left contains a list of the step and log channels defined in the measurement, together with current values and progress indicators (for step channels). The green light indicate that a value is currently being sent/received from an instrument. The graph on the right visualize the measurement progress for the step channel selected in the channel list on the left. Alternatively, if a log channel is selected, the graph will show the currently measured trace for that channel.
The tool bar at the top of the dialog contains buttons for showing the measured data in real-time, either as a line plot or as an image map. In addition, there are buttons for skipping traces, pausing and stopping the experiment. The Skip button will stop execution of the innermost step sequence, save the current trace, and then continue to the next step item.
5.10. Signal connections¶
Many experiments involve sending or reading waveforms from instruments like arbitrary waveform generators, digitizers or digital oscilloscopes. For example, imagine an experiment where we want to control the amplitude of a sine signal outputted using an arbitrary waveform generator. The process can be divided into two tasks: The first task is to numerically calculate a waveform with the correct amplitude, the second task is to send that waveform to the output of the arbitrary waveform generator. Another example would be to measure a waveform with an oscilloscope, and then apply some function to extract the signal’s amplitude or frequency, which would allow us to record only a single or a few values characterizing the signal instead of saving the whole waveform to the log file.
The Measurement program provides Signal Connections for managing situations like this. The idea is to separate the signal generation or signal analyzing from the instrument communication, to make it possible to develop generic Signal Generator or Signal Analyzer drivers for creating or analyzing waveforms, which operate independently of the specific hardware that is used to output or measure the waveforms. In this way, the waveform generation/analyzing functions can be used interchangeably with instruments from different vendors. For more information on how to create your own Signal Generator or Signal Analyzer drivers, see Section DriverINI.
The Signal Connections button in the toolbar of the main Measurement configuration window is used to show/hide a list of signal connections defined in the current setup. The button is only enabled when the setup contains instruments that allow waveform generation/analyzing. The Signal Connections control contains a list with all the instrument quantities that can output or analyze a waveform. To make a connection, double-click one of the outputs and select the source signal from the dialog that pops up, or simply drag a channel that represents a signal source from the main Channels list onto the correct output in the Signal Connections list. Figure Signals shows an example of a Measurement configuration with a few signal connections.
Note that signal connections are also possible for scalar-valued channels. To make a signal connection between two scalar-valued channels, click the “Show scalar-valued signals”-checkbox below the signal connection list. Scalar-valued channels are listed in italics in the signal connection list, to distinguish them from the waveform signal connections.
As mentioned earlier in this section, two types of signal connections can be made: The first type is when a Signal Generator driver is used to generate waveforms that will be sent to the output of an arbitrary waveform generator, for example. The second type of connection is when a waveform that is acquired using an instrument such as a digitizer or an oscilloscope is sent to a Signal Analyzer driver. The example in Fig. Signals illustrates both examples: The signals generated by the “Pulse Generator” Signal Generator driver are configured to be sent to various output channels of a Tektronix Arbitrary Waveform Generator (labelled “AWG” in the figure), whereas the waveforms acquired by the “Acquiris U1084A Digitizer” will be sent to the of the “Signal demodulation” Signal Analyzer driver that will extract the amplitude of the waveform at a specific frequency.
When running a Measurement that contains Signal connections, for each step in the step sequence the program will perform the following sequence:
- Update step values:
Update the values of channels defined in the Step sequence.
- Generate and output signals:
If present, calculate signals with Signal Generator drivers and send the resulting waveforms to the corresponding instruments outputs.
Wait for the time specified in the Timing section in the lower-right corner of the main Measurement configuration window.
- Acquire and analyze signals:
If present, measure instrument channels that acquire waveforms, and send the acquired waveforms to the corresponding Signal Analyzer drivers.
- Log results:
Measure the channels specified in the Log channels list and save them to disk. If a Signal Analyzer driver is in use, the Log channels list is where the user defines what quantities to store in the log file.
In the example of Fig. Signals, the step sequence will update a few parameters of the “Pulse Generator” Signal Generator driver. Once all parameters have been updated, the “Pulse Generator” driver will calculate new waveforms that will be sent to the “AWG” output channels. After that, the program will wait for 0.1 second to give the sample time to settle, before acquiring two waveforms (“Ch1 - Data” and “Ch2 - Data”) with the “Acqiris U1840A Digitizer”. The measured will waveforms will be sent to the “Signal demodulation” Signal Analyzer driver, which will analyze the waveforms and return the result in the channel named “Value”, which will be stored in the log file.
When running an experiment that contains Signal connections, it is possible to look at the measured waveforms in real-time as they are being acquired and processed. In the window that is visible when an experiment is running, mark the channel to investigate in the step sequence list in the left-hand part of the dialog (see Fig. MeasuringSignal).
5.11. Hardware timing and synchronization¶
In standard operation mode, Labber handles instrument synchronization by waiting for an instrument to report that all step channels values have been outputted before reading the log channels. Since this requires communicating with the instruments over the computer, the time synchronization may not be precise enough for certain applications. For such applications, Labber supports hardware triggering and hardware looping for enhancing the synchronization and timing precision.
5.11.1. Hardware trigger¶
In hardware trigger mode, log instrument will be armed to wait for a hardware trigger before starting to acquire data. To turn on hardware trigger mode, click the Hardware trig checkbox below the Step sequence configuration list in the Measurement setup window. The trigger channel must be an instrument channel represented by boolean or a button, and it is defined by the pull-down menu next to the check box. The instrument used to generate the trigger must also be represented in the step configuration list.
In hardware trigger mode, the following operations are performed at each point of the measurement sequence:
- Set output values of the step channels, but instruct the instrument to wait for a trigger before outputting any signals.
- Arm the log channels to get ready to acquire data.
- Wait for the time specified in the Timing section in the lower-right corner of the main Measurement configuration window. This time can be zero.
- Generate the hardware trigger. The output of the hardware trigger should be physically connected to the step and log instruments, so that the step instrument can start outputting signals and the log instruments can start acquiring data.
- Read out the acquired data.
5.11.2. Hardware looping¶
Some instruments can perform looping of values within the instrument hardware. This allows for implementing more efficient looping, since there will be no need for the computer to send new values to the instrument at each step value. This mode requires that the instrument outputting values support hardware looping, that the instrument reading values supports both hardware looping and hardware arming, and that there is a hardware trigger defined for instrument synchronization. If the instruments used in the Measurement configuration fulfill these requirements, hardware looping can be activated by clicking the Hardware loop checkbox next to the hardware trigger controls.
In hardware loop mode, the top-most step item in the Step sequence configuration list of the Measurement setup window will be controlled by the instrument hardware. Instead of setting and getting values point-by-point using the computer, the looping of the top-most step item will be handled in the following way:
- Calculate the number of values to step in the top-most step item.
- Send all values of the top-most step item to the output instrument, but instruct the instrument to wait for a trigger before outputting any signals.
- Arm the log channels to get ready to acquire data. The log instruments will be configured to acquire values.
- Wait for the time specified in the Timing section in the lower-right corner of the main Measurement configuration window. This time can be zero.
- Generate the hardware trigger. The output of the hardware trigger should be physically connected to the step and log instruments, so that the step instrument can start outputting signals and the log instruments can start acquiring data. The step instrument will output the values in the prescribed order, and the log instrument will acquire values.
- Read out the acquired values.
Since multiple values will be read out at once in hardware looping mode, the progress bar and the time estimate shown in the Measurement window during experiments may not update often enough be accurate.
5.12. File locks¶
The software uses a file locking system to prevent the Log Browser, Log Viewer or Measurement Editor from making changes to a file while a measurement is running. The locking mechanism works by creating an empty file with the same name as the log file that is being measured, but with the ending .lock. Under normal operation, the .lock-file will be removed when the measurement is completed, but if the experiment was unexpectedly interrupted (for example, if the computer suddenly lost power), the .lock-file will persist and prevent any changes from being made to the file. To manually remove the locking, go to the folder where the log file is stored, locate the .lock-file and delete it.
5.13. Measurement settings¶
In addition to the general preferences described in Section Prefs, there are a number of settings that can be uniquely defined for each specific Measurement. These specific Measurement settings can be accessed by clicking the “Show Settings” toolbar icon in the top-left corner of the Measurement dialog. The settings are described in detail below.
- Send values in parallel:
- When outputting multiple values in a measurement step sequence, define if data should be sent to all instruments in parallel, or sequentially one after each other. Default value is True.
- Only send signal if source instrument has been updated:
- If checked, Labber will only perform a signal connection if the source instrument has been updated since last call.
- Data compression:
- The value ranges from 0 (no compression) to 9 (maximum compression). Higher compression reduces the log file size, but may slightly increase time for loading/saving data.