12-05-2012 04:06 AM
I have a test procedure which makes use of state machine approach.I want to give the user options such as:
"run":for starting the test
"pause":for pausing the test
"resume":for resuming the test run from paused state
"abort":for aborting the test
All the above options are given in the customized run time menu bar.Currently I am using a producer-customer approach wherein 1st while loop keeps track of menu items(user selection) & 2nd one is for running the test(has test state machine inside it).
Any ideas on how to implement the above control features efficiently in the testing procedure?
Thanks
12-05-2012 08:22 PM
any suggestions guys??
12-06-2012 04:33 AM
So, what is the problem?
you have a producer where the user events are tracked. when a menu option is selected, your producer would detect the event. will it pass the event info to the consumer and how?
you have the consumer which has a test procedure running. so, when the producer sends the event info, execute the corresponding states!
please give details of the issue you are facing. if you want design help, then post the code (LV 2010 or lower) so that we can tell you how to improve.
12-06-2012 07:21 AM
...or, add an "Idle" state to your State Machine and let your UI producer loop enque trips there to the front of the queue on a 'pause' command.
12-06-2012 07:45 AM
TestStand is a good hint 😉
Using LV, the state machine must be "self-feeding" to act as a sequencer. You can add a logic after each case (within the loop, outside the case structure) to query for "pause". If it is pressed, backup the "next state" (additional shift register) and replace it with "idle" as next state.
If the button (toggle as pause/resume) is unpressed, restore the backuped "next state".
Using producer/consumer complicates the query a little since you have the queue as "next step" storage, but the approach is 'transferable'.
Norbert
12-07-2012 02:17 AM
i have used global var to control test sequence, before the execution of next step its checking if pause is active, its not best way to do it. Test sequence is inside for loop connected to array where all seetings are. It works fine so far.
12-10-2012 10:46 PM
I am using following method for my VI:
In this the lower while loop has the state machine instead of the "inner while loop".I want to know how I can implement "pause" & "resume" features in this. Is there any way to make it more efficient by using dynamic events, queues etc. coz I can see most of the producer-consumer examples are based on these approaches.I am new to LV so I exactly dont know how can I apply those things here.
12-11-2012 03:39 AM
One more problem that I encountered while using the above method is that the consumer loop has to be executed only once in order to execute the test state machine.For doing this, I am using "run" variable value to stop the main loop of consumer.By doing so the vi becomes unresponsive to the "run" menu item after single execution of the test and thus I have to stop the vi and re run it for running the test for the 2nd time. Any suggestions to solve this problem??
12-11-2012 03:43 AM
Can you attach your code in 2009 version.
12-11-2012 04:48 AM
You do not use the producer/consumer architecture. You are using a simple two loop architectures which is using local variables for data transfer.
You should rework your VI to match a real producer/consumer.
Norbert