From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

auto update waveform chart error

Hi all!

 

I have come across the problem when working on my VI. As you can see from the VI that I have attached, there is a waveform graph on the front panel for data acquisition. The value shown right now is from time, 00:00:00 to 00:05:00 (0-5minutes).

 

The problem that I am faced right now is, everytime when I hit the run button, LABVIEW seems to automatically change my time value to some sort of generic time. What I want to accomplish here is that, I want to acquire data on the waveform graph from time 0 to 5 minutes. Also, I would like to specify the increments myself. For example on the time scale (x-axis) from 0-5 minuntes, I would like a 30 seconds interval between them. How do I actually accomplish it?

 

I have tried absolute time format and changing my waveform chart to sweep chart.

 

Thanks for any help!

 

Jlam

0 Kudos
Message 1 of 7
(3,408 Views)

The problem here is that Waveform Charts and Graphs always assume a constant delta time between data points. If you are absolutely certain the data points are guaranteed to be sampled at consistent intervals, the Waveform Chart or Graph is a good fit for the data.

 

On the other hand, if data points are sampled at arbitrary time intervals, it will be necessary to use the XY graph, where different timestamps for each data sample determine the t-axis (time, horizontal axis).

 

The deal here is that your horizontal axis is N, Sample Number, not t, sample time. Your samples start at 0, and increment 1, 2, 3... Therefore, if you are taking 120S/sec, it will appear two minutes - 00:02:00 (HH:MM:SS) - have elapsed in the first second! One way to convert Sample Number to Time is by mulitplying that scale by the factor 1/120. To add a multiplier (or offset) to your scale, go to the properties of the Chart. Likewise, you can use a property node to programmatically set scaling factors on the scale.

 

19143iFA6FE42C50C65BD4

0 Kudos
Message 2 of 7
(3,400 Views)

You aren't providing the chart with any timing information. You are just providing a 2D DBL array. A chart does not go out and read some clock someplace. It is something you have to provide to it.

 

If this DAQ device does not have the ability to timestamp the data and create a waveform datatype (a datatype with the necessary timing information), you could modify the DAQ function to create a 1D Waveform for the multiple channels or use property nodes to set XScale.Offset and XScale.Multiplier. Look at the example called Real Time Chart.

Message 3 of 7
(3,399 Views)

Dennis,

 

Thank you for your prompt response. But I still do not get what you really mean. Is there any example of VI or show it to me on the VI that I had provided.

 

I tried finding example called Real Time Chart but to no avail.

 

Much help would be appreciated.

 

Thanks!

 

Jlam

0 Kudos
Message 4 of 7
(3,388 Views)

Jack,

 

Thanks for the help and advice. What I do not get is my horizontal axis right now is in t (sample time). You said that I had N instead. Also, you mentioned here "1, 2, 3... Therefore, if you are taking 120S/sec, it will appear two minutes - 00:02:00 (HH:MM:SS) - have elapsed in the first second!"

 

Where do you determine that I am taking 120 samples/sec? I know this might sound like a really stupid question but do bare with me.

 

Note: As of right now, when I run my VI, the waveform chart would keep updating and would not hold. Also, the time of 0 mins to 5 mins would not hold on the x-axis but instead of some arbitrary time.

 

Thanks! Much help would be appreciated!

 

Jlam

0 Kudos
Message 5 of 7
(3,387 Views)

You use the Build Waveform function (waveform palette) to create a waveform datatype. There are 3 inputs - t0,dt, and a Y array. This would go into your DAQ function which I don't have. You would create a waveform for each channel and create a 1D array for mult-channels.

 

Open the example finder and go to the search tab. Search for 'chart'.

 

0 Kudos
Message 6 of 7
(3,377 Views)

It was an arbitrary example he used and not related to anything in your actual code.  He probably picked 120 since it is divisible by 60 to have a good example of a comparison of seconds to minutes, and probably also a factor of 2 so that, it is multiple minutes and not just one.  (Though honestly, I'm not so sure he applied the math correctly.)

 

The point is that if dT=1 (the default) your sample number is the same as the time in seconds.

If your dT is something else, you need to tell the graph that, otherwise it will just plot the sample number as seconds, and the time scale will look wrong.  Put in the correct dT, then the timing scale will look correct.

0 Kudos
Message 7 of 7
(3,370 Views)