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


Tags: NI Software

Similar Questions

  • 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.

  • 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.

  • 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


  • 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".

  • 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.

  • 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.

  • queue and notifying with state machine

    I'm trying to implement a declarant and a queue to collect data that is running on a state machine in two separate loops.  I'm new to the whole and methods notifier queue and I think I'm really close to make it work as I want.  When I start the computer the first time that State everything works and it is what I expected.  When I try to restart the test and do it again she acts like the queue has been cleared and it will not connect anything to the queue.  I use the queue as a buffer for the data collected between iterations of the loop of State machine.  I empty the queue and add all the data in a table.  The declarer seems to work in all situations as I want.  I have attached a simplified version of what I'm trying to do.  Any ideas? Thank you.

    After the execution of your code (I had to make my own custom control to the States because you include not yours) and some survey values, here's the conclusion that I came to:

    It is not your queue.

    It's your math.

    In your upper loop, put sensors on the values you use to trigger the 'True' case (specifically, put a probe on the values to enter your service "superior or equal to") and then watch their values that you run your code.  The value that is coming through the shift register is your problem.  He isn't getting back to zero when you restart the test.  The first time you run your program, the value is zero.  For subsequent iterations, it's everything the last calculated deflection was.  Run your button 'force' down to zero once your test is over and look at what this value.

    Thus, when you restart your test without having to restart your program, you start with a nonzero value for calculated arrow.  Is to prevent your delta never exceed 0.001 in., and therefore your 'Real' case never executes.  So nothing ever shows in your queue.  You do not put anything in your queue.

    The reason why you go to your "complete" State in the lower loop when you hit 0.3 in flexion is because the current value of the 'deviation' is passed through your Notifier and is not dependent on the previous value of the way your queue is.  So you can always hit deflection 0.3 in., without calculated being greater than 0.001 in. delta.

    Try to reset this registry offset value in your greater than zero loop every time that you restart the test, and your program will probably work.

    And Ravens Fan has a point about the complexity.  It usually does.

  • State machine with acquisition different modes/loops

    Hi all

    I did a machine design to State (as described here) to organize three (mutually exclusive) process / States: idle, measurement of calibration and continuous measurement. Calibration must be performed before measurement, because the result of the calibration is used for measurement. The data entry is a camera that should run continuously, also in rest mode.

    The problem however is that this state of calibration and continuous measurement (should) have another method of data acquisition. The measure is continuous and the images are processed in real time. To calibrate a number N of images should be accumulated and treated (simply create a background image).

    In the state machine as I have now (see attached image), I have the acquisition of vision outside the state machine in order to have a live view at any time. The problem now is that the inner loop in the State of calibration (the loop that must accumulate the framework) accumulates of course that the first framework N times, it is not question for all new managers during this State.

    Of course, I could fix this with an if/else statement in the first calibration mode accumulate images (if I< n,="" accumulate="" frame="" in="" buffer="" and="" continue),="" but="" i="" am="" not="" convinced="" that="" having="" a="" lot="" of nested="" loops="" is="" the most="" elegant="" way="" to="" do="">

    This also got me thinking, is the state machine, as I built it here all the best way to manage these two processes/acquisition modes? Or are there better ways to do this?

    Contributions and comments are very much appreciated!

    Note: I know that loop as scheduled now in State calibration is wrong with shift registers. It was a test before I realized that the fault was in the interweaving of the state machine altogether.

    Please do not attach pictures, but rather post executable code, screws (easier) or as extracts from LabVIEW (which became the screw when you drag in a block diagram).  If you have more than three attachments, compress the folder and attach the ZIP file.

    I was once describing a system similar to yours, and one of my students, who was a computer science major, said "it's not a State Machine."  I had a similar situation to yours, where I had a procurement process which took time and a 'Stateful' routine that does different things with data (in your case, use it for calibration, waiting to 'Go', absorbent, etc.).

    I understood that it was correct.  I ' D 'opposite' model, with the Acquisition, always running and "driving", the calendar and make 'Appropriate Action' on each set of data, where the Action could (and did) vary according to other conditions.  So I renamed my state machine 'Action engine', and everyone was happy.

    So I won't bother looking at your code (a quick glance showed me that I have only would be frustrated by the limited view), but will give you a suggestion for an alternative architecture.

    You want to (ideally) two parallel loops.  A single loop simply acquires the data (images) at some rate.  For each Image, it signals the loop else it's time to 'Action' on the acquired data (to do this, use a queue or the notifier).  You want that engine of the Action to perform independently the Acquisition loop, just in case a particular Action takes, say, 1.2 times sample to complete - you don't want 'Miss' samples!.

    The loop of the engine of the Action is a unique, appropriate Action at the time, on the newly acquired data.  If you are in the 'State' calibration, the Action will be "add to the calibration.  When you have accumulated enough data to do calibration, set the following Action to (for example) 'wait to start the Signal.  When you receive the Signal to begin, take Action to "acquire, process and save data.  And so on.

    As it happens, I did my code exactly in this way, but it was the idea General - Acquisition was the 'King', he ran the clock and led the ' Machine/Action State engine' to 'do the right thing, appropriate to the time' with the data.  See if this type of model is appropriate in your situation.

    Bob Schor

  • How to transmit DATA between several state machines.

    Hi I'm doing a project that needs to acquire data from a simulated data file and display it on a graphical interface. Two of them are manufactured in a state machine. I wonder if it is a good way of communication of data between two state machines? It would be very appreciated if you can provide a few examples. Thank you very much.

    OK, there are plenty of ways to communicate, but who are these state machines in the same project? Same VI? All LabVIEW?

    I like functional global variables due to the functionality that can be included in the. If they are used wrongly, as most of the things with the coding, you will create the races and break your code.

    Work of local variable, but I try to clear them tsar when possible. If they are used wrongly, as most of the things with the coding, you will create the races and break your code.

    Queues are pretty popular to connect, but try to stay with fixed size data, if you think that the limits of memory could be a problem.

    If you speak through the eyes of network to published static Variables (do not use these unless you have a stable network) network, TCP/IP, UDP, or Web Services flow (you need experience in this field. It is not just together.

    LabVIEW is a good way to program, but this kind of key options.

  • State machines are well... Thanks to you all

    Thank you!!!

    For several months I struggled to learn how to use LabView, at all... much less efficiently.  With the help of the forum I was finally able to combine a display for our Lab Manager.  It was slow and unresponsive no and completely event-driven and completely unmanageable.  With the help of several key members of the forum (and I'm sure that the wishes of the rest) I learned about the State machines, queues and other good habits.

    Within 2 days, I rewrote the project as a state machine and it works beautifully.  It uses a typedef enum for the definitions of the State and a sub.vi for the variable initialization.  The BD is readable, simple, and can be seen on a single screen (almost... have to scroll down a bit to see all error.)

    I can't thank you all enough.

    Hummer 1


  • 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.

  • Engine using a state machine control logic

    Hello

    I'm trying to implement motor control using the logic of the state machine. My requirement is simple. I have a voltage from data acquisition value that corresponds to the couple (initial value = 5). I need my feeding motor a positive (right-hand rotation) and negative (counterclockwise rotation) speed depending on whether the value of this tension is between the top (7 V) and the lower thresholds (3 V).

    In other words, the motor starts to turn in a clockwise direction at the outset; the voltage is declining, as soon as we get to <= 3="" v,="" it="" changes="" direction="" and="" moves="" counterclockwise="" till="" it="" hits="">= 7 V, then changes direction again and this repeatedly for, say user-defined number of cycles. I tried to write this logic, and when I run the program it starts well, is to see the first time, entry happens under a low threshold, changes direction but oscillates at the same position. He won't until > = 7 V.

    I enclose the code for your reference. Logical machine state in queue can be of any help? Also, can I present a State in which after that user-defined cycles are more the engine back to a position where the voltage is 5 V.

    Thank you very much.

    Ravens fan is OK.  You need to know which direction you are moving before deciding what to do comparison.  Look at this simple diagram that shows how to use a shift register to keep track of which direct that you use.

  • How to start and stop the video capture in a state machine

    Hello

    I am a student of neuroscience and this is what I try to do: 1) trigger a camera to GigE (200 FPS), 2) start the video capture, 3) triggers a light that stays on for x milliseconds, 4) trigger a valve that will blow an air puff, 5) stop the tone and the valve at the same time and 5) stop the video capture 1 second after 4). For this, my VI is a state machine, with a State for each trigger (ex, 1 State for trigger camera 1 State of light of trigger, ect) and a statement to "stop" and a "time-out State." Everything worked except the video acquisition - the program could trigger the camera but only acquire a frame, because it was not running in a while loop and this is my first question: for an acquisition video is it always necessary to have a while loop?
    I guess the answer is Yes, so I built a loop of 'consumer' for the camera. A queue of the pre-trial 'trigger camera' in the loop of producer, I was then able to start the video capture, but now the problem is to stop it at the right time. I have an another queue in the State of 'stop' in the loop of the producer, but is not able to start the State 'stop' in the loop of consumer, I think that maybe it's because the loop of consumer gets "stuck" in the whole loop.

    I hope you can help me, the VI is attached. Thank you!

    Hello

    First of all, in your loop producer: STATE 'Stop', you use the flushing line, then there is no need to use 'item queue at the opposite end. You can use the enqueue function.

    Secondly, you said "I moved the command stop inside the while loop as you said, but it did not work. But if you look closely, you moved "Enqueue function" inside the while loop. Instead you should use Dequeue function. Please, look at the picture I posted an orderly manner.

    And remove the circled (i.e. function. Enqueue function loop of consumption, where I wrote 'Why stop here').

    Try now.

  • How can I control a .vi another State machine?

    I've written a VI which is an event focused on the state machine.  Events are operator actions that take place on closing buttons on the front panel.  Each event features one or more state names on the queue of the State.  A state machine then takes the name of the State off of the queue of the State and use them to open the case, containing the functions to be performed... Now comes the desire to interact with this vi programmatically to an another vi.  Given that events cannot be triggered remotely because the keys are of type lock and cannot be manipulated by the property node (value (signal))... Is it possible to add a name from State to State in Quebec to distance... ?  It would be nice.

    I prefer not to add the buttons 'hidden' for the original vi, or perhaps to change the structure of the event.

    Is there a better way...?

    Hummer1

    You use 'Get in line' with the same name in the other VI or using a functional Global Variable to pass the reference of queues for the other VI.

    Then you write the State via 'Element of the queue' names as you would in the VI containing the state machine.

Maybe you are looking for

  • Satellite P10 power problems

    My P10 is just over a year and has developed feeding problems. It does not seem to register on drums (Iget the a/c light green, orange for the battery) and it won't let me turn it on. Leave it plugged to charge doesn't seem to help. It is intermitten

  • nidevmon.exe error 0xc0000142 / niusb6009 multifunction i/o

    Our Labview application collects analog data using an e/s of the Multifuncion niusb6009. The application is proven and has been in production for years. Today, the application has stopped to receive analog data. After the termination of the applicati

  • Master/slave with events

    Hi, I'm developing an application in which the user actions will initiate certain events.  I've implemented the application as an event-driven state machine.  However, I realized that one of the events must launch a continuous process, i.e. reading f

  • Participating Lync could not connect. Please check your login credentials and try again

    With the help of OC 2007 R2 Version 3.5.6907.225, but I invited Lync users meeting. So I downloaded Lync 2010 Attendee on a per user level. But is a mistake when joining by using the credentials of company, here is the error message: Participating Ly

  • Compatibility view settings

    When I add a site to the list of display compatibility and output, it does not record. I go back and is no longer on the list. I have problems playing games on Pogo.com and the only way I can play is to use compatibility view, but after that I added