LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Waveform Chart Help Making Efficient

Hello,  Could someone help making waveform chart  vi more efficient.  I'm collecting 8 channels of data.  In order to use the waveform chart I have to rebuild each wave form with the get date/date.  All eight points are collected simultaneously but using the attached vi Its making a timestamp for each of the 8 data points if you export to excel.  Seems like a waste collecting a timestamp for each piece of data but it's the only way I could get it to work.  Anyway is there an easier way to make this more efficient or clean it up.  I only need to collect points every 2 seconds or so. Thanks in advance.

example pic.jpg

0 Kudos
Message 1 of 11
(4,145 Views)

Hi jon,

 

what about using (autoindexing) loops?

check.png

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 11
(4,137 Views)

Either you don't quite understand Waveforms and Sampling or I don't quite understand what you are doing!  Here are some comments:

  • A "Waveform Chart" doesn't necessarily have anything to do with Waveforms -- it is just a way of plotting things (like Waveforms) that consist of equally-spaced (timed) variables, so the X axis is effectively equally-spaced Sampling Time, and hence not explicitly specified.
  • Inputs to a Waveform Chart can be a Waveform (or an Array of Waveforms, to get multiple channels).  A Chart has "memory" -- points are "added" to the existing Plot so you can see it evolving over time (there are several modes for updating, so it can emulate a Strip Chart, scrolling data to the right and the "background" to the left, or a Scope, where the data "overwrites" as it goes from left to right.
  • You can plot one point at a time (a scalar input), an array of points (updating multiple points at a time), or a Waveform (which carries "starting time" and "dt" along with it.
  • If you are collecting data every 2 seconds (not "every two seconds or so", Charts expect to be updated at equal intervals, as the X axis strictly increments), then forget about the Waveform, just plot a point every two seconds.  To get the X axis to reflect Time properly, you can manipulate the Multiplier property of the Axis.
  • If you want to plot multiple channels, you don't make an Array (which means "multiple Time points"), you combine them into a multi-element Cluster.  Note that there is an Array to Cluster function that can help you here.

Bob Schor

Message 3 of 11
(4,125 Views)

@Bob_Schor wrote:

Either you don't quite understand Waveforms and Sampling or I don't quite understand what you are doing! ...


Waveform Data types for charts are my preferred method of plotting data. They are great when we are trying to plot data coming in under hardware timing vs devices that are polled via serial. They support equally spaced samples using the Y-array and the "dt" value along with arbitrarily spaced samples.

 

Just my 2 cents worth,

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 4 of 11
(4,117 Views)

Thanks Gerd,

Your example absolutely cleans things up and will help much.  However, when I export the chart to excel I still get a time and date stamp for each of the 8 columns of data.

0 Kudos
Message 5 of 11
(4,114 Views)

Thanks Bob,

The array to cluster function can help also.  But when I export the chart (strip chart) to excel I want want column of date and time and then eight columns of data.(right click on chart - export to excel)  Is there a way to do this with offset and multiplier to get time and date?

0 Kudos
Message 6 of 11
(4,110 Views)

Let me guess...

You are using the chart right-click option to export to Excel?

 

In theory all of those time stamps could be different so including a time stamp for each sample is the better method.

 

If that really bothers you then read the data from the Chart History and write the data in the form you desire.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 7 of 11
(4,107 Views)

Thanks Ben,

Yep, that is correct

It looks like that is what I will have to do.  Appreciate the help. 

0 Kudos
Message 8 of 11
(4,105 Views)

Hmm -- I've never tried Export to Excel.  When I cobbled up a simple example, to my shock and surprise, it really opened Excel!  Of course, nothing was written, and the usually-wonderful LabVIEW Help was curiously silent on the Export property, but I'd probably not do it this way, anyway.

 

What I'd suggest is to optimize the output file by writing it myself.  To get all of the Timing Information from data in a Chart, you need only two times -- the time (conventionally called t0) that gives the time that the first point was acquired (and can be saved in any format you want/need, including a Date/Time Timestamp, or simply 0 if the date and time the data were acquired are not important), and the sampling time, or time interval (conventionally called dt).  Once you have this, you have the times for every data point -- data point "i" (where the first point is at i = 0) is associated with time t = t0 + i*dt.  Hence you write a header with t0 and dt, then you write an array of channel data for every sampled point, without bothering to write t.

 

This gives you an "efficient" data set, with minimal redundancy.  If, for some reason, "time" is really important (i.e. you are "listening" to a grandfather clock and want to know if the Chimes come at the quarter hours, and if the hour chimes are the correct number), you can always generate a file with a Date Column, a Time Column, and multiple Data Columns (but then you have to parse those extra columns which will have a different format, almost surely, from the Data Columns, what a mess ...).

 

Bob Schor

Message 9 of 11
(4,091 Views)

Thanks Bob,

I have a 16 channel system that already writes to a text file and has a date column and time column along with 16 data columns without a strip chart.  I figured I put a strip chart in the vi to improve it and noticed the export to excel.  I made up a quick vi by GerdW recommnedation and it does export to excel when I right click.  Both vi and excel data sheet attached.  Gerdw's recommendation will clean up the larger vi but still produces a date/time stamp for each data point.

 

The reason why the date and time are important is because this data needs to be correlated to other unrelated events that are also date/time stamped.  If I have to live with a date/time stamp for every column of data I can live with it.

Download All
0 Kudos
Message 10 of 11
(4,077 Views)