07-07-2023 05:14 AM
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.
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
Solved! Go to Solution.
07-07-2023 08:59 AM
You have to impose a dataflow order on the two writes otherwise they try to run concurrently with unpredictable order.
07-07-2023 09:50 AM
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