LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

SubVi with feedback nodes used more than once inside a While Loop

Solved!
Go to solution

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.

0 Kudos
Message 1 of 5
(5,063 Views)
Solution
Accepted by topic author popcorno

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.



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
(5,056 Views)

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 

0 Kudos
Message 3 of 5
(5,032 Views)

Are you initializing your feedback nodes?

Message 4 of 5
(4,992 Views)

Yes 🙂 Problem solved.

0 Kudos
Message 5 of 5
(4,989 Views)