01-13-2011 02:04 PM
All,
I have a subvi that does a set of operations and uses 3 feedback nodes. I am using this subvi inside a While Loop a total of 4 times. I've noticed that all instances used share the same result at each corresponding feedback node but I would like to have an individual result from each of them. Is there an easy way to go around this problem? I have come up with ways to avoid this: a) create a different vi for each time the subvi was used. b) use global variables instead of feedback nodes. Is there any easier way to go around this issue?
Example:(Please note that both subvi's are the same) If on my first subvi I calculate a maximum value and get 1.29 (then goes to feedback node) on my second subvi i get 1.01 my feedback node at the second subvi still registers the maximum value to be 1.29. (and I want it to be 1.01!)
Hope this is not too confusing, I've been scratching my head with this for a while, can't find the "easy" button. Thanks in advance.
-Pop
Im using 9.0.
Solved! Go to Solution.
01-13-2011 02:28 PM
Attaching the code would be helpful. Anyway, I am not sure how multiple feedback nodes are supposed to operate so I will defer that to others to answer. As far as being able to use distinct values or instances if you are using a subVI you could mark it as reentrant. That way each call to it will behave as it it were a copy of the VI and it will have its own memory space. This should include the feedback node. You may be ending up with a single subVI and in reality a single feedback node. If you need to pass data between calls than simply wire the data through. You could also use an Action Engine to store and retrieve values. An AE is a MUCH better solution than a global variable.
01-13-2011 03:26 PM
Mark,
I went to the VI Properties>Execution, then checked "Reentrant Execution" and selected "Preallocate clone for each instance". Now each instance has its own state. This is exactly what I meant when I said "easy" button. I will also look into your other suggestions.
Thank you for your help.
-Pop
01-14-2011 10:14 AM
Are you initializing your feedback nodes?
01-14-2011 10:19 AM
Yes 🙂 Problem solved.