ADS DAQ
The ADS DAQ (Data Acquisition) VI is a LabVIEW™ Express VI for easy configuration of measuring tasks with TwinCAT 3, i.e. you can use this VI for read access to TwinCAT runtimes.
The user interface of the ADS DAQ VI 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)
- Type generator configuration
- Configuration of start and end condition of the measuring task
The configuration window opens after placing the ADS DAQ 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 DAQ VI The ADS DAQ VI stores the configuration of an instance in the path of the current project/VI. Therefore, it is necessary to save the project/VI beforehand. |
Open ADS DAQ 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".
Output | Meaning |
---|---|
[20] Handle | Handle to the ADS client |
[25] Loaded Types | An array of LabVIEW™ Enums:
|
[26] Selection | LabVIEW™ cluster consisting of two elements:
|
Number of symbols Currently, the ADS DAQ block supports reading a maximum of 10 ADS symbols per instance. Use multiple instances or the upgrade ADS FlexDAQ if you want to read more than 10 ADS symbols. |
Generation of TwinCAT 3 data types 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
This window is used to select the ADS symbols to be read with the ADS DAQ instance. The window offers three different ways to select the ADS symbols:
- Symbol Interface: Opens an additional graphical user interface for browsing ADS symbols.
- Browse into the connected targets.
- Select the desired ADS symbols and drag and drop them into the right field.
- Optionally, in the right field you can export the selected ADS symbols as a list and save them as an XML file.
- Symbol File: Opens a LabVIEW™ file dialog box to read in the ADS symbols using an XML file exported from the Symbol Interface.
- Reads only the symbols, but does not include all other settings of the ADS DAQ VI from the other configuration views.
- Load Previous Configuration: Loads the last configuration (if existing) with which the ADS DAQ instance has already been configured.
- The configuration always opens as an empty configuration. If you want to adjust the existing configuration, select Load Previous Configuration.
After selecting the ADS symbols, select Next.
Click Finish in the dialog at any time to save and close the configuration.
Notification selection window
In this window the notification mode is specified for individual selected ADS symbols. The Notification Mode describes on one side the way of reading (single/buffered) and on the other side the display of the read data in LabVIEW™ (control/queue). Default setting is Buffered TypeResolved Queued.
The following table describes the different properties:
| Single TypeResolved | Buffered TypeResolved |
---|---|---|
Control (Only recommended if the data do not need to be processed or saved) | The individual notifications are displayed directly in a LabVIEW™ control. | Notifications are first written to an intermediate buffer layer and passed into the LabVIEW™ process when the buffer is filled. The data are displayed in a LabVIEW™ control. |
Queued (Recommended if data are to be processed, saved, ...) | The individual notifications are inserted directly into a LabVIEW™ queue. | Notifications are first written to an intermediate buffer layer and passed into the LabVIEW™ process when the buffer is filled. The data are inserted into a LabVIEW™ queue. |
For more information on single and buffered mode, see Communication modes and Event driven reading.
Click Modify to open the Symbol Interface and make changes to the ADS symbols to be read.
Click Next to go to the next configuration page.
Type generation selection window
In this window you can select whether the respective data type of the ADS symbol to be read is to be generated as a LabVIEW™ constant or as a control/display element. Both constants and control/display elements are automatically generated in the block diagram of the VI, where the ADS DAQ instance is also located. Default setting is Control/Indicator.
Measurement Job configurator
In this window the ADS DAQ instance can be configured with additional start/stop/record conditions.
Default setting is at Start: LabVIEW run and at Stop: LabVIEW Abort, no Record.
Start Job
The control Start Job configures the start of the reading process. The parameter Start Condition describes the way of starting.
- LabVIEW™ Run: The ADS notifications are both automatically registered and started after starting the VI.
- On Signal: The ADS notifications are not started automatically in this case. The ADS DAQ instance waits for a specific trigger from LabVIEW™ or TwinCAT.
- Trigger on LabVIEW™ Event: With this selection the ADS DAQ instance generates a separate event logic to start the ADS notifications from LabVIEW™.
- TwinCAT Signal: The DAQ instance is triggered by an (additional) TwinCAT signal and therefore does not start the ADS notifications automatically. The button Browse Target opens the Symbol Interface. Drag an ADS symbol to the right onto the "Read" area. All primary data types are allowed. Furthermore, a signal condition has to be defined on which the ADS DAQ VI is to be triggered.
The table below describes the transition (Last value ➔ New value) of different TwinCAT types with the definition of Rising and Falling Edge used here.
TwinCAT type | Rising Edge | Falling Edge | ||
---|---|---|---|---|
| Last value | New value | Last value | New value |
Boolean type | 0 | 1 | 1 | 0 |
Numeric integer type (i8, i16, i32, i64, u8, u16, u32, u64) | < Threshold | = Threshold | > Threshold | = Threshold |
Numeric rational type (float32, float64) Epsilon: 1.0 e-7 | < Threshold | = Threshold | > Threshold | = Threshold |
Stop Job
The control Stop Job configures the stopping of ADS notifications, i.e. the stopping of the reading process. The parameter Stop Condition describes the way of stopping.
- LabVIEW™ Abort: The ADS notifications are automatically unregistered as well as stopped after stopping the VI.
- Measurement Duration: The ADS notifications stop automatically after the measurement time has elapsed.
- On Signal: This option behaves identically to the selection On Signal in Start Job (see above).
- Click Copy from Start Signal to copy the start condition from Start to Stop Job (applies only to the TwinCAT signal).
Record Job
The recording of ADS DAQ measured data can be configured with the control Record Job. After configuration and clicking Finish, the ADS DAQ instance generates an additional Block To TDMS to save the received data as a LabVIEW™ TDMS file under the specified file name and path.
Click Finish to save the settings. The automatic code generation for your configuration starts.
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 DAQ VI is generated with default settings, i.e. Buffered Type Resolved Queue, Control/Indicator, Start with LabVIEW™ Run, Stop with LabVIEW™ Stop. An ADS symbol MAIN.aBuffer is read.
- 1a: A handle from Queue 1 goes from the instance of ADS DAQ VI to the underlying queue blocks. The queue of the ADS DAQ VI already contains Type-Resolved data packets. Each data packet is of size LvBufferSize (cf. settings in the Symbol Properties), as Buffered Type Resolved Queue has been configured.
- 2a: Initialization of the queue with a LabVIEW™ Variant Array as data type.
- 2b: While loop with start condition "LabVIEW™ Run" and end condition "Timeout or error occurred".
- 2b.1: Dequeue element: Waits for received data packets with specified timeout of 5 seconds (customizable).
- 2b.2: 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.
- 2b.3: Checks the current state of the queue, e.g. whether the queue is growing steadily. If this is the case, the data will arrive from ADS DAQ VI faster than it can be converted to the LabVIEW™ data type. Optionally, the user can insert a display element or similar here to monitor the queue.
- 2c: Releases the queue memory. After that the queue is released from the LV 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 recording to a TDMS file is enabled.
- The blocks already described in the first example remain identical in their function. Only the timeout was set to -1 in this case (wait infinitely), because the start of the measurement is triggered by LabVIEW™.
- 2b.4: The TDMS block is automatically generated based on the setting that a recording should take place. The user must manually link the data to be saved 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).
- 3a: The ADS reader handles are regenerated with each new configuration of the ADS DAQ VI. The obsolete reader handles are automatically released from memory.
- 3b: Logic is created that generates a trigger-event when a Boolean value change occurs. This is used to start the ADS notifications.
- 3b.1: Starts the ADS Notification for the registered ADS symbols.
Notes on the "To TDMS" in the block diagram
The To TDMS block allows you to save ADS DAQ instance data to a LabVIEW™ TDMS file (the NI TDMS file format). This block is automatically generated by the ADS DAQ instance, but only if Queued has been selected as the notification mode, cf. ADS DAQ.
The TDMS file format provides TDMS objects and TDMS channels to hierarchically arrange data or properties (name, date, ...) among TDMS objects. The inputs Property-/Data Objects can be used to reference or classify both properties and data. The inputs Property-/Data Values help to enter measured values under TDMS objects and channels.
Input/output | Meaning |
---|---|
[0] Path In | The path to the TDMS file |
[1] Property Objects | An array of a LabVIEW™ string:
Sample: Property Object[0]=ObjectABC/ChannelXYZ:Name,Author,Date TDMS Object=ObjectABC TDMS Channel=ChannelXYZ Property[0]=name (string) Property[1]=author (string) Property[2]=date (timestamp) |
[2] Property Values | An array of LabVIEW™ variants:
|
[3] Transpose Data? | Flag to transpose the entered 2D of 3D arrays. |
[5] Data Objects | An array of a LabVIEW™ string:
The following format is used for referencing:
Sample: Data Object[0]=ObjectABC/ChannelXYZ |
[7] Data Values | An array of LabVIEW™ variants with the following supported LabVIEW™ types:
|
[4] Path Out | The path of the TDMS file |
The following graphic shows an example of the To TDMS block in use.