 Benjamin_
		
			Benjamin_
		
		
		
		
		
		
		
		
	
			11-01-2012 05:54 AM
Hi all,
I am facing a strange problem with closing an array of references.
A few words to my environment:
I can load dynamically VIs into a subpanel sitting on my main VI but if I unload and reload Visa I need to close my Visa properly, not just by stopping.
Therefore I wrote a closingVI which is attached. In this VI I look for a "Stop" button and send a true by signaling.
The problem now is that the very first reference in the "Control[]" needs around 40seconds to close, all following refs just need <1ms! By the way, the array size is just about 24 and it is independent which ref comes first.
In addition to that the problem just occurs when the VI runs longer than 10 minutes, which doesn't makes any sense to me.
Do you have any suggestions?
 
					
				
		
11-01-2012 06:10 AM
Hi Benjamin,
Try this:
Not sure if it helps, though.
Br,
/Roger
11-01-2012 07:58 AM
Hi Roger,
thanks for your suggestion but it didn't help.
I guess the problem isn't somewhere in the for loop. It is more the first close ref VI which causes the problem.
I also tried it without any close ref VI and let LV choose when to close all the refs but it also didn't help.
Maybe there is a whole other solution for my basic problem of define closing a running VI.
Any helpful suggestions are appreciated 😉
 crossrulz
		
			crossrulz
		
		
		 
		
		
		
		
		
	
			11-01-2012 08:02 AM
Benjamin_ wrote:The problem now is that the very first reference in the "Control[]" needs around 40seconds to close, all following refs just need <1ms!
I don't know what you are referring to here. You are closing all of the Control references in a single node. Are you saying it takes that long for the Close Reference for the entire array?
 Javed_H
		
			Javed_H
		
		
		
		
		
		
		
		
	
			11-01-2012 08:05 AM
Hi
Are you facing the problem for a particular VI or any VI ?
 
					
				
		
11-01-2012 08:08 AM
@Benjamin_ wrote:
Hi Roger,
Maybe there is a whole other solution for my basic problem of define closing a running VI.
Any helpful suggestions are appreciated 😉
Ah, my misunderstanding. You said closing. I took it as you wanted to write a value to a control in your pane.
My bad,
Br,
/Roger
 Ben
		
			Ben
		
		
		 
		
		
		
		
		
	
			11-01-2012 08:34 AM
When the VI ref is closed LV checks if there any other refs open to the VI and if not, the VI will be removed from memory. If the VI in question was doing something with VISA, then LV has to watit for that to complete before the VI can be removed from memory.
So rather than using a hammer to close the VI (effectively aborting it) use a signalling method to tell the VI to close up what it is doing THEN close it.
Yes, a lot of speculation in that reply.
Ben
11-01-2012 08:53 AM
@crossrulez:
you are right in the picture I close the whole ref array in one close ref VI but for debugging I put a for loop over this part and measured the time it needs no close each ref separately. I saved the time with the name of the control in a txt file so i was able to see which control needs how many time to close. Then I saw that it is independent of which control comes first just the first one needs around 39 to 45 seconds, all following refs are below 1ms.
@Javed
No unfortunately I am just facing the problem in one particular VI (my measure VI) no in all VIs.
I also measured the time in the measure VI from the time where my eventloop receives the close command until it definitely is closed. This time is about 250ms, independent of how long it has been running before.
This shows me that the problem definitely lies not in the measure VI but in the close ref part.
@Roger
no problem
11-05-2012 07:39 AM
Hi Benjamin,
why don't you just use a Functional Global Variable?
In case you don't know what it is:
It is a SubVI which iterates only one time everytime it is called (While loop with True connected to the conditional terminal). That loop also contains an uninitialized shift register to buffer values during the Execution.
Here is an example on how to create global function variables:
Basic Functional Global Variable Example
So I would recommend, instead of searching for the control and then changing the Stop value to TRUE by reference, you could create a functional global which contains a Boolean value.
That FGV can be written with TRUE (Stop) in your main VI. The referenced VI running in background should read that FGV and can should down properly. So you won't need to care about control references.
Regards,
Lam