09-11-2012 03:50 PM - edited 09-11-2012 04:03 PM
multiple pressings adds to the queue and it is still working on the extra "start test" in the queue, plus by pressing the "stop" ...you've stopped the producer loop. Add a "flush queue"...it should work or you can "enqueue at opposite end".
09-11-2012 04:30 PM
Yes. Experimented with the "Flush Queue" myself! 😉
I have read in these forums about "Producer/Consumer" structures. I guess I'm now building one! If I understand the full operation correctly:
1. Pressing START causes the event structure in the producer loop to put a "start test" on the queue.
2. The state of the CASE in the consumer loop transitions from "initialize" to "start test" when the "start test" is taken off the queue. The "start test" case includes all of the work of the VI.
3. Pressing STOP flushes the queue (now!) and puts a "stop" on it, sends the abort notification, and stops the producer loop.
4. The abort notification ends execution of the "start test" case. The next execution of the Consumer Loop takes the "Stop" off the stack and transitions the CASE to the "stop" case, whose sole function in life is to flip the boolean input to the consumer's conditional terminal.
09-12-2012 04:51 PM
I now have this running in an acceptable state using the producer/consumer architecture that apok posted as a guide, and also taking johnsold's suggestions into account. I'm actually pretty happy with the way it has turned out. 😉
The Producer Loop is essentially the same as apok's diagram with the "Flush Queue." The Consumer Loop is customized based on my needs. I kept the three states, although I really do not need an initialize state. Only difference is that I have to push the START button to begin data collection. The data collection state includes three "blocks" that iteratively execute in sequence:
For reference, the program is used to periodically collect the temperature of nine locations in a system using nine 4-wire RTDs. The RTDs are wired to a pair of 50-pin terminal blocks that connected to a PXI-2530 that is in 4-wire MUX mode. The temperature is being measured by a PXI-4071 DMM with its terminals wired to the common pins of the terminal block.
09-12-2012 05:07 PM - edited 09-12-2012 05:14 PM
good to hear it helped...if you want to directly goto "start test", click on the enum that is "initialized" on the outside loop and make it "start test". As soon as you run the program, your test will begin. Also, you can delete the front panel control "start test." and delete the "event case" in the structure for that action.
09-13-2012 11:55 PM
Yes, Indeed. Simple enough to omit the Inititalized state. Not a terrible nuisance to keep it though. There's only been one tome when I've looked at the screen asking myself why the thing isn't collecting data to realize I hadn't pressed "Start". So far, anyway. 😄
And I hadn't "lost" anything except a few minutes time.
Thanks again!
Jeff