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.
How to Use
To utilize the application:
Connect your C Series module and CompactDAQ chassis to your PC.
Open the solution file in Microsoft Visual Studio with the Measurement Studio extension installed.
Run the project.
Input the name of your physical channel in the “Physical Channel” drop down box.
Input the name of your trigger channel in the “Trigger Channel” drop down box.
Input your desired sample rate, in hertz, in the “Sample Rate (Hz)” text box.
Input your desired samples per channel in the “Samples per Channel” text box.
Input your desired iterations to acquire in the “Iterations to Acquire” text box.
This program was built in Microsoft Visual Studio 2019 with an installation of Measurement Studio 2019 f4.