LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Why needs the first reference much more time to close than all others?

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?

Stay Hungry, Stay Foolish
0 Kudos
Message 1 of 9
(3,243 Views)

Hi Benjamin,

 

Try this:

 

Controls.JPG

 

Not sure if it helps, though.

 

Br,

 

/Roger

 

0 Kudos
Message 2 of 9
(3,234 Views)

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 😉

Stay Hungry, Stay Foolish
0 Kudos
Message 3 of 9
(3,220 Views)

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?



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 9
(3,215 Views)

Hi

 

 

Are you facing the problem for a particular VI or any VI ?

0 Kudos
Message 5 of 9
(3,213 Views)

@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

 

0 Kudos
Message 6 of 9
(3,211 Views)

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

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 7 of 9
(3,199 Views)

@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

Stay Hungry, Stay Foolish
0 Kudos
Message 8 of 9
(3,194 Views)

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

 

 

0 Kudos
Message 9 of 9
(3,146 Views)