Closure of a state machine in queue event with several parallel loops

I am trying to find the best way to stop a program that consists of an architecture of State machine in line waiting for event with several parallel loops. Can anyone recommend the best way to achieve this in my attached VI? (To browse the forum, this seems to be a frequently asked question, but I have not found a solution that works for me.)

I look forward to any comments on my as well code, if someone is willing to offer it.

My program needs:

If the user press the 'Stop' button, the program should prompt the user with "are you sure you want to stop the program?" and then return to a State of rest or move forward to stop the program. In addition if there is an error, the program should prompt the user to ' clear the error and continue, or stop the program. Then back to the idle state or move forward to stop the program.

Architectural details:

The program consists of 3 parallel loops: (1) a loop of event management that places different States of a queue of the State, (2) a State Machine that enters the State that is removed from the queue of the State and (3) a loop error/Shutdown, which deals with errors in the error queue management.

During normal shutdown, where running handling loop in the case of event 'Program.Shutdown' and 'Shutdown' and the 'Idle' States are added to the queue of the State. In the state machine, the State of 'Stop' is invoked. Special "5000" error code is added to the queue of the error. In the loop of error handling and stopping, "5000" error triggered a prompt that asks the user if they want to stop the program. If the user chooses not to stop, a notifier StopNotif is sent to the State of 'Stop' and 'Program.Shutdown' event case with notification 'Go '. If the user decides to stop, the Notifier sends the notification "Stop". Loop and event management State Machine ends when they receive the notification "Stop".

In case of error, the program behaves in the same way: If the user chooses to clear the error and continue, the program returns to the status "pending".

HOWEVER - if the user chooses to stop the program, the program crashes. The author of the notification that is sent to stop the loop of events and State Machine management cannot be read because event Program.Shutdown and the stop State (which contain the function "Waiting to notify") are not active.

I was able to activate the stop State by Queuing in the loop of error/Shutdown management. But I don't know how to activate the "Program.Shutdown" event by program and thus access the function "Waiting to notify" inside.

I tried to put the function "Waiting to notify" outside the structure of the event, so the event-handling loop never ends. Placing timeouts on the "wait for declaring" and the structure of the event makes the programme of work, but I want to avoid using timeouts because I don't want to turn my event program into a program of polling stations. I would also avoid using variables or nodes property to stop loops, because that requires the creation of a control/indicator for something that the user does not need to interact with.

Thank you!

First of all, close the notifier outside loops with your queues.  Second, you must use a user event to send the message to the event structure loop so that it stop in the case of the stop on an error.

Tags: NI Software

Similar Questions

  • State machine in queue

    Hello

    I use a State Machine in queue which is controlled by a Structure of the event. In this example, the State Machine has 3 cases: inactive, State 1 and State 2.

    I need to trigger execution of State 2, in the Interior of the State 1.

    Thank you

    Dan07


  • Help with State Machine user Sequentail events

    I'm trying to create a program using the state machine which include events genreated user to jump between States. Also, I want the program to require a sequence of events to be genreted before entering in some States.

    For example:

    States: Init, idle, a-1, A-2, A-3, B - 1 and stop

    If a-1 State is selected, the user must enter the setting and select the condition A-2.
    The user cannot directly jump without having to access the mode a-1 to A - 2
    If the user selects the a-1 State, he should have the possibility of not input parameter and jump to another State as B-1 or Stop

    State A-3 can be entered automatically by State A-2.

    How to program the machine in order to do what I want? I've updated a sampling program. I'm not sure if I impleted the program properly. The user Panel hangs if I enter State a-1, and then press the Stop button. It does not allow me to leave the a-1 State and forces me to go to State A-2.

    A few other questions:

    -How to initialize all values of boleean to 0 during my Init State?

    -Why is a timeout value?

    Hey there, I developed example of Jacobson on a bit here to illustrate the case "Idle, how far to walk, ' your state machine diagram.

    Some keys on the front panel when you are in the bad condition will do nothing, as you can see, because I only check for buttons, I would like to respond to each State. For example, by pressing "Start on" the State of market won't do anything because this isn't a valid button, but pressing "Quit" will bring you to Idle. To implement the rest of the state machine, it is up to you!

  • Race conditions manifested in the state machine in queue

    Hello

    I ' am developing a vi in which I use a design of producer-consumer model.
    the producer s enqueue States for the consumer. but at a certain point in execution of I want to enqueue the next state of the statemachine consumer, within the State of the consumer himself. This causes a problem?
    in other words I have given queue in the loop of consumer can also. so the man the next state of consumers will depend on the data in queue

    Thank you

    I make extensive use of Handleres of Message queue where the "producer" and the consumer enqueue for the same queue.

    A "Firinstance" of work today: here are two screenshots of a part of the same code

    The top loop controls the State of a semi autonomous process where data is collected.

    1. an event is detected, triggering the start of the measuring cycle
    2. Data are being gathered
    3. Another event tells the top loop that it's time to stop collecting data and "Analize" is sent to the end opposite to the consumer
    4. The buffer empty analize, formats the data and continues to the State of "Log".

    The thing to remember is to use a priority queue.  Enqueue to place free and flush properly, in front of end control.  See also 'A trip to Grandma's House'.

    It is a very powerful technique for applications where you want abstract on the 'what' and 'When' the how and just leave a "do".

    And Yes, if I had chosen a unrestricted data (string, var) rather than an enum type and built the lower loop as a child class, you have a "player".

  • Tips to remember when using the state machine in queue

    I was able to work through the convert my architecture of State Machine for a BAU, thus eliminating the use of nodes of property/local variables to send data values to my machine of the State, but rather to send through queues.

    I would like some advice/tips on taking to serve perfectly. Especially, "is not to make" things with queues and how to effectively release a queue, etc.. What is the convention when using queues? Thank you!

    V


  • State machine in queue with the producer consumer

    Hello

    I am trying to build a VI where the user allows some Boolean controls on the front panel.
    VI uses a producer consumer in which based on Boolean values clicked architecture.
    some States are queued one recorded in a table.
    After the user is done by selecting, Boolean values should get disabled and the table of States
    should be indexed one after the other.
    It is an attempt to solve the review model car wash.
    However, the VI does not generate the required results.
    Can someone help me please understand what is the correct way to this implementation.

    Thank you

    Its because you have wired the consumer while loop the first stop. Remove and in your loop of consumer, make a comparison of the States that you receive and if it is equal to stop, stop the loop of the consumer.

  • State Machine with PID control

    Hi, I currently have a problem with my state machine, I control two cylinders double effect in sequence that works very well. However, there is one point I need to increase the pressure in the cylinder and to maintain this pressure through the sequence of State machine, however when the state machine transitions to the next indicate the PID controller resets, how can I solve this problem? Everything in is also allowed to apply the pressure in the cylinder another (same node IO accessed).

    Thank you I joined my project in a WinZip file, then it will have to be extracted. The two main VI to watch is 'Park Brake FPGA VI New' and 'park brake host VI update 2 "(new)

    Thank you.

    Nevermind I solved the problem with a parallel loop.

  • How to wire state machine

    I am trying to learn how over the state machine.  I created this simple vi.  The intention is to take the entry, and if it is less than 5, then the value squared.  If it is greater than 5, then the value should be cut into cubes.  However, I only get squared values.  What is missing here?  For a value greater than 5, I get the value "2" appears in the output area square... whence the 2?

    NIquist beat me to the punch.  I made this moification an got tied up before I could post it for you.

    Unfortunately for you, these examples show only two States that do not help House by car at the point of a state machine.  You can have several States to treat your data or move you your application.

    I have developed your VI a little to show a few things.  There are essentially 3 separate running in the loop state machines.  The bottom is a simple example where to put your code based on what you need to do.  Then you determine what state your data tells you to go to the next, and you may have several States here, not only two.

  • Need help with the events of user base in state machine example in queue

    I wrote a small example queue state machine to try to teach myself about the creation and use of the user events.  The purpose of the machine is periodically pick a number (I do now with a control instead of a generator of random numbers for troubleshooting), and compare this figure with the number I put in a control.  When they match, I want to raise an event to fire so I can do something about having found a match.  The examples in the file LV references help show events within the structure of the event, but I want to reach out of a State and trigger an event...

    Can someone point me in the right direction here?

    Thank you

    Hummer1

    I think the service you're looking for is generating the user event.  What to put in your consumer loop, inside the case structure when identical numbers.

  • event and state machine

    Hello

    I have a problem when I want to set up an event in my state machine.

    The state machine is reading communication series through different States 10 +.

    The problem came when I tried to add an event inside the State number 10. In the number of State 9 code seems to work only partially (an option button is not possible to change the value on).

    It seems almost that it is frozen but when I select the code I can see it works well (option button isn't).

    It is strange that when I remove the event in condition 10 all is well again? The event code is not yet performed yet because it is in the frame after!

    Any thoughts?

    I'm under LabView 2013 on a Windows 7 PC.

    I'm trying to figure out which of the two cases is the one who seems to hang if the name would be better than a number.

    When using am event structure you don't we want to use a local variable.  In fact, you should only use local variables on rare occasions that they break the flow of data.  The event structure is fine for the entry.  The problem is the way you treat things after that the button is pressed.  Again, I think you have to look at a design model of producer/consumer with a machine of the State in queue.

    The best way to have a writing occur only after a button must have the code for writing in a case that is active when the button is true and is simply empty, when it has the value false.

  • Structure of the event in a state machine

    Hi all

    I have a state machine with a sort of stand-by, where a user can select the next button state. I tried using a structure of the event with changing the values to select the next case, but when the state machine is in a specific case and the button of another State on the blocks of all things. I've attached an example, the lights simply stating that you are in the State.

    Thx for your time,

    Bert

    Edit: actually, I miss-clicked

    1. you have not need a while loop around the structure of your event.  With no wired time-out, you will never get a timeout event.

    2. your button events are set to 'Lock Front Panel until end of the event'.  Uncheck the box which.

  • Event structure/state machine

    Here's the scenario.

    I use the buttons controlled by the user in an event structure to control a state machine. Currently, I have a different State for each button. However, 4 or 5 of these buttons could ideally correspond to the State, which is what I would like to get... Each of these 4 or 5 buttons causes flow data and the results are stored in a table, but listened data are different for each button! Therefore, if each of those 4 or 5 buttons caused the same condition occur how I could decipher what button was pushed? Ideally, I would have 4 or 5 different paintings once all the buttons are out of the same State.

    Is there anyway that I can achieve this?

    Hi the shots.

    you have access to the refnum of the element inside the event. With the Ref, you can simply get the name or any other property of the control to distinguish them.

    Mike

  • Master/slave event Structure vs. State Machine

    Hello

    First some background to the question (skip this paragraph if you are simply interested in the question). I'm relatively new to Labview, after only a few months of coding with Labview and LabVIEW Core 1. Being one of the only people in the company who now knows Labview I have been challenged with the creation of a relatively complex application that will perform a selected ten or to view different tests with customizable options, display, analyze and deliver and automate reports.

    For the application I am writing I need a GUI with several screens (I achieve with tabs), initially I tried this code with the structures of the event within a machine to States (but as you probably know this was fundamentally flawed, that you can't put structures of the event within the structures of the case) (, or structures of the event), but from here, I spent several hours of searching the best alternatives.

    So my Question is: would recommend to use a master-slave (with the structure of the event and the State of computer, respectively), or simply use to continually voting machine status?

    (Keep in mind I'm going to use this as part of a larger facility of producer/consumer.)

    Thanks in advance,

    Joshua Walker.

    I use a case in my state machine specifically for checking to GUI events.  It is usually a "Idle" State or a specific State to 'check events.  I can also set the time-out programmatically by using a register shift, just in case I need to do a quick check (some small timeout) or wait for a user to press a button (timeout is - 1).

  • State Machine with queues

    Probably a stupid question, but if I'm not asking that I not just guess.

    I have a well-organized State Machine and I am in the final stage - data record. The saved data might be pretty long (a good 15-20 seconds) due to the latency on our LAN and I think that the best way to address this would be to use queues. I was wondering what things I need to look out for or is it as simple as pass the data to the consumer?

    I would need just two pieces (a field ID and its actual data - two string values) of data for each record that could be transmitted through a 2D array.

    Sounds like a normal of the producer/consumer for me.

  • State machine with the help of event

    Hello everyone,

    I have a question on how to achieve the "Timeout". In the diagram below, you can see 2 different situation:

    1. in the 1st case, I used the state machine, it starts in State 1, that contains a case of event. From there, it will first be determined, if the input value has changed in 10 seconds, if it didn't, the state machine will go to State 2, if it is changed, will also be determined, if the value equal to 3, if so, input the distributor of State will in State 3, if not, go back to the State 1. (this VI I've done it before, you can take a look at the attachment).

    2. my question is in the 2nd case. He also started the State 1. Here, the input value can also be changed (once or several times) or not. If the value has not changed within 10 s, or even if it's been changed many times within 10 seconds, but it was never equal to 3, the state machine will go to State 2. only when the value of the entry within 10 seconds equal to 3, he can jump to State 3.

    This problem, I do not know how to solve, everyone has no idea or improve methods?

    Thank you very much!!

    My bad, dint tested before posting (in addition to kills confidence)...!

    Let me know, if it works this time...!

Maybe you are looking for

  • Mail disappeared

    Hello everyone. I need your help because I tried to use all the means I have raised on the web and I have had no results. I used especially this: https://www.mozilla-hispano.org/documentacion/Recuperar_mensajes_borradosand others in English, too. The

  • Create Bootable Linux full Installation on a Flash drive

    Hi, I tried to install Ubuntu on my 16 GB flash drive, using a live 8 GB with Ubuntu flash drive and have been broadcast in a lot of trouble. I scoured internet for several days, but all the guides I can find are to a flashdrive bootable Windows or t

  • What is "Contacts in email?

    I read through the posts and other help information.  When it comes to email, it refers to "contacts in email.  I thought that the contacts were Contacts and accessible e-mail contacts as needed?  Send has a set of contacts which he controls?   Thank

  • Re: A few questions with the Satellite A350-12J

    My father-in-law's cell phone is the Satellite 350 and I think there 12j after his name. We re-installed Vista 32 bit the other day and he said that some things do not work as they should. First of all, if he presses the FN key, and say the s, the br

  • HP Pavilion P7 - 1207c - drivers

    Good afternoon I just purchased a P7 c - 1207 and managed to reinstall windows 7 and all my drivers. However, I have a driver under Device Manager I can't seem to find... "SM Bus controller". I am sure this is part of the Chipset drivers and I tried