12-07-2021 12:04 PM
I've used LabVIEW for years, but am relatively new to the Realtime and cRIO flavors. I'm working on a project with a cRIO that needs to run multiple modules/instruments. Assuming the instruments are OK for tag-style data, Network Shared Variables look like a good solution.
But if I make a class or library for an instrument, and include a Network Shared Variable for its tag data, how can I spawn 2 or more copies of the shared variable (for multiple identical instruments)? Maybe this is just something simple that I'm missing... otherwise I'll need to replicate the functionality of the Shared Variable Engine if I want to dynamically spawn variables?
Or is my whole approach off-base for a realtime app?
Solved! Go to Solution.
12-08-2021 01:13 PM
It's not pretty
https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z000000kIT8SAM&l=en-US
DSC might have another solution:
https://zone.ni.com/reference/en-XX/help/371618K-01/lvdsc/dsc_create_shared_variable/
12-14-2021 10:56 AM
Thank you, and sorry for my delay. We don't have DSC and probably won't introduce it for this project.
And wow, that really isn't pretty!! That looks like VI scripting, in that a template gets physically saved to disk as a new instance. I'm using the Actor Framework, so I hoped the variables could spin up/down more easily.
Unfortunately, this makes Shared Variables essentially useless to me. I decided to build a custom library to handle my tag data. One nice benefit to the custom approach is that I can extend it with custom events too (to update UI refs OnChange, for example).
Thanks again for your answers!
12-14-2021 11:11 AM
Yes, like you, 90% of us probably start out with shared variables but then quickly find some limitation and then quickly switch to something else.