LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

What is the best approach for passing large clusters?

Solved!
Go to solution

Hi All,

I am relatively new to labview and developing a test automation.

For the purpose of this automation I need to read a row of data from a csv which can grow to 250 elements. I have a state machine that goes through a few states, and takes measurements and adds to that data another 200 elements. Ideally I would have used one cluster to pass the data between the states with a shift register but in this case the list of the elements doesn't fit on my screen. I can use a cluster of clusters but I would end up with two many bundle/un-bundles to the get to my elements. I know about global variables but also have heard a lot against using them.

 

It came across my mind that I can use a reference to the big cluster(450 elements) that is memory efficient and also easy to bundle/un-bundle and doesn't clutter my diagram with wires.Is this a good approach?

Any good suggestions are appriciated but bear in mind that I want to keep it simple.

 

Thanks very much

0 Kudos
Message 1 of 16
(3,961 Views)

I can use a cluster of clusters but I would end up with two many bundle/un-bundles to the get to my elements. 

 

Why? You can create a proper data hierarchy with descriptive names and sub-clusters! If you want to pick a subcluster, it takes only a single "Unbundle by Name"! Oh yes, and you MUST use Type defined cluster for your project, alongside with "Bundle/unbundle by names".

 

edit: and do not forget to make the subclusters also type defined. It will help you when you need to carry out modifications.

Message 2 of 16
(3,953 Views)

Although I agree that using Unbundle by Name to get to one node for however many sublevels necessary (along with Hide Full Names, if you want!) will be a good solution, if you have 250-450 elements, are they all distinctly named?

 

If you're not going to need to refer to specific elements by name (and essentially, to all specific elements by name) you might have an easier time with a 2D string array, or an array of clusters, depending on the datatypes you're reading/writing from your csv. You could use string matches on the array to get something like "Unbundle by Name" if you wanted to index specific elements. However, if you do need specific elements, by name, you should just do as Blokk says and use subclusters as appropriate, and typedef everything!


GCentral
Message 3 of 16
(3,921 Views)

Seems to me you need an array instead of a cluster (or an array of clusters)? If all elements are the same, you'd be able to use index array to get a specific cluster.

 

If all elements can differ from each other... Well,it's never too early to start learning OO... I'd probably end up with an array of classes, so each element (object) can be a different class (= cluster).

0 Kudos
Message 4 of 16
(3,915 Views)

What about if the OP tries Current Value Table (CVT) library? Using this library you can create tags either in code or in file. So would be much faster and easier to access data elements in the applications than using conventional clusters...

What do you think?

 

https://forums.ni.com/t5/Reference-Design-Content/LabVIEW-Current-Value-Table-CVT-Library/ta-p/35142...

0 Kudos
Message 5 of 16
(3,896 Views)

Not sure if I'd use the CVT library, it is a typical solution though. Since the day I've started using OO, I don't feel the need for clusters anymore (except the error cluster). Inside the class there will still be a "cluster" but unbundling the items by name seems a stretch.

 

I'd say this functionality is much too high level for a function. A .vim, sure, but anyone could make that when required. But this general solution wouldn't add much since a library or class would implement this in a specific way.

0 Kudos
Message 6 of 16
(3,889 Views)

wiebe@CARYA wrote:

Not sure if I'd use the CVT library, it is a typical solution though. Since the day I've started using OO, I don't feel the need for clusters anymore (except the error cluster). Inside the class there will still be a "cluster" but unbundling the items by name seems a stretch.

 

I'd say this functionality is much too high level for a function. A .vim, sure, but anyone could make that when required. But this general solution wouldn't add much since a library or class would implement this in a specific way.


I agree with you! But for this you need to learn OOP 🙂 I do not know about the OP's learning curve, but for me OOP still not started yet 🙂 Well, shame on me and my laziness! 😄

0 Kudos
Message 7 of 16
(3,881 Views)

@Blokk wrote:

wiebe@CARYA wrote:

Not sure if I'd use the CVT library, it is a typical solution though. Since the day I've started using OO, I don't feel the need for clusters anymore (except the error cluster). Inside the class there will still be a "cluster" but unbundling the items by name seems a stretch.

 

I'd say this functionality is much too high level for a function. A .vim, sure, but anyone could make that when required. But this general solution wouldn't add much since a library or class would implement this in a specific way.


I agree with you! But for this you need to learn OOP 🙂 I do not know about the OP's learning curve, but for me OOP still not started yet 🙂 Well, shame on me and my laziness! 😄


Took me 15 years to start. I never want to go back!

0 Kudos
Message 8 of 16
(3,875 Views)

I am with the others.  It sounds like you need to rethink your data structure.  And why do you even need that many parameters?  I have yet to run into a situation where I needed that many variables.  But a couple of options:

1. Use arrays.  Arrays of clusters also work well, depending on what you are doing.

2. Use Variant Attributes.  You can store all of your parameters in a single variant and use a string (name) for the lookup.  The lookup for a Variant Attribute is fast (everything is sorted as you add data).


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 9 of 16
(3,857 Views)

If these are really parameters, as in configuration items, you might also keep them in a .ini file reference (see Configuration File VI's).

0 Kudos
Message 10 of 16
(3,845 Views)