Jump to content

Design Question


Recommended Posts

I am replacing an old application which has about 100 VI's. The program uses globals extensively for data transfer between Sub-VI's. I have heard there are much better methods.

1. What are the best most efficient methods of transferring data between Sub VI's?

2. What are the best most efficient methods of transferring data between seperate (parallel) while loops on the same block diagram?

Keep in mind that this programmer is not well versed in implementing large scale development (100 Sub VI,s), but is confident there are better methods.

Any help would be greatly appreciated.

Thanks

Your fellow architect.

Link to comment

QUOTE (wkins @ Aug 11 2008, 08:05 AM)

That would depend much on what type of data and how frequent the exchange is. There are queues, notifiers, refnums, LV2 functional globals... But you've got to be careful when subVis talk to each other directly. You might run into data collision problems. There is no "one" method that could be described as the best one.

Not knowing your data architecture, I could be way off... but I'd probably try to have a master VI that does the communication all in one place and make sure the subVis don't talk to each other too much. This way, everyone knows who's talking to who. It's easier to debug.

QUOTE (wkins @ Aug 11 2008, 08:05 AM)

I'd have to say Queues, for the simplicity of the design. Take a look at Producer/Consumer design patterns. There are numerous sources for help. Either from LabVIEW "New..." screen and help files, or other sources like http://expressionflow.com/2007/10/01/labview-queued-state-machine-architecture/' target="_blank">ExpressionFlow.

Link to comment

QUOTE (wkins @ Aug 11 2008, 01:05 PM)

In terms of clarity of coding and most efficient use of memory transfering data via the normal connector pane and wires is the best way to go. If you have many items of data that are related consider using a cluster to hold them all together on a single wire and a single input/output terminal. If programming in LV>=8.2 then using a LabVIEW class rather than cluster has advantages in terms of encapsulating the data and potentially improving maintainability. Passing data between sub-vis without sending it through the parent diagram is not great style, but you should look at notifers and queues if you really want to do this.

QUOTE (wkins @ Aug 11 2008, 01:05 PM)

2. What are the best most efficient methods of transferring data between seperate (parallel) while loops on the same block diagram?

Queues are the way to go here. Again, if you are passing large amounts of related data, then define a cluster (look at Type Def controls), create q queue with that type as the element outside both loops and then pass the queue reference to each loop. Queue data in one loop and read it in the other. Have a look at the examples of produce-consumer design patterns to get the idea.

Link to comment

QUOTE (wkins @ Aug 11 2008, 06:05 AM)

Ditto to several comments above. First always use wires whenever possible. In other words, pass the data into the SubVI and as noted, clusters are your best friend here (type def them). If this app is one that might be changed in the future, definitely consider classes. They are actually quite simple. There is a learning curve and it is important to experiment a bit before rolling a class into your app. But once you are over the curve, they are easy to build and your code becomes more scalable.

QUOTE (wkins @ Aug 11 2008, 06:05 AM)

2. What are the best most efficient methods of transferring data between seperate (parallel) while loops on the same block diagram?

The two most important techniques to master, if you have not already done so are queues and functional globals (LabVIEW 2 style globals). However they function differently. Consider the functional global to be a data repository. You set values and get values - but with global scope and the ability to do error checking. The queue is more of a command/messaging architecture. Send a command and the associated data needed to execute the command to the appropriate location.

Often "most efficient" is not a matter of the time to transfer the data, but rather that which is cleanest on the block diagram.

Sounds like a marvelous time to learn a few new techniques.

N

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.