LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to programmatically multiply an action engine

Hello,
 
following Ben nugget, i would like to use an action engine to hold my operations and data. however, i would like this to be done on multiple datasets simultaneously.
To explain:
lets say i have a function of a linear ramp. the control will give the initial point, last point, rate and nb of steps. the AE should then just give back to me the desired 'y' value at the specific time i am asking him. it should hold the data about its actual x position, nb of steps, and so on.
so far, this is not too complicated. only tric is to define tick counts from the main vi to decide wether or not to deliver a new 'y' point in relation to the nb of steps. doing that in correlation with other operations will allow to avoid to sort the outcoming array.
 
the problem comes now if i want to calculate several such ramps, some of them parrallel in time. how can i call the AE and give him a specific ramp nb, to follow? the idea overall is to transfer all info related to the ramp only once, avoiding precious computation time. so the AE has to hold the data for the specific ramp at all time.
 
Thanks for help
-----------------------------------------------------------------------------------------------------
... And here's where I keep assorted lengths of wires...
0 Kudos
Message 1 of 5
(2,942 Views)
Why not set up an array?  So the action engine holds an array (maybe it's all numeric values, maybe it is an array of clusters) where each row of the array relates to one particular ramp.  When you pass in the control data, or request out the results of the function, you also pass along a value for the ramp number that is an index to the array holding all of the data.
 
Of course because the VI is non-reentrant, if you have the sub-VI's in parallel loops, the second loop won't be able to acquire the data at the exact same time as the first loop.  But once the first loop has completed using the sub-VI, it will be freed up for the second loop to access it.
Message 2 of 5
(2,931 Views)
Ravens Fan's idea is a good one. You can, though, have reentrant Action Engines (functional globals). Though if you need to call a specific copy in more than one location on the block diagram, you will need to open a reentrant copy using VI Server and pass the VI Reference around. Then call the VI using a Call by Reference Node. More on this topic in this article, which is a really good read.

Refer to the Methods for Large Data Storage section. There's also some good examples.

Message Edited by Jarrod S. on 05-17-2007 10:15 PM

Jarrod S.
National Instruments
Message 3 of 5
(2,924 Views)
The VI Server suggestion is a good one, but you don't have to pass the reference around if you want multiple instances running simultaneously. If the target VI is reentrant, every call to Open VI Reference will spawn a new copy of the VI in memory. You can then either buffer the reference locally to the VI that is openning the reference, or close it (thus disposing of the copy); depending upon the circumstances.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 4 of 5
(2,921 Views)

thanks guys.

reentrant vi is not a good option for me for 2 reasons: first it uses much more memory, therefore computation time, especially as the number of such engines grows, and are called multiple time without stoping the main vi. very fast the performances deteriorate.

second reason is that i would then have to keep trac of the specific copy of the AE for picking up data from him. not a good solution.

the array solution seems to have the answers to what i need. i will try that.

-----------------------------------------------------------------------------------------------------
... And here's where I keep assorted lengths of wires...
0 Kudos
Message 5 of 5
(2,907 Views)