Simulate event structure in LabVIEW base?

I have a LabVIEW base version (v8.6) which does not have the event structure. I found it was quite inconvenient to monitor the status of several controls (the action after click a control depends on the status of other control(s)). Especially if I want to add another function (control), the effort increase exponentially with the existing number of controls
I got an idea of simulate the event structure using 'Shift Register'. First, I will bundle all the values of controls into a cluster. Then I will put the cluster in a while loop, and compare the value of the cluster with its previous value (xor the shift register). If the compare result is false (none of the control is changed), the program goes to next iteration. If the XOR result is true (one of the control was changed), then the program goes into event handling code (it will pass which control has changed, and the whole cluster). So for each control change, we can write a independent code to process the event. After processed the event, the event was cleared.
The following is a section of my ugly code currently used to monitor several controls. And I am thinking of rewrite it using above idea so that there will be less likely a hiden bug.
Any comments of suggestions?
Message Edited by RyanWu on 10-23-2009 10:16 AM
Solved!
Go to Solution.
Attachments:
UglyLabVIEWCode.png ‏18 KB

Ben wrote:
Altough this is an interseting academic question, we really can't duplicate the efficiency of the Event structure so springing for an upgrade is highly recomeneded.
But I am not here to sell LV but rather help LV developers so...
Start by developing an Action Engine with the following actions.
1) Init -caches control ref for all controls and indicators for which you need an event. Optionally rest them and cache their state.
2) Check - Will compare the current state with the prvious state and any changes get pushed onto a stack in the AE and if there are elements in the stack (due a change detected now or one left over form the last check) and returns a type-def'd enum describing what changed. Multiple changes should be on the stack for next time.
3) Get New - will return the new value of the value requested via an Enum.
In you top level VI use the AE to Init before you run and then use an "Check" method to se if anything changed. If it flags a change (boolean output of AE) then the Enum is used to select the proper case of a case structure. Inside the psuedo-Event case, you can use teh AE with the "Get New" action and pass the enum to choose which value to get.
It is hardly an Event Structure but it should come close.
Ben
But after looking at Knickerbocker's* post we can go farther.
Put the above code in a sub-VI that feeds a queue. Then you can monitor the queue for updates just like in an event structure AN you can queue up all of the changes at once and can ingore my mention of caching the change methods in the AE. Just let the queue handle the stack.
Ben
*Kudos for inspiration!
Message Edited by Ben on 10-23-2009 10:54 AM
Ben Rayner
I am currently active on.. MainStream Preppers
Rayner's Ridge is under construction

Similar Messages

  • Alternative to Event Structure

    Hi,
    I am an EE intern creating a testing program for an antenna pedestal.  I am using LabVIEW Base Version 11.0.1.
    I am using an LV-Link VI provided by an example from the download for the Data Translation 9836 module that my company is using.  Currently, I have an array correctly storing data when the user presses the "Start/Stop" button for the first time.  I am working on the section of my VI where I prompt the user to "Save Data to File?" so that I can make the VI either save the data when the user clickes "yes" or stop acquiring data and not saving the data when the user clicks "no".
    My current problem is that in my implementation, when the user clicks the "Start/Stop" button for the 2nd time to stop acquiring data, the user prompt will continuously come up because the "Start/Stop" button is in a false state as long as the button is "unclicked", and will remain that way until the user clicks "Start/Stop" again.  I do not have the event structure at my disposal because I only have LabVIEW Base which does not include the even structure(I did give a kudo to whoever was suggesting that the event structure be put into every level of LabVIEW).
    I saw another thread with a similar problem here: http://forums.ni.com/t5/LabVIEW/Simulate-event-structure-in-LabVIEW-base/td-p/1008900, but I am having a hard time understanding what exactly is going on since I just learned all of the basics and am figuring out LabVIEW as I go along.  If someone could help me simulate an event-structure-like situation in my VI that I have attached, it would be greatly appreciated.
    Thank you,
    Aki
    Attachments:
    Compact Range Controller.vi ‏43 KB

    At the moment, the code is still way too scattered. I meant one of multiple states of a state machine. From the current code, I cannot really tell what you want.
    Maybe all you need to do is delete the orange wire in the FALSE case of the upper case structure and make the output tunnel to use default if unwired. (but make sure you don't lose the data).
    Attached is a quick modification that gives you another additional true whenever the button changes. Used it to either clear the array or execute the "save" case once. 
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    Compact Range ControllerMOD2.vi ‏37 KB

  • I can't add an event to an event structure. Option not visible in the menu. Fix?

    I didn't have the event structures on my pallette to begin with (LabVIEW 6.1), so I added them by downloading the struct.mnu file on the website. Now they show up in the pallette, but are not usable because I can't add events. Any help would be much appreciated.

    You're correct, if you have the Full version, you should be able to create and edit the Event Structure. The Base version is the only one that is limited.
    I would try the reinstall and see if that takes care of it. Something must have gotten corrupted.
    Ed
    Ed Dickens - Certified LabVIEW Architect - DISTek Integration, Inc. - NI Certified Alliance Partner
    Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.

  • Case structure & event structure

    1.What are the disadvantages of case strucure?
    2.What are the advantages of event structure?

    Are these test questions? I could name 10 for each, but why are you asking?
    While there are often many ways to accomplish the same thing, Case structures and Event structures serve different purposes. Straight from the Help file:
    Case Structure
    Has one or more subdiagrams, or cases, exactly one of which
    executes when the structure executes. The value wired to the selector terminal
    determines which case to execute and can be Boolean, string, integer, or
    enumerated type. Right-click the structure border to add or delete cases. Use
    the Labeling tool to enter value(s) in the case selector label and configure the
    value(s) handled by each case.
    Event Structure (Not in Base Package)
    Has one or more
    subdiagrams, or event cases, exactly one of which executes when the structure
    executes. The Event structure waits until an event happens, then executes the
    appropriate case to handle that event.
    Right-click the structure border to add new event cases and configure which
    events to handle. Wire a value to the Timeout
    terminal at the top left of the Event structure to specify the number of
    milliseconds the Event structure should wait for an event to occur. The default
    is –1, indicating never to time out.

  • Acquiring continuous data using an event structure

    I am new to labview, having recently taken the Core I and II courses.
    I am programming a test rig to acquire the linear position of a hydraulic cylinder and plot it over time.  In programming this code, I elected to use an event structure so that when a front panel button is pressed, a certain part of the test is run. 
    In one particular part of the test, called the Snub Test, I need to measure the position of the cylinder over time and plot it to a graph.  The data acquisition needs to be continuous, however the event structure only allows the loop to run once. 
    I have attached a portion of my code for reference.
    Can someone please advise how I can get this data acquisition to run continuously until the user (or a reference trigger) stops the test?
    Thanks
    Attachments:
    Front Panel.vi ‏115 KB

    A few comments to your VI in general:
    You changed the stop button to "switch until released", most likely because you fabricated a race condition and did this as a quick fix. The reason is (1) your placement of the stop terminal outside the event structure and (2) the use of a local variable wired to the stop condition. The button terminal of a latch action boolean belong inside it's associated event case! This way it gets read (and reset to false) when the event occurs. In your case, the local variable and the button get read before the event occurs and the loop needs to spin once more at the event that occurs when you release it (true->false). At this point, the local is still true from the earlier event and the loop stops. Correct would be: latch action, stop terminal inside stop case and wired to the stop condition from inside the event. Other cases use the default output (false) and don't stop the loop.
    Your "equal false" code fragment is just an invert, right? So why complicate things?
    Why do you need a wait if there is an event structure?
    LabVIEW Champion . Do more with less code and in less time .

  • What are the Dynamic Events avaliable in the LabView 6.1 Event Structure?

    I recieved LabView 6.1 recently and I am working with the Event Structure, and I'm trying to figure out what Dynamic Events are avaliable in the event structure, and how to access them. If you don't understand what I'm talking about, open a new VI in LabView 6.1 and drop an event structure on the diagram. Add an event and look at the dialog box that appears on the screen, specifically the Event Sources section. The third option in this area of the screen is "grayed out" but reads "Dynamic". I'm curious what these events are, and how I access them. I'm running WinNT 4 SP6.
    Thanks,
    Chris Davis

    I believe this is part of a feature which is not yet present in LabVIEW 6.1, but may be present in a future release.

  • Tutorial on Event handling structure in labview

    Hello,
    can some one suggest a tutorial on event handling? I want to understand about the adavanced feature of the event handling structure like the dynamic even handling. Further is there any tutorial and examples using the user defined even handling function?
    Regards
    Gopal

    Hi,
    Thank you for those links. I would also like to know about the event menu in labview.Which has functions like create user event, register user events etc., further in event structure there is an option called show dynamic event terminal. what is its purpose and when and where should it be used?
    Regards
    Gopal

  • Find Control in Event Structure doesn't show the object when it is not in the frontmost Tab page [Bug Report, LabVIEW 2012]

    When you are looking for the control/indicator handled by a case in the Event structure, you can use the contextual menu item "Find Control" (doesn't distinguish between control and indicator, BTW).
    The result is that the control/indicator is highlighted on the FP. The problem is, if that control is in a Tab and specifically in a page of that Tab that happens to not be the frontmost, the only thing you'll see is marching ants, but no control:
    <=========== the wrong TAB page was shown. LV did not bother to switch to the relevant one....
    In other words, "Find Control" in the Event Structure doesn't switch the tab to the owning page. This is contrary to what happens if you right-click, say, the terminal of this control: the FP will switch to the owning Tab page.
    I'd call this a bug and this is definitely an annoyance (which most likely has been around since the creation of the Event Structure).

    I did not. Is there any better chance for it to be caught there by a NI eye than it is in the LV forum? I though these threads were deemed to gather bugs/features that had been already acknowledged by NI with a CAR number.
    I (and others!) wished there was something like this: http://bugs.sun.com/ or http://bugs.python.org/ for LabVIEW...
    I am just coming back from a short conference of scientists who quite uninamously ended up with the conclusion that LabVIEW was to be disregarded as a lab development environment because of maintenance problems (which could have been argued for any language in my opinion, although I think they meant spaghetti diagrams are the natural tendency of students who could not care less as they are not going graduate because of their LV skills or lack thereof), but I guess I could have added my grain of salt and added the complete opacity on bug and feature handling by NI.

  • VI containing Event Structure will not receive front panel events in LabVIEW Real-Time.

    Hi again, I'm working in my first UI (attached VI).
    It works when running directly from PC. It doesn't when running from cRIO, there's the message "VI containing Event Structure will not receive front panel events in LabVIEW Real-Time". I've been reading and I found that "Event structures on RT targets do not support events associated with user interface objects, such as VI panels or controls. For example, associating the Value Change event with a control does not work. RT targets support only user events".
    Is that the problem? If it is, how can I create Mouse Up, Mouse Enter, Value Change (or other user interface events) user events?
    If I run my VI in FPGA mode should it run?
    Attachments:
    HMI.vi ‏33 KB

    Since it looks like you are new to the whole RT and machine control, I recommend giving this a good read: NI LabVIEW for CompactRIO Developer's Guide
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • 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

  • Event structures in older versions of labview?

    Can anyone tell me how to create a workaround for a 'value change' event structure in an older version of labview?  I have a student  version of LabVIEW 6i and need to create a queued buffer from each value change.  Thank you.

    James.Morris wrote:
    Ah, you're only one release away from the event structure. That's too bad.
    You're going to have to implement a Polling loop that continuously checks the user inputs. Make sure you add a Wait function to the loop (~100ms) because that will act as your chance for the user to make changes. You can use shift register(s) to keep the previous loop's values and compare to get a bunch of Value Change booleans. If you want a specific case for the specific events, then you can group all of your Value Changes in to an array and act upon the ones that are True via a Case Structure.
    The Event Structure only pulls a single event per loop and has a queue of events to handle for following loops. You might encounter multiple value changes in a single loop if the user clicks fast enough, or you trigger value changes. To avoid losing the trailing events, you should probably have a For loop within the Polling loop that handles all True values. Either that, or have a consumer loop that handles all of your events.
    James, I swear I'm not picking on you today
    You can set the maximum number of events alowed in the event queue per event in the edit event dialog box.  Check box and int fields in the lower right side.
    6.i didn't have a "Value (Signaling)" property- (a subject of some CLAD exam questions not that you suggested it)
    Student editions could not use 6.i events.  From 7.0 or 7.1 through 2011 Student Edition could use but not edit event structures. 2012 and on Event Structures are available in "All Versions" of LabVIEW- at the time.  I haven't looked into the newer license options.
    On to licensing options. (Not a lawyer! consult your Legal Dept!)
    If you are not doing work towards earning a educational certificate you should not be using Student Edition.  And, in some cases (Like working on a student project with commercial investment) not even then!
    The Home Edition is also a new option.  It is intended to enable fast "Proof of Concept" development or development for your sole non-comercial use.
    LabVIEW Full and Professional are for comercial use and have a "Home Use License Agreement" clause attached. If your company owns a LabVIEW License you CAN install a copy on a "Home PC" for the limited use of aiding your employer (who paid for the license) such things would arguably enclude "Training"
    NI is not totally opposed to negotiating "Exceptional" agreements for mutually beneficial reasons.  Youl'd better bring a justification better than "I can't afford it"  Go find some investors and buy a license in that case.  And Yes, until the moderators take this down, I did at one time have a LabVIEW license for exclusively engaging the LabVIEW Community (Forums and NI Sponsored events use only- LAVA was not encluded)  I'm not sure if such a deal could be negotiated in the future.  In Fact, The Home Edition would have been less costly.
     

  • LabVIEW 2012 while event structure cannot stop

    I am trying LabVIEW 2012.
    An example of while-loop with Event structure inside cannot be stopped with the boolean stop button.  Any thing wrong?
    Please see the attached VI.
    Thanks.
    Solved!
    Go to Solution.
    Attachments:
    Close VI prompt.vi ‏9 KB

    Yep, something is wrong. You need to add a event case to detect a value change on the stop button.
    The thing is now your event structure keeps waiting for one of the event that it handles, and ight now it only handles the "panel close" event, the "timeout" event is handled too but since you haven't connected anything to the timeout terminal (top left corner of the event structure) the timeout is -1. So when you run the VI the while loop is stuck in the first iteration and waits for a panel close, the stop button will only be taken into account after the even structure catches an event ; I think this is because LabVIEW will execute code linked to the stop terminal of the while loop only after all the rest of the code in it has finished executing.
    Hope this helps
    When my feet touch the ground each morning the devil thinks "bloody hell... He's up again!"

  • Labview 2013 cannot use event structure

    Event structure can be added into the back panel, however when i add event case or try to edit the default event case, the program is crask and cannot response to my mouse. 
    when i launch windows task manager, it present " running" properly.
    However this program run properly at my another computer with sample Win7 OS.
    Can anyone tell me what the problem is?

    Aaron1978 wrote:
    sir, this issue does not related to code, even i create new empty VI, the event structure cannot work properly, i cannot add new event or edit the default even!
    However, i installed the same eval version into my another computer, this event structure can work properly, both computers use same Win 7 OS.
    Okay in that case I would recommend a repair install of LabVIEW.  
    Unofficial Forum Rules and Guidelines - Hooovahh - LabVIEW Overlord
    If 10 out of 10 experts in any field say something is bad, you should probably take their opinion seriously.

  • LabVIEW Event Structure only accept user action?

    Hi All.
    For example, Event Struture responses to a 'BOOL Control' such as someone press the button.
    But, if I use property node to change Bool control status, Event Struture can not accept such a action?
    Why?
    Any solution for monitor variables and controls change which is not caused by user actions.
    *The best Chinese farmer*

    You can use the value signaling property node, if you want to go down the property node route. The best way would really be using user defined events and wire these events to the dynamic event terminal on the border of the event structure. You can check out the examples that ship with LabVIEW to see the VIs that you would need to accomplish this task.
    Hope this helps.

  • LabVIEW 7.1: menu driven event structure question: How can I cause an event case to fire when either a boolean object or a menu item is selected without polling?

    I am using an event structure to eliminate the overhead associated with polling from the GUI. I have build cases associated with each front panel button, and would like to programmatically generate a menu for the vi, adding each selection from the menu to its associated case. However adding a "user event" to a case that is already associated with a front panel button does not seem to allow the selection of the associated user event. Do I have to register each option on the custom menu? Should I programmatically generate the menu and use the same array to register the choices? Are there any examples out there
    that would help me?
    Thanks!!!!
    Steve

    Hello:
    I visited the forum for the purpose of getting some ideas on user
    events architecture. Well, I have to finished standalone working
    modular VI codes one which works as a standalone local control and
    one  which works on a remote communications mode. Now these 
    codes in themselves has event driven capabilities my problem is I
    needed to create another topmost layer VI that will be capable of
    switching between these remote and local operating mode - which I was
    thinking also to be event driven. This maybe a poor idea but I tried
    anyway. Is the User Event loop can be nested? Meaning an event within
    an event thing?
    Regards,
    Berns B.
    Bernardino Jerez Buenaobra
    Senior Test and Systems Development Engineer
    Test and Systems Development Group
    Integrated Microelectronics Inc.- Philippines
    Telephone:+632772-4941-43
    Fax/Data: +632772-4944
    URL: http://www.imiphil.com/our_location.html
    email: [email protected]

Maybe you are looking for

  • How do I create a PDF for iPAD that can open other files on the iPAD?

    I have a PDF that has embedded PDF's & links to external MP4 video & Excel files it works great in Windows... Can I make this work on an iPAD? If using embedded files won't work can I make the PDF's external files & have links to open them? Really ne

  • OBIEE 11g - Data Fetch Issue.

    Hi, I am facing this weird issue regarding data fetching while executing Reports in OBIEE 11.1.1.5. When I login to the BI user interface and execute any report for the first time, everything is working fine. Bt after that I am not able to execute an

  • Unable to create relational connection in IDT

    Hi, I am trying to create a Relation Connection in IDT. but i m getting the following error My System is: SAP BO 4.1 SP1 I was able to connnect when i made the connection through Super User. but i get the error when i make it with my ID. There is som

  • Download speeds, 600kb/s via speedtester, but only...

    Hi all, Does anyone know why Im getting download speeds of around 600kb/s via speedtesters and the Binary newsgroups, but via hotfile, megaupload and rapidshare (have premium accounts for all) i'm only getting 30kb/s ??? Im baffled completely !! Are

  • Max  date in analytic function

    I have records that has repeating load dates. I would like to pick the records that has the maximum load_dates. My source data looks like this - ( select 60589 as C_number, to_date('01/08/2012','DD/MM/YYYY') as load_dt from dual union all select 6076