How are channel calculations performed in LabChart Lightning?

LabChart Lightning provides a powerful and flexible system for creating and using signal calculations.  The two ways to create these calculations are:
 
  1. Simple mode: where a single existing calculation is selected from a drop-down menu.
  2. Custom mode: where a new, custom calculation is built using combinations of existing functions, inputs, and outputs.

The video and knowledge article below describe the process of how to use these two modes. 
 

To create a new calculation, left mouse click on an existing signal name in the channel header in Chart View to view the signal’s properties. Now, click on the "Add Calculated Signal…" button. As shown in the image below, you will now see the Calculation Tab where you can either create a simple or custom calculation. 
 


 

To create a new custom calculation, left mouse click on the "Customize…" button. You will now see the Custom calculation dialog. This dialog is split into three areas: (1) A canvas where you construct your calculation. (2) A preview where input and output signals are shown; and (3) A function library that contains the building blocks of your calculation such as existing calculations, inputs, outputs, and parameters.
 

A new custom calculation starts with an Input and Output Node. Input Nodes represent existing signals in a recording. They typically feed into Function Nodes. Output Nodes represent the calculated signals produced by a calculation. Left mouse clicking on the eye icons in the Input and Output Nodes shows and hides their signals in the preview. Clicking on the signal name in the Input Node changes the signal the Input Node uses.

 

Custom calculations consist of a series of inputs, outputs, parameters, and functions. These are represented graphically in the calculation diagram by Nodes and Connecting Lines. The Connecting Lines indicate the flow of data or values into and out of Nodes.

A calculation is built up by adding one or more functions between the Input and Output Nodes. Functions can be found by typing in a partial or complete function name into the search field at the top of the Function Library. In the example below, the SmoothSeconds Function has been located. Left mouse clicking once on SmoothSeconds in the search results list shows detailed documentation on the function. The SmoothSeconds Function can be added to the calculation by dragging the list entry for SmoothSeconds (or the Node preview in the documentation area) to the middle of the line connecting the Input and Output Node.
 

Left mouse click on the SmoothSeconds Node so that it is highlighted and take a moment to look at a typical Function Node.

 

If you look at the signal preview you may not notice anything different. This is because the output signal is covering the input signal. The SmoothSeconds length value is set to 0, so the source signal is not being smoothed at all - the output signal (yellow) is identical to the input signal (red). Go ahead and change the averaging time length for the SmoothSeconds Node to 0.25 seconds. You should now see two distinct signals in the preview. Note: The colors of the signals and the Input and Output Nodes. Inputs and outputs are drawn using the same color as their signals in the preview.

 

Function Nodes may be chained together to form more complex calculations. In the example below, the abs (absolute value) Function has been dragged from the Function Library to the midpoint between the Input Node and the SmoothSeconds Node. LabChart Lightning automatically connects the Nodes together.

 

To apply this calculation, left mouse click on the "Add Calculation" button at the bottom right of the Custom Calculation dialog. Back in Chart View, the new calculated signal can be seen in the same channel as the source signal. Note: You may need to perform an autoscale for the new calculated signal to be visible.

 

There are other methods in LabChart Lightning for manipulating Nodes and Paths in a Custom Calculation. For example, Nodes can be manually connected. In the example below, the abs function has been dragged to an empty part of the canvas. It can be added to the calculation by manually dragging the paths to the input and output notches of other existing Nodes.

 

A selected Node can be removed from the calculation by selecting it with a left mouse click and then pressing the delete key.  Paths can also be deleted in the same way.

Note: a warning icon appeared in the SmoothSeconds Node when the path is removed. This is because when the SmoothSeconds Node is connected to an output, it requires a valid data source input. Calculations that contain errors cannot be applied (the Add/Update calculation button will be disabled). The error warning can be removed by reconnecting the Input Node to the SmoothSeconds Node.

 

Function Nodes in a calculation can be easily and quickly replaced by having a replacement Node dropped onto them as demonstrated below.

 

Editing the Custom Calculation is easy. Simply left mouse click on the color square or name of the calculated signal in the Chart View header to see its properties. Click on the "..." button in the calculation row (highlighted in the image below), and then click on "Customize..." button. You should now be back in the Custom Calculation dialog. Change the Length value for the SmoothSeconds Node to 0.15 seconds and left mouse click the "Update Calculation" button. The changes in the calculation are not applied in the Chart View until you click the "Update Calculation" button.

 

If you have any questions about LabChart Lightning and its use, please reach out to your local ADInstruments Technical Support Representatives.