09-25-2023 09:07 PM
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
09-26-2023 01:03 AM - edited 09-26-2023 01:34 AM
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?
09-26-2023 02:07 AM
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.
09-26-2023 03:55 PM
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
09-26-2023 03:57 PM
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
09-27-2023 01:38 AM - edited 09-27-2023 01:44 AM
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?