About user event

I have a basic question about  a user event (UE).
I got to know UE needs at least two "while structure" (for main event structure and generate UE).
Even In this case, is there still some advantage such as reduction of CPU time and guarantee the interaction of block diagram?
Cast a glance at two while structures, what is different thing with normal while structure?
according to NI document at http://digital.ni.com/public.nsf/websearch/86256A47004E16D286256B490060C5A1?OpenDocument
it seems to exist the limitation of using event.
What else in using Labivew?
메시지가 09-09-2005 05:39 AM에 labmaster에 의해 편집되었음
Attachments:
user_event.vi ‏42 KB

First of all, yes event structures are not only in the "base" version of LV. But given the number of other things that NI excludes from that package I can't imagine anyone doing any sort of serious work with it. I've always seen the base version as a very high-priced demo package...
Second, if you structured a real program like that example, there would not be much reason for using events. However, most real applications would typically only have just the one loop to handle the event. The event would be triggered in either other VIs (by passing the event reference to them as a parameter) or in other events in the same VI. The attached shows one such possibility... With this you type characters into the input string until you press the return key. The code detects this character and generates the user event to transfer the data to the output display. Replace the output string indicator with a VI that sends a command string to an instrument, and you can see why you might want to do this.
Third, never forget to incorporate error handling in event structures, other wise you can be left in a situation where you can't exit the event loop because an error prevents you from generating the event required to exit.
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
Attachments:
user_event.vi ‏46 KB

Similar Messages

  • Responding to two user events with same name

    LV 2013, Win 7, & LVRT 2013, PharLap OS
    I have a situation where I create an ARRAY of User Events, one for each "domain" .  
    A "domain" is an area of DAQ: there is a SCXI domain, a CDAQ domain, an EtherCAT domain, several domains dealing with TCP instruments etc., about 25 domains all told. The name of the event is "New Channels This Domain".
    When a new configuration comes to the PXI from the host, I sort out the channels by their domain and generate a user event for whichever domains have channels that have changed: more channels, fewer channels, differences. If a domain has no channels that have changed, I do not generate an event for it.
    There is a handler for each domain: in that handler, I pick out the event for this domain from the array, and register to receive it.  I have an event structure that responds to the NEW CHANNELS THIS DOMAIN event.  Since it is an array, then no matter which domain I select, the name of the array is "New Channels This Domain".
    All this works fine.
    Now I have a situation where it makes sense to have one handler for TWO domains.
    I can pick out TWO elements of the array just fine, and register them both.   (See attached pic)  But now, in the EDIT EVENTS FOR THIS CASE list, I have TWO events called "New Channels This Domain".  I can select one for one case, and the other for the other case and it seems to work.
    --- Is there any heartache ahead with this scheme?  
    --- If I change the events in the clusters before, is it going to confuse LabVIEW?  
    --- Is there something I can do to change the name of the event after I pick it out of the array?  
    --- Is there something I SHOULD do at that point?
    Like I said, it seems to work, but I'm leery of it staying that way - I've had event structures disturbed before (LV2010) when changing cluster order.
    Steve Bird
    Culverson Software - Elegant software that is a pleasure to use.
    Culverson.com
    Blog for (mostly LabVIEW) programmers: Tips And Tricks

    CoastalMaineBird wrote:
    Thanks, Greg for that link.  I gave kudos to the idea of the COERCE TO TYPE function, and it seems like it would do the trick, but as of LV2014 it's still not on the palette.
    My question still remains: is it necessary?  Will the event structure remember that it's supposed to use the SECOND event named "X", through all edits and recompiles?  My guess is no, but I'll listen to alternative stories.
    I've been using the Coerce to type for this and enums in versions 2011 through 2014 since learning about it.  I've seen no issue using it in these cases.  I'm guessing it doesn't behave in an expected way for extreame uses which is why NI doesn't release it yet.
    As for would it always know to go to the second event if they are named the same?  My guess is yes.  They maybe named the same but they have different references.  I would think it would be just like having two controls with the same label.  You should never do this, but if you did, and made a local variables on one and wrote to it, it would always write to the correct control.  It would never write to the different control with the same name.  Now even if this is the case it could be confusing to a developer looking at the code, which is why I strongly suggest having unique names.  But if you don't I suspect every thing would work fine, just have a bold comment or something explaining what each case actually is handling.
    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.

  • User event for array of waveforms with attribute

    I have been transferring data in a Producer/Consumer architecture via User Events.  The data consisted of an array of waveforms. When I added an attribute to the waveforms the code breaks with two errors about Create User Event: User event data type is unnamed or has elements with no names or duplicate names, and Contains unwired or bad terminal.
    From reading the help on user events it is not clear that arrays are even allowed: "user event data type is a cluster of elements or an individual element whose data type and label define the data type and name of the user event."
    From experimentation it seems that arrays of numerics and arrays of wavefroms without attributes work. A single waveform with an attribute can also be used. But an array of the same waveform with attribute leads to a broken run arrow. It also appears that I can put the array of waveforms with attributes inside a cluster and then create the user event.
    Is this a bug, an undocumented corner case, or some "feature" that I do not understand?
    Searching for User Event for Array of Waveforms generates some interesting, but mostly irrelevant results.
    Lynn

    tst wrote:
    Another option would be typecasting, but it looks like you can't typecast a waveform. Variant to Data or Coerce to Type might also work, but I haven't tried.
    I have also done the Flatten To String and Unflatten From String to send data around.  It would be preferable to not need to do that though.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Producer Consumer Subpanels, User events and DAQ

    Hello All,
    I am working on a Producer Consumer application and have beed looking at subpanels for user navigation. The application needs to be capable of responding to user generated events but also manage data received from attached data acquisition and control hardware. This is a 2 part question.
    I need to implement about 15 screens in this application and have started integrating subpanels. I need to be able to navigate from one subpanel vi to another using subvi buttons but dont understand how to build this functionality. Can I build functionlaity so that when I click on a subpanel loaded vi's button it will load the vi referenced by that button and the original dissappears.
    I have a 3 loop producer event template consisting of (1)data acquisition producer, (2) user event producer and (3) consumer loop but theres not much detail, are there any reasonable templates out there? I have seen the data- consumer and user-consumer but no mix of all 3.
    Advice appreciated
    Chris

    I use subpanels to host my display vi's and control them dynamically.  I would have a loop or vi process that manages your subpanel.  You could use user events, queues or notifiers to send messages to this subpanel manager to perform the basic functions such as loading a vi into a subpanel, removing a vi from subpanel (you can remove and stop the vi or keep the vi running in the background or even make it a floating vi.)  A subpanel button can create a local event which in turn could trigger a user event or message to the subpanel manager.  I have attached my subpanel manager to give you some ideas...
    Attachments:
    Subpanel Manager.vi ‏39 KB

  • Dynamic user events freeze user interface

    Hi all,
    I am having problem with dynamic user events.
    Dynamic user event is registered to the event structure, and many dynamic user events come in very fast, about every 30 ms. It freezes up the user interface, no response to mouse and keyboard, even after all user events finish execution.
    Any idea or work around?
    Thanks for any help.
    Anne

    Hi Anne,
    > Dynamic user event is registered to the event structure, and many dynamic user events come in very fast, about every 30 ms.
    The 30ms rate is not unreasonably fast as long as the processing for the event(s) can be completed in less than 30ms.
    What tasks are you doing in the User Event?
    For tasks that may take time to complete (like logging) you could queue up the data and send it to a consumer loop.
    > It freezes up the user interface, no response to mouse and keyboard, even after all user events finish execution.
    My *guess* here is that you got stuck in an event that never completed.
    steve
    Help the forum when you get help. Click the "Solution?" icon on the reply that answers your
    question. Give "Kudos" to replies that help.

  • How to make a simple control value comparison a user event?

    Hey everyone,
    I am trying (with no luck) to figure out how to make an event out of a simple control comparison without having to put the controls inside a while loop to be polled or in the event structure.
    For example; how do I make an event when 'numerical control 1' equals 'numerical control 2'?
    I know that I could have these inside a while loop with the event structure and then wire the comparison to a boolean, then reference the boolean's value change event.  But rather, I would like to create an event for the comparison without the boolean and outside the while loop such that the loop doesn't have to run through the comparison each time, and doesn't have to poll the controls and bool.
    Thanks for the help

    Attached is a simple user event structure that I was thinking about.  Using this you can decouple the control from the comparison, it just works on valye comparisons.  Since it uses the event structure there is no polling and is very CPU friendly.  I have allowedfor the comparison to be linked to the "Value 1:value change event" and the compare button true event.  I hope this is what you were looking at.  Also since it is a user event which is dynamically registered you can register/unregister it at will durring execution making it a flexable event handler.  It might be alittle buggy because I have spent about 3 minutes developing it (particularry when passing values into the event structure there might be a state issue from the data flow so local variables are a better choice)
    Paul
    Paul Falkenstein
    Coleman Technologies Inc.
    CLA, CPI, AIA-Vision
    Labview 4.0- 2013, RT, Vision, FPGA
    Attachments:
    CompareEventvi.vi ‏49 KB

  • Starting/Stopping a polling loop with a user event.

    I keep reading on this forum that placing a loop inside a user event structure is a bad idea because it disables other user events from triggering.  However, it seems like a good idea to be able to start and stop a loop from a user event (like a button being pressed or de-pressed) and it seems like a good idea to not have the loop waist CPU resources while it does not need to be running.
    So what are the solutions to this?  Is a notification the best approach?
    Attached is my solution.  Is there a more graceful approach to this problem?
    Aside: Why are boolean controls that are of the "Latched" mechanical action always pressed in after their event fires?  For instance, the stop button on the attached VI?  Shouldn't it be depressed after the user clicks on it because it is "Latch when released?"  I've always wired "false" constants to 'variables' of these controls after the event structure fires, but do not find this approach very graceful.
    -Nickerbocker
    LV 8.5
    Attachments:
    Wait for Notification for Polling Loop Test.vi ‏25 KB
    wait for notification for polling loop test.jpg ‏61 KB

    Nickerbocker wrote:
    If an error is generated on the first itteration, then the loop is terminated with that error line.  Right?
    Wrong! The loop cannot terminate until everything in it has terminated. RIght now it will stall at the event structure no matter what until an event occurs. At this time it is sufficient to get the error piped through the event structure. If you are worried about an error in creating the notifier (anything that happens before the loop starts), you shold place your entire later code inside a case structure wired to the error so the loops don't even start.
    Nickerbocker wrote:
    Can multiple event structures exist in the same block diagram?  For some reason I was under the impression that there could only be one event structure that fires at one time.  If that structure was in execution then no other Event Structures could fire....  if my information is wrong, then I like your solution.  If it is right, then I don't like your solution .
    Your information is wrong again. You can have as many event structures as you want, and all is well as long as all event structures can execute in parallel. So make sure they are in independent loops.
    (If you would place two event structures in the same loop, both must trigger for the loop to complete the iteration, probably something that does not make a lot of sense. So don't do that!).
    LabVIEW Champion . Do more with less code and in less time .

  • Xcontrols and dynamic User Events

    Hi all,
    I'm trying to build a XControl with an Event Structure that accepts User Events generated by a separate parallel loop on the block diagram.
    A monitoring loop with its own Event Strucure on the block diagram seems to handle the User Events generated by my producer loop but the XControl seems to ignore the User Events.
    Example LabView 8.5.1 project is attached
    Any ideas?
    Attachments:
    XControl.zip ‏75 KB

    Hi Anne,
    > Dynamic user event is registered to the event structure, and many dynamic user events come in very fast, about every 30 ms.
    The 30ms rate is not unreasonably fast as long as the processing for the event(s) can be completed in less than 30ms.
    What tasks are you doing in the User Event?
    For tasks that may take time to complete (like logging) you could queue up the data and send it to a consumer loop.
    > It freezes up the user interface, no response to mouse and keyboard, even after all user events finish execution.
    My *guess* here is that you got stuck in an event that never completed.
    steve
    Help the forum when you get help. Click the "Solution?" icon on the reply that answers your
    question. Give "Kudos" to replies that help.

  • Missing dynamic user events across VIs

    We have a sub-Vi Statemachine.vi, which has its own event structure with a 5ms time-out, everything enclosed into a loop.
    This sub-VI is called repeatedly from the main application with command lists to execute. This can be a longer list or e.g. an empty list.
    It turned out, that we can miss successfully sent events, despite the documented internal queues.
    Placing the event structure into an added parallel executing, non-terminating loop in the sub-VI seems to help.
    Is there a link to further informations about this behaviour? We are using a german LV 8.2.1.

    Martin,
    I don't know of a good document describing the use of the user event in the way the you and I are using them.
    I've learned from bits and pieces lying around and my collegue. After using it for two years now I have a framework in which the use of user events is relatively easy.
    I know this doesn't help you a lot, but I know that if get the hang of it, it will provide a good and usable architecture.
    I hope the attachments helps you a bit. It is the way I define user event for inter process communication. It will get rid of a lot of wiring.
    Kind regards,
    André
    Regards,
    André
    Using whatever version of LV the customer requires. (LV5.1-LV2012) (www.carya.nl)
    Attachments:
    Event buffer.zip ‏13 KB

  • User event unvoluntarily unbundles a cluster

    Hi
    I try to send a user event to another loop and come a around a curious feature(?).
    If I create a user event with a data type "cluster (of bool in this case)" the receiving end unbundles the cluster.
    I'd rather have the cluster as such to foward it internally  at the receiving end.
    Is there a simple way ?
    Of course you may envelope the cluster in another cluster, but that seems not really clean to me ?
    using LV 2010
    Thanks for any ideas
    Gabi 
    7.1 -- 2013
    CLA

    Thanks Matthew for the link to that ongoing discussion.
    It is sometimes a bit tricky to select the proper keywords to get to right thread.
    Well, I found out about the packing into another cluster before, but as said (l.c.) it is messy and unclean.
    But thanks anyway. I'll definitely vote for that option.
    Gabi 
    7.1 -- 2013
    CLA

  • About Business Events

    Frntz,
    In Normally workflow I had created few wft files and completed it sucessfully and Now I need to know about Business events in Oracle Workflow.
    Does it required to login as SYSADMIN to create an event or else is there any more options available in it.

    Anyone who has the workflow administrator role assigned to his/her user can see create/update Business events.
    Navigation is :
    Login to Oracle Applications -> Workflow Administrator -> Administrator Workflow -> Business Events.
    Please make sure that the application in which the business events( seeded ) exist should be licensed and its status should be enabled.
    Also you need to make sure you have subscriptions to partciular events. The same also needs to be licensed and status should be enabled.

  • Need help with basic user events in Queued state machine example

    I have written a little queued state machine example to try to teach myself about creating and using user events.  The objective of the machine is to periodically choose a number (I'm doing it now with a control instead of a random number generator for troubleshooting), and compare that number with the number I have set in a control.  When they match, I want to cause an event to fire so I can do something about having found a match.  The examples in the LV Help file references show the events within the event structure, but I want to reach out of a state and cause an event ....
    Can someone point me in the right direction here?
    Thanks
    Hummer1
    Solved!
    Go to Solution.
    Attachments:
    User Event Generator Example01 snip.png ‏102 KB

    Yep....That was it...I had tried to do that but got fouled up with the variant definition...so defined the user event using a boolian and did the same in the case structure where I wanted to create the event and it worked great...
    Thanks.
    Here is the final version...not bulletproof, but does have a queued state machine using a user event to cause an event to fire.
    Hope you find it useful.
    Hummer1
    Attachments:
    User Event Generator Example01.vi ‏45 KB
    Operating States Enum Example01.ctl ‏5 KB

  • Making an array of different user events refnums?

    Hello all,
    I have a question about dynamic user events. I have 6 different users events which I create, and would like to put into an array. (Such that I can use them in a For loop laters, taking off one event per loop and assigning it to a control of a vi) So far I haven't found a way of doing that since if I just wire the user events refnums to an array I get broken wires. (Similarly if I wire them to a build cluster structure.)
    I think that you'll understand what I am trying to do if you look at my labview code in the attached vi.
    In the vi I create some user events, and then wire them to the control of two vi's which will communicate to each other using these events. In the code you will see 6 Invoke Node structures where I use the "Ctrl Val.set" to pass the events to the two vi's. Obviously this is the wrong why of doing things. Since if instead of having 6 events I had 100, then I would need to put 100 Invoke Node structures on the block diagram (making it very large compared to the size of my computer screen!). 
    So what I would like to do, is put the user events refnums into a array, then put the one Invoke node structure into a For loop, and index the array to assign the events to the vi's programmatically. 
    Is there anyway of doing this? Or is there an alternative (/ better way) to what I have done?
    (Baisically I have 2 vi's that run in parallel and communicate to each other using user events. I need to pass the events to both vi's, how do I do it in the minimum of mouse clicks, and minimum of screen space.)
    Thank you!
    Paul.
    Solved!
    Go to Solution.
    Attachments:
    CameraTempControllerRunner.vi ‏49 KB

    I haven't created any new messages since the forum changed over, so I'm not sure.  But check on the menu under Options on the upper right.  I think there is a way to undo your choice and put it on another.
    Kudo's have replaced the stars.  Anything that was 4 or 5 stars is now equivalent to a Kudo.  But with the old system, anything less than 5 stars was essentially a negative opinion in the ratings.  So to simplify the multiple shades of gray (1 through 4 stars essentially being some degree of a negative) and to just eliminate the negative aspect altogether, the Kudo system was born.
    I don't know if the "Accepted Solution" designation does anything to help the person whose solution was accepted, but having that designation helps people searching the forum because they have the same problem find the answer quicker.
    Message Edited by Ravens Fan on 10-06-2008 10:15 AM

  • LabView user-event from external dll source

    Hi!
    I'm dealing with the following issue:
    I use a CAN sniffer device, wich sends data over USB to a PC. The main goal is to create a vi that can process the incoming data. I already have a vi wich works with polling mechanism. It calls external DLL functions with the "Call library function node". The main problem is the polling mechanism.
    I would like to recreate this vi so that it would work event-driven. I have an other application, written in C++, that does the same thing, and it gets interrupts from a DLL, when a new data is available in the input buffer.
    The callback mechanism is implemented in the DLL.
    In LabView I would like to do tha same thing. There is the "event case structure", but there is no option for defining such user-events, that i would prefer.
    I have found a similar topic, there the solution is "occurrences". The occurrence is called from a DLL, too. But this solution uses the "waiting for occurrence to set", that is an endless-loop-like thing.
    The other thing I've found is the ActiveX and .NET events. I don't know, probably that is the solution.
    Anyway: is there a possibility to create such events, that can be generated from a simple external DLL and can be handled by "event case structure"? How should I do this?
    Or how NI does this? I mean that NIs DAQ cards must use some similar methods for data processing. Is there some tutorial or support about it?
    Thank you for your answer!

    2716jag wrote:
    Hi Wiebe,         From your answer i have a doubt that What it exactly means "If the dll is used from within LabVIEW". Also i want to know Is there any way to access the functuions defined in the .SYS file in Labview Environment. Regards,Jagan Can you be a litte more specific with your first sentence. I have no good idea what you mean. A .sys driver is usually a kernel device driver. This driver has to be started and run in the kernel subsystem which LabVIEW can not access directly. Such a driver is initialized using the CreateFile() Windows API. The returned handle is then used with other API functions such as ReadFile(), WriteWile(), DeviceIoControl(), and finally CloseHandle().Theoretically you could call all this APIs directly from within LabVIEW using the Call Library Node. In practice you do not want to do this even for fairly simple kernel drivers since the parameters for those APIs do get fairly complex in most cases, and you usually do also want to have some sort of asynchronous operation using events or such to make the driver access user friendly. All these things are most easily handled in a user space DLL written in C that exports a more LabVIEW friendly API that you can then import into LabVIEW using the Call Library Node. Usually most kernel device drivers do come with a accompagning user space DLL already, as this is the only sensible way of accessing such a driver. So you can usually look for the documentation of that user space DLL API and go from there trying to import that into LabVIEW using the Call Library Node. Even then it may not be easy at all if that API uses complicated function parameters and even completely impossible if it uses callbacks or such, requiring you to write a so called wrapper DLL that translates between the native API and a more LabVIEW friendly API.  You don't have to believe me but I can guarantee you that if writing such a user space DLL or wrapper DLL is beyond your capabilities, trying to go directly about accessing the Windows APIs in LabVIEW to access a kernel device driver is going to make you squirm in real pain. And those knowing how to write such a DLL would never even consider spending the time to try to access a kernel device driver directly from LabVIEW. Rolf Kalbermatter

  • Named User Events? - NOT using labels

    Why do user events require the event name be pulled from the label of the item wired to the create user event VI? I am looking to use user events which the name of the event may be wired separately to the create user event and register for event VIs.
    If I have a data store with 1000 variant items in it. I want to create an "on change" event for each item in the data store. All of the items have the same data type.. a variant or some cluster of info.. and a different name. Other tasks can then watch for a specifc item to change by registering for an event with the same name and type. However, I certainly do not want to waste my time creating 1000 constants of the same type just to wire it to the create user event VI. (The actual names in this application may be built at runtime) I also do not want the tasks to have to watch for a common event that triggers whenever any item in the data store changes and then have to filter out what is relevant to the task. (this wastes resources)
    Why can't the user event and register for event functions just use the type of the data and let the name be passed in separately like queues do??
    Can NI provide me a simple patch to do this?

    "is using only one event ok for you? You can generate this event everytime you write data into your buffer. If your event is of the type string, the you can send whatever data you need with the event (name, value, ...)."
    This works, but I'm concerned about the performance hit / scalability of waking up every single task for no reason whenever anything changes just to realize it's of no interest and go back to sleep. Lets say there are 25 tasks. Each task is registered for one of 1000 items. Higher rate data may be changing which none of the tasks are interested in... Not very efficient to have one common event. 
    "rather than pounding on an event structure to change it's shape, how about using "named queues"?
     Instead of the event in a loop you check the queue in a loop and if there is something there handle it like it was the event. You can set it up to either do it witha zero timeout (polling) or the loop can sit at the "Dequeue" until something is pusshed to the queue."
    The current implementation is named queues. Yes this works, But what am I doing.... Using a queue to implement an event........ (why should I have to do this?) If you call a generate event and nobody is registered, nobody cares. You have to add logic to determine if you want to put an item on a queue in case nobody is listening so that you don't build up the queue..
    "The type def is created as a constant via right-click menu on the wire coming from Create User Event. Just the label changed."
    This is an interesting trick.. However, it still requires me to create a constant with x unique names. I guess I will have to do some testing to see if the events created in a loop are unique, but have the same name, or are truly the same event with unpredictabel results for creating many with the same name. (unless someone already knows the answer) ... If they are truly unique, but have the same name, I could use this for tasks that register for only a few items... Still rather cumbersome for tasks that need to register for many.

Maybe you are looking for

  • App Store. Could not sign in. An unknown error has occurred.

    I keep getting this message on my iPhone 4, iOS 6. Every time I try to update my apps after I put my password. Have not changed anything on the phone itself, it just started doing it a few days ago. My iPad, Macbook and iMac with the same account do

  • How to open the FPM (pcuigp_xssfpm ) used in CATS application ?

    Hi All, Can anyone help me out in accessing the above mentioned FPM ( pcuigp_xssfpm ) as I am new to Java webdynpro and dont have working experience in FPM. My actual requirement is to tweak a litle with the standard SAP ESS application CATS ( record

  • Clock and date

    Hi. Everytime I shut down my lap top the time and date also stop. So each time I turn on my computer I have to go into the control panel to reset the date and time. Not sure why this is happening? It is each and every time.  This question was solved.

  • Photo changes tones when i add a new Stamp Visible Layer!

    When i make adjustments like for example adding a Posterise layer! lets say i would like to Stamp visible, shift+alt +command+E for mac. My photo changes tones slightly!! Why does this happen??

  • Quote in file name

    What is the correct way to copy and rename files whose names contain the quote symbol ? my script fails due to extra quotes. See extra quote right before the .soholb. Thanks for any hints ! tell application "Finder" DUPLICATE "Databoat:Words:Labels:P