Guest Posted August 29, 2013 Report Share Posted August 29, 2013 The LabVIEW wiki page on Functional Global Variables (FGV) states that The primary use of Functional Globals is to provide data sharing across an entire project, both horizontally and vertically. In the past, I have successfully used FGVs to share data among VIs running on the same target. In my current project, which involves multiple targets (namely, a host PC and a cRIO), I now want to pass configuration data between a Host VI and an RT VI, and I thought an FGV would come in handy for that. However, it doesn't seem to work: I write to the FGV on the Host VI alright; but when I read data from the FGV in the RT VI, I only get default values, as if nothing had ever been written to the shift registers. Before you suggest it: yes, I have checked the VI properties of my FGV; its execution is set, as it should be, to non-reentrant. Can Functional Global Variables be used to share data between VIs running on different targets? Or is an FGV's scope limited to the target it runs on? Unfortunately, I couldn't find any answers to those questions in the LabVIEW online help, or on any LabVIEW discussion board... Quote Link to comment
Jordan Kuehn Posted August 29, 2013 Report Share Posted August 29, 2013 You will need to implement some communication mechanism to pass data back and forth between the two targets. Try reading the material here. Quote Link to comment
Rolf Kalbermatter Posted August 30, 2013 Report Share Posted August 30, 2013 The LabVIEW wiki page on Functional Global Variables (FGV) states thatIn the past, I have successfully used FGVs to share data among VIs running on the same target. In my current project, which involves multiple targets (namely, a host PC and a cRIO), I now want to pass configuration data between a Host VI and an RT VI, and I thought an FGV would come in handy for that. However, it doesn't seem to work: I write to the FGV on the Host VI alright; but when I read data from the FGV in the RT VI, I only get default values, as if nothing had ever been written to the shift registers. Before you suggest it: yes, I have checked the VI properties of my FGV; its execution is set, as it should be, to non-reentrant. Can Functional Global Variables be used to share data between VIs running on different targets? Or is an FGV's scope limited to the target it runs on? Unfortunately, I couldn't find any answers to those questions in the LabVIEW online help, or on any LabVIEW discussion board... They of course can't do that out of the box. A VI in one application context does share absolutely no data with the same VI in another application context out of its own. That is even true if you run the FGV in two separate projects on the same computer and even more so if they run on different devices or different LabVIEW versions. As Jordan suggested you will need to implement some real interapplication communication here, either through network variables (most easy once you got the hang of it how to configure them and deploy them to the targets), or your own network communication interface (my personal preferences in most cases). There are also reference design projects for cRIO applications such as the CVT (Current Value Table) and accompagning CCC (CVT Client Communication) that show a possible approach for implementing the second solution. Quote Link to comment
Guest Posted August 30, 2013 Report Share Posted August 30, 2013 Thanks for your replies, which have been really helpful. Instead of using and FGV for this particular task, I will put my config data in the variant of a queue element on the host, then send that queue to the target via network streams. Quote Link to comment
Jordan Kuehn Posted August 30, 2013 Report Share Posted August 30, 2013 I do suggest reading through my linked document. It will give you some help determining which implementation is best for your use case. At a very very rough guess if an FGV works for you, a Network Shared Variable (NSV) may be a better solution for you. There are some out-of-the-box solutions from NI and a few others that transition to a custom implementation. The important thing is to understand the options and choose what is best for your application. Good luck with your choice. More details and I think we'd be more than wiling to guide you to the appropriate transport mechanism. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.