How to stop/abort an event case once started without stopping the main while loop?

How to stop/abort an event case once started without stopping the main while loop?

Post by Jega » Mon, 23 Jun 2008 03:40:07


Hi,
My problem is once I start an event case - for e.g "start, value change", I have to wait till it's completed, only then I have user control again. This is troublesome if the event take hours to complete, I do not have the option of pressing any buttons while the event is running. Is there a way I can use a control button to abort or quit the current running event? I'm only looking to stop/abort the running event and reinitialize it back to default without having to stop the entire main while loop. Any suggestions would be much appreciated.
 
Jega
 
 
 

How to stop/abort an event case once started without stopping the main while loop?

Post by smercurio_ » Mon, 23 Jun 2008 04:10:06

You should not be performing actions which take a long time in the actual event case. You can either spin off that process as a dynamic VI, or, as a better solution, set up a producer-consumer structure. The event structure becomes your producer loop which sends messages to the consumer loop via the use of queues. This is a very fundamental program architecture and well worth spending the time to learn it. You can take a look at this KB article for more information: <a href=" http://www.yqcomputer.com/ " target="_blank">Application Design Patterns: Producer/Consumer</a>.

 
 
 

How to stop/abort an event case once started without stopping the main while loop?

Post by anki » Mon, 23 Jun 2008 04:40:05

Jega
This can be achieved by adding a state machine after the event structure and using the event structure to drive the state machine in the require state. I am knind of doing it in a similar way in one of my applications.
Hope it helps......
Ankit
 
 
 

How to stop/abort an event case once started without stopping the main while loop?

Post by MSca » Tue, 24 Jun 2008 21:10:08

hi  as already mentioned, using event structure for actions that take long time is not suggestible.using  state meachine is a good option. have the event structure in one of the cases in the state machine.perform the code before your 'start' is enabled in different cases. call the case with 'event strcuture' when you are sure 'start' is enabled. call the cases which you need to execute after the event structure.this might be easier! even producer-consumer is a good option.
 
 
 

How to stop/abort an event case once started without stopping the main while loop?

Post by JeffOverto » Tue, 24 Jun 2008 23:10:06


This won't eliminate his inability to perform any actions while his hour long process is happening.  If his event structure is in a user input state and calls an execution state, he's still locked within the same structure.  I think the producer consumer is the only feasible option here.
 
 
 

How to stop/abort an event case once started without stopping the main while loop?

Post by Jega » Thu, 26 Jun 2008 14:10:05

Thanks all, but will the master-slave loop apply in this scenario?
Jega
 
 
 

How to stop/abort an event case once started without stopping the main while loop?

Post by JeffOverto » Thu, 26 Jun 2008 20:40:05

master slave is another name for producer consumer.  the consumer loop does (basically) nothing while it waits for input from the producer, which is akin to the slave loop not being able to execute any code without direction from the master.
 
 
 

How to stop/abort an event case once started without stopping the main while loop?

Post by Jega » Fri, 27 Jun 2008 05:40:07

Thanks All.
Your advice/suggestions helped.
Jega