Data Acquisition and Analysis with LabVIEW Nathan McReynolds, Calvin College Introduction Methods

advertisement
Data Acquisition and Analysis with LabVIEW
TM
Nathan McReynolds, Calvin College
Introduction
Labview is a graphical programming
language designed for measurement and
control systems. The Front Panel, or
console, allows the user to quickly and
easily set variables while being able to
see the results on the same screen.
A distinct feature of Labview is the
virtual instrument (VI) which acts as a
class or method within a program. These
VIs and subVIs are represented in the
code, or Block Diagram, as boxes and
shapes that can be wired together.
Labview is data flow oriented. This
means that functions will be executed in
the order in which they are wired
through VIs from their initialization to
an output or deletion.
Objectives
Data Acquisition Goals...
•Take and save video to a file of the user’s
choice while displaying what is being
saved.
•Analyze the intensity distribution of light
in the video frames by subtracting
background images and fitting the results
to a theoretical function.
•Be able to read in voltage data over a
specified time interval and fit it with a
theoretical curve.
• Measure and display the frequency of an
oscillating signal.
•Produce digital and analog outputs that
are automatically updated at userspecifiable time intervals.
Methods
Results
Video
Accessing Data
In addition to the basic Labview package,
National Instruments provides vision acquisition
software. This comes in the form of separate VIs
that allow the user to connect to almost any USB
camera and grab images. These images can be
displayed and saved in real time to create a video
feed.
•Photos can be saved as JPEG, PNG, or any
other type the programmer specifies on the
vision VIs. These photos can be opened as a
regular photo file or can be called and
displayed by other Labview programs.
Analysis of Photos and Video Frames
Another module can be added to Labview that
allows the programmer to manipulate the photos
taken with the visual acquisition software. The
VIs available through this module can be used to
determine total luminosity and other relevant
parameters as needed in an experiment. They also
allow regions of interest to be selected and
analyzed, which gives us the ability to specify
what section of a photo’s luminosity is recorded.
•Other data such as the parameters of the fitted
inputs, frequencies, and even the raw input
itself, can be saved to text files. These files can
be opened through other VIs or through an
excel file.
Conclusions
Benefits
Fitting Data
Labview makes fitting data easy. For each form
of fit (exponential, linear, quadratic, etc.) there is
a separate VI. Each one needs the same two
inputs, an X and Y variable. To control which fit
is used, the programmer can create a case
structure in which, given the selected fit, the
program will run the X and Y values to the
chosen VI.
Excel can be used to view data written to text
files.
Digital and Analog IO (Input/Output)
Labview allows the execution of multiple
simultaneous IO tasks. These tasks can be
configured through simple “express VIs” or
individual DAQmx VIs that give the user more
control.
Labview is used in industrial and research
occupations across the world. Labview is a great
introductory computing language for anyone who
wants to go into experimental sciences. The
visual aspect of this language gives the
programmer easy access to the components of the
program that are being used. This allows the user
to see the results of whatever changes he or she
makes to the system that has been created.
Labview has made a more direct method for data
acquisition through express VIs that can take in
data and save it to specified files.
Challenges
Challenges with Labview include variable control
and device limitations. Labview allows excellent
control of the variables on a given VI, but the
structure of these VIs generally cannot be
changed. This prevents controlling variables that
are not explicitly provided by the VI.
•Inputs: All inputs for our experiment are time varying
voltage inputs. Fitting routines can be used to analyze
the temporal changes. Labview can be used to measure
the frequency of any periodic signal.
•Outputs: The two important aspects of outputs are
synchronization and control of the output voltage level.
Analog outputs allow the user to specify how much
voltage to output and digital outputs allow the outputs to
be synchronized to within a microsecond.
This is a snapshot of Labview’s block diagram which is
where the coding actually happens. This particular code
creates a square wave analog output and its frequency is
ramped up and down between a specified high and low.
Here Labview is fitting intensity data from the
slow turn-off of a light bulb. The two bell shaped
curves are the intensity per pixel, while the decay
curves show the average intensity per image. The
image being analyzed is displayed in the lower
left hand corner of the front panel.
Programs that are involved with IO tasks can be
limited by the number of lines/channels of a
device. Also, if synchronization is important, the
host computer’s counter must be used. Therefore,
the precision of your outputs is determined by the
processing speed of the device’s onboard clock.
1
Download