Download - LabVIEW - Logging Data to Text Files
![Page 1: LabVIEW - Logging Data to Text Files](https://reader031.vdocuments.us/reader031/viewer/2022012915/61c55f8444c52e4ddc415a77/html5/thumbnails/1.jpg)
Logging Data to Text Files in LabVIEW
Hans-Pe8er Halvorsen
h8ps://www.halvorsen.blog
![Page 2: LabVIEW - Logging Data to Text Files](https://reader031.vdocuments.us/reader031/viewer/2022012915/61c55f8444c52e4ddc415a77/html5/thumbnails/2.jpg)
Datalogging• When acquiring data from a DAQ device or an I/O
Module you typically want to store the data to either a File, a Database or an OPC Server
• Here we will use the “Write To Measurement File” in LabVIEW as an example
• If you don’t have a DAQ device or an I/O Module you can create a simple Simulator as exemplified later in this tutorial
![Page 3: LabVIEW - Logging Data to Text Files](https://reader031.vdocuments.us/reader031/viewer/2022012915/61c55f8444c52e4ddc415a77/html5/thumbnails/3.jpg)
Contents
1. Using DAQ or I/O Module in LabVIEW
2. Write To Measurement File3. Temperature Simulator
![Page 4: LabVIEW - Logging Data to Text Files](https://reader031.vdocuments.us/reader031/viewer/2022012915/61c55f8444c52e4ddc415a77/html5/thumbnails/4.jpg)
Using DAQ or I/O Module in LabVIEW
Hans-Petter Halvorsen
h@ps://www.halvorsen.blog
![Page 5: LabVIEW - Logging Data to Text Files](https://reader031.vdocuments.us/reader031/viewer/2022012915/61c55f8444c52e4ddc415a77/html5/thumbnails/5.jpg)
Data Acquisi+on Pale1e in LabVIEWFor more “advanced” DAQ we use these func+ons
For basic DAQ we use the DAQ Assistant
Students: Make sure that you have this palette installed. If not, install the latestDAQmx driver!
Functions Palette: “Measurement I/O” -> “NI DAQmx”
![Page 6: LabVIEW - Logging Data to Text Files](https://reader031.vdocuments.us/reader031/viewer/2022012915/61c55f8444c52e4ddc415a77/html5/thumbnails/6.jpg)
LabVIEW DAQ Assistant
When you place the DAQ Assistant on the Block Diagram, a Wizard automatically pops up where you configure what you want to do, i.e., if you want to Read or Write Data, Analog or Digital signals, which channel you want to use, etc.
![Page 7: LabVIEW - Logging Data to Text Files](https://reader031.vdocuments.us/reader031/viewer/2022012915/61c55f8444c52e4ddc415a77/html5/thumbnails/7.jpg)
Basic DAQ Example
![Page 8: LabVIEW - Logging Data to Text Files](https://reader031.vdocuments.us/reader031/viewer/2022012915/61c55f8444c52e4ddc415a77/html5/thumbnails/8.jpg)
Write To Measurement File
Hans-Pe4er Halvorsen
h4ps://www.halvorsen.blog
![Page 9: LabVIEW - Logging Data to Text Files](https://reader031.vdocuments.us/reader031/viewer/2022012915/61c55f8444c52e4ddc415a77/html5/thumbnails/9.jpg)
Save Data to File (Datalogging)Right-click-Properties
Recommended Se;ngs
![Page 10: LabVIEW - Logging Data to Text Files](https://reader031.vdocuments.us/reader031/viewer/2022012915/61c55f8444c52e4ddc415a77/html5/thumbnails/10.jpg)
Recommended Settings
![Page 11: LabVIEW - Logging Data to Text Files](https://reader031.vdocuments.us/reader031/viewer/2022012915/61c55f8444c52e4ddc415a77/html5/thumbnails/11.jpg)
Datalogging Example
![Page 12: LabVIEW - Logging Data to Text Files](https://reader031.vdocuments.us/reader031/viewer/2022012915/61c55f8444c52e4ddc415a77/html5/thumbnails/12.jpg)
Students: (1) Log Temperature Data, both Celsius and Fahrenheit (use SubVI) to a “Measurement File”. (2) Then Plot the Data in the File in Excel.(3) You should also create a new VI in LabVIEW where you plot the data from the File in a Graph and in an Array.
Datalogging Example – Block Diagram
![Page 13: LabVIEW - Logging Data to Text Files](https://reader031.vdocuments.us/reader031/viewer/2022012915/61c55f8444c52e4ddc415a77/html5/thumbnails/13.jpg)
Read from Measurement File - Example
Right-click-Properties
Block Diagram
Recommended Se>ngs
![Page 14: LabVIEW - Logging Data to Text Files](https://reader031.vdocuments.us/reader031/viewer/2022012915/61c55f8444c52e4ddc415a77/html5/thumbnails/14.jpg)
Recommended Settings
![Page 16: LabVIEW - Logging Data to Text Files](https://reader031.vdocuments.us/reader031/viewer/2022012915/61c55f8444c52e4ddc415a77/html5/thumbnails/16.jpg)
Temperature Simulator Example❗If you do not have the TC01 device available, you can create and use a
simple “Temperature Simulator” instead A simple SubVI that simulates a Temperature value using a
Random Generator:
In this way you can easily switch between
the real Temperature sensor (TC-01) and
the Simulator
Case Structure
While Loop
Case Structure
While Loop
Students: Create a “Temperature Simulator”.
Here you just see a simple example - feel free to
create a more realisOc Temperature Simulator
Use e.g., an “Enum”
Control (or just a String
or Numeric Control)
Example
![Page 17: LabVIEW - Logging Data to Text Files](https://reader031.vdocuments.us/reader031/viewer/2022012915/61c55f8444c52e4ddc415a77/html5/thumbnails/17.jpg)
How to create an “Enum” in LabVIEW
1 2 3
4
5
6
(used in the Temperature Simulator Example)
![Page 18: LabVIEW - Logging Data to Text Files](https://reader031.vdocuments.us/reader031/viewer/2022012915/61c55f8444c52e4ddc415a77/html5/thumbnails/18.jpg)
Log Datato File
Simple Example of how to log data to a Measurement File using the “Write To Measurement File” function in LabVIEW
In this example we get data from a simulator.
You can turn logging On/Off
Example
![Page 19: LabVIEW - Logging Data to Text Files](https://reader031.vdocuments.us/reader031/viewer/2022012915/61c55f8444c52e4ddc415a77/html5/thumbnails/19.jpg)
Hans-Pe(er Halvorsen
University of South-Eastern Norwaywww.usn.no
E-mail: [email protected]: h(ps://www.halvorsen.blog