05-13-2016 10:32 AM
Is there a method to control 2 parallel loops that have the same state machine control with a queue?
I'm looking to run two tasks in seperate loops but I want their states to change at the same time. I'm running into XY graph issues when my AO turns off...
I've attached the VI. Please excuse my mess.
05-13-2016 10:58 AM
Queues can have multiple "writers" adding things to the Queue, but only a single "reader" removing data. If your intent is to have two State Machines running as close to "in parallel" as feasible, the easiest way is to have two Queues, one for each of them. If you want both to do a particular State, you'd need to "Enqueue Both". Is there another model of what you want to do that can deliver the same functionality as parallel State Machines?
Bob Schor
05-13-2016 11:04 AM
I'm not sure. I'm running an AO and an AI. I'm doing a frequency sweep with them. I'm turning on the AO and doing a log frequency step and am reading the excitation of an accelerometer via AI, thus creating a HP curve. Once the AO is done, (once it's reached it's max frequency defined) my HP curve graph should stop taking data, but there seems to be a bit of lag. It plots an extra point or so because it's dependant on a boolean turning off, which I think is causing some performance issues.
Since you say I can only dequeue 1 element, it sounds like it would work. I want to dequeue the AOs loop state into my AIs loop state so it shuts off my acquisition at the same time as my AO is done.
05-13-2016 11:19 AM
I just took a quic klook at yourt code and I do not understand why you need the two seperate loops to begin with.
Combine your AO and AI into the same state machine.
05-13-2016 12:13 PM
I tried that and it won't start the AI task while my AO task is running. What am I doing wrong?
05-13-2016 12:27 PM
I need to be able to control the AO task via the front panel
05-13-2016 09:19 PM
I'm not sure what's wrong, but I was not able to open your VI with LabVIEW 2012 or LabVIEW 2015. Not sure what is wrong, but I cannot "see" your code...
Bob Schor