02-10-2023 11:07 AM
My situation is this. This is on a compactrio 9053 or 9056. I have made a subVI that can communicate with/control a device. Depending on the system, there can be an x amount of these devices. There could be 1, or there could be 3.
My plan was to have my controller read from a config ini file at startup. It would have a key in that file that states the amount of devices in the system. It would then create/start that number of subVI's and apply the appropriate ip addresses and whatnot and do its thing.
Does anyone have a link/direction I can head in? I have seen an article from NI on dynamically loading VIs but after reading it I'm not 100% sure it's what I need. Thanks in advance!
02-10-2023 11:10 AM
02-10-2023 12:30 PM
Unfortunately, I am not able to figure out the path to the dynamically called VI. I'm assuming the subVI I want to call is going to be stored somewhere on the cRIO-9053's file system.
I did create a build specification and added my subVI to the Always Included portion.
Any hints on how to get the path to the subVI?
02-10-2023 12:38 PM
I attached my test project to this post. I also don't see how you're supposed to access data from the subVI based on that example.
02-10-2023 12:50 PM
Static VI References can help with this. Here is an example.
Then you can reference the VI by name, which will be in memory, and be included in any built applications.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
16 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
02-10-2023 12:55 PM
The VI path doesn't actually have to be the path, it can just be the VI name. If you put the VI name in there it will work fine. You do have to make sure to include the name of any library or class that the VI is a member of, if it's in one of those.
Alternately, you can put down a static VI reference to the VI you want to use and then use a property node to get the "VI path" property from it and get the path from there. It can be even more helpful, because if you right click it and enable the "strictly typed" option, you can use that same static VI reference for the input to the type specifier on the top of the Open VI reference node (the one with the connection pane constant).
02-10-2023 01:06 PM
Big big thank you to you guys for the help so far. I feel like I'm about to level up big time in my abilities. It's running the subVI and I'm pulling the value.
But now I feel like all I've done is call the subVI in a fancy matter. How do I apply this to calling multiples of this subVI at the same time? Right now it seems I'm only calling one "instance" of the subVI.
I want these subVIs to run continuously so I'm using while loops.
02-10-2023 01:09 PM
I just tried this out for the heck of it, and it seems to be working? But it was just a guess, I have no idea if this is right
02-10-2023 01:54 PM
Well you will likely need to make it more complex than that:
That sort of stuff. But I think you have enough to get going.
02-10-2023 02:19 PM
I suggest you start thinking in terms of arrays. You have an Array of VI references, and you start them with a for loop. Set to the for loop to for the number of instances you want. In there you might pass in a user event, or queue references to each instance (so an array of references). Then when you want to talk to a specific instance, you can use the reference you sent into that VI.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
16 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord