Event structure triggered by multiple events

I have an events structure where one case needs to handle a button
press from any of three controls from the front panel.  When i
press any of the three buttons, the program is going into the correct
event case.  However, once i am in the correct case, i need to
know which button was pressed so that i can perform slightly different
tasks?  Any ideas?
Kind Regards,
Bryan

There are many possibilities. Attached is one simple example (LabVIEW 7.0) that does not use control references.
(If only one of the buttons can be active at any time. you could also use a single radio button as a control)
LabVIEW Champion . Do more with less code and in less time .
Attachments:
ComboEvent.vi ‏35 KB

Similar Messages

  • Can I have multiple event structures with the same event cases?

    Hello, 
    I'm doing an application that reproduces the front panel of the HP6675A power supply. To achieve this, I have done a state machine with different states
    (initialize, measures, voltage, current, ocp, ov, store, recall, etc). In each state, should have an event structure that catches the events of the buttons, like for example: if the current state is the Voltage mode and the user press the current button the next state will be the Current mode. For this in each state of the state machine should be the same event structure with the same events.
    My problem is that the Vi doesn't work properly when I have multiple event structures with the same event cases. There are some possibily to do this, and how? Or is impossible to have multiple events? I have been reading some posts, but I don't find solutions. 
    Any help is appreciated.
    Thank you very much.
    Solved!
    Go to Solution.

    natasftw wrote:
    Or as others mentioned, make two parallel loops.  In one loop, have your state machine.  In the other, have just the Event Handler.  Pass the events from the handler to the state machine by way of queues.
    A proper state machine will not need the second loop.  The "Wait For Event" or "Idle" state (whatever you want to call it) is all you really need in order to catch the user button presses.  The setup is almost there.  Maybe add a shift register to keep track of which state to go to in the case of a timeout on the Event Structure.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Event triggered by multiple events

    Hello!
    I am working on interactive code in Adobe Edge. I created several function triggered by specific events. Now I need to write the final function. The symbol should play when several draggable elements are inserted into several drop boxes at the same time. Please, give me an example of how to write this function.
    Here is the code:
    yepnope(
        nope:[
            'js/jquery-ui-1.9.2.custom.min.js',
            'js/jquery.ui.touch-punch.min.js',
            'css/jquery-ui-1.9.2.custom.min.css'
        complete: init
    function init() {
              var stage = sym.$("Stage");
              // draggable
              var Rectangle1 = sym.$("Rectangle1");
              Rectangle1.css("position", "absolute");
              Rectangle1.css("left", 50);
              Rectangle1.css("top", 35);
              Rectangle1.draggable({ disabled: false });
              Rectangle1.draggable({ containment: stage });
              Rectangle1.draggable({
       snap: '.target1',
       snapMode: 'corner'
              // drop in box
              var dropCase1 = sym.$("dropCase1");
              dropCase1.css("position", "absolute");
              dropCase1.css("left", 375);
              dropCase1.css("top", 25);
              dropCase1.on( "dropout", function( event, ui ) {
                        Rectangle1.css("background-color", "grey");
              dropCase1.droppable({
                        accept: ".case1",
                        drop: function(event, ui) {
                                  // change the color of the draggable item
                                  Rectangle1.css("background-color", "blue");
                                  //play the symbol box timeline
                                  var box = sym.getSymbol("box");
                                  box.play();
              // adds visual when correct drops here
              var Rectangle2 = sym.$("Rectangle2");
              Rectangle2.css("position", "absolute");
              Rectangle2.css("left", 50);
              Rectangle2.css("top", 150);
              Rectangle2.draggable({ disabled: false });
              Rectangle2.draggable({ containment: stage });
              Rectangle2.draggable({
       snap: '.target2',
       snapMode: 'corner'
                        // drop in box
              var dropCase2 = sym.$("dropCase2");
              dropCase2.css("left", 375);
              dropCase2.css("top", 150);
              dropCase2.droppable({
                        // accept only case 2
                        accept: ".case2",
                        drop: function() {
                                  var box = sym.getSymbol("box");
                                  box.play();
    Thank you very much!
                                                                               Anastasiya

    There are many possibilities. Attached is one simple example (LabVIEW 7.0) that does not use control references.
    (If only one of the buttons can be active at any time. you could also use a single radio button as a control)
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    ComboEvent.vi ‏35 KB

  • Subtype event not triggering and supertype event triggers twice!!!!!!

    Hi,
    We have created a subtype for object bus2030 and also an event created for that. My workflow should trigger whenever an inquiry is created.
    I've maintained this as triggering event in SWDD and done type linkage is SWE2 and everything looks fine.
    When i simulate or create event the WF is triggered but when create inquiry in VA11 WF does not triggers.
    I've checked SWEL for event trace but no event is triggered at all... Am i missing something... I've done almost everything that i used to do...
    Even synchronized buffer!!! nothing paid me a solution...
    Infact the same was working with 3.1i system but after migration to ECC6 we had to create new WF template for the same Process.
    Now I also see that the supertype bus2030-created event is triggered twice but, obviously no receiver type exists. But the zbus2030 event is not being triggered at all!!!!
    Kindly help me understanding my mistake...
    Regards,
    PB

    Hope you have already set the deletegation in SWO6.
    Now, event dont get triggered automatically, jus because they are defined in object. They have to be explicitly published in thesystem.
    Check for a suitable user exit in your transaction, which makes use of function module to create the event, from that you know how to proceed.
    If you dont find user exit, try other triggering techniques such as change documents, logistics, BTEs... etc.
    regards,
    Sandeep Josyula

  • Can I get the event structure to NOT queue events?

    I was wondering if it is possible to have the event structure not queue events that happen while the vi is executing code associated with another event. Basically, I have a toggle switch that, when "on", captures a live feed from a camera and displays it to the screen. This is done in a while loop that executes until the toggle switch is turned off. At this point, that event is done and the vi returns to the uppermost level of the event structure and resumes looking for events. The trouble is that the whole while the video capture was happening, the event structure was queueing events that were occuring during that time when the user was hitting other front panel buttons that had their own event associated with th
    em and would not execute at that time. When the video capture toggle is turned off the event structure then executes any other events that were queued during that time and I don't want it to. I can't lock the front panel while the video capture is happening so the user can't push buttons because they have to be able to push the button to turn the video capture off. Any suggestions? Thanks in advance.

    > I was wondering if it is possible to have the event structure not
    > queue events that happen while the vi is executing code associated
    > with another event. Basically, I have a toggle switch that, when
    > "on", captures a live feed from a camera and displays it to the
    > screen.
    I think there are lots of other articles about this on devzone.
    To summarize them, the key is that the event structure intentionally
    synchronizes events with diagram execution. The typical way to do what
    you want is to have the event start up another loop or subVI running
    asynchronously.
    Usually there ends up being one loop with an event structure in it.
    Another loop that executes a statemachine, possibly as simple as just
    two states of acquiring and not. Use the events to pr
    od the other loop
    between states via locals, globals, occurrences, etc.
    Greg McKaskle

  • Event structure react to programmatic events in Labview 7

    I originaly thought, that Labview 7 would have the option to have the event structure react to programmatic changes. That's what I thought "dynamic" support would do. Instead, it doesn't seem to be the case. Is there a way to make an even structure react to a "programmatic event" in Labview 7?

    You can do what you want, although your terminology is a little off. You can use the User-Defined Events which are new to LabVIEW 7.0 to create and generate programmatic events. There is a shipping example calling "Programmatically Fire Events." This is an example of User-Defined Evenst.
    When you say "dynamic" events, you are probably referring to "dynamically registered" events. This is different. This means that you can register and unregister an event programmatically. Now, this can either be User-Defined events or just the user interface events which are available by default. The LabVIEW Zone currently has an article up by the developer who built these feature
    s so I would suggest taking a look at that. It should help get you started on this. They're certainly a very powerful new tool, but also very advanced.
    J.R. Allen

  • Come usare Event structure avendo come source event un indicator

    Devo creare un Event, e per controllarlo devo usare una variabile globale. Avete qualche soluzione?
    Grazie

    Carlo,
    puoi guardare negli esempi di LabVIEW (7.x o superiore) dove trovi l'esempio "Programatically Fire Events.vi" che mostra come registrare uno user event e come farlo "sparare" programmaticamente.
    In allegato ti riporto il codice LV8 di un esempio che ho fatto che mostra come generare un evento (popup message) al variare di una variabile globale. L'evento viene generato solo quando la variazione e' maggiore di 10 in modulo.
    Saluti,
    AlessioD
    Allegati:
    VariableEvent.zip ‏15 KB

  • Logic AND with event structure

    hi everyone,
    The event structure can handle multiple events at a time to do the same thing : looks like a logical OR. But I haven't found a way to sequence events to approach a logic AND. Example: first click on a Draw button and then enter the image would make the mouse cursor change. With an event structure, I can handle these 2 events separetely or together (either one would change the cursor), but i cannot make a sequence of events.
    Is this possible to do that with an event structure?
    I hope I am clear (sorry for the english btw). And thanks in advance.
    Christophe
    Solved!
    Go to Solution.

    Mark Yedinak wrote:
     In the event processing you would have to check if the required event occurred before this event. If it did, do your processing. If not ignore the event.
    That's exactly what I am trying to do! I am already working with a producer/consumer architecture and with a state machine in the consumer loop. I tried to add state info as you suggested in the event loop. But i do not know if i am doing this well. I attach a very small example where I try to demonstrate what I am trying to do with 2 booleans to be pressed in order.
    Tell me what you think of the state info in the event loop.
    @Mike : same solution as Mark if I use a shift register and a case structure inside the event loop?
    Message Edited by superfunk on 03-03-2010 10:24 AM
    Attachments:
    event_test.vi ‏27 KB

  • Multiple event structures in one VI

    I have two event structures in a single VI, one that handles events that freeze the user interface and one for events that don't. The latter group are all triggered acquisition tasks, where you arm the  data acquisition, but possibly might want to abort it (or do other things, while waiting for the data to come. Obviously you need a stop button to be active and responsive. In retrospect, using two loops was possibly a poor choice, but one I made because it never occured to me that these things would only fire once and have to be put in a while loop to be kept active. No other language does that as far as I know. Anyway, the question is how do I keep both active? Do I enclose both in a single while loop? Do I give each there own while loop. Do I give up and merge the two event structures into one. For clarity I would like to keep them seperate, but that is not essential. I'ld like to know what my options are.
    Solved!
    Go to Solution.

    rossu wrote:
    If they are in sperate while loops will they both run. If they are in one loop will the loop recycle if one structue is still waiting for an event to occur?
    The answer to this is fundamental to how LabVIEW works. A loop will not proceed to the next cycle until everything inside it completes. If you have two event structures in the same loop, both of them need to process an event (or a timeout) before the loop will iterate.
    You can have multiple event structures in the same VI.
    By "freeze the UI," do you mean the "Lock front panel..." checkbox in the event dialog? There is no problem with having some events that do lock the front panel and some that do not in the same event structure. I'm not sure that this is what you mean by "freezing" the UI, though.
    EDIT: and one more comment. Generally you should not put long-running tasks (like data acquisition) inside an event structure. Instead, the event case should pass those tasks off to a separate loop (for example using a queue) so that the event structure can quickly go back to listening for other events.

  • Shutting down a queued event state machine with multiple parallel loops

    I am trying to find the best way to shutdown a program that consists of a queued event state machine architecture with multiple parallel loops. Can anyone recommend the best way to accomplish this in my attached VI? (From browsing the forum, this seems to be a common question but I haven't found a solution that works for me.)
    I welcome any other feedback on my code as well, if anyone is willing to offer it.
    My Program Requirements:
    If the user presses the "Shutdown" button, the program should prompt the user with "Are you sure you want to stop the program?" and then either return to the Idle state or proceed to stop the program. Additionally if there is an error, the program should prompt the user with "Clear error and continue, or Stop program?" Then either return to the Idle State or proceed to stop the program.
    Details of architecture:
    The program consists of 3 parallel loops: (1) an Event Handling loop that enqueues various States to a State Queue, (2) a State Machine which enters the latest state that is dequeued from the State Queue, and (3) an Error/Shutdown handling loop which processes any errors in the Error queue.
    During normal Shutdown, in the Event Handling loop the "Program.Shutdown" event case executes, and the States "Shutdown" and "Idle" are added to the State Queue. In the State Machine, the "Shutdown" state is invoked. A special error code "5000" is added to the Error Queue. In the Error/Shutdown handling loop, the "5000" error triggers 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 "Shutdown" state and "Program.Shutdown" event case with the notification "Go". If the user chooses to stop, the notifier sends the notification "Stop". The Event handling loop and State Machine are terminated if they receive the notification "Stop".
    In case of error, the program behaves similarly: if the user chooses to clear the error and continue, the program returns to the "Idle" state.
    HOWEVER - if the user chooses to stop the program, the program stalls. The notifier that is sent to stop the Event Handling Loop and State Machine cannot be read because the Program.Shutdown event case and the Shutdown state (which contain the "Wait for Notifier" function) are not active.
    I have been able to activate the Shutdown state by enqueuing it in the Error/Shutdown handling loop. But I don't know how to activate the "Program.Shutdown" event programmatically, and thereby access the "Wait for Notifier" function inside it.
    I tried to place the "Wait for Notifier" function outside the event structure, but then the Event Handling loop never completes. Placing timeouts on the "Wait for Notifier" and on the Event structure makes the program work, but I want to avoid using timeouts because I don't want to turn my event-driven program into a polling-based program. I'd also like to avoid using variables or property nodes to stop the loops, because that requires creating a control/indicator for something that the user doesnt need to interact with.
    Thank you!
    Solved!
    Go to Solution.
    Attachments:
    Queued event state machine parallel loops empty.vi ‏46 KB

    Thanks for clarifying that, Ravens Fan.
    I marked crossrulz as the solution for pointing out User Events to me.
    I also adopted Ravens Fan's suggestion to keep the Shutdown procedure out of the Error Handling Loop. This has simplified the architecture by eliminating the need for Notifiers. Instead, I have used booleans in case structures to stop the Event Loop and State Machine, and Release Queue to stop the Error Handling Loop.
    For reference, I'm attaching my corrected code.
    Thank you to everyone who helped!
    Attachments:
    Queued event state machine parallel loops empty in progress.vi ‏44 KB

  • Event not triggering

    Ok, so the basic premise is as follows:
    I have a control panel with fifteen or so boolean controls.  All of them operate properly, except one.
    They all trigger the same event, which uses the event source data to determine which boolean triggers and what to do in some case structures.
    All the code operates as it should, except for this one odd control that operates properly the first time it is set to True (default is False).  After toggling this boolean to True, neither it nor any of the other booleans will trigger their events.  They will toggle, the event will take almost a full second to trigger, nothing inside the event structure will occur (the Event Data still appears properly, though), and they will toggle back to the state they were in when the problem boolean went True.
    However, I have my sensors update the screen on the timeout, so I know the events are all occurring, just none of the code is executing.
    Any ideas?
    edit - oops, forgot to attach. 
    Message Edited by JeffOverton on 02-08-2008 02:26 PM
    =============
    XP SP2, LV 8.2
    CLAD
    Attachments:
    attach.zip ‏164 KB

    Pnt wrote:
    You should post a simlified version of your problem.
    Many vis are mising...
    The simplified version is that a boolean triggers an event, and thereafter that specific event won't execute.  The trouble is that all the booleans execute under the same event case.
    MikeS81 wrote:
    Hi Jeff,
    can you upload the missing vi´s?
    Some points for you:
    control references don´t need to be closed
    in the timeout case, you use the control reference of your cluster and at the end you overwrite the value (what do you make there??)
    Mike
    The missing VIs are the proprietary ones
    In the timeout, the first missing VI is me reading my various pressure sensors.  The second missing VI is enabling or disabling various valves based on what pressures exist and what valves are open.  However, they are either enabled or disabled and grayed out, so I know that's the not the source of my problem.  Also, if the booleans were disabled and not grayed out, the event itself wouldn't trigger (which it does, just no code executes).
    =============
    XP SP2, LV 8.2
    CLAD

  • Event structure or case structure

    I have some case structures wired to buttons.  When each button is true, code inside the corresponding case structure executes.  `What are the advantages/disadvantages of using an event structure instead of a case structure?
    Ron Deavers, CLD

    Place an indicator for the iteration terminal of the main loop to see an obvious difference
    Your case structures must be in a loop that constanty runs. If you don't put a delay in the loop, it consumes all CPU, but if your delay is too long, it takes a moment to react to the button changes. The loop spins all the time, no matter if you press buttons or not.
    Your event structure also sits in a loop, but nothing happens until you press a button. Now the event structure triggers IMMEDIATELY, executes the event case, and then waits for the next event. The loop does not spin unless needed.
    You can even mix the functions by using a timeout event. Code in the timeout event occurs at regular intervals, but at any time, any of the other events can take over.
    LabVIEW Champion . Do more with less code and in less time .

  • Event structure and a cluster - lagging input

    I am running into problem using a cluster of controls that I want to use with an event structure. Each control tied to an event case. Simple enough.
    I used the cluster because the number of controls I am using is quite large. The problem is that I need to read the cluster to get the latest state before I unbundle and handle the event. The issue is that in order to pull this off, I need to use a local variable of the cluster for each event. Since the event structure could have ten or so cases, I end up with ten or so of the reviled and maligned local variables. 
    The cluster has great advantages for what I am doing, but the local variable break old taboos in the LabVIEW style rulebook.
    I am attaching a micro-version of the vi so you can see the problem. You have to imagine expanding this to a lot of event cases to see the problem. Below the simple front panel is the real front panel I want to work with just so you have an example.
    So, am I wrong to use the variables and should I break the cluster and lose it advantages, or is this a valid use of the local?
    For those of you that don't see why the locals are needed, just run the vi. You'll see that the direct wired version always lags one state behind the control. The reason is that on an event trigger (toggling the boolean) , the last state of the control is already at the event structure boundry. The event code executes immediately with the previous data. Putting the local inside forces the case to read the current state of the control and use the correct data.
    Long winded and not much meat, but somebody must be bored out there and willing to jump into the fray.
    David A. Taylor
    Attachments:
    Clusters and events.vi ‏19 KB

    Ray.R wrote:
    which route?
    the bottom one is going to give you the wrong value which is what he had as a problem..
    OR
    you probably mean something similar to what I posted, but got the reference from within the Event Structure... Yeah, I also prefer that one
    The latter, it ties the event direct to the control triggering the event, and you could use it for several boolean controls.
    Now in total retrospect, the event (Value Change) will also output the 'New Value', so there's actually no need for the local/reference.
    Ton
    Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
    Nederlandse LabVIEW user groep www.lvug.nl
    My LabVIEW Ideas
    LabVIEW, programming like it should be!

  • Event structure - general

    hello
    this is probably something that had been treated millions times, however i could not find direct answers from previous threads on that, so i ask directly.
    i am a bit confused by the utilisation of event structures:
    first, one would expect that if the event is used, say in a while loop, then outgoing data would be kept trough the sequence, without having to wire trough the other events, unlike as depicted in the pic below. that should be to my understanding the definition of "use default values" on the outgoing data nodes.
    however it seems not to work like that. why? is there a way to force LV to do as i want (instead of "use default values", make him "use last input value")?
    wiring trough all the nodes make the event structures very unelegant.
    second: this is probably a very naive one, but i dont like the way i do it: in some events i have same operations going on as on turn on of the vi. in other words, when i initialise my system, i pass trough several operations, which also exist in the event structure. to make the diagram more elegant it would be usefull to call all those events programmatically a first time. up to now i do it by programatically signalling the values of some controls. however there must be a more elegant way, where i could just queue the events needed. any suggestions?
    Message Edited by Gabi1 on 05-17-2007 06:11 PM
    Message Edited by Gabi1 on 05-17-2007 06:13 PM
    ... And here's where I keep assorted lengths of wires...
    Attachments:
    event structure.PNG ‏10 KB

    Jarrod S. wrote: 
    Triggering events forces a thread swap to the
    user interface thread, which can slow down execution. It can also make
    a redundant copy of the data that has to get stored in the control
    whose value change was triggered, which you might not need. Enqueuing
    commands onto a queue does not have these limitations.
     To clarify Jarrod's comment, it's important to note that neither the event structure itself nor dynamic events cause a switch to the User Interface Thread.  Functions inside the event structure (e.g. property nodes, invoke nodes) can cause a switch to the UI Thread when they operate on UI components.
    In that discussion, Jason King points out that:
    "There is nothing specific about the event
    structure that requires the event-handling case to run in the UI
    thread.  In fact, there is not any event that will force it to run in
    the UI thread"
    "Reading from or writing to a front panel terminal or local variable does not cause the diagram to run in the UI thread."
    "Any actual processing of user interaction,
    however - either looking at user interaction to determine which events
    to generate or finishing processing a filter event after the event
    structure has had a chance to discard it or modify any of the event
    details - requires the UI thread."
    "Pretty much anything you do with the reference to
    a control or indicator will cause a switch to the UI thread (property
    nodes, invoke nodes, etc)"
    Certified LabVIEW Architect
    Wait for Flag / Set Flag
    Separate Views from Implementation for Strict Type Defs

  • Event structure and automatic queueing of events.

    I have found out the long way that the event structure queues all the events taken place while it has been executing yur most current event.
    In other words... I understand why the locking of the front panel is an automatic option that is selected. As it will prevent you from queueing more events,  and causing yur program to execute endless event structure runs, when you wanted it to stop 15 button presses ago.
    case in point.... is in this simple VI i attached.
    My question is ... is there a way to turn off this automatic queueing of events??
    Attachments:
    EventStructureHUH.vi ‏53 KB

    Well ... the problem for me... was, for example, in the VI I posted....
    The OK button in the VI I posted, has an event triggered to it in the event structure.... So when I enter that loop after hitting the enter loop button... it registers those OK clicks...
    Say the OK button and NOT the continue button takes me out of the little loop and back into the big loop. Now, after leaving the little loop and entering into the big loop, I will immediatly enter back into the event structure to handle the OK button click.
    Basically I wanted one button to control the termination condition of the little loop, but also have an event in the event structure associated with it, so basically one button to exit the little loop AND the big loop.
    I hope Im making sense. I found a solution, by just making two buttons, when entering into the little loop, the one button dissapears... and vice versa when entering into the big loop. So to the USER it appears like ONE button... but in the code its actually two.
    I just wasnt sure if there was another way around it... it was tough to figure out what was really happenening in my code... took my about an hour or two to track down.
    EDIT: Yea.. thanks for the reply....  as for the comments in my code... yea, I get a little crazy towards the end of the day... after 6-8 hours of straight labview programming. 
    Message Edited by MJBrehm on 06-30-2006 02:21 PM

Maybe you are looking for