10-08-2020 12:02 AM
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
10-08-2020 02:41 AM
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.
10-08-2020 02:43 AM
10-11-2020 01:48 AM
Hello Paolo,
Thank you for your reply. Please find attached a screenshot of that part of the VI. The parameter e is from another loop, but even if I take it out, still I have the same issue.
Thank you again!
10-11-2020 01:50 AM
Hello GerdW,
I attached a screenshot of my VI in my previous reply. Any feedback is more than welcome. Thank you again!
-Alex
10-11-2020 09:04 AM
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.
10-11-2020 09:51 AM
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.
10-11-2020 11:31 PM
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 e 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!
10-12-2020 01:49 AM
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.
10-12-2020 02:25 AM - edited 10-12-2020 02:33 AM
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.