ni.com is currently experiencing unexpected issues.

Some services may be unavailable at this time.

LabVIEW Channel Wires

取消
顯示結果 
搜尋替代 
您的意思是: 

Order of messages on a Messenger Channel

已解決!
前往解決方案

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 積分
1 條訊息(共 3 條)
3,124 檢視
解決方案
接受者 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

2 條訊息(共 3 條)
3,092 檢視

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 積分
3 條訊息(共 3 條)
3,081 檢視