LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

sub vi with cluster does not pass variables to main vi and causes whole program to lock

Hi all,
 
I am trying to use a cluster inside of a sub vi as a "control panel" to change control values of pass on the main vi. The basic idea is that I want to call the sub vi, change the values in the cluster on the sub vi, pass those values to the main vi, unbundle them by name on the main vi and use those values in main vi.
 
Right now, when ever I try to click on the "Go to the Controls" button on the main vi, it calls the sub vi, but it runs extremely slowly or locks up the whole system. Also when I hit the stop button on the sub vi does not stop the sub vi.
 
This is driving me crazy. Anybody know what i have done incorrectly?
 
Thanks,
 
rlk
 
 
0 Kudos
Message 1 of 3
(2,227 Views)
I cannot reproduce your slowdown (LabVIEW 8.2.1), but your code deserves a few improvments.
 
Basically, whatever you are doing makes no sense. With each iteration, you get several hundred (100-600) new points that you append to the array in the shift register, but then you throw everything away except element 0 and elements 50+.  This constant resizing of arrays can be very inefficient because of memory reallocations.
 
Is it possible that you want to take a running average of the last 50 points for each simulation path. In this case you want to only get a single point from each simulator call and then you would just use "replace array subset" and replace the element at index j, where j is the remainder of using "Quotient&Rmainder of [i] divided by 50. The element order does not matter, right? (You can also get rid of all these shift registers entirely and use the express VI "Collector" with the history set to 50.)
 
You code parts are fighting each other. You try to simulate acquisition timing (different for each simulator!) but at the same time you place them all in the same loop and are enforcing timing with the timed loop.
 
It is a bad idea to use an LED as a control. LEDs are indicators! Most likely, you should also set the meachnical action to "latch when released", else you'll not be able to return to the main program for long because the subVI will pop up again at the next iteration, over and over!.
 
Another problem is the fact that the main timed loop stalls until the subVI is closed. Why even use a timed loop then? Why do you think you need a subVI to change a few controls?
 
These are all typical beginner problems. Maybe you should do a few tutorials and browse the shipping examples first. 😉
 
0 Kudos
Message 2 of 3
(2,224 Views)
That should get me started and I appreciate you taking the time to help. I'll keep plugging away at it. rlk
0 Kudos
Message 3 of 3
(2,217 Views)