From 11:00 PM CDT Friday, Nov 8 - 2:30 PM CDT Saturday, Nov 9, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW Channel Wires

cancel
Showing results for 
Search instead for 
Did you mean: 

Order of messages on a Messenger Channel

Solved!
Go to solution

I've recently started investigated the use of Channel Wires, particularly in data acquisition systems for shuttling operating commands and data between loops.  I sometimes have a situation where I want to tell a hardware loop to perform multiple consecutive operations, for example, "Reserve resources" then "Start acquisition".  Using a regular Queue, this is straightforward as Enqueue Element observes the regular dataflow paradigm.

 

Replacing the queue with a Messenger Channel, the Channel Wires from two Channel Writers can be joined.  However, I can not see a way to ensure that the messages are delivered in the intended order as there are no suitable dataflow terminals on the Channel Writers.  Hopefully the sketch below makes it clear what I mean.

Order of messages, queue vs Messenger ChannelOrder of messages, queue vs Messenger Channel

I've tried encapsulating the Channel Writer in a subVI with error wires to enforce dataflow, joining the Channel Wires after both subVIs have run, but this produced different results when running normally (incorrect) and with highlight execution on (correct), suggesting this was not working as I anticipated.

 

Am I missing something fundamental and obvious, or am I trying to do something for which Channel Wires were not intended?

 

PsyenceFact

0 Kudos
Message 1 of 3
(1,434 Views)
Solution
Accepted by topic author PsyenceFact

You have to impose a dataflow order on the two writes otherwise they try to run concurrently with unpredictable order.

 

Screenshot 2023-07-07 at 8.52.50 AM.png

Message 2 of 3
(1,402 Views)

Both of those options are disturbingly obvious, now I come to look at them!  My actual message content is a cluster of enum (command) and variant (payload) with the data type of the payload being different for each command, so there would need to be a little finessing to use the for-loop, but straightworward enough.

 

Many thanks!

 

PsyenceFact

0 Kudos
Message 3 of 3
(1,391 Views)