LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Ordering of passed cluster values

Hello,

In the main VI of my application, I have created a cluster of about 9 different related quantities to pass to a sub VI. I am concerned about how to pass this cluster correctly. I have chosen the same names (one of the elements in the cluster is a result of a calculation and does not have a name - how does one set one explicitly ?) for the elements of the cluster and on the front panel of the sub VI. How do I ensure that the connection matches correctly and there are no ordering problems ? Is having the same names and data types enough ? Is there a way to check that the connnection is correctly mated (a sort of a decomposition of the cluster connection).

I am using the cluster because the VI has a lot of different inputs and formation of logically similar quantities into clusters makes it neater and easier to follow the logic.

Thanks.
0 Kudos
Message 1 of 4
(2,863 Views)
If you want to assign names to the elements of the cluster, right click on the bundle output and select 'Create Constant'. Wire this constant to the 'cluster' input of the bundle function. This is the input that is right in the center of the function. For any element that does not have a name, just right click on in and select Visible Items>Label. Type the name you want. If you have already created the output cluster, you can right click on the output and select Create>Indicator. This will give the output cluster with names. You can copy this indicator to the subVI and then right click on it and select Change to Control. I find it's easier to use Bundle by Name or Unbundle by Name. You still might wire the wrong values to the wrong inputs/outputs but it's a little more obvious when you make a mistake. Also, you can select the order of the elements that you bundle/unbundle and select to do this with some or all of the elements.
0 Kudos
Message 2 of 4
(2,856 Views)
Thanks for your response.

I removed the bundle and created a bundle by name. Now, when I try to wire in a double or an integer, I get an error that complains that I cannot connect that data type to this polymorphic terminal. I have tried adding elements, etc. No help.

I must be missing something very basic, because when I chose to right click and replace the bundle with a bundle by name, the names showed up in the named bundle.
0 Kudos
Message 3 of 4
(2,832 Views)
m-s,
 
I would reccommend first creating a typedef of your cluster and then wiring a constant of this typedef into the "input cluster" input of the bundle by name.  When you do this, the bundle by name will auto populate with the names of the elements in your cluster.  By making a typedef, you will save yourself some work in the future if you ever want to change what's in that cluster.  If you change the typedef, it will change all instances of that typedef in all of your vi's at once.  You can learn more about how to create a typedef in this article.
 
 
I hope this helps,
Justin D
Applications Engineer
National Instruments
0 Kudos
Message 4 of 4
(2,813 Views)