12-07-2009 11:15 AM
hello dear experts.
I am new to labview (v2009), and did not had much help around. I did anyway managed to get a working code for my application, although the timing is not good, yet.
I attached the code. the idea is the following:
the upper timed loop define different periods, the main output being if the local variable "laser" is on or off.
the middle timed loop should acquire and show data flow.
-To acquire data, I would like to get one data point every 10ms and average them to transfert one data point every 50ms to the rest of the code (chart graph, histogram (with a reset evey new period), write data)
one time loop allow to get a pulsed signal
the last time loop trigger the laser which should be on if "laser" is on, pulse is on and the data entry is positive (or negative following the "side punished" input)
It is basically working but the problem is that the acquiring data is never fast enough: lowering the period input to the time loop doesn't change anything, although the priority of the loop is high. In order to get about one data each 50 ms I need to take the average of only three data point instead of 5. (that's why the loop is set to stop at i+1=3). NB: the speed was deduced from the data written to the file.
Erasing the first timed loop defining the periods didnot change anything.
In a simple input-output-write VI, the device can be read at one point per 7ms(measurement computing USB 1208fs device).
if set at 25ms period and average between two loops, it works, but then it is a bit slow.
the processor is used only at 10% capacity, so I do not understand why data input is so slow. Any ideas?
I would like the speed to be independent on the computer on which I run the VI too, and I think just setting the end of loop at 3 will not be so elegant, and I would like to maximise the number of data I could average to get my 20Hz data flow...
It seems also that the laser turn on or off one cycle (50ms) after the input change from positive or negative, this is not critical, but if you would have an idea to have this more syncronised, the help would be appreciated.
Thank you for your help,
julien colomb
12-08-2009 04:02 AM
Hi!
First of all, you should understand that LV uses dataflow to synchronise actions... try using flat sequences to synchronize when to pause (is it really needed in a timed loop ?) and when to execute code. Also, to communicate between loops, local variables are the best way to be deterministic. Try using RT Queues (FIFO) instead...
Hope this will help...
12-08-2009 07:28 AM
12-08-2009 08:20 AM
Thanks for your help.
I can't use FIFO since I do not have the RT module, but reading its tutorial allowed me to better build the VI: I regroup all real time actions together, adding a sequence between getting the data and react to it (avoiding the use of one local variable in the process). Then I set the period of secondary loops to higher values, which are sufficient since their timing does not need high precision.
This allow the input reading to be faster and make the reaction of the laser direct: it did the trick.
@aeastet: I tested it and for the file size I have, there is no difference in speed at the beginning and at the end of the procedure (18min x60x20 =2160 entries), maybe it was also fixed by sequencing the data acquisition and the data writing (?).
Thanks again.