01-22-2021 01:42 PM - edited 01-22-2021 01:44 PM
I have one primary loop (while loop) and multiple secondary loops (while loop).
I would like to send command vice versa.
Command send from multiple secondary loop to single primary loop:
--------------------------------------------------------------------------------------------
If I would like to send command to primary loop from secondary loops then I am using custom user event. I am generating custom user event in secondary loop with some identifier, and custom user event is only handle at one place, in side the primary loop. Identifier is help to figure out command is came from which secondary loop.
Command send from primary loop to specific secondary loop.
-------------------------------------------------------------------------------------------
Is there any way? I can send the command from primary loop to specific secondary using any mechanism in LabVIEW.
if there is single secondary loop then I can send command using Queue, but Here I have multiple secondary loops. I need to send command to specific secondary loop.
Here I am placing the example.
Here I have example.
Experiment 1 and Experiment 2 is communicating to main loop using User Custom event. I am try to figure out the way which will help report data back from Main loop to Experiment 1 and Main loop Experiment 2.
Number is Experiment is not fix in actual version it will be very depending on requirement.
I thought notifier will work for this functionality but there is one thing which I found in Solution that it may overwrite the data. Data rate is very high in my application.
https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z000000kFGfSAM&l=en-US
Any one please give me suggestion how should I need to handle this issue?
Solved! Go to Solution.
01-22-2021 01:45 PM
I have a similar experiment setup where there are a handful of conditions. I think your best bet here would be to use a finite state machine so you can take the user to the appropriate options based on their button presses.
01-22-2021 02:00 PM - edited 01-22-2021 02:01 PM
Yes, I can change to finite state machine but I did not able to figure out the way of communicator.
should I use another custom user event, Queue, notifier or anything else?
If number of Experiment is fix then I can use specific number of Queue and send the data from FSM. But Here It will be very. I want something like user can provide just two wire to experiment loop. One for sending command to Experiment and another one get commend from Experiment.
01-22-2021 09:50 PM
You are using LabVIEW 2018, so you have access to Asynchronous Data Wires. The Messenger Data Wire provides one-to-many and many-to-one communication opportunities. It isn't obvious to me from looking at your code just what you are trying to do, but you might consider using Messenger Data Wires and building a structure similar to the Queued Message Handler, but with Messenger Channel Wires (I call this a Channel Message Handler, a CMH). One important metaphoric advantage to Channel Wires is that the Channel Writer (the "output" side) can be placed on the right side of an enclosing Structure (like a While Loop) and can exit on the right side (as though the data is flowing "out on the right" (which it certainly is). Similarly, the Channel Reader (which gets inputs) can be placed near the left ("input") edge and accept a Messenger Channel coming in from the left.
Bob Schor
01-22-2021 11:33 PM
Thank you @Bob_Schor for you replay. I don't have much knowledge about LabVIEW. I will do research about channel wire in depth.
I figure out the solution with help of Queue per experiment. did you see any draw back for this structure?
01-23-2021 03:21 AM
If your loop has an event structure, then you should use a User Event to send messages to it. Do not use a Queue like you show.
Put your Experiment User Events in an array if you have a variable number of Experiments. You can then send info to a specific Experiment, or to all of them, as needed.
01-23-2021 01:03 PM
I'd say you could use a dequeue, just put the dequeue in the timeout case of the event structure with a timeout value wired that lets it regular handle items in the queue. Otherwise someone mashing buttons and triggering events faster than the timeout value would never give the timeout case a chance to get data from the queue.
01-25-2021 12:27 PM
While sending the data to Main loop I am generating event from experiment loop, and handle the Custome User Event in Main loop, event is contain information queue reference which you seen in block diagram.
are You try to say use another User event which will inform data back to experiment loop?
01-25-2021 12:29 PM - edited 01-25-2021 12:30 PM
@RavensFan
Thank you for suggesion, and pointing out the issue. Sure I will use the timer in while dequeue elements in experiment loop.
01-26-2021 02:56 AM
Y@sh001 wrote:
are You try to say use another User event which will inform data back to experiment loop?
Yes, just use User Events for communicating both ways, instead of using Queues.