The program: I am trying to create a program which takes in a continuous stream of data from an external source. The user can interact with the front panel to do various things such a plotting the data, starting a calibration process, stopping a calibration process, etc.
I have attached a VI which a very simplified example of what I am trying to do.
In this VI, loop 3 is taking that live stream of data and processing it into various doubles, strings, etc. and passes that data via a queue to loop 2. Loop 2 is what does all the logic and display for the program (In actual application, I would have many sub-VI's inside here to do this). Loop 1 is what handles the user inputs. So far, the solution I have been able to come up with is using local variables to take the user input from loop 1 and select the appropriate process in loop 2. This is functional and would work but I am wondering if there is something better.
The problem: How can I do this without using local variables?
Solved! Go to Solution.
Change the data content you use for the queue to loop 2 to be a cluster with a command (ENUM or String) and a variant for the data type. When you dequeue a message check the command type first and use that to select the case you will execute. any given case/command will know the data format for the specific command and can call variant to data with the appropriate typedef for the data. This way both loop 1 and loop 3 can send messages to loop 2.