LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

looking for design suggestions

Hi,

I'm looking for sugestions on how to pass data between VI's in a large program.  I have cooked up a simple example of my main trouble to show how things work (attached).  I have a top level VI, with many (approximately 40) boolean controls.  These are all passed to a subVI which contains my logic.  The logic also returns the same number of indicators.  In my attached example, I have wired the controls and indicators directly into, and out of the sub.vi; since I have many more booleans in the actual program, I have clustered them into groups of 8, and then uncluster by name in the subVI.  This is rather unwieldy and I think, not the right way to do things.  I'm now thinking that stuffing them all into a single array and then passing that to the subvi would be a much better way, but I'm wondering if anyone out there has a better suggestion?

Bjorn

Download All
0 Kudos
Message 1 of 6
(2,996 Views)

Hi Bjorn,

I think the best design would be for you to bundle all the boolean values into a typedefed cluster.  This cluster would be a data structure that you could wire into a subVI and unbundle/bundle only the values you wish to read/change.  Since it is a typedef, as you add more booleans to your design, the subVI input/output clusters will automatically update with the new data.  Within your program, you would probably have a shift register on your main UI loop that keeps this cluster between loop iterations.  You can read the LabVIEW Help for more information about typedefs.

Good luck,

-D

Message 2 of 6
(2,987 Views)

Yes, I would probably go with the array. 🙂

Still, the cluster approach as some advantages, especially if each boolean has a unique name. Can't you use a single cluster?

Another alternative would be a single U32 variable, then use all the bits in it  to hold your data. (or a U32 array if you really need more than 32 booleans).

If all the booleans are identical as in your example code, you should make the FP controls/indicators also clusters or arrays to simplify things.

Message Edited by altenbach on 01-03-2006 11:30 AM

Message 3 of 6
(2,987 Views)
Bjorn,

What is "better" depends on what aspect of the program is most important. Your current approach is good in several respects: It is straightforaward and self documenting (if each control has a unique name). It faithfully follows the LV dataflow paradigm. Even though bundle and unbundle are somewhat awkward, they are easy to use.

The array approach loses the unique names of the controls: Each element of the array has the same properties and (I think?) no name at all. Plus you have to cycle through them or know the index number of the control you want.

You can use references or globals, but that only adds another layer of complexity and may slow things down. Although speed may not be a factor in a user interface.

You could send the data via a queue. That can offer a lot of versatility, but at the expense of more complex programming to identify the boolean involved.

Any panel with 40 controls and 40 indicators is going to have some messy programming behind it. If you and your users really need that many, you will need to deal with the mess.

Lynn
Message 4 of 6
(2,984 Views)

Here is an example that I used for input data coming from an opc server into the DSC module.

0 Kudos
Message 5 of 6
(2,962 Views)
Ah, thanks.  This looks like it will work quite well now that I finally figured out how to use bundle by name.  Now I can put everything into one cluster, which will make wiring a lot easier.  I had them split into groups of 8 before just so I'd be able to keep track of what was what I think 😛



0 Kudos
Message 6 of 6
(2,937 Views)