To download NI software, including the products shown below, visit ni.com/downloads.
This Windows Forms Application allows users to acquire and plot vibration data from a C Series Sound and Vibration Input Module, in addition to using digital edge triggering. The script utilizes NI-DAQmx, Measurement Studio, and the Math.NET Numerics toolkit.
The code begins by instantiating the following variables: the maximum and minimum vibration, the accelerometer sensitivity, and the current excitation value. The sample rate and number of samples per channel are instantiated through user input within the Windows Forms application. Then, the DAQ task is created. Within the task, a channel for the accelerometer is created, the timing of that task is configured, and the trigger is configured. A single channer reader is instantiated using the DAQmx “Analog Single Channel Reader” class. An array of doubles for the time data is generated using the Math.NET Numerics’ “Generate Linear Spaced method.” Data is acquired in a for loop through the “ReadMultiSample” function. This data and the time data are continuously plotted in the Measurement Studio scatter graph control during each iteration, as the graph’s “ImmediateUpdates” property is set to true. Overall, this program flow follows the same programming flow that you typically see in NI drivers: open, configure, read or write, and close.
If necessary, this script can be modified to accept different measurement and triggering types, longer or unlimited acquisition time, and more. For more information, read the documentation in the links provided below.
To utilize the application:
This program was built in Microsoft Visual Studio 2019 with an installation of Measurement Studio 2019 f4.Additional-Separate-2
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.