Jump to content

Firing Events from External VIs


Recommended Posts

I'm trying to create some monitoring software that can monitor 20-30 clones. Each clone does the reading and tracking of a particular unit.

I have a central VI that should launch and kill the various clones. I know it's nothing that hasn't been done before and it seems simple enough, but I've been having problems with "Error Code 1: Generate User Event in (name of VI)" which apparently means the Event isn't firing properly. I'm not seeing the error in this set of VIs though, which is good and bad because a) it works but b) I don't know what the problem is when it doesn't. I'm fairly positive that events aren't stored properly in functional global variables.

I've uploaded an example of the framework I'm using and I'm looking for some feedback on possible better solutions or how to fool-proof this approach. Obviously I haven't put the innards which monitor the UUT in there yet; baby steps.

To run the example all you have to do is open Controller.vi (after opening the project) and then set the Minion number to any number (this would be the UUT #) and set the enum to "Launch". If you click run, a clone will launch and if you click run again the original clone will close and a new one will run again. You can do this for however many minions you want open.

To kill a clone, set the enum to "Kill" with the minion # and click run. To kill all clones set the enum to "Mass Destruction" and click run. Mass Destruction only kills clones 0-16 at the moment, however it's easy enough to bump that up.

My main thought is that I should fire some sort of central server that each clone registers with and the controller controls that. Maybe I'll give that a go and post it up here later.

Dynamic Events With Clones.zip

Link to comment

I looks like when one clone is killed the FGV is reinitialized, meaning that the reference is lost. I haven't quite rationalized it in my head yet. But I have seen with other FGVs that if I just run it on its own and then run it again, the data is lost. I updated your VIs so that the controller handles maintaining the FGV and it worked just fine.

DEWC.zip

Link to comment

I haven't looked at the code, but this is a relevant general point in LV and refers to crossrulz's post - references in LV are "owned" by the hierarchy they were created in. The hierarchy is determined by the top level VI. So, if you're opening references, you will want to call the VI opening the reference from a hierarchy which will stay in memory.

Error 1 means invalid input, which usually refers to the reference in something like this, since it's the only input which can have invalid values, so it makes sense that this is your problem.

Link to comment

I looks like when one clone is killed the FGV is reinitialized, meaning that the reference is lost. I haven't quite rationalized it in my head yet. But I have seen with other FGVs that if I just run it on its own and then run it again, the data is lost. I updated your VIs so that the controller handles maintaining the FGV and it worked just fine.

DEWC.zip

I thought that I was only getting a new event on the first call hence why the dialog only comes up with "HI" on the first call. That was my fancy test to make sure it was only getting initialized once.

Link to comment

I haven't looked at the code, but this is a relevant general point in LV and refers to crossrulz's post - references in LV are "owned" by the hierarchy they were created in. The hierarchy is determined by the top level VI. So, if you're opening references, you will want to call the VI opening the reference from a hierarchy which will stay in memory.

Error 1 means invalid input, which usually refers to the reference in something like this, since it's the only input which can have invalid values, so it makes sense that this is your problem.

I guess the idea with my example is that the reference is "owned" by the first clone created. The reason that I'm not keeping it initialized in the launcher is that I'm not exactly sure how the launcher is going to be used at this point.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.