LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

read and display data outside while loop

Hi,

 

I am trying to display output of a while loop on a waveform graph outside the loop. For this, I am using bundle to specify initial time, deltaT and data. However, I can not connect output of the bundle to the waveform graph because of trying to connect different types terminal. For reference, I have attached the vi. Could you take a look and suggest where I am going wrong? 

 

Also, I am trying to write the output in different formats. Although it does not display any error in doing so, it does not write and save the files in designated folder. What could be the culprit for this?

 

Thanks in Advance,

 Novice

0 Kudos
Message 1 of 6
(766 Views)

Hi Novice,

 


Novice@labview wrote:

However, I can not connect output of the bundle to the waveform graph because of trying to connect different types terminal. For reference, I have attached the vi.


First: you didn't attach a VI. All you gave is an image of a block diagram! Keep in mind: we cannot debug/edit/run images with LabVIEW!

 

On your question: did you read the context help for your graph? It mentions most of the datatypes expected by graphs. Your cluster with a 2D array of waveforms does NOT belong to those datatypes…

 


Novice@labview wrote:

Also, I am trying to write the output in different formats. Although it does not display any error in doing so, it does not write and save the files in designated folder. What could be the culprit for this?


Do you see those coercion dots? Do you know what they indicate?

Again: 2D arrays of waveforms are a very uncommon datatype when it comes to saving data to files!

 

Did you by any chance disable the automatic error handling in your LabVIEW IDE? Either implement your own error handling (to actually recognize those errors) or use the automatic handling to know about them…

 

What is your goal? Do you want to save ALL measured data or only the data of the last iteration?

  • It doesn't make sense to show a lot of samples in a graph: your graph will be less than ~1000 pixels wide, but your waveforms are take with 100k samples per second! (Too many samples to show in a limited size graph…)
  • It is dangerous to collect a lot of samples (200k samples per second, resulting in 1.6MB memory requirement per second!). It would make sense to save the data while you measure them: DAQmx can do that for you, you just need to configure it correctly! (DAQmxConfigureLogging)
Best regards,
GerdW


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

There are a few points to note here, I will start on setting the waveform information. You can indeed set the dt of a wfm with a 'build wfm component' 

https://www.ni.com/docs/en-US/bundle/labview-api-ref/page/functions/build-waveform.html

 

This looks like a cluster but is not quite the same. The read Function may populate the dt for you but if not you can use this function.

 

The wfm graph you have in the loop will currently show the most recent n sample from the read function. By changing this to a wfm chart you should be able to see the last m samples from multiple loops. 

 

As stated above it is not usual to create a 2d array of wfm's as you will need to read the elements one at a time. You have a few options here some are not a great solution depending on what your end goal is but I have included so you can start to understand the problem more. 

 

The first is to use a For loop to get the data from the wfm into one block (array) and plot it from that. If you are running for a long time. This may not be a good plan as there will be a lot of data.

 

You can try to process the data inside the loop. This is most relieving to the saving data, but also displaying. You can save the data chunk by chunk. This depends on how many samples you are reading at a time and for how long. 

 

If you know there will not be a lot of data you could read a 2d array instead of wfm. Building a large array of data over multiple while loop iterations. This can be done by concatenating the data on the path out of the loop (right click) this can then be saved as a 2d array or converted to a wfm using method above. 

 

See above for error handling. 

0 Kudos
Message 3 of 6
(718 Views)

Thank you GerdW for the prompt response. I realize that the sampling rate and hence, number of data acquired is huge. But, this is the requirement of the project. I am now able to show the all the data in waveform graphs by using convert to/from dynamic signal manipulation palette. 

 

As you suggested, I am now saving the data as it is being measured in the loop, using write to measurement file. For now, I am using .lvm format to write the data. I am using x-header for each channel to store the time information. However, surprisingly, the time data are occasionally  negative, which does not make any sense.  I have attached my .vi and a snapshot of output of write measurement.  Do you think I am not specifying sth essential while writing the measurement file?

 

Also, since I am using sampling rate of 10^5, how can I make sure that the actual time interval between each acquired data point is 10^-5?

 

Thanks a lot,

Novice

Download All
0 Kudos
Message 4 of 6
(691 Views)

Hi Shuggy1,

 

Thanks for your detailed response. I am now able to show the data in waveform graph. However, when logging it in .lvm format, the time column is negative. Any suggestions to avoid this will be helpful. 

 

 

Thanks,

Dipendra

0 Kudos
Message 5 of 6
(689 Views)

Hi Novice,

 


Novice@labview wrote:

I am now able to show the all the data in waveform graphs by using convert to/from dynamic signal manipulation palette. 


Using those ExpressVIs is just a bandaid, but not a solution…

(The graph after the loop will show the data, but it will NOT show the correct sample timing! You lost all timing information due to using those ExpressVIs…)

 


Novice@labview wrote:

Also, since I am using sampling rate of 10^5, how can I make sure that the actual time interval between each acquired data point is 10^-5?


As long as your DAQ device is able to read data at 100kS/s you will get waveforms with a dt of 10µs. There's no way you can "ensure" this, you depend on the capabilities of your DAQ device!

 


Novice@labview wrote:

As you suggested…


I clearly suggested to use DAQmxConfigureLogging!

Why don't you let DAQmx do all the file saving stuff for you?

ALL YOU NEED IS TO USE DAQmxConfigureLogging!

 


Novice@labview wrote:

number of data acquired is huge. But, this is the requirement of the project.


You need to (learn to) translate "project requirements" into "senseful code/algorithms"!

When the requirement is "show all acquired data in a graph" then it's your job to translate that into "collect data (but not in memory) and show decimated data in a graph"…

What happens when your users let your current VI run for more than 60s?

Best regards,
GerdW


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