Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

read from measurement file make slow the while loop

Solved!
Go to solution

Hi Lynn,

my txt file contains just one column of trajectory data with no references to time. My idea was to take one datum per iteration of the while loop and "set" the speed of the process by varying the time delay of the loop with the vi "wait". Conceptually this must be works, is it right?

 

Today I'm trying to use "simulate arbitrary signal" instead of "read from measurement file" but the first tests were not so promising Smiley Happy 

 

Thanks again for the support

0 Kudos
Message 11 of 15
(1,917 Views)

OK. Now we know what you are doing in enough detail to make some progress.

 

Thw while loop timing is driven by two factors. One is the DAQ timing. That will always take 100 ms or slightly more. (100 samples at 1000 samples/second = 0.1 second.)  The second is the Wait (ms) function. It is also set to 100 ms. It essentially runs in parallel to the other code, which is dominated by the DAQ timing. So shortening the 100 ms wait has no effect because the DAQ always takes at least 100 ms. If you lengthen the wait to values greater than 100 ms, you should see a slowdown effect.

 

Note that this is what crossrulz was suggesting in his initial reply.

 

If you want to run somewhat faster, follow the suggestions crossrulz gave in his reply to your original post in this thread.  If you try to go faster than ~50-100 iterations per second, you may begin to see jitter and timing error due to OS latencies.

 

Lynn

0 Kudos
Message 12 of 15
(1,904 Views)

Hi Lynn,

I tryed to follow the suggestion of crossrulz but nothing happened; using the continuous sampling I had a slight improvement of the speed but not as I want (as the simulate signal does). Anyway this morning I tryed again: I remove the wait vi (in order to remove some possible conflict), I put in the DAQs 10 samples at 1000 samples/second = 0.01 second, is it right? In this way I should have a perceptible increasing of the speed but nothing happens yet. Please correct me if I'm misunderstanding your advices...

0 Kudos
Message 13 of 15
(1,893 Views)

Yes, that should make the loop iterate faster. Wire an indicator to the "i" terminal of the loop. That will give you a direct indication of how fast the loop is iterating. If you do not see  a substantial difference, then something else is limiting the speed of the loop.

 

Lynn

0 Kudos
Message 14 of 15
(1,889 Views)
Solution
Accepted by topic author Masaniello

Hi there,

finally I have got the solution. The main problem was that at each iteration the txt file was loaded entirely and after was taken just the needed value (this is because I cannot saw strange behavior in the signal with the use of the grapg). The solution was to put out of the while loop the DDT and maintaining inside the loop the "index array". At last, the way to manage the speed of the process was, as suggested by crossrulz and Lynn, by varying the values inside the DAQs.

 

Thanks to all,

Flavio 

0 Kudos
Message 15 of 15
(1,884 Views)