Re-triggering event structures after queue purged

I have a vi built with an event structure that allows the user to stop the tests.  I am using the flush queue subvi in the producer loop to remove the remaining elements.  Then the user may fix the problem and again press start, starting the tests all over. 
About 50% of the time, the event structure will not restart, and the vi will need to be stopped and re-started. 
There must be something I am missing that is not allowing the event structure to re-start. 
Is the position of the flush queue correct in my snippet?  
What could cause the event structure to not respond and how can I troubleshoot it?
Thanks.
metzler CLAD
Attachments:
producer snippet.png ‏56 KB

You should take more care about your error handling. Propably you just miss the errors that cause this behavior.
* At the while loop, use shift-registers for the error wire.
* I also recommend you to place a case around the event structure that catches errors and stop the loop.
Felix
www.aescusoft.de
My latest community nugget on producer/consumer design
My current blog: A journey through uml

Similar Messages

  • How to exit event structure after a trigger occurs?

    I am acquiring some analog signals. Before the trigger occurs, I would like to be able to save the setting or load the settings. I am using an event structure to do it.
    My problem is I can't not exit the event structure after the analog acquisition is finished.
    I am attaching the vi.
    Thanks for your comment.
    Attachments:
    event.vi ‏53 KB

    Seems you are trying to fire an event using a local variable. This will not work. Events are primarily designed to handle user interactions on the front panel. If you want to programmatically fire the stop event, you can write to a "val(sgnl)" property of the stop button.
    Still, you program needs quite a bit more work than that. For example you cannot do any save or load operation before the trigger happens. Maybe you should redo the entire thing as a state machine?
    LabVIEW Champion . Do more with less code and in less time .

  • Daqmx "Done" event not triggering event structure

    I would like the user to be able to abort my daqmx task by pressing a button.
    I am attempting to use the method in this VI:
    https://decibel.ni.com/content/docs/DOC-15815
    It utilizes an event structure with the daqmx Control Task VI to abort.
    The example VI above works for me, on my system with my USB-6356 device, as expected.
    When I attempt to incorporate the same method into my VI it does not--despite having an identical arrangement, so far as I can tell.
    I believe that my problem lies with the event structure, and the dynamic registration.  I am unfamiliar with this and must be using it incorrectly.
    I have attached my VI, though it is cumbersome.  The code which I am struggling with is in the "Acquire" case.  As far as I can tell, I am doing exactly the same this in this particular case as in the example mentioned.  Yet in the example, the event structure completes, or aborts, whatever you want to call it, right after the "Wait Until Done" VI executes.  In my own VI, the "Wait Until Done" and "Clear Task" VIs execute, but the event structure does not register it.
    Here are my specific questions: is there anything extra or special that one must do in order for the Task to properly trigger a "Done" event and pass through the event structure?  At what point is the daqmx task "Done"? 
    thanks,
    Matt
    Attachments:
    BoomTubeMain.vi ‏175 KB

    natasftw,
    My event structure is identical to theirs; what you are seeing are the two different cases that exist in the event structure.  In both the example and the VI, there is a <task out>: Done and a "Dynamic Event": Value Change.  In the dynamic event case, I have my abort button and relevant code--this I believe is the code you were referring to, which you thought I was missing...  Regarding my multiple event structures, they should operate completely independently as they respond to different events.

  • MDB's keep consuming messages after queue purged

    I have a pool of 5 mdbs processing messages from a queue. The queue had 500 messages in it.
    I used the imqcmd purge dst ... command to clear a queue.
    The mdb's continued to consume messages. I would think that at most 5 messages could have been in the middle of processing and then it would stop but it processed another 30 messages before I killed the app server. I assume it would have gone through the 500.

    I have a pool of 5 mdbs processing messages from a queue. The queue had 500 messages in it.
    I used the imqcmd purge dst ... command to clear a queue.
    The mdb's continued to consume messages. I would think that at most 5 messages could have been in the middle of processing and then it would stop but it processed another 30 messages before I killed the app server. I assume it would have gone through the 500.

  • 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

  • Conditional stopping event structure

    Hi all
    Attached is my Vi , I want to stop the event structure in loop 1 , from the loop 2 which is continously running in parallel and getting digital input from a DAQ device.
    whats happening is first I am checking the status of teh digital input and then on that I am excuting the true structure. once I am in the True case , an event structure for user operations and a parallel while loop is used to monitor the digital input , what I  want to do is as soon as the digital daq input is low again i should be back to my fasle case in the main loop but the loop 1 with event structure is not stopping.
    help
    regards
    Regards
    Attachments:
    Untitled 1.vi ‏12 KB

    Snamprogetti wrote:
    You can't put an event structure into a case structure. It will run even if you are in the other case.
    See http://forums.ni.com/t5/LabVIEW/An-event-structure-can-freeze-the-front-panel-even-if-not/m-p/106629...
    What then, is a queued state machine? . The issue is the event structure still queues your events whether or not you are in your "idle" case. So if you don't promptly return to your idle case, events can back up in the event structure causing your program to act like it's lagging. Setting a busy cursor can help to solve this problem. I felt this should be clarified because a properly set up queued state machine is very powerful. This obviously isn't the solution for the parallel loops here but I thought I should add to your point..
    CLA, LabVIEW Versions 2010-2013

  • Event structure problem in updating array

    Hi, i have a problem with my .vi...
    i have an array of 10 boolean i want to modify by pressing SET TRUE or SET FALSE buttons, after selecting (with the ring selector) which is the elemente that should be changed...
    there seems to be something strange in the behaviour... the array is not correctly updated... maybe there a big mistake i cannot find...
    i  hope you could help me
    tks
    Attachments:
    array_modify.vi ‏18 KB

    The problem is the the Ring control is read before the event structure, so it return "old" data when you click of either SET TRUE or SET FALSE.
    You need to move it so that it is read inside the event structure after you click on one of the "SET" buttons.
    Create a local of the Ring for one of the SET events and move the Ring terminal into the other.
    Or create a blank event for the Ring control so that it will update the input tunnel going into the event structure.
    Or create a single event to handle both SET TRUE and SET FALSE.
    Omar
    Attachments:
    array_modify.vi ‏9 KB

  • Event Structure - Lock Event: Does it Queue ?

    I had couple of question related to this post in other posts but I thought I'd use a new one since it might be more relevant (others were related to local variables, and VI file sizes)
    I have this event structure running about 10 different tasks. For some I would like to lock the panel when it runs. I used "Lock panel ..." but during the run, if you click on any boolean and menu ... for some reason it queues the task and performs it after the event is complete ... is there any way I can lock the event and not have any event queued ? Thnks !
    Kudos always welcome for helpful posts

    If you were to change the value of the Block Panel Event boolean using a local variable it wouldn't fire an event so I'm not sure that would be the way to go.  I had intended that just to be an example control.
    I have further modified the example to show how a custom user event can be programatically fired to signal that the front panel should be "unlocked" and that new events should be added to the event queue.  In the new example you will see that while the LED is flashing no events are queued.  Once the LED is done flashing it communicates to the event structure via a user event.
    It may also be possible to change the value of the "locked?" boolean without requiring an event to do so.  I didn't explore this option but it may be a valid approach.
    Also please remember that any example I have posted here is not meant to be incorporated into an application - I am merely attempting to demonstrate ideas and concepts.  It will be more beneficial for you to examine and understand how I programmed a certain behavior and then use those concepts to create your own application than to try to make my code fit into your application.
    Regards,
    ~ Simon
    Attachments:
    lock event 2-1.vi ‏75 KB

  • Strange problems about my projects(efficiency,event structure,queue)

    hey,guys,i am a labview user from china,so forgive me about the chinese words of my projest. i found something wrong with my work. .
    there are two functions in my "While loop", the first one depends on "queue" and  is to get information from UART, the second one is "event structure" to send information through UART. my problems:
    1. i can not stop while loop by pressing "停止“, and i find two ways to stop it. first, i press"停止”,then, i press any buttons that can trigger "event structure"twice, at last, while loop can stop.the second way, i press buttons for "event structure" one time, then "停止”, and then the same button for"event". it also works
    2.my work does not run efficiently. you guys can try. once you press buttons for "event structure", it responses very slowly,and if you press many times,the whole program seems like suspending.i have added a LED named test at the front panel, it should light once you press "运行“. and it also shows how slow the whole program is.
    i have attached my work, and my main vi is "串口通信 主VI".
    can any body give me some suggestions? thanks a lot
    Attachments:
    Uart.zip ‏140 KB

    Your event structure will execute exactly once per loop of the main loop, thus the other three loops must stop before handlig the next event. You will also get a race condition between the top loop and the events when writing.
    I'd put the top loop as the timeout case in the event and place the loop around the event for starters.
    /Y
    LabVIEW 8.2 - 2014
    "Only dead fish swim downstream" - "My life for Kudos!" - "Dumb people repeat old mistakes - smart ones create new ones."
    G# - Free award winning reference based OOP for LV

  • Queues and event structure

    Hi,
    I'm having some troubles with a program that I'm doing.
    I think the big problem are in the queues and the structure event. I don't know why, but the elements in the queue only increase. And I think, because of that, some things that should happen, don't happen. For example, when I press the button "Impact" an square wave should appear, and it didn't appear.
    Thanks for all your help,
    Sílvia
    Attachments:
    Sonic.zip ‏115 KB

    sreis wrote:
    Hi,
    Of course I read your post, but like I said, I don't understand why, when I press the "Impulse" button, I have the start in the queue. I shouldn't have the previous used enum, because of the shift register?
    You are right, the things are slow down because of the re-enqueues and the many Acquire state I have in the queue. But how can I fix that?
    Thanks,
    Sílvia
    Yes the previous enum will be there because of the shift register.  But look at what is happening in your Acquire loop.  You are enqueueing on every loop iteration.  So your action is like this:
    Press Start - enqueue Initialize and Acquire
    Initilaize state runs
    Acquire state runs - Acquire is queued up again.  Because you have no wait state,  this loop runs super fast and you keep dequeueing acquire and queueing acquire again.  The wait state is imperative to allow the CPU time to process some other loops.  This is not done automatically, you have to allow it by adding waits to loops.
    Now you happen to press impact and somehow the CPU finds time to process the event.  What state gets queued?  Acquire again.  Now you have two acquires queued because the last Acquire state also queued an acquire.  Every button you press will enque something on top of what is already there and your dequeue will never be able to keep up.
    The solution is to not enqueue anything in the bottom loop.  Never do this.  If you want to acquire when no event is happeing, queue up the acquire in the Timeout event.
    - tbob
    Inventor of the WORM Global

  • Event Structure Freezes Vi After Capturing The First Event

    My Event structure catches the first instance of my button press but then it freezes my Vi.  The reason is because of the while loop but I need the while loop to constantly read from a serial port and send data to a serial port. The vi included is stripped down to be just a while loop that does nothing.  I have also tryed putting the event structure in the while loop, but the same thing is happening.
    Any ideas?
    Thanks,
    Cason Clagg
    SwRI
    LabView 7.1, Windows XP

    Also, put the button inside the event structure where it is acted upon, from LV help (suggest you read the entire events section of help):
    When you trigger an event on a Boolean control configured with a latching mechanical action, the Boolean control does not reset to its default value until the block diagram reads the terminal on the Boolean control. You must read the terminal inside the event case for the mechanical action to work correctly. As a reminder, a note appears in the Edit Events dialog box when you configure a Value Change event on a latched Boolean control.
    Refer to the Handling a Latched Stop Boolean Control in an Event Structure caveat for information about how to handle a latched Boolean control.
    When you trigger an event on a Boolean control configured with a latching mechanical action, the Boolean control does not reset to its default value until the block diagram reads the terminal on the Boolean control. You must read the terminal inside the event case for the mechanical action to work correctly. As a reminder, a note appears in the Edit Events dialog box when you configure a Value Change event on a latched Boolean control.
    Refer to the Handling a Latched Stop Boolean Control in an Event Structure caveat for information about how to handle a latched Boolean control.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~
    "It’s the questions that drive us.”
    ~~~~~~~~~~~~~~~~~~~~~~~~~~

  • 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

  • Start stop event structure queue

    Hello,
    I would like for the attached vi to start logging/displaying data when the Start button is pushed, not when the VI starts. So I did some research and was led to the Event Structure (this is my 1st time using an event structure). I have been trying all sorts of things over the last few hours so what I have now is probably somewhat convoluted, however, my latest error is that my dequeue is receiving an "invalid refnum".
    Could someone guide me on what I am doing wrong?
    Thanks.
    Solved!
    Go to Solution.
    Attachments:
    InitFile.vi ‏20 KB
    CNAP Daq Event Structure.vi ‏109 KB

    Hi Nouse,
    I had some free time and was bored so took a look at your vi for you. You was on the right track, had started with a good architecture which is half the battle, just needed some fine tuning:
    I took your code and added it to this. All that i have taken out is the Sub vi's that get your data, i replaced this with a random number just to see some data on the wavechart and also being logged in your file. A point to notice is that your 'CNAP INIT FILE' vi has no error cluster propogation. If you run this subvi and there isnt the 'C:CNAP\' Directory (As there wasnt on my computer at first) the 'OPEN File' vi errors and halts the program, as you have no error propogation or handling in this vi you cannot handle this error.
    I changed the vi slightly and added a 'Start' 'Stop' and 'Exit'. This allows you to start acquiring/logging data, stop (without exiting the program), restart acquiring/logging or exiting the program. A point to note is that if you do 'Stop' and then 'Start' again, relatively quickly your 'CNAP INIT FILE' Vi will append a previously written file, which is fine, but it will also send out a new start time. So your readings in the same file will start from 0 time. You may want to catch this and not update the new start time if appending an old file.
    I have attached the VI in both LV2009 and LV8.6 as you never stated your version.
    Hope this helps,
    Rgs,
    Lucither
    Message Edited by Lucither on 03-27-2010 03:32 AM
    "Everything should be made as simple as possible but no simpler"
    Attachments:
    Data Logger VI 2009 and 86.zip ‏229 KB

  • Is there a way to add an event to the event queue handled by the event structure?

    I am using an event structure to control the flow of a program. In one case I want to change the state of a switch and then have the event structure catch this exception and handle it. It works if the user toggles the switch, but doesn't seem to when it is done programmatically. Any suggestions.

    Hello,
    LabView User's manual says:
    "Use Events for Direct User Interaction Only
    Events wait only for direct user interaction on the front panel. Events do not work if you use VI Server, global variables, local variables, and so on to change VI or front panel objects programmatically."
    However, you can have a look in Example Code, there's some applications generating events programmatically, maybe that helps you. (Search for event structure in support).
    Hope that helps,
    SBC

  • Locked controls on new tab after finishing event structure

    Greetings All,
    My first question for the forum.  I found a few posts which had similar issues but I still can't seem to figure this one out.
    This program creates a temperature profile and it's within a much larger program where I want the user to be able to cancel, continue, go back a step, etc.  It all works fine until I leave the event structure loop and go to the verify tab.  The user should be able to continue or cancel but the buttons will not press.  I believe the event structure is locking the front panel but I turned off the lock for that case and still no go. 
    I've attached the LLB, please check it out.  Any help will be most appreciated.
    Regards
    Using LabVIEW: 7.1.1, 8.5.1 & 2013
    Attachments:
    TempProfiler2.llb ‏575 KB

    Hi,
    The answer is almost in the question, just go to the event structure and disable the option "lock front panel until event completes"
    Message Edité par TiTou le 06-30-2006 09:18 AM
    When my feet touch the ground each morning the devil thinks "bloody hell... He's up again!"
    Attachments:
    Clipboard01.png ‏435 KB

Maybe you are looking for