LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Error 1198 when launching re-entrant VIs

I am trying to launch multiple instances (just two instances for right now) of a re-entrant VI using a static reference to the VI and the Run VI method. I am trying to do this in parallel. I am not waiting for the VI to finish and am auto-disposing the reference. To set the VI up, I am also modifying the VI's control values before launch using the Set Control Value method.

Sometimes when doing this I receive Error 1198 -- "The VI is not in a state compatible with this operation. Please change the execution mode of the referenced VI to reentrant for this operation."

The VI is already re-entrant though so I'm not quite sure what's going on or if I'm trying to run things in parallel that shouldn't be.

Any insight into what else this error might be indicative of? The only other symptom is that it gives me the error sometimes and sometimes it doesn't.
0 Kudos
Message 1 of 6
(6,912 Views)
The VI may be reentrant but you have to explicitly state this in VI Properties. Did you specify the VI to be a re entrant VI?

To do this follow these steps:
1. Right click on the VI Icon located on the top right hand corner of the front panel
2. Choose 'VI Properties'
3. In the Category field choose 'Execution'
4. Click the box that says 'Reentrant Execution'
5. Hit OK

This should fix the problem.
0 Kudos
Message 2 of 6
(6,897 Views)
Yes I already declared and double-checked that the VI was re-entrant.

I have been able to change things around and obtain the desired functionality by using the Invoke Node method for the re-entrant VI which does not give me an error. I'm still curious however why this occurs.

I recall reading a tutorial somewhere on this type of thing--parallelism using re-entrant VI's--I believe it was a powerpoint presentation by Michael Aivaliotis given at NI Week once upon a time but I can't find it now.
0 Kudos
Message 3 of 6
(6,891 Views)
I tried to mimic your problem and came up with something similar. I received Error 1000 stating that the 'The VI is not in a state compatible with this operation'.

I think you were missing an input on your Open VI Reference VI. You actually have to prepare the VI for a reentrant run. You can do this by wiring a constant value to the 'Options' terminal of Open VI Reference. Refer to the detailed help for the Open VI Reference:

Here is the part that I think will solve your problem
" options is a bit set that specifies how the VI reference is treated. options can be a combination of the
following values.

0x08 Prepare for reentrant run. Reserves the target VI so it cannot be edited and if the
target VI is reentrant, allocates a dedicated parallel data space for this VI reference. If the
target VI is not reentrant, the function returns an error. When you release the VI reference,
LabVIEW unreserves the reentrant target VI and deallocates a parallel data space. When you set
this option and use the Run VI method, you can run multiple instances of a reentrant VI
simultaneously. Refer to the examples\viserver\runvi.llb for examples of using this option."


I am attaching a VI that demonstrates the same. Note, once you create the constant you have to change its format to Hex and then type in the value '8'
Message 4 of 6
(6,877 Views)
This is very close to the behavior I have but not quite. In my first post you'll note that I encountered error 1198 static VI references to launch them. If you use static VI references in your example (in leu of the Open VI Ref and path) you'll get error 1198 instead of error 1000.

I was unaware of the option for opening references to re-entrant VI's... that it specifically allocated space (or whatever the details were that were listed in the help for Open VI Ref option 8). Since it's not a default option, it's probably not something you can do with a static VI reference.

I guess a workaround is to use the path property of the static reference then open a VI reference with option 8. That seems (to me) to be a kluge but slightly less combersome than having to hardcode the path itself.

Thanks.
0 Kudos
Message 5 of 6
(6,868 Views)

So are all vi's that are called remotely using the Run vi method considered reentrant vi because of launching them in this fashion. I have a problem where I am starting a vi using this method, and I get Error 1198, so I change the execution to reentrant (even though it's not called simultaneously), and this error still occurs??

0 Kudos
Message 6 of 6
(6,093 Views)