10-24-2022 02:29 AM - edited 10-24-2022 02:49 AM
Hello,
I am working on a parametrized data processing project with multiple input / multiple output signals, all configurable by user. I want to repeatably use VIs that have their own memory (e.g. filtering or resampling). The problem emerges when I want to use filtering of array of signals inside a SubVI as the actual VI that does the math has memory for only one channel so it mixes up data. This is common concern with classes as you usually have array of objects and one method of its class does the processing on a property. And you want to do the processing on multiple objects.
How I usually solve it:
I included a simple illustration of my problem. Top VI:
SubVI:
Do you have any other ideas? Is there any approach that should be noted? I feel like classes could theoretically have some kind of behavior that isolates the VIs in their methods so that they are clones for each class instance, but I don't know about such feature in LabVIEW.
Thanks
10-24-2022 03:22 AM
Reentrant VI's should not have internal memory for the reasons you've found out.
So:
- "Rewriting every needed VI so that all the inner shift registers are outputted on each iteration in a cluster. Then I handle the behaviour myself by putting in the correct memory cluster every time. (Ouch!)" is a correct solution
- Make it a class so you have your unique memory (i think that'd work)
10-24-2022 07:23 AM
Here's a thread I remembered that discusses the use of VI Server (and possibly also parallelized For Loops) to do this.
To make a tidier package with unique parameters per channel, you could make a "channel" class that holds a waveform, a VI ref, and any other needed parameters for processing. The class would have a "process data" function that would use VI Server to call the function while passing in the waveform and processing parameters that the "channel" object carries.
-Kevin P