LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How should I share a cluster across several sub .vis? Best practices? Current problems...

I'm trying to share a cluster across several sub .vis.  I've written a save / load settings function that basically stores these settings in a static variable (full .vi attached):

 

 

 

Settings

 

Questions: 

  1. Is this an appropriate practice?  (using a sub vi to share data)

  2. My program settings appear to be lost occasionally and reset to their default values.  This bug is rare, and it's hard to see what's causing it.  Could this be caused by my "save / load settings"?  Would this .vi result in race conditions or something weird if I use it in many places (and sub vis)?  I've disabled reentrant execution.  

 

The "save / load settings" vi above uses a sub vi to initially read the settings from a binary file and save them each time they are changed (saved).  I initialize the "save / load settings" by loading the settings from text the first time this function is called.  

 

Thanks!

Download All
0 Kudos
Message 1 of 4
(2,471 Views)

What you are doing is generally called a LabVIEW 2 Style Global or an Action Engine. It is a valid way to store data for use across subVIs. Rather than use first call why not have a specific action to initialize the data? The code is a bit more readable. Though you can use first call as you have.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 2 of 4
(2,459 Views)

Thanks Mark, any chance this function is causing my sporadic resets (the cluster is reset to the default value)?  

 

If not I guess I can look at the data I'm sending to the function when it saves...

0 Kudos
Message 3 of 4
(2,439 Views)

A reset is expected if you pass "Load Settings" or an invalid option as "Mode" and "First Call" as "True". Otherwise, the data should only reset if you unload the VI inbetween.

So you should first off focus on mis-parametered (does this word exist???) calls.

 

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 4 of 4
(2,419 Views)