LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

stopping an event sequence

So I am running about 10 different machines, about half at a givie time. Everything seems to be working great but one of the processes i would like to be able stop. I am using an event sequence to trigger different processes, i would like to be able to stop one of my events if lets say a certain condition is not met. But once the event starts and runs its stacked sequence I can not stop it. Is there anyway around this?

0 Kudos
Message 1 of 28
(4,267 Views)

Generally speaking you have two options.

 

Code all of the frames in the Timed Sequence to check for a flag to control execution

 

OR

 

Re-code it as a state machine inside a Timed loop and struture the state machine to check for the work/no-work flag.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 2 of 28
(4,259 Views)

Now I am not using a Timed Loop or Time Sequence since the process i am running can take either and hour or four, so will this work an a stacked sequence

0 Kudos
Message 3 of 28
(4,252 Views)

@jastel wrote:

But once the event starts and runs its stacked sequence I can not stop it.


This is exactly why stacked sequences or even flat sequences is frowned upon.  You cannot stop it in the middle in case of errors or some other event.  Ben has given the best advice, convert to a state machine.  You can put error or event checking in each state to dictate what the next state will be.  Sort of like this:

 

If error

  NextState=exit

else

  NextState=NormalNextState

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 4 of 28
(4,245 Views)

@jastel wrote:

Now I am not using a Timed Loop or Time Sequence since the process i am running can take either and hour or four, so will this work an a stacked sequence


Yikes!

 

The same suggestion for the timed seq will apply to the stacked seq but the only difference between a stacked an un-stacked sequnce (aside from experienced LV developers knowing better than to use a stacked squence, Yeeesh!) is the flat version is easier to read.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 5 of 28
(4,237 Views)

This maybe a stupid question but how do you create a state machine

Message 6 of 28
(4,227 Views)

I would get away from the Stacked Sequence Structure.  It gets nasty when using them.

 

As the name suggests, it's a sequence, which means that unless you use case statements around your code, you won't be able to control your code based on changes in events.  As a matter of fact, unless done properly, you may not be able to control the code within a stacked sequence even if you do use case statements. I won't get into details.

0 Kudos
Message 7 of 28
(4,226 Views)

 


@jastel wrote:

This maybe a stupid question but how do you create a state machine


 

Glad you asked..  That is the right question..  😉

 

The easiest answer is to do a search on the topic.  I think I have a tag where it is well described (I'll look for it).

Message 8 of 28
(4,223 Views)

Attached is a simple state machine example.  It can be used as a start.

 

- tbob

Inventor of the WORM Global
Message 9 of 28
(4,216 Views)
Message 10 of 28
(4,213 Views)