LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Cluster controls best practices discussion

I would love a discussion around this seemingly simple thing. 

 

For passing many values into another VI, it is usual to use clusters, especially when there are many elements that go into the function. But what comes next? how do we as developers  make the code most readable for ourselves and our colleagues?. Here are my two cents, Please contribute with more!. 

 

Naming: 

Names like "Input cluster" are of course bad, I like descriptive names like "Main control reference cluster"

 

When going into a VI:

How often haven't I done this:

normal 1.PNG

This seems pretty usual, but wait. If i am in another state, I can't se anything of what data I have. I'ts just a small indicator. I can't really see what data I deal with without going to the frontpanel or scrolling. 

so maybe this is better ?: 

norm2.PNG

Now, without scrolling through the cases, and without jumping to the frontpanel, I can see what data goes into the state machine, I can even comment on the different names. 

Or maybe I'm just overthinking stuff. what do you think? 

 

As a P.S. the tunnel for the cluster in my opinion should be shift register if you are writing and reading from it. But I like to use normal tunneling when it is read-only data, like refnums.

 

-Magnus

0 Kudos
Message 1 of 5
(2,995 Views)

@mersdal wrote:

norm2.PNG

Now, without scrolling through the cases, and without jumping to the frontpanel, I can see what data goes into the state machine, I can even comment on the different names. 

Or maybe I'm just overthinking stuff. what do you think?


I think you are overthinking things here.  The beauty of the Unbundle By Name is that you only see what you need to see.  So each state just unbundles/bundles only what it needs.  If a state doesn't need any of that data, then you don't see it.  That is just fine.  Showing more information often just confuses people.

 

Your other two points I fully agree with.



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
Message 2 of 5
(2,979 Views)

Durring development I see nothing wrong with the extra unbundle.  The compiler is going to throw a warning about "Dead Code" ( remove it prior to code review if I'm a reviewerSmiley Wink) however, the compiler is going to toss out the dead code so there will be no perpormance hit at all other than a data copy in the BD space.

 

I would also use short  captions that provide human friendly names show lables on the FP but the bundle/unbundles and terminals will pick up the captions and take up less BD space.

 


"Should be" isn't "Is" -Jay
Message 3 of 5
(2,959 Views)

@JÞB wrote:

 

I would also use short  captions that provide human friendly names show lables on the FP but the bundle/unbundles and terminals will pick up the captions and take up less BD space.

 


Dear sir, would you be so kind as to demonstrate, I understand all the words in your sentence, but not the sentence itself. 

From what you said, I came to expect that a caption would shorten the name of a label if unbundle is set to hide full name. 

what I did: 

unnorm1.PNG

0 Kudos
Message 4 of 5
(2,947 Views)

Hi mersdal,

 

it's vice-versa: the UnbundleByName uses the label (like all LabVIEW BD operations). The caption is only used to create a nice UI…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 5 of 5
(2,943 Views)