LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Write to Measurement and Write to Text File

Hello,

When I am connecting directly the output data from my  DAQ to Write to Measurement, the data are saved in the same frequency as I have input in the DAQ (1KHz). But when I am trying to save the data to a Write to Text File, the data are saved on much lower frequency (10 Hz).

Thank you. Any feedback is appreciated. 

Regards,
Alex

0 Kudos
Message 1 of 16
(2,554 Views)

Writing to a text file is notoriously much less efficient, although 10 Hz only is a very poor performance, assuming you are writing on your local disk.

Probably you are opening and closing the text file at each write operation, instead it should be opened/closed only once.

Post your code (vi or snippet) for more suggestions.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 2 of 16
(2,521 Views)

Hi Alexis,

 

it seems there is a problem in your VI.

As you forgot to attach that VI you need to debug on your own!

Best regards,
GerdW


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

Hello Paolo,

Thank you for your reply. Please find attached a screenshot of that part of the VI. The parameter is from another loop, but even if I take it out, still I have the same issue. 

Thank you again!

capture 2.PNG

0 Kudos
Message 4 of 16
(2,450 Views)

Hello GerdW,

I attached a screenshot of my VI in my previous reply. Any feedback is more than welcome. Thank you again!

-Alex

0 Kudos
Message 5 of 16
(2,449 Views)

Screenshot of VI <> VI.

 

The problem might be in the way the Express VI is setup.  But we can't see that in a picture.

0 Kudos
Message 6 of 16
(2,424 Views)

Hi Alexis,

 


@Alexis_Koul wrote:

I attached a screenshot of my VI in my previous reply. Any feedback is more than welcome.


Feedback:

I asked for VI(s), but you refused and only attached an image…

I see too many local variables in this tiny image.

Best regards,
GerdW


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

Hello,

In the DAQ assistant, I have Acquisition Mode: Continues Samples, Samples to Read: 100 and Rate: 1 KHZ

So in the Write to Measurement file this gives me data every 0.001 seconds. So 1000 data points per second..which is want I want

In the Write to Text file I am getting every 0.1 seconds

If I change the Samples to Read, for example 10, I am getting data almost every 0.01 or 0.009/0.008 seconds...the value is not constant

The local variable is a result of a calculation from the other while loop. In the other while loop I am using Visa Serial to control Arduino

Again, thank you!

0 Kudos
Message 8 of 16
(2,406 Views)

Reading 100 values sampled at 1 kHz takes... 0.1 seconds.

At each loop iteration, the DAQ assistant node outputs 100 values (per input). Your code extracts the first of those values and saves it into the file. As a result, you are storing values at 0.1 Hz and trashing 99% of the samples.

To solve this problem, insert a For Loop and save all elements in the three arrays of doubles.

Test if the file writing can keep up with the acquisition timing. If not, you need to separate acquisition and writing in two different loops.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 9 of 16
(2,399 Views)

Hello Paolo,

Thank you very much for your reply. What I did now was to just add a For Loop in the part of the VI that I am saving the data and I put as N = 100.

It looks that it works good, and I am getting almost 1000 data points per second, is just that many values are repeated. So the time stays the same and measurement is repeated.

I am not sure what you meant with to add three arrays of doubles, since I already put every data different Index Array and then to the Concatenate String.


0 Kudos
Message 10 of 16
(2,395 Views)