LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Alternative to Reference Cluster in Event Driven State Machine

Hello Fellow Labviewers,

I have an event driven state machine and use a reference cluster of some 40 odd elements to carry values of user operated booleans, strings, numbers, pictures, etc. through the state machine. However, initializing the cluster with all the references of controls and indicators in the program looks rather tacky on the block diagram. (see below) Any creative ideas/suggestions on reducing this tower of reference initialization?

 

 

 

 

TackyReferenceCluster.PNG

Thank you kindly!

0 Kudos
Message 1 of 11
(4,806 Views)

@cwatanabe92 wrote:

 However, initializing the cluster with all the references of controls and indicators in the program looks rather tacky on the block diagram. (see below) 

 

 

 

 

TackyReferenceCluster.PNG

Thank you kindly!


Hi,

    If you want to intialize the element in the cluster just right click on the cluster go to create ---> invoke node ---> reinitialize to default.

 

using this method all the value of cluster will be reinitialized to default. you can just pass the cluster input.

 

 

Hope this helps 

 

Kudos Welcome 🙂

 

Certified-LabVIEW-Associate-Dev_rgb (2).jpg

Certified LabVIEW Developer
Best LabVIEW Programmer @NIDAYS 2015
0 Kudos
Message 2 of 11
(4,791 Views)

I'd recommend to use variant and operate on control name:

variant.png

0 Kudos
Message 3 of 11
(4,782 Views)

@cwatanabe92 wrote:

I have an event driven state machine and use a reference cluster of some 40 odd elements to carry values of user operated booleans, strings, numbers, pictures, etc. through the state machine.


Why use the references?  Why can't you just use the terminals to get the values and local variable to write them?  It would be more efficient than using property nodes.


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 4 of 11
(4,763 Views)

I believe it's more convinient when you want to enable/disable different controls or just changing their's properties...

0 Kudos
Message 5 of 11
(4,760 Views)

@AdamTrojak wrote:

I believe it's more convinient when you want to enable/disable different controls or just changing their's properties...


The OP specifically stated uses the references to carry the values.  That was the point of my comment.  Yes, it does make it much easier when you start dealing with enable/disable etc.  But purely for the values, references is a path best not taken.


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 6 of 11
(4,753 Views)

Oh, yes, I din't noticed that. In that case references are pointless

0 Kudos
Message 7 of 11
(4,745 Views)

See this thread.

 

I have been asked to rewrite an application written in another lnaguage such that the GUI had to be identicle to the original. That required multiple nest tabs with hundreds of controls. I resorted to using a state machine that bundled all of the control from each tabe into a single cluster. That cluster was then used in a GUI controller that took care of all of the viability/disable/enable work using multiple sub-VI each with their own dynamically registered even structure.

 

While that approach is not used by many, it worked to make the code easy to understand by my customer who very quickly was able to take over maintaining the code himself.

 

Just offering another idea...

 

Ben

 

 

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 8 of 11
(4,720 Views)

Interesting! Looks really clean. In this case then, instead of having a cluster that references all of the controls and carrying that through the state system, we have a variant array that we can use to carry information about the controls through the system, and changing values/parameters of controls is as easy as indexing the control in the variant and changing the value of that control?

0 Kudos
Message 9 of 11
(4,573 Views)

I should have been more specific, my apologies. I also use the reference cluster to control multiple properties of the controls in the program.

0 Kudos
Message 10 of 11
(4,571 Views)