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.

Tags: NI Software

Similar Questions

  • 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

  • Shift registers and state machines

    I am creating a VI that controls a power supply, a switching system and a nanovoltmeter so that I can measure the Seebeck of different materials. After reading through these forums, it seems that the overwhelming opinion was that the state machine is much better than the structures of the cell, which was what I was going to initially use. However, I have a problem. To control my sourcemeter, I the user to enter the number of steps (time machine increases the voltage), a final voltage and output voltage. Of these, I get the value of the increment. However, within my state machine that the first step is transferred to the structure of the case. I used probes to see how information is moving, and it seems that the voltage value is increment correctly but the real VI for the power supply receives the initial value. I'm just wondering how to pass the updated values in the structure dealing with each iteration.

    I've included the vi. It is far from over because I'm sure you will see, but my current problem in the case of 'change v '. That said, if anything jumps out and you feel the immediate needs, feel free to say it, I learn and I accept all the entries.

    I recommend that you run your VI highlight execution lit.  This will help you understand what's happening better.

    Just to remind, only 1 case in structure can work iteratively.  If you have a TRUE/FALSE in the middle of a VI case structure you plan to run both cases?  Of course not.  Same thing here.

    So keep your current tension in a shift register and increment only when you are in the case of set.  Stop your state machine when your voltage exceeded the stop voltage (have a just State to check this box to make things easier).

  • active enum entries, enums disabled in control and state machine accessibility

    Background:

    I have an enum of entry that can be anything.

    In the vi, some enum States are 'disabled '.

    The enum led a state machine that defines the output.

    Question:

    If an entry corresponds to a "off State" it will create an exit?

    A 'disabled' in an enumeration element applies only to the dropdown list control allows you to manually select an option.  The program itself does not pay attention to State on or off selection passed around the nodes or son.

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

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

  • 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, controls, and indicators

    Hey everybody,

    I'm working on the conversion of a VI to use a state machine architecture. In other words, there are several buttons that trigger States through a structure of the event in the standby mode. Two States need write values in the same set of indicators, but the rest should be left alone. Several States also contain a Subvi, which takes a cluster entry. The cluster is composed of about 10 digital/boolean controls. I wonder what is the best way to deal with these two problems. I could use local variables or references, but that seems to be discouraged for most cases. I do not have access to the VI himself at the present time, but it might send more later if necessary.

    You could go with the local population, in this case it should be ok, or have an update-state indicator.

    I have probably to take the easy road and go with local to a simple state machine.

    /Y

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

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

  • How to use a structure of the event with a state machine


    I don't know exactly what you're asking, but it sounds as if you want a bunch of script tests and if the user says stop, to immediately stop the current test and abandon others?  I'll assume you know how to clear the table so that it will not abandon the others, so I guess that you have wrong to abandon the current test?  If it is indeed the case, the problem is that you are not able to spread the message of the VI FP main which is the GUI for the sub vi which is the test where the test may or not have a GUI (FP visible) of its own.  Threading is the first thing to come to mind, but it will be may not need the use of events.

    You can do this by passing a refnum of the stop button to the Subvi, where you can then add to wait to the structure of business event.

    I have attached 2 screws, mainvi.vi which is just a loop displays the number * 2 (number of seconds since the race) to be called subvi.vi and then check to see if the button is pressed.  mainvi.VI is in no way a state engine, it's just a simple loop for demonstration purposes.  subvi.VI just waits 2 seconds and leaves, this is a better engine State structured with an init State to start a case of survey to wait events and an exit status to clean.  You can change everything as you wish so that he can do what you want.  You will notice that even if subvi.vi is running, it will automatically end when you press the stop button.

    I hope this helps.

    A

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

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

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


Maybe you are looking for

  • Equium M50 - doesn't recognize any USB device

    All my USB devices (printer/external disk hard/usb keyboard, mouse, usb-serial adapter / any...) are not recognized by Windows Xp SP2, but USB port will provide power to the device. Everything worked fine before that I don't know what is happening. I

  • I could not connect my iphone 4 for Apple TV. If the sound comes out but not images.

    Hello I have an iphone 4 model MD128E/A 7.1.2 IOS Software IAM a teacher at the University. I have a connection perfect with the ipad but not iphone 4 I could not connect my iphone 4 for Apple TV. If the sound comes out but not images. Can I use the

  • Scanner and Camera Wizard no longer works

    The automatic transfer to "Scanner and Camera Wizard" function has stopped working on one of my two digital cameras.

  • What should I do if I receive-no not found any device compatible direct3d?

    I'm trying to play a hidden object game. When I start the game, I get the message "Could not find device compatible direct3d" I have a Toshiba 1905-S303 with xp. How can I solve this please? Thank you

  • Help with loading photo

    Im trying to download pictures from my camera and it will not let me open the file. Whenever I have try opening the pictures he sends me to Internet Explorer, saying that its to protect my safety. How can I fix to be able to look at my pictures?