LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamically loading template VI class member causes error

Jason,

 

Could you perhaps post an example code? When I tried attaching same reentrant member VI to two subpanels, using two different objects, I got a run time error that VI is already in use. There is even NI KB post stating the same - http://digital.ni.com/public.nsf/allkb/60A749CF788726088625766200537F65?OpenDocument

0 Kudos
Message 11 of 16
(1,450 Views)

Fedor,

 

I can't post all my code - this is a work project for an unreleased product.  But I can show you some of the pieces.

 

My project uses the active object concept as described in this post:

http://forums.ni.com/ni/board/message?board.id=170&thread.id=462967&view=by_date_ascending&page=1

 

In my project, I'm monitoring anywhere from 1 to 6 chemical reactors called modules.  For each module, I create an active object called a "Module Controller".  Each module controller is responsible for handling a subset of 3 active objects called "Plugins".  Plugins could be a sensor, a processing algorithm, etc.  Plugins are also active objects.  

 

The thing is, both module controllers and plugins must have front panels the user can manipulate.  And because I'm running several module controllers, and each of which could need the same plugins, I have to create multiple, independent instances.  So, first things first - I create the active objects:

 

Active Object - Create.jpg

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Obviously, there are create functions for the Module Controller and Plugin subclasses, but they basically just set up some class properties.  The top level create is what actually launches the subclasses and runs their VIs.  It's nothing too special - looks just like Ben's code.  Likewise, the module controller and plugins themselves are nothing unusual - just standard, reentrant VIs.  After they are created, I put them in subpanels:

 

Insert Plugin into Subpanel.jpg

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

And that's really it.  As I said, the module controller and plugin VIs themselves are set for reentrant execution where I'm preallocating clones for each instance.  I agree looking at the knowledge base article it seems it shouldn't work - but it does, both in dev and as an exe. I'm not seeing any errors using this method.  Not sure if it matters, but I'm running LabVIEW 2009 SP1 (32 bit) on a Windows 7 machine

 

I hope this post is helpful.  If you are doing something different is triggering the error, please let me know.  I may be standing in the middle of a minefield and just not know it!

 

Thanks,

JasonP - CLD 

 

Message 12 of 16
(1,430 Views)

Ha! I just realized looking at my post that one of my subVIs in the Active Object:Create method still says "VIT path" - evidence of my first, somewhat faulty approach that must be eliminated! 

 

JasonP - CLD 

Message 13 of 16
(1,429 Views)

Thank you Jason!

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 14 of 16
(1,421 Views)
Thanks Jason. Looking at your code I realized that although I saved VI as reentrant in my 1st attempt, I was not using option "8" in "Open VI Reference". Option 8 seems to fix it.
0 Kudos
Message 15 of 16
(1,406 Views)