LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Actual data acquisition rate way less than sample rate I set.

Solved!
Go to solution

Hello community, I am a student who is still learning LabVIEW.

 

I am working on a project that can acquire voltage and current data from PMSM motor using NI 9244 and NI 9227 DAQ. And write the data I acquired into a .txt file. I use two while loop with queue. The way program works is suppose to be setting the DAQ physical channel, set the sample rate and Numbers of Samples. Noted that I want the sample rate to be 25000 and the NumOfSample to be 2000. Then I run the program, it should save the acquired data at the rate of 25000 per second right? However, in reality when I go check the saved data, the amount of data were way less than 25000 per second, like the figure indicates down below. Only 617 data were saved to the txt file during a 40 seconds duration. 

 

I checked the program by adding two indicators to the iteration of the while loop. When finishing the program the numbers of two indicators are the same (i.e. the while loops are working in sync.)

Noted that to make the program work you need to put the .vi program file into a file and create another file called "data."

 

Can anyone tell me where I did wrong and how to correct the program. 

Thank you for reading and responding to my post. 

Billy90_0-1680067673139.png

 

 

0 Kudos
Message 1 of 11
(1,204 Views)

I'd be happy to help but can you save the vi for a previous version of LabVIEW (e.g. 2019). Most experienced users here are not on LabVIEW 2022.

0 Kudos
Message 2 of 11
(1,175 Views)

First I want to say thank you a lot !!! 

And I attached a vi to this post, should be LabVIEW 2018. 

0 Kudos
Message 3 of 11
(1,160 Views)

Well, you are acquiring the correct number of samples and sending them to your bottom loop. But then you use "Convert from Dynamic Data" to essentially convert all the 2000 samples in your waveform to a single scalar.

 

If you want to save all values, just use Get Wfm Comps to get the data as an array and save that to the file.

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

I don't have much to contribute to the question at hand. But, a cleaned up VI is attached. The only major change I made was to implement the in place element structures in the top loop for handling the math on the voltage channels before going into the Line Voltage Queue.

0 Kudos
Message 5 of 11
(1,141 Views)

I tried to use Get Wfm Comps but when I use it. Labview will automatically generate Convert from Dynamic Data for me. If I don't use it, it'll not run. 

0 Kudos
Message 6 of 11
(1,118 Views)

Thank you for responding and helping me, I will keep trying! 

0 Kudos
Message 7 of 11
(1,116 Views)

I tried using Get Wfm Data this morning, but it’s still logging data with the while loop. I checked the iterations of the while loop and the txt files. When the loop runs for 10 times, it shows 10 lines of data in the txt loop, which is still far from 25000/sec! 

0 Kudos
Message 8 of 11
(1,103 Views)
Solution
Accepted by Billy90

Hi Billy,

 


@Billy90 wrote:

I tried using Get Wfm Data this morning, but it’s still logging data with the while loop. I checked the iterations of the while loop and the txt files. When the loop runs for 10 times, it shows 10 lines of data in the txt loop, which is still far from 25000/sec! 


Here you convert your waveforms into scalar values:

 

Do you see those red coercion dots? They are there for a reason!

Btw. I replaced those 6 ExpressVI nodes you used to index waveforms from your waveform arrays: why don't you use IndexArray when you want to index array elements???

Why don't you use a shift register for the file reference? No need to set the file position in each iteration!

 

When you want to save full waveforms I recommend to use TDMS functions…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 9 of 11
(1,095 Views)
Solution
Accepted by Billy90

You probably still convert the array to a scalar somehow. You have to save the entire array! The simplest is to convert all the data to a 2D array and then convert it to a string to write the entire array to the file.

 

Look at the following code and try to understand the various data types (use the probe on the wires!):

Basjong53_0-1680173855314.png

 

0 Kudos
Message 10 of 11
(1,072 Views)