LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Activated Dynamic Array

I have the following problem:

 

In my main loop, i have a signal processing SubVI that generates results only after a few iterations. For example, the loop iterates 1000x and, during the runtime, this SubVI produces 16 numbers (can vary) that need to be stored in a array.

 

I have found the solution in attachment, but i fear this isnt a good solution. Is there an alternative?

 

Thanks!

0 Kudos
Message 1 of 5
(2,502 Views)

That is a rather simple example of what is known as an action engine or LabVIEW 2 Style Global. Generally an action engine will support more options of what you can do with the data and use an ENUM to select the operation. There are other ways that you can pass data in your application such as queues, notifiers or user events. The basic action engine is a viable solution as well.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
Message 2 of 5
(2,499 Views)

, is something like that. The idea is the VI produce an output (and execute subsequent VI's) only when the result is ready.

Is there a more efficient solution?

Where i can find alternative examples?

 

Thanks!

0 Kudos
Message 3 of 5
(2,496 Views)

Take a look at the producer/consumer examples. Your acquisition loop would be the producer and the consumer would get the period data and do whatever processing you need.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 4 of 5
(2,483 Views)

While you created a simple LV2 style global, there are several issues (that don't really mattter if you only generate 16 elements, but could be useful in the future).

Appending an element to the front of the array is significantly more expensive than appending an element to the back, you might want to swap the inputs.

The code is relatively disfunctional, because it is initialized on first call and you can only ever add elements, never reset the array for re-use, etc. until the program is restarted.

 

You did not really explain how this is used? Is it (1) only read out after all elements are in it or is the (2) array monitored asynchronously from a second loop? In the case of (1), you should place the shift register in the main loop instead of a subVI (or inline the subVI). You could also use a queue instead.

 

 

0 Kudos
Message 5 of 5
(2,470 Views)