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.

Tags: NI Software

Similar Questions

  • 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

  • Sequential execution of the structure of the event?

    Greetings,

    I'm at the very beginning of the development of applications. I have a list of 10 tests (we just call test 1 test 10). I would (ideally) for a user to have the option of selecting 1 or even 10 tests, any combination basically (listbox, it was what I thought). Now the kicker is, I want a structure of event related to this list box. And run each index table selected by the user. So if the user must select test 1, test 2 and test 6, I had received a table of 0, 1, and 5, respectively. The structure of the event should run sequentially as a result. Right now I plan each event at the outbreak would run a state machine for the test itself. So if test 1 was a simple test of current draw (just for example). The user would choose 1 Test that raises the corresponding event. The event inside a state machine would execute the necessary market, TAKE the MEASURE of CURRENT, STOP says finally.

    I've tried my hand at a cluster with Boolean values, but did not too far. Even though I know there is a solution somewhere within the cluster and the binder for Boolean types inside for the value change. But I need allow the user time to choose all the tests to run before launching the sequential execution of the structure of the event.

    I'm sorry if I missed something, I am still drinking my coffee Sunday I do not have a VI to post. I tried yesterday with no luck and the best test I had too many nested loops.

    Thanks in advance for any help in this matter. I feel I've hit a moment "DUH" in the development process. But I find it difficult to set up a structure of the event to run several events in the event generated by 1 user.

    -Chazzzmd


  • Using the Structure of the event in a Machine of State Enum

    Hello!

    I'm new to labview(~10 months). I tried my best to search on the forum/net but didn't have an explanation.
    I simplified the code to show the problem. I'm using Labview 2013 worm 13.0f2 (32 bit).

    The "EventStructure_Trigger_in_EnumStateMachine.vi" is a State Enum machine.
    The "resting" State contains a structure of event that detect evnet of changing value of 3 buttons:

    Do something touches: simply show something of the display flag
    Start Run button: bring the program into "run" State
    End key: put the program in the 'final' State and then close it

    The State of 'run' is a time loop that will be stopped only by clicking the 4th button - button stop running and bring back the program in case of 'lazy '.

    The problem is to "run" State, any click on irrelevent buttons 3 (buttons only detected by the structure of the event in case of 'lazy') will make the program crash.
    By comparison, I create an another vi attached as 'WhileLoop_in_EnumStateMachine.vi', which is almost the same except that the event structure is replaced by a while loop (and do something key has no function). In this vi, everything works well - by clicking the irrelevent buttons will not crash.

    I can't understand why.

    P.S. I failed to attach .vi onto this post... a zip compressed instead.

    A problem that resembles yours: http://forums.ni.com/t5/LabVIEW/why-does-simple-case-structure-code-hang/td-p/3176592

    I think that the response of Stuart will help you understand how your code handles this situation.

    You must manage your events outside your main loop to your structure to operate on any captured event.

  • How to control the structure of the event

    What I'm trying to do, it's when the condtion is true, I want that the structure of the event to excute. But the event structure wil excute not except if he's changed the puch model, any idea how?

    It is more likely that he wants the sequence of events that he has set up to run after the result once changes.  If you change the logic to check the values after each numeric change (2), you will need to learn how to check to make sure that the latest iteration was not true.  Otherwise, it will start the sequence over and over.

    Really, you have to escape completely the structure of the event.  This isn't what you want.  Your code lends itself to a great state machine.

    You'll want to ask you a few things:

    (1) I want my code to run continuously or I just want to check double-digit times? (your code is currently the second)

    (2) I want the user to be able to stop my code once the sequence begins? (it is usually a Yes)

    (3) what I want 6 Road, path 5 or the comparison to happen first?  I want all run at the same time?  Do I need one before the other? (currently, you cannot predict what will happen first).

    You will need to understand the topics are: State of the machines, the flow of data, structures, business, calendar, and race conditions.  Now, you need to get you into trouble.

  • Front panel locked, but not due to the structure of the event

    Hi it LV community.

    I did a staemachine program that executes an oscilloscope (screenshot of a provided below... the State of the problem). I ran my program yesterday and it worked very well. Then, like a model, a dialog box opens and I just clicked on it in a hurry. now my front hangs as soon as I move the above-mentioned State "the Oscilloscope settings.

    As indicated, I have go a repeat loop that collects successive impulses of my oscilloscope and displays on the front panel (it works fine). In parallel, I have a structure of the event that makes the tail for the real-time feedback of changes to parameters that I placed on the façade (exodus of state change).

    Here's the problem: as soon as I State 'Oscilloscope Settings' using a Boolean button on the front panel for get me there, the front hangs... No event triggered by this point, and even if it did, I already deselected the "Lock panel until the end of the matter for this event" checkbox in the case where the structure menu.

    So WHY is my front lock now? Thoughts anyone?

    Read the detailed help for event structures.

    He urged that a single event structure serve in a VI. There are moments where more can be used effectively, but caution and a thorough understanding of the structure are needed.

    The problem is that you have several structures of the event in the various cases of the state machine and they are set to respond to the same events.

    When the button Set Oscilloscope, the structures of the event in the purchase Menu and home screen States receive the event. The two lock the screen, but only one of these cases may work. It can transfer control to the State of the Oscilloscope settings, but the other event responding to this same event structure maintains the locked Panel.

    The solution is not not to release any of the event. The default value is usually the best setting. The best solution is to spend on an architecture of producer/consumer (events). Who uses two parallel loops. The producer has the one and the only structure of the event and passes orders to consumer loop through a queue.

    Probalby want as the mechanical action on the buttons to lock when you press. Put kiosks inside the respective case of event changed value and local variables becomes unnecessary.

    Lynn

  • How to use the structures of the event for long-running tasks

    I created a state machine that scans a cluster of Boolean controls in a State of 'home '. Most of the States run a Subvi or two in ~ 100 ms or less.

    However, a State run for 10 seconds.

    The code works but the user interface is limited because the controls are outside the cluster because they provide inputs to the structure of State machine case but do not cause changes in the State. In other words, I all orders cluster stacked vertically on one side of the main panel and do not have the flexibility to move the controls to the more intuitive positions on the Panel.

    My question: How can I convert this code in a structure of the event and keep this long term 'event' and prevent that the operator by clicking another button event during the execution of this event?

    Thank you

    You say you have controls outside of your main code... You should really put these inside and manipulate them in a State of your state machine is initialized. This allows you to make changes to the code easier and limits of line entering your outside loop.

    You can do different things to lock the user.

    You can disable specific controls so that they can't be clicked or edited.

    You can use the palette of the mouse to define the busy cursor and disabled again once finished, I do this a lot during treatment when my code something loads the user just clicked.

    One of my favorites is to set a Boolean value in your data that passes through you event titled structure "disable mouse." When the value is True, a mouse down event will effectively reject the event, clicking on disable. I also added an event mouse move where if the bool disable the mouse is set to True, it moves an indicator of string with the mouse by telling the user why it is disabled.

    If you want more specific suggestions, I suggest to post an excerpt of your code, or attach your screws, so that we can better help you.

  • How to manage the structure of the event with two loops

    I have a question about the structure of the user event with 2 buttons?

    key 1: START LOGGING DATA

    key 2: STOP LOGGING DATA

    How do I control my

    structure of the event so that it will work? because now that the loop is save data... I can't stop the loop, when I clicked on buttons.

    super_saiyans wrote:

    the problem with moving it is that I don't have control of the DATA RECORD STARTING?

    Of course, you do.  When you get your press conference button, you say your state machine to move to the State of logging.  You must also make sure that you return to visit the State to wait for the event to check out the events of the stop button.

  • Structure of the event in the event structure

    Is it possible that I can have a structure of the event, which is in another structure of the event? When I run the code, I can't use other buttons. (See chart for details)

    Do not put the event structures in the structures of the event! There is never any reason to do so.

    Redefine architecture your code in a correct state machine.

    (By default, events lock the façade until the event ends and if you raise the event internal or external, first of all, the other event can never fire because the current event can never accomplish or is inaccessible by data stream.)

  • Programmatically trigger a structure of the event with the value (signaling) is not responding

    Hey, in my attached program I check if the two steps of translation are in a specific position. If Yes, I want my code to execute a sequence of movements. If this isn't the case, I'm asking the user if he wants contributed from this position anyway. It has three options: Yes, go to load (the specific position) and cancel. If he hits Yes, I am using a property of signal value which should update the controls Boolean true, allowing the sequence. Cancellation and work "to load" perfectly fine, but 'Yes' does not work. I think I need a structure of the event to ahndle the value of the Boolean control 'x' change event, however, the addition of this structure of the event for some reason any even do not allow me to click on the Start button of the procedure.
    Thanks for any help in advance.
    Doug

    Really, you should look into using a State Machine.  You should have really not what happens inside a structure of the event.

    In addition, I would like to use a shift register to store this value instead of a front panel control.

  • Instead of using the structure of the event with the producer consumer?

    I used the architecture of producer-consumer in the past to control a state machine with the structures of the event.  I'm working now with the basic version of LV that does not include the structure of the event.  Can anyone recommend alternatives to the use of the same architecture in this case?  Thank you, David

    Before the introduction of the structure of the event, the only option was the election.  Control terminals are in a time loop (the producer) with shift registers and a wait, usually about 100ms.  At each iteration of the loop, the control's current value is compared to the previous value.  If it has changed, and then take appropriate action.  Andrey suggested, queues are a good way to pass information between the loops.

    It works for the equivalent of the value change events.  Things like mouse to top or filter events were much more difficult or not possible.

    Lynn

  • When to use the structures of the event

    I wrote several applications using the state machine architecture.  Generally, these applications have two buttons (I created), a race and give up.  The abort button interrupts the guide and goes to a State of inactivity which loops until the run button is selected.  One thing that I don't like, my programs ending up with one or more local variable for the Cancel button.

    (1) should I use structures event for these types of programs?

    (2) is a program of event also structure a state machine?

    Why would you need local varables for the button abandon? Do simply lock action so it resets automatically.

    If your loop by turning in any case (e.g. for updating views) migh ask both controls. Any necessary event structure.

    ggress1 wrote:

    (1) should I use structures event for these types of programs?

    (2) is a program of event also structure a state machine?

    The event structures are mainly for the manipulation of interaction of the user on the front panel. I encourage you to learn more about the structures of the event so you can make an informed choice on the best architecture of code for a particular programming problem. Maybe you should show us some of your code so that we can decide by using the event structures should improve things.

    A program with event structures is generally much less forgiving of the rookie mistakes. Used properly, they can easily lock your program.

  • Structure of the event - controlled motor not variable

    I have a state machine that includes certain structures of the event. These event structures are used to control stepper motors using an Arduino Mega microcontroller. I'm using labview in 2012.

    The entrance to one of the events is the variable "pour the entry. I want to use it to control the motor speed and direction.

    If I control the motor as shown in the attached image Working.jpg, then the motor functions correctly. If I fix the motor to the steps variable # then the engine moves at the speed set in the right direction depending on whether the entry "pour" is positive or negative.

    However, I want to control the speed of the engine, not the number of steps, with the variable "pay Input". I checked that the values read by the indicator image INPUT_VALUE works do not are of the same order as the specified values, working, by using the "Set Speed". When I connect the value of the entry to the spindle speed of the motors of the Arduino (not_working.jpg) icon, the engine is running, apparently indefinitely at maximum speed. I don't understand why there is a difference in motor behavior between the value provided by these two methods at the entrance to the speed of the motor. I am confused by the present and don't know where to go from here.

    The structure of the event somehow behaves differently when taking a value from outside the structure to this data inside? or y at - it something to do with the opening of the structure on its first loop?

    I have also attached my vi together, even though she may not be the easiest to follow and requires an arduino Mega to run.

    Carlr wrote:

    I have a state machine that includes certain structures of the event. These event structures are used to control stepper motors using an Arduino Mega microcontroller. I'm using labview in 2012.

    The entrance to one of the events is the variable "pour the entry. I want to use it to control the motor speed and direction.

    If I control the motor as shown in the attached image Working.jpg, then the motor functions correctly. If I fix the motor to the steps variable # then the engine moves at the speed set in the right direction depending on whether the entry "pour" is positive or negative.

    However, I want to control the speed of the engine, not the number of steps, with the variable "pay Input". I checked that the values read by the indicator image INPUT_VALUE works do not are of the same order as the specified values, working, by using the "Set Speed". When I connect the value of the entry to the spindle speed of the motors of the Arduino (not_working.jpg) icon, the engine is running, apparently indefinitely at maximum speed. I don't understand why there is a difference in motor behavior between the value provided by these two methods at the entrance to the speed of the motor. I am confused by the present and don't know where to go from here.

    The structure of the event somehow behaves differently when taking a value from outside the structure to this data inside? or y at - it something to do with the opening of the structure on its first loop?

    I have also attached my vi together, even though she may not be the easiest to follow and requires an arduino Mega to run.

    You have a very inappropriate design of "state machine" - even if you do not have same event in more than one of your structures of the event (in addition to time-out), looks that get some of your treatment to go forward until you get something very specific (and in which none of your other user events are being processed).

    I strongly suggest that first set you design of State machine - perhaps follow producer/consumer Design Pattern (events) rather than having everything in a loop, the way you have.  If you keep everything in a loop, you should consider redesign so that you at least allow events to deal with rather than stay in a loop for an indefinite period!

    In any case, in the case where work, you send variable "Set Speed (steps per second)" for engines step by step write vi.  But otherwise, you're feeding 'Entry for' value - are they the same? And to let you know, you send only command "write" step by step when the input value to be paid.

    It's a big mess!  For starters, look at the attached picture, get rid of your structure of the event that has "for the entry" and replace it with what I showed in the picture. (In fact, all your event structures can / must be replaced with a similar logic.) Does not need the event structure in all this, you're just more complicated it must be!

    -DP

  • structure of the event a substitute

    Hello everyone and sorry for what I think may be a very newbie question, but I can't understand not just how to use the structure of the event in my program.

    The presentation is as follows:

    I'm using labview for control devices in my lab.  I have to activate something for 30 minutes, then heat it for an another 30 miunutes (the first device is controlled DAQ and the second is controlled GPIB).  While these two processes occur, I monitor a temperature using the data acquisition card.  The two-step process is finished, I have to wait for the temperature to be lower at some point and then start again it.  So, I have to repeat this process for a number of times defined by the user.

    My question is this, I use a structure of the event to handle it all (this is maybe not the best way to do it, if you know a better way, feel free to share!).  The whole process of starting the program, I want to be able to stop it at any time in case something goes wrong, and I would do this by using a Boolean on the front panel, because I will finally control the process from a distance.  Is it possible to substitute a case of the event once it has started?  I have no doubt a 'Wait (ms)' VI in there somewhere to facilitate synchronization of processes, but once the VI begins the program waits until it is done before register you for any other button presses.

    Thanks in advance for any response,

    -daman

    You should definitely read up on State Machines!

    Maybe the link in my previous post doesn't work.  Try these.

    Reference design - http://zone.ni.com/devzone/cda/epd/p/id/6091

    State machines - http://zone.ni.com/devzone/cda/tut/p/id/3024

    ExpressionFlow Blog on policy - http://expressionflow.com/2007/10/01/labview-queued-state-machine-architecture/

    Machine States JKI - http://jkisoft.com/state-machine/

  • logical AND with the structure of the event

    Hello world

    The structure of the event can manage several events at once to do the same thing: looks like an OR logical operator. But I have not found a way to sequence events to approach a logic and example: you must click on a button to draw, then enter the image would change the mouse cursor. With a structure of the event, I can handle these 2 events separately or together (i.e. change the cursor), but I can't do a sequence of events.

    Is this possible to do with a structure of the event?

    I hope that I am clear (sorry for English btw). And thanks in advance.

    Christophe

    I don't think this is possible directly. You will need to add status information to your event loop that could enforce the order of events and the rules of logic you want. Where transformation you would have to check whether the required event has occurred before this event. If that were the case, perform your treatment. If this isn't the case, ignore the event. Your first event would need set this status information. You can also include some kind of time-out for the second event were to occur within a specific period.

    This type of logic may be better treated with the help of producer/consumer architecture and a state machine in the task of the consumer.

Maybe you are looking for