Questions from a rookie about event structures

Hello,
   I am currently scheduled for Labview classes next month,
so I want to apologize in advance for "dumb questions". I have created
a program that is starting
to be a CPU resource hog. The majority of my program is inside a while
loop so that the program will "react" to changes in controls, etc. I am
assuming that
if I incorporate "event structures" in my program that my program will
not be a resource hog.  Is the use of event structures the correct
way to go? If using
event structures is the correct way to go, what is the best way to
learn how to incorporate "event structures"?  I am assuming that
the examples in Labview will show me how. Are there any good reading
materials about event structures?
Regards,
Kaspar

To fix the CPU resource issue, you need to place a small wait statement in your loop. It will solve two problems:
Slow down the loop (you don't need to check for UI changes more that 10x/second)
It will allow other, parallel tasks a chance to run after each iteration. Without a wait, it will hog the CPU for 55ms before releasing control.
If your loop currently spins one million times a second and you would place a 1ms wait, the CPU would go from 100% to 0.1%!
The event structure is a fantastic tool to solve most UI issues and it makes the diagram automatically simpler, more self-documenting and easier to read. Have a look at some of the examples that ship with LabVIEW.
The event structure is easy to learn, so dive right in. Read the online help for some important considerations. As a rule of thumb you should stick to a single event structure per diagram.
LabVIEW Champion . Do more with less code and in less time .

Similar Messages

  • Questions from a Rookie about JSP and JEE

    Hello friends. I've just started to learn JEE and JSP technologies. I have some experience with .Net and PHP; but just found time to learn JSP. I have developed a simple Web application by using those technologies. And I want to deploy those codes to the web. I have googled. But could not find an explanatory tutorial about this topic.
    My second Question is:
    I am using Netbeans 6 Beta 2 and I am connecting to a Database by using a function let's say something called connectDb() with SSH;. How can I bind a Data table with this function. (Netbeans have a buildin component for binding to a component to db but does not support SSH)
    Thanx in advance. I would appreciate any kind of help.

    Hello.
    Is there anybody in there?
    Just reply if you can help me.
    Is there anyone here?
    By Dink Floyd

  • Firing events from a Menu using Event Structure - all in the same Event Window?

    I have an ap where I have three menus, and several selections from
    those three menus. I'm trying to keep everything within the Event
    Structure, but it seems that ALL of the events fired from the Menu must
    be contained within one "frame" of the Event Structure, that being the
    Menu Selection (user) Event. In other words, if I have 16 events that
    can be fired from the menu, do I have to put them ALL in this one event
    frame?
    I can't seem to use a T/F indicator within the Menu Selection (user)
    Event to access another Event. For example, within the Menu Selection
    (user) Event, I placed a boolean named X and can turn it on with a menu
    selection. Now, make a new Event Structure to look for X Value Change -
    doesn't work.
    Message Edited by Broken Arrow on 11-30-2005 10:24 AM
    Richard

    I use one event, Menu Selection (user). to trap all of my menu events.  Use Item Path and / or Item Tag to figure out what menu item was selected then branch code based on selection.  Wtih Booleans and menus you need to update the state of the boolean on the menu by setting it True or False.  It doesn't automatically toggle like you would expect.
    Matt
    Matthew Fitzsimons
    Certified LabVIEW Architect
    LabVIEW 6.1 ... 2013, LVOOP, GOOP, TestStand, DAQ, and Vison
    Attachments:
    menuSelect.JPG ‏45 KB

  • Exit from the application using event structures

    Hi
    In my project i used event structure it working fine.
    Now i want to exit(close) the application when i press EXIT button on the front panel.
    Here i attached my project give an idea.
    Regards
    hari
    Solved!
    Go to Solution.
    Attachments:
    Sledge.zip ‏40 KB

    Hi SAM
    U saw my ok.i have one more problem when i run the program(main vi) all the remain sub vi's also opened.
    i want open sub vi when i press a button on front panel.
    i have made small changes to it.
    Regards
    hari 
    Attachments:
    Sledge.zip ‏41 KB

  • I Have a question from a Customer about ONLINE OPTION

    Hi all,
    I have the below question from one of my customers, and non being a DB expert I am not able to answer or even where to find a documentation supporting the answer.
    "We need to know how the "Online Option" to reorg indexes or tables is safe to be used, this way:
    - Alter table ... Move .. online;
    - Alter table ... Rebuild .. online;
    to understand if the technique can be used to maintain the DB without stopping service to end users.
    The DB is in 11gR2. I do not want notes or PDF's but just answers on:
    - It's Safe ? yes/No or Yes with some tricks, Best practices (which?)
    - Any known issues or bugs or patches to be applied (or Service Packs)"
    I was planning to setup a Bug Review with my ACS Service Engineers but they would like a quick preliminary answer to the fist question before starting the full Bug Review.
    In my understanding, the Online option is to reorg indexes and not tables... am I right?
    Which can be a documentation page or community discussion or any additional link you can share ?
    Or may be you just have a full answer :)
    Thank you
    Kind regards
    Chiara
    Edited by: Chiara Scarafiotti on Jun 7, 2013 2:35 AM

    Rebuilding an index online will lock the base table at the start and end of the rebuild, this can cause issues if there are active transactions see http://richardfoote.wordpress.com/2008/02/11/index-create-and-rebuild-locking-improvements-in-11g-ch-ch-ch-changes/
    alter table move online will make any associated indexes unusable and these will need to be rebuilt after the table is moved.
    Two other options:-
    for indexes a coalesce is generally faster and requires less space.
    For everything dbms_redefinition has more options and is less intrusive at the expense of being more complex.
    Also probably the biggest risk is you move tables rebuild indexes charge your customer for all this work and it fails to improve anything (or actually makes things worse)

  • Quarterly CPU question from a rookie

    Question qualifier: I am not a trained or experienced DBA, I have however been thrown under the Oracle bus to set up a Patch and Vulnerability Management program for the Oracle servers.
    Question: Are the quarterly CPUs cummulative? In other words, does each quarterly CPU include the patches from the previous quarterly CPU?
    If not, I would like to clarify theire installation order.
    The CPUs MUST BE installed in the released sequence to make sure that all vulnerabilities are covered.
    a. This is correct. The patches have to be installed in the released order.
    b. This is the official position, but in reality it is not that strict.
    c. It doesn't matter as long as all the patched are applied.
    d. What is a CPU?
    I thank everyone in advance for your help.
    Jonathan

    All these questions are answered in Note 360470.1 (FAQ)
    Basically, CPU patches are security patches likes the ones released by other vendors sent at predefined intervals to contain a list of fixes based on bugs or issues found. They are usually not cumulative (the answer depends on which Oracle product you are referring to).
    About the official position?.. Treat as strongly recommended.
    CPU = Critical Patch Update

  • Question from Mac newbie about system and startup programs

    I recently switched from an old Win 98 computer and LOVE this macbook! Could someone please explain a couple of things to me?
    Two windows now suddenly appear when I restart my computer - one is a window with all the files and folders stuff from when I installed my Canon MP500 printer last week. Why is this box opening at startup, and can I get it to stop?
    The other suddenly opening at restart is a simple Finder window showing my hard drive and network. (I am not connected to a network). What's the source of these things starting up? How can I fiddle with this setting? These things are not listed when I go to System Preferences-Accounts-Login items.
    On Windows you can hit CtrlAltDelete and see all the running programs, even background programs. How do I do it on the Mac?
    Thanks,
    -Alden

    Charles I'll start from your last question. You'll find "Activity Monitor" in the Utilities folder (inside Applications folder) that's the equivalent to the Task Manager in Windows. you can leave it in the dock to have it handy.
    About the Canon printer window showing when you start; see if it has an open icon on the dock when it's open. Click and maintain clicked on that icon (if there is one) and uncheck "Open at Login".
    Finder Window usually opens at login if it was open when you logged out
    Oh, and Welcome to the forums!

  • Simple opinion question from a newbie about IDE's

    I have been looking around for the best architecture for a n-tier client server app. I have been using the jsp/servlet architecture for a while, and have recently found out about web-start . There seems to me to be a great advantage to be able to maintain state on the client, as opposed to having multiple roundtrips to the server.
    My questions are:
    1) What is the easiest (i.e., any open source tools/ide's?) way to build a full featured gui for a desktop application that will connect to servlets or web services and can be deployed via web-start? I would prefer a gui builder with many available widgets - are there any out there?
    2) what is the difference between JNLP and web-start?
    3) How do you bind gui controls (swing/swt/whatever) to the data? I.E., I used to work in Borland c++ builder and there were data-aware controls. Does java have any similar controls that can be bound to a datasources?

    1. I'm sure there are a few out there, but the ones I've tried created crap code, so I usually roll my own.
    2. Java WebStart is the name of the JNLP implementation that comes with Sun's JRE (but the two are often used as synonyms). There are other JNLP projects, but most of them seem to be dead.
    3. I'll leave this to someone else.

  • Very simple question from a rookie

    Hi,
    I don't know how sequences work in OWB.
    I have a very simple mapping:
    1 (not empty) source table, 1 (empty) target table, 1 sequence.
    Source and destination are connected.
    The sequence.nextval is connected to the primary key. sequence.currval is not connected.
    When I run the debug mode an error occurs: "Could not find data for all sources and target ...". The "Test Data" shows that OWB has not found data for the sequence.
    Help!

    I use 10gR2 and OWB 10.2
    The tables and the sequence are deployed. They are in the database.
    There's something strange about this:
    Starting ("Start...") works.
    The debugging does not work.
    Problem nearly solved ...
    Message was edited by:
    user517859

  • Event structures for dummies

    After all the great help with data handling, I thought I would ask a question about event structures.
    I have a main VI that sits around and lets me read in files and change variables. Once I am happy, I press start which fires up some sub VI that start running in the background. I have tried this using event structures. But then disaster strikes!! One of my variables is wrong and I need to stop/reset the sub VIs (without stopping the main program). However, my subVI is running in a timed loop continuously, within the event structure, so it's stuck. Attached is a very simplified VI of what I mean.
    I basically want to run a program, set up some variables, set off a background subVI, update/reset if needs be and then press the big continue button to the next stage whilst the subVI is still chugging.
    Any suggestions from the Guru's? I do not think event structures are the way forward
    "When I read about the horrors of drinking, I gave up reading"
    Attachments:
    event structures for idiots.vi ‏90 KB

    The important thing about event structures is to use them in the right way. For example as a rule of thumb, don't put into an event handler anything that will take more than about 200 msec or so to complete. Why? Studies have shown that 200 msec is the longest delay you can generate without the user noticing the delay (obviously YMMV).
    One good solution (as corys pointed out) is the Producer/Consumer Loop - but there are a variety of others. For example, I have created applications where pressing a button launched a long task as a separate process running in the background. When it finished it passed data back to the GUI using another event, queue or some other mechanism.
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • About Event

    HI!
    I got a question about Event structure,Attached is a simple example, there 's one VI in each of these two event.Is it possible to make the two VI(VI 1,VI 2) run at the same time? because when i run Example.VI,i can only make one of the VI run,if i want to run the other one,i have to close the current one,any suggestion? thanks!
    Attachments:
    Event.llb ‏59 KB

    If I understand correctly this is the scenario that you're looking at. The user presses the vi1 button and vi1 begins running. This vi continues operating until the Stop button is pressed in vi1. You want the user to be able to press the vi2 button and have vi2 begin running also.
    One possible solution is to use notifiers in your event structure instead of putting the vis there. You can then put the vis in parallel loops triggered by the notifier. I have attached a quick example to show how this would work. This approach allows each of the vis to be started and stopped as many times as you like in any order.
    I would also recommend that you use a reference to the Stop button on the main vi to allow you to stop the subvis.Message Edited by John Rich on 06-10-2005 11:59 AM
    Attachments:
    Event[1].llb ‏93 KB

  • Event structure, case structure, iteration number

    Hi
    I am trying one example about Event Structure from the book,  LabVIEW for Everyone: Graphical Programming Made Easy and Fun. 
    The example in the book looks like this:
    The number of 'work done' equals 'iteration number'.
    But when I build a Vi and try this example, I got this:
    iteration number is two times the 'work done'.
    I have attached my Vi. Does anybody know what's wrong with my Vi
    Thanks
    Bing
    Solved!
    Go to Solution.
    Attachments:
    do some work.vi ‏10 KB

    Both Activation and Deactivateion of the boolean causes Value Change events, but you only add 1 when it's activated. If you set the booleans mechanical action to Latch instead of Switch they should be the same.
    /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

  • How does the event structure work & ...

    How does the event structure work & and how to modify the case example if you want to change the name of the case? I haven't a look at the manual but nothing about event structure is mentioned.

    I know how it works.. =P

  • Event structure buffering?

    Hi all,
    A quick question, if i have an event structure with lots of value change events for booleans, if 2 or 3 change at the same time or within a few milliseconds of each other does it buffer this event so that when it comes out of the event structure it knows another one has happened since it last went in? i.e. it could get a trigger for one, enter the event structure pass over a couple of ones that didnt trigger then get a trigger for them whilst its in it, but gone past them, then deal with the one that did trigger it and exit. Or perhaps i am not understanding how event structures process the value change triggers.
    I hope i have explained myself well enough
    Cheers
    Mike

    Pnt wrote:
    Yes. As far as i know, events are buffering and it is NOT possible to miss one.
    I agree here. You cannot "lose" any events. Sometimes this is a problem as demonstrated (and solved) in this old discussion:
    http://forums.ni.com/ni/board/message?board.id=170&view=by_date_ascending&message.id=207811#M207811
    Pnt wrote:
    I agree that you should not have the same event in two different event cases (in parallel), but i disagree that there is possibility to miss an event.
    LabVIEW will not allow you to place the same event in multiple event cases anyway, so there is no problem. However there is also no problem having two different event structures listening to the same event.
    LabVIEW Champion . Do more with less code and in less time .

  • 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