12-11-2007 10:46 AM
12-11-2007 11:01 AM
12-11-2007 11:05 AM
well you could use a queue as an Ae, but even better: you can use a queue in an AE
the AE is not only a place to save data, but to treat it as well. imagine you try to make an analog ramp. as input data, you can have a cluster that give you the slope, initial and final value. in the next time you call the AE, instead of getting all the info, you might just need the actual analog value at the specific moment you call it.
so the AE, will use its stored parameters, and figure the value you need at this moment.
you can do even better, as the stored parameters can be changed at every iteration! no way you can do that with a queue.
disclaimer: you can have a queue, take the last element, and restore to last element, assuming no other vi is playing with your queue. but that is a high risk. you could also do it with a notifier that store your data, retrieve it, treat it, and reinsert it into your notifer. sorry, this is soooo unelegant!
12-11-2007 11:07 AM
Look at Aristos Queues post from 4-12-2007 for the example you are asking for.
I have not tried using queues yet but one reason that I would go with the USR's would be performance getting at parts of what is stored.
Example:
AE stores all values read from DAQ susb-system.
Clients of AE are only interested small subset of all readings.
By using USR I can index out of the USR.
If the USR was a Queue, I have to de-Q index and re-Q so that data was available for the next client of the AE.
I probably could avoid that issue by using one queue for each DAQ channel, but I have to admit, I have never tried that.
Ben
12-11-2007 11:22 AM
12-11-2007 11:35 AM
Under the right circumstance, the queue could outperform the USR because it can pass pointers (by reference) to data rather the data itself.
Ben
12-11-2007 11:52 AM
12-11-2007 11:57 AM
12-11-2007 12:38 PM
i miss something: one main purposes of my USR, is the protection of my data. one has to make a copy for utilisation outside.
with the queue, i can too easily have access to this data, change it and bring it back without my AE to know about it. how do you protect that? (hum... i already see applications where that might actually be very useful...)
very interresting. Thank you Jarrod!
12-11-2007 12:42 PM
I'd put the code that modifies your data inside the case for that action if at all possible.
Like...
De-Q
Process
Re-Q
Return to caller.
That way nothing can step on the data form an other thread.
Ben