Implementing Custom Data Acquisition Code

NI InsightCM™ SDK 3.3 Help

Edition Date: December 2018

Part Number: 375191F-01

»View Product Info
Download Help (Windows Only)

Parent Topic: Overview: Developing Software for Devices in an NI InsightCM System

To implement custom analysis calculations, create a new process that runs in the device code and runs as part of the Dataflow Script. For guided, step-by-step instructions for creating a process, refer to Creating a New Process.

Planning

Determine how you want to construct data sets of the size you desire.

Details

In the SDK reference code, the NI-developed Accumulator process combines waveforms from successive data sets into sets of a user-specified size. Then, the NI-developed Analysis process calculates feature and spectral band values on the resized data sets.

Initializing the Process

Determine whether your process needs to perform the following common tasks.

Read the device configuration for channel properties that are required to perform the calculation.

Details

For example, data-acquisition processes might need to scale data from a channel according to its sensitivity property. In this case, read the sensitivity property and bundle its value with other channel properties for use in the subdiagram that reads channel data.

How-to: Providing Configuration Data to a Process

Prepare the NI-developed Data Event Creator process to collect data that contain the sensor data this process acquires.
Make the status of each sensor available in the InsightCM web application to display sensor information in the Features and Alarm Rules tabs on the Assets page.

Details

Use the Register Dataflow Points VI to register every feature assigned to every channel. Set their data type as string because the status is either ok or another string that indicates an error condition.

Initialize hardware resources to prepare them to operate prior to the process beginning continuous acquisitions.

Details

Depending on the type of acquisition modules you use, you might need to complete additional steps before you can initialize hardware resources. If your hardware initialization depends on another process completing a task, move this code into a separate subdiagram and create a dependency on the other process. For example, if the device must be running the FPGA bitfile before you initialize hardware, you can subscribe to the FPGABitfileDownloaded message, which is broadcast when a process finishes that task, in order to wait to initialize the hardware until handling that message.

Acquire Subdiagram

Data acquisition processes continuously acquire data from equipment by repeatedly reading from hardware resources. Therefore, a process typically contains an acquisition subdiagram to perform the following tasks during each iteration of the process loop.

Store a running count of the number of acquisitions the process performs.

Details

Increment an element of the process configuration cluster that stores a running count of the number of acquisitions the process performs. Each data set the process creates must specify its order relative to other data sets from the same data group, so this property provides that value. When you create a data set, ensure you write this value to a map point named AcqBlockNumber in the copy of the data group's point value map that you create.

Check each channel that produced data in the data set to ensure it was in proper working condition when it acquired the data.

Details

If the channel status is not ok, consider flagging the channel so that your process writes a value of -1 for all its features.

Use the device driver API to read data from hardware.
Manipulate acquired data into the appropriate format so other processes can handle it.

Details

  • If the hardware produces a single value per channel each time it reads, write the value for each channel as a map point in the data group's point value map. Write the Tag Id as the point name. Use the Point Set Valid subVI to write the channel-status Boolean value from step 1 as an attribute of the point.
  • If the hardware produces waveforms, build an array of waveforms, where each element is a waveform from a particular channel. If you will reuse the NI-developed Accumulator process, create a new data value reference to store the waveform array until it reaches that process.
Determine how the data will enter the Dataflow Script to be evaluated for triggers and alarms and to be transferred to NI InsightCM Server.

Details

  • If your process produces waveforms, create a data set and send it to the first process in the Dataflow Script.
  • If your process produces single-point values and you have data groups that contain both single-point channels and waveform channels, the process that acquires waveforms automatically includes the single-point values when it makes a copy of the point value map for those data groups.
  • If your process produces single-point values and you have data groups that contain only single-point channels, you can allow the NI-developed Single-Point Clock process to create one data set per second that includes the latest single-point values for those data groups. The one-second period that Single-Point Clock process implements is a hard-coded behavior.

How-to: Send it to the first process in the Dataflow Script

Top-Level VI

After you complete the previous sections to prepare for many devices to connect to NI InsightCM Server, complete these tasks for each device you add.

Initialize the application software with Qbus.

Details

Templates can save time because you do not need to manually perform similar configuration tasks for each device. You might only need to verify that the settings are correct.

How-to: Initialize with Qbus

Add the process to the Dataflow Script in the execution order you desire.

Details

If you want to reuse the NI-developed Accumulator process to construct data sets of a desired size, add this process after the Accumulator process.

How-to: Add to DataFlow Script

WAS THIS ARTICLE HELPFUL?

Not Helpful