ADS FlexDAQ
The ADS FlexDAQ (Flexible Data Acquisition) VI is a further development of the ADS DAQ VI. As with the ADS DAQ, this is a LabVIEW™ Express VI that simplifies the configuration of measuring tasks with TwinCAT 3 and provides read access to the TwinCAT runtime.
The ADS FlexDAQ VI also offers the following additional options:
- Any number of ADS symbols can be read per instance.
- A unique Loop-ID can be assigned to the symbols. Symbols with the same Loop-ID are read in the same while loop.
- Each symbol can be assigned a corresponding TDMS flag to store the data to be read in a TDMS file.
The user interface guides you step by step through the configuration of your measuring task:
- Selection of the data points to be read (ADS symbols)
- Configuration of the read mode (ADS notification)
- Configuration of the Loop-IDs
- Configuring the storage of measured data in a TDMS file
- Configuration of start and end condition of the measuring task
The configuration window opens after placing the ADS FlexDAQ instance in the LabVIEW™ block diagram or by double-clicking. The configurations can be made with the help of the selection windows described below. After the configuration is complete, the instance creates all the necessary resources for reading the data.
Save VI before using the ADS FlexDAQ VI The ADS FlexDAQ VI stores the configuration of an instance in the path of the current project. Therefore, it is necessary to save the project beforehand. |
Open ADS FlexDAQ VI in an accelerated way
- The library must be precompiled.
- 1. Open the settings for "Mass Compile" in the LabVIEW™ settings at Tools > Advanced.
- 2. Select the folder of the TwinCAT 3 Interfaces for LabVIEW™ library, e.g. C:\Program Files\ National Instruments\LabVIEW 2023\user.lib\Beckhoff-LabVIEW-Interface .
- 3. Start "Mass Compile".
Input/output | Meaning |
---|---|
[1] Reader handles | Handles on the reading symbols |
[20] Handle | Handle to the ADS client |
[26] Selection | LabVIEW™ cluster consisting of two elements:
|
TwinCAT 3 data type generation To support all notification modes, all generated types are converted to arrays. Notifications Buffered as well as Notifications Single are supported in the same way. |
Symbol selection window
Just as with ADS DAQ, the Symbol selection window is used to select the ADS symbols to be read with the ADS Flex DAQ instance. In addition, there is an option Import Configuration, which can be used to import a saved configuration. For this purpose, a LabVIEW™ file dialog box opens, in which a path to an exported configuration can be selected.
Notification and Loop-ID selection window
In this window the Notification Mode and the Loop-ID are selected. The possible notification modes can be found in the section ADS DAQ. The Loop-ID is used to distribute the reading of the symbols to while loops. With the ADS Flex DAQ it is possible to assign the same Loop-ID to several symbols. These are then processed in the same while loop. This reduces the number of loops.
Maximum Loop-IDs The number of inputs is limited to 23 for the ADS Flex DAQ instance. Consequently, a maximum of 23 different Loop-IDs can also be assigned. |
Save measured data
For each symbol there is the option "Save To TDMS", which saves the respective symbol in a TDMS file when reading from TwinCAT. The block "To TDMS" like in the ADS DAQ is used for this purpose.
Automatically generated code in the block diagram
In the following, two variants of the automatically generated code are explained as examples.
In the first example, the ADS FlexDAQ VI is generated with default settings, i.e. Buffered Type Resolved Queue, no storage of measured data, Start with LabVIEW™ Run, Stop with LabVIEW™ Stop. An ADS symbol MAIN.aAM is read.
- 1: ADS Reader handles are initialized for the selected ADS symbols. The ADS reader handles are regenerated with each new configuration of the ADS FlexDAQ VI. The obsolete reader handles are automatically released from memory.
- 2: A handle from Simpe Queue1 goes from the instance of ADS FlexDAQ to the underlying queue blocks. The queue of the ADS FlexDAQ VI already contains Type-Resolved data packets. Each data packet is of size LvBufferSize (cf. settings in the Communication modes), as Buffered Type Resolved Queue has been configured.
- 3a: The queue is initialized with a LabVIEW™ Cluster, Read Package. The cluster contains a data array as a variant (TypeResolved ADS notification data) and a numeric array (notification timestamps) as elements.
- 3b: While loop with start condition "LabVIEW™ Run" and without end condition.
- 3b.1: Dequeue element: Waits for received data packets for an infinite time (customizable).
- 3b.2: Unbundle element: Splits the cluster into data and ADS timestamps.
- 3b.3: For loop: Takes the individual elements of the Variant array and converts the data type to the corresponding LabVIEW™ data type. Here, for example, the user can directly access the converted type and continue working with it.
- 3c and 3d: The queue memory is released. After that the queue is released from the LabVIEW™ memory. Optionally, after these steps, the user can release the ADS client handle from memory.
In the second example, the start condition is changed from LabVIEW™-Run to "Trigger on LabVIEW™ Event" and the data storage to a TDMS file is enabled. Two symbols are read: MAIN.aAM and MAIN.aSine. These are assigned the same Loop-ID. Thus, both symbols are read in the same while loop.
The blocks 1a, 2, 3b, 3b.2, 3b.4, 3c and 3d already described in the first example remain identical in their function.
- 1b: Logic is created that generates a trigger-event when a Boolean value change occurs. This is used to start the ADS notifications.
- 3a: The queue is initialized with a LabVIEW™ cluster as data type with the member variables:
- SymbolName: Identifies the read data packet
- Data: TypeResolved ADS notification data packet
- Timestamp: ADS notification timestamps
- 3b.2: The read data packet is unpacked and distributed to the corresponding case structure.
- 3b.3: Case structure that passes the ADS data for the unpacked symbol data to LabVIEW™. In the example, the case structure manages two ADS symbols MAIN.aAM and MAIN.aSine.
- 3b.5: The TDMS block is generated automatically based on the setting that the data should be saved. The data to be saved is automatically linked to the To Variant block. If the received data correspond to a LabVIEW™ signal, they can be converted to a LabVIEW™ waveform before the To Variant. The user can use the automatically generated constant dt which corresponds to the time distance between two data points (sampling period duration).
- 3e: Initialization of the handle to the TDMS file.