LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Initialise waveform array of 10 elements

Hi all,

 

I would like to create an array of 10 waveform datatype constants to pass into a structure.  Once passed in, 9 of these elements will be extracted and then another added after which the new 10 will be graphed.  Hopefully this will effectively create a continuously updating graph of my data.

 

I was wondering if anyone knows how to create a 10 element array using waveform datatypes.

 

I look forward to the great help I have received so far.

0 Kudos
Message 1 of 12
(3,778 Views)

Whay does it have to be a waveform? You could just use a 1D array and keep x0 and dx seperately.

0 Kudos
Message 2 of 12
(3,775 Views)

HI,

 

Thanks for that.  The reason for the waveform datatype is that I would like to graph the data on a waveform graph with the time of each reading on the x axis and the value on the y axis.  Would there be another way to do it?

0 Kudos
Message 3 of 12
(3,770 Views)

Why not just use a chart with a chart history set to 10? What else do you need to do with the history data?

 

Can you explain in more general terms what the program needs to do?

0 Kudos
Message 4 of 12
(3,762 Views)

Hi,

 

The charts are a bit limiting as I would like to see the grid lines so that values can be directly read from the graph.  What I am trying to do is to acquire some data from a liquid nitrogen tank we have and then display it on a graph so that we can see the last four days usage.  This is important for us as if we run out our experiments will fail.

 

The only way I can think of doing this is to create a 10 element array and feed it through a shift register into a while loop.  Inside the loop the array will be cut to 9 elements using the subset array function and then the new data point that is acquired will be added to the array.  This would make the new array one point different each time.  Each time the array is appended it would be redrawn effectively showing a continuously acquiring graph.  The obviously the shift register would feed the new array back into the beginning and it would update again.

 

I have tried many iterations but there always seems to be a problem.

 

 

0 Kudos
Message 5 of 12
(3,755 Views)

Hi doljam,

 

using a PtByPt-DataQueue makes this a very easy VI:

check.png

 

so that we can see the last four days usage

What is your sample rate? How many samples do you want to display?

Depending on the answer to these questions you should think about "decimation"…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 12
(3,749 Views)

Hi,

 

Thanks for that.  I do have a couple of questions.  I haven't recreated the VI yet but it looks like it might not attach an individual time stamp to each point in the data queue as the data going into the data queue function is not waveform type.  Would it end up just being a number of points with the same time stamp.

0 Kudos
Message 7 of 12
(3,708 Views)

Hi doljam,

 

as long as you have a constant dt you only need a timestamp for the very first sample - that's the whole point of a waveform!

And I used a constant wait in the loop to read the next sample, you might use WaitForNextMultiple too…

 

One correction to the image above: As the queue will only hold 1000 samples the t0 is wrong once the queue is filled the first time. You might need to correct t0 from that moment on…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 12
(3,692 Views)

Excellent.  Thanks for clarifying the waveform datatype.  Is there a need to specify a dt or can that just be done using a Wait For function in the loop as you mentioned.

 

 

0 Kudos
Message 9 of 12
(3,682 Views)

Hi doljam,

 

the dt in the waveform and your wait statement should be the same.

Otherwise you would wonder why a waveform graph doesn't show the correct time on its X axis…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 10 of 12
(3,680 Views)