1

I've made a VI using modbus API and managed to connect to an HMI and read some data. I want to save this data in a file, also show this data on a historical trend even after a reset due to power failure. Which component should I use?

Termininja
  • 6,620
  • 12
  • 48
  • 49

3 Answers3

0

Depending on what format you want to save the data in, try Write to Spreadsheet File or Write to Measurement File in the File I/O palette. Look at the help and examples for those VIs for more information.

By 'show data on a historical trend' I assume you mean on a chart against time. The easiest way to do this is to write each set of data points to a waveform chart as you acquire them. Again, look at the LabVIEW help for more detail. To read or write the accumulated data in the chart, right-click on the chart's terminal and choose Create > Property Node > History Data. You can change this to read or write via the right-click menu.

nekomatic
  • 5,988
  • 1
  • 20
  • 27
  • Yes, I want to show data vs time (absolute time). But, the acquired data has not any timestamp. Anyway to read the system time and save as timestamp? – Ahmad Mansouri Jun 13 '16 at 12:52
  • Have you tried opening LabVIEW help and searching for 'time'? Anyway, the function you need is `Get Date/Time in Seconds`. – nekomatic Jun 13 '16 at 14:27
0

I would look to use a single file for both ideally, why repeat the work.

There tends to be two major types of files used from LabVIEW:

  1. TDMS is a custom binary format developed by NI. Useful for storing meta data along side binary data (which tends to be the smallest way to store data).
  2. CSV file is a text format which has a comma between values and new line between rows. This has the advantage of being openable by a number of different programs like Excel.

For TDMS there is a built in library.

For CSV check out a function called "Write to spreadsheet file" which will support the formatting and write the file. This tends to expect an entire file to be written in one go though, if you need higher performance look at the standard File I/O library and a function called "array to spreadsheet string" which will take care of the formatting for you.

Then for either of these you can also read the file on a boot and load the history (assuming you also have a basic config file that says this file was the last one used).

jamesmc86
  • 324
  • 1
  • 6
  • thank you. May I ask provide more details about " (assuming you also have a basic config file that says this file was the last one used)."? – Ahmad Mansouri Jun 13 '16 at 12:57
  • When you reboot the system, if you want to load the history you need to know what file to load it from. To do this you either need to always use the same file name or store the file name in some sort of configuration file that you can load each time the program starts. – jamesmc86 Jun 20 '16 at 05:46
0

Thank you nekomatic

After some search, I ended up with DSC module and historical trend. There is an example named DataSet Marking Demo. In the example, you can find a signal generator that generates ad sinus signal, eventually its data will be saved in Citadel Database. The problem is if your system shuts down due to power failure, it does not retrieve last data set correctly.

Any suggestion?