LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to dinamically run a reserved VI

Hello all,

I have searched the solution to my problem but unfortunatelly I have not found it.

 

I run the daemon VI "A" which reserve a subVI "a" in its own lvlib "a-lib", then I run another top-level VI "B", in another lvlib "b-lib" which tries to run dynamically the subVI "a", by using the Run Invoke Node.

 

The Run Invoke Node returns a error because the state of the subVI "a" is Bad (it is already reserved).

 

What I want is to run "B" without reserve the "a" so that I can work on the "a-lib" while "B" is running. To do this I need a way to run a subVI dinamically without place it in the "B" diagram.

 

Someone knows if it is possible?

Thanks a lot

0 Kudos
Message 1 of 9
(3,456 Views)

You should be able to use Call By Reference on the normal (not clone) VI. However, the VI will be blocked for execution until the other instance is done. A normal VI simply won't run more then once at the same time. To be able to use Call By Reference, you need to know the (correct) connector pane. This is easy when you use a static VI reference; simply right click it and set it to "Strictly Typed VI Reference".

 

If the subVI should run in parallel, you need to make the VI you're trying to run a clone, in VI Properties>Execution. You can't use a static VI reference directly anymore, but you can (should) still use it to get the name of the VI. Then use this name to open a clone reference, by using Open VI Reference with "8" as an option.

 

If you make the VI a clone, you should be able to use it as a normal sub VI. No need to call it dynamically at all!

Message 2 of 9
(3,443 Views)

I cannot use the static reference, it reserve the VI as well as if it is used in the block diagram.

So the only way is to convert the subVI from Non-reentrant to Preallocated clone reentrant.

I will try it also if I do not like this solution.

Again many thanks

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

@ico82 wrote:

I cannot use the static reference, it reserve the VI as well as if it is used in the block diagram.


Almost.

 

The static VI reference doesn't reserve the VI. But if the VI is reserved (e.g. not idle, because it's in the hierarchy of a running VI), it will give an error when you try to run it dynamically.

 


@ico82 wrote:

So the only way is to convert the subVI from Non-reentrant to Preallocated clone reentrant.


Yes, running a VI twice in at the same time can only be done if it's a clone. There's no way around that.

 

But if you set it to be reentrant, you don't need all the dynamic stuff. I do think (but please confirm or dismiss) you looked into the dynamic calling because a sub VI didn't work? Well, if the VI is reentrant, a normal sub VI will work.

 

Preallocated vs shared clones does make a difference, but most likely not in this case.

0 Kudos
Message 4 of 9
(3,388 Views)

wiebe@CARYA wrote:

But if you set it to be reentrant, you don't need all the dynamic stuff. I do think (but please confirm or dismiss) you looked into the dynamic calling because a sub VI didn't work? Well, if the VI is reentrant, a normal sub VI will work.

No, I am looking in dynamic call because I have written a sort of task manager to run and  stop, open and close front panel, and abort execution of other daemons, so when I work on daemons I want that my task manager is always in execution so that is simpler for me to act on daemons. However if this task manager uses VI of other lvlib the whole library is locked and is impossible to add new VIs.

It looks a bit crazy.

 

P.S. Library are locked also if my task manager does not use daemon's subVIs 😓

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

@ico82 wrote:

wiebe@CARYA wrote:

But if you set it to be reentrant, you don't need all the dynamic stuff. I do think (but please confirm or dismiss) you looked into the dynamic calling because a sub VI didn't work? Well, if the VI is reentrant, a normal sub VI will work.

No, I am looking in dynamic call because I have written a sort of task manager to run and  stop, open and close front panel, and abort execution of other daemons, so when I work on daemons I want that my task manager is always in execution so that is simpler for me to act on daemons. However if this task manager uses VI of other lvlib the whole library is locked and is impossible to add new VIs.

It looks a bit crazy


That is a valid reason.

 

The reason might go away once the library is developed to a point where it's stable and doesn't need to be edited much...

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

wiebe@CARYA wrote:

The reason might go away once the library is developed to a point where it's stable and doesn't need to be edited much...


Of course if I do not need to develope the library then it can be locked, but i have to develope it 😄

however also with only dynamic calls the lvlibs of my project are locked.

I am not seeing something.

 

EDIT: Yes, i did not see a opened reference. Everything work as expected.

0 Kudos
Message 7 of 9
(3,343 Views)

wiebe@CARYA wrote:

...

If you make the VI a clone, you should be able to use it as a normal sub VI. No need to call it dynamically at all!


Your wording confused me.  I think you mean: 'If yo make the VI reentrant ...'

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 8 of 9
(3,334 Views)

@paul_cardinale wrote:

wiebe@CARYA wrote:

...

If you make the VI a clone, you should be able to use it as a normal sub VI. No need to call it dynamically at all!


Your wording confused me.  I think you mean: 'If yo make the VI reentrant ...'


You can make a VI:

Shared clone reentrant execution
Preallocated clone reentrant execution

 

If you make the VI reentrant, it's SubVI instances will be clones. Each SubV instance of a reentrant VI is a clone of the VI. (You can get a reference to the VI or to a clone.)

 

I guess you are right: you make the VI reentrant, but you can make a SubVI a clone (by making the VI reentrant).

 

Guess it is quite confusing.

 

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