Real-Time Measurement and Control

cancel
Showing results for 
Search instead for 
Did you mean: 

Timed loops and buffered acquisition

We are deploying an application using LabView Real Time and the multifunction DAQ NI-6115. We use a simple schedule with only two tasks: a non-deterministic task that manages the communication between the host and the target, and a time critical task that performs the processing of the samples acquired by the DAQ 6115. We use a modified version of the state machine template.

The specification for the maximum delay time (since the samples are acquired by the DAQ until the time critical task finishes the processing of the samples) is 50 ms. For this, we have configured DAQmx Configure Input Buffer: buffer size= 250000 samples, which is equivalent to the number of samples acquired during 50 ms at a sample frequency of 5 MSamples/second (as far as I know, some space of the configured buffer is employed by the DMA controller. Anyway, I will obvious this issue for the moment).

 

On the other side, for the time critical task we use a Timed Loop since we look for determinism. The Timed Loop has been configured NOT to maintain the original phase. The Timed Loop period is 10 ms.

 

With all this information, my question is: if the deadline is lost (in other words, if Finished Late is TRUE), do we respect the maximum accepted delay time (50 ms) as long as the input buffer (that only can hold 250000 samples) does not overflow? I understand that the buffer does not overflow as long as the number of finished lates or the jitter keeps below a limit. Is this interpretation correct?

I have not found any other parameters I can modify to synchronize the Timed Loop and the buffered acquisition.

 

Thanks a lot for any help you can offer,

 

M. E.

 

0 Kudos
Message 1 of 3
(3,348 Views)

Hi Peron,

 

I think you did it ok... so I think u ar not going to have problems on that.

I recommend you to use the tick counts functions with a shift register on your timed loop so that way u can see how long (miliseconds) take a cicle of your timed loop needs to execute. This way you can know how long it takes and how is the jitter of that... But everything depends on the number of instructions/processor load to make that u have on the loop.

But I think you ar not going to have any problem if you read all the available data on the buffer every iteration of the timed loop. 

If you read all the data on the buffer you empty it... So teorically you empty the buffer every 10 miliseconds.. depending on the jitter you can read more or less data every iteration but you will empty it. And of course the jitter is not going to be so hard to the loop be more than 50 miliseconds (that is your program crash limit).

So... I do not believe you are going to experience problems with that configuration if you empty the input buffer (read all samples) inside your 10 ms timed loop.

Anyway if that is not working ok you will see an overflow buffer or you can always add a DAQmx property node to see how many available samples are on the buffer and check if they are growing... that will tell you that the program is not working ok,

Hope that it helps,

 

Regards,

Jaime Cabrera

NI Applications Engineering Spain
0 Kudos
Message 2 of 3
(3,328 Views)

Hi Jaime,

thank you so much for responding. Is good for me to know that if our specifications are not followed  an overflow error does appear.

I will check the time execution by using the tick counts functions. Up to now I have been using Trace Execution Toolkit (then I can perform as well a deeper study of the threads and so on). Since by using Trace Execution Toolkit the VI overloads if the acquisition is included, what I do is to send sets of 10 ms of samples contained in a file in the host to the target. Obviously this manner I only consider the processing time (without the acquisition).

As you recommend, I empty the buffer every 10 ms. The proofs performed up to now have worked well. Anyway, I have to perform more experiments to consider all the possible situations.

 

Thank you again!

 

0 Kudos
Message 3 of 3
(3,315 Views)