LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Best practice: read data from disk and share value throughout application?

Hi,

 

I have a problem (or maybe I do not). I'm searching for the most efficient way of doing this.

 

Currently I'm reading a number of parameters (beloning to a specific actuator) from a config file. The value's are stored in functional global variable in protected scope. Further more I have a GetValue VI that is getting the parameter values from the functional global.

 

In Short I have: Class "Actuator" with VI's:

       1. ReadFromDisk (private) 

       2. ChangeParameters (public)

       3. ParametersFGV (private)

       4. GetParameters (public)

 

Is there a better way of doing this? I cannot seem to find a way. If I need to add some kind to clarify, please ask.

 

Kind Regards,

0 Kudos
Message 1 of 3
(2,197 Views)

In my opinion, your approach seems valid, especially if it works. However, if you have a problem, you obviously need to fix it. What is your problem with this approach?

Marc Dubois
0 Kudos
Message 2 of 3
(2,159 Views)

Sjeg wrote:  The value's are stored in functional global variable in protected scope. Further more I have a GetValue VI that is getting the parameter values from the functional global.

If all of the states of your FGV are "Get Value" and "Set Value", then change it to be a Global Variable.  They are functionally equivalent, but the Global is a lot faster.

A Look At Race Conditions

 

But as an object, these parameters should be need to go outside of the object.  So the ChangeParameters and GetParameters seem to contradict the point of a class.  Instead, you should have methods to tell the actuator to do something.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 3 of 3
(2,157 Views)