Showing results for 
Search instead for 
Did you mean: 

Channel Wires vs References

Go to solution

I am considering the use of channel wires that might replace references in some elements of my project. 


Below I'll explain how I'm using the refs and what I see as some of their advantages over the use of channels for my use case.  My hope is to learn how I might use channels better, as I do think they offer a lot more clarity on the block diagram.


In my project I have a top level vi that launches several subvis that run continuously and in parallel.  Each subvi in my use case monitors/controls a piece of equipment. Typically the subvis are launched with inputs that are references to indicators that the parent expects the subvi to keep updated with the most recent measured values. Some also receive a reference that is used to instruct the subvi to shut down.  It is easy to run many pieces of equipment that might provide updates at very different rates.  It is also easy to have an event handler that responds to new data when ever it arrives.  A simple mock up is below.




Now consider the image below that uses a similar parent/child setup with with channel wires (tags. assume i only care about the most recently posted data).  Now I am back into what seems like a 'polling' situation.  I have to decide on a rate to check for new data.  I don't think I can set up a comparable event structure.




Interested in the community's thoughts on the use of  reference vs tags for situations like mine above.



0 Kudos
Message 1 of 5
Accepted by topic author AdamZeroK

First of all, using references is SLOW.  And I am talking 1000s times slower to read from or write to than using local variables.  Every time you use a property node of a front panel item, it causes a thread swap and forces it to run in the UI thread.  This can drag things down to a crawl.


As for sending data back to your main GUI, I personally like to use User Events.  They work with the Event Structure that you are already using.  Nice and simple.


For sending the latest values to the actors, the tag channels will make more sense.  Based on what you have stated, you could also use Global Variables or Notifiers.

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
Accepted by topic author AdamZeroK

For a Parent/Child situation, I would not use a Tag Channel, but rather a Stream or Message Channel for precisely the reason you mention, namely that the "listener" has no way of knowing when to loop, so ends up "polling".  This can be just fine, for example if you have a display that just has the "latest values" and you know you want to update 10 times a second, so you use Tags (to send the "latest") and have the loop run with a 100 millisecond "Wait" embedded, not caring that if nothing happens for minutes, the loop will still "poll" the old numbers.


Note that in LabVIEW 2017 (and in some releases of LabVIEW 2016), an Event Registration Channel was introduced, so if you want to use User Events with Channels, you can do that, too.


Bob Schor

Message 3 of 5

Yup, in favor of User Events, and the Event Registration Channel wire, no polling necessary.  But to be fair I haven't used channels much yet, and haven't used the Event Registration Channel at all, but understand the concept and can see where in the future I might use it.

Message 4 of 5

I fished up all the most experienced commenters!  Thank you for your ideas. 


I have 2017, so the channel events seem particularly interesting. looking over the examples for these now.

0 Kudos
Message 5 of 5