Mischief of structure event... suggestions?

Hello

I wrote my first "involved" application that will have the data and control an arbitrary number of instruments; my code uses called asynchronously queued message manager type screws and VI models to allow easy reconfiguration before and during execution. These are loaded dynamically into the Panel before the main VI on the selection, and control of these screws past only secondary.

I use the event structures and events user to manage events of the façade and other data passing through each of these VI, and I am very confused about some of my curls event expose the behavior.

For example, in some cases a user event generated to stop a loop of events fails to trigger a reaction from the structure of the event, which would continue to expire. This behavior has occurred irregularly and sometimes my finished well, loop that led me to believe it was a conditions race somewhere in my code. This problem has been fixed in each of the guilty screws by placing the event logging for the user event inside the Subvi to initialize even which created the refnum event. However, I still have no idea why this fixed the problem, or why it was produced in the first place.

Currently I see a similar question when instead of a user event, the structure of the event does not meet the value change events in a control.

I would fix the code, but I was unable to reproduce the behavior in a trial screw I wrote to probe this behavior, and I don't see how posting one of my asynchronous screws would be useful unless I posted the entire application.

Please give me suggestions if something comes to mind!

Thank you!


Tags: NI Software

Similar Questions

  • Response time of Structure event & simultaneous execution of events

    Hello. I built a VI using the structure of the event. Whenever I press a button to start the program (for example, I press "w" to the throttle), the indicator does not respond immediately. Is it normal for the structures of the event or can I do? Another problem I have is when I am pressing on a button, I can not press other buttons to work simultaneously (for example, I press "w" to the throttle and yaw "d"). Is there a way I can change this? Please advice.

    Thank you

    Hello

    Watch what you do with these business structures.

    Better, you can use in the range and force.

    Already done this for you well, there's also a better way to come of age this another case structure on the right.

    You had no timeout in the structure of the event, so he'd be stuck in this case.

    As its name suggests doesn't work if the key is down for a little while has added another key case down, repeat.

    I found something strange to the w, a, s, d keys allow you to the stored value but with to the up, down, left, right you set back to 0 after releasing.

    Koen

  • void / buttons vi of the single of structure event during the first round.

    I have a project that contains separate programs. In the past (for 15 years), I develop a 'main Menu' which uses a structure of producer-consumer (events). The user selects "Program 1" says event loop of consumer to open "program 1". Program one opens, running tests, exit button returns the user to the main Menu. All programs are maximized, open front audio, closed when finished, etc.

    It is the first project that I did in LV 2013 as it and now it does not work. If I go back to the main Menu and reinstate the program 1, none of the operator buttons don't market, which are supported in a loop of event also structure/consumer.

    No variable is passed to and from the main Menu. Each separate program uses the structure of consumption of the producer with an additional of 10 ms loop that reads/writes on DAQmx tasks. All tasks are closed and removed to exist, the queues are closed.

    I'll continue searching for a solution in the discussion forums and knowledge base but if someone sees what I'm doing wrong, please let me know!

    Thank you.

    I put this little sequence before I call the initialization block and now it works... Usually I initialize my variables in the block of initialization, but for some reason that this program doesn't. My producer loop check for "first time" so that they do not give up so I don't know why it has to be added.

    Seems to work but I'm going to run the whole project a couple of times to make sure.

  • Problem with nested structures event

    Hello

    I'm rather new to Labview and I wanted to use a structure of nested in one of my programs at the event.

    However, I seem to fail to do things.

    I created a minimal example of construction that I use, you will find in the attachment.

    The idea behind this program is as follows.

    1. I have run the program and go into a while loop

    2. once I have hold down a button on front of a counter is increment every 100 ms.

    3. when I release the incrementing buttun stops.

    However, this does not work. What I am doing wrong?

    Thanks in advance!

    Never stack event structures. Never ever.

    That being said, your code contains a lot of illogical parts, for example a queue time when using a case of 0-timeout event.

    Please use a unique event structure. Where growth is expected to run, set the timeout case e .g. 100 (using the shift register) and once it is based again on set it back to-1. Initialize the shift with-1 register.

    Also avoid using references and nodes property to read/write the values. These are bad practices (in most cases) and bury a lot of run-time performance.

    A second shift register allows to keep the numerical value and increase the value in the case of timeout. Update of the terminal after the structure of the event.

    Norbert

    EDIT: My first line is a rule of thumb. With the increase in the skills of LV and appropriate design, the stacking of the structures of the event is possible, but you must know the rules. If this isn't the case, you won't fail hard.

  • Copy a structure of event containing local variables

    Hello

    I am a state machine design in Labview and next state transition logic to wait be clicked a few buttons on the Panel.

    If I press a Boolean button from 1 to 9, next State should be X, otherwise condition (10 to 16 tags) should be there.

    I thought that the right approach, because it would be a structure of the event, where I added two cases: case 1 (button 1: mouse to the bottom button 2 down,..., 9 of the mouse down) and box 2 (10 mouse buttons down,...). For each of these cases, I'm reading & writing the local variable of some double digital.

    When I copy the structure of the event in another case of structure of outer case, I note the following: all cases in the event loop is missing, and the local variable renamed automatically and a new created indicator digital.

    • How to make an exact copy of the structure of the event, without the problems described above?
    • Could you suggest a different approach more effective than mine?

    Thanks for any response.

    Start by reading the guard and recommendations for using events in LabVIEW - LabVIEW 2011 help

    The fact that you try to copy and structure of the event to another, and that a structure of the event will be buried in a case initially tells me you are already heading on the wrong track and yourself in creating a world of problems.  Your architecture will never seem to work for you.

    The event structures are always active and capture events.  Even when the structure of the event is not in the path of execution, it's queue of events to which he attributed to him.  If you have events that are set to lock the façade until full, then you're really screwed because the event structure will capture the event, locking of the front panel and the execution path of your code with the state machine may never come to the specific case that has captured the event to support then release the façade.

    In general, you should have the structure of a single event in a VI, and should not be buried in a case structure where he can never carry.  You also shouldn't have several event facilities manage the same events.   These are not hard and fast rules, but until you are quite familiar with how the event structures work and completely understand the architecture of your code, you should not violate or you will just ask trouble.

    Similarly with the help of local variables.  The fact that you say that you have local variables and you try to copy tells me that you already have too many.  There is certainly a better way to build your VI, which does not require local variables with the exception of a few cases and certainly won't need several structures event buried in the structures of the case.

    You should probably have a producer/consumer architecture that handles the events.  Have a simple loop with a structure of the event which captures all user interactions.  Pass events to a loop of consumer who is also your computer through a queue of State.  (Also known as a computer state in queue or the BAU).  Let the state machine to determine how to manage the events, he received based on what is the current state of the VI.

  • Impossible to manually stop the structure of the event

    Hello

    I have a machine program fully functional State to control a stepper motor.

    However, I face a problem where I'm not able to break the inbetween the delivery of the program by clicking on the stop button to loop MANUALLY.

    I don't know why he can't go out to user input.

    Uggh. I typed a response to your note here, but NEITHER website timeout kicked me and I lost everything that I typed.

    Words RavensFan is shown in the picture as an attachment, you must uncheck this option on any of your structure of events so that it does not lock to the top of the face.

    But, more important even than Lynn and other people mentioned, you have a big problem with your implementation of design.  My previous example was to show how builds to a state machine can be made clean/nice/efficient/etc.  I have two monitors 30 "on my Mac, and your block diagram extends as well in my second monitor! :-)  (I'm a bit of a clean freak so I like things to look nice and son arranged properly / in straight lines, wireless useless intersection/etc - anything that makes it easier for yourself and others to see the drawing).

    Sorry, back to the basics - you should definitely follow the advice of Lynn on the use of model of consumers/producers (events) - a simple start would be to separate your structure events in its own while loop that runs parallel to your line up.  With this, at least you run structure of events at regular intervals.  Another strong advice is to simplify your design so that you do not use nested (another inside) design of State machine. I have several decades of experience in LabVIEW and yet I stay away from this kind of complication, because it only causes more problems that you grow your design. Why not just add more cases to your state machine design existing rather than adding a nested state machine structure inside?

    -DP

  • Two loops of event Structure: hang

    Hello

    I have a wired problem when I try to use two loops with two event structures (see VI below).

    The problem is that you can stop the measurement and close the VI with X but not to stop it only with STOP button: this would lock the façade.

    Here my (rather long and perhaps not quite understandable) description of VI:

    A structure must respond on the user interface and the other a certain action. The first uses only user events: change value button START, PANEL NARROW? and the value enum STATE changes. The second event structure uses those registered dynamically: start the event user & user close event. Action when the STATE changes from button should always be done. When you press start the startup user event disables the START button and activates a loop in the second structure that should make continuous measurement. Now, we can always change the STATUS button and information (this works). The measurement loop should stop if the STOP button is true. Later START is enabled again and we should be able to press START again. It does not work as the front panel is locked. Curiously the last implemented user action works very well: by pressing X of VI, the PANEL CLOSE? is called in the first loop and should stop the two loops: If the measurement loop is running, STOP is True first, stop the loop measurement. Then a secondary structure event waits until the JUDGMENT is again set to False. If the measure is not in the process of running the first loop stops. In both cases, the event close user is sent to the second loop, successfully stop.

    I'm really confused, because I have no idea what is wrong. I would greatly appreciate any help on this.

    Best regards

    Daniel

    Thank you very much! This solves the problem. I did not understand that structures of events queued events even if they are not "active".

    (Finally there is even no need one notifier, you can just change the value of the real STOP button and will raise the event close user, comapare attached, work VI)

    Thanks again,

    Daniel

  • a few seconds "turn on", how can make I make in the structure of the event

    Hi, friends of LabVIEW

    I want to leave user click and hold down a button for a few seconds to turn on a device. Using registry item and history of shift I can make it work. I wonder how to implement it with case and structured event. Which case should I choose? mouse up?

    I have attached the test code as well.

    Thank you.

    I'm sure there are a lot of possible solutions, but here's a way to do it with a structure of the event. Mechanical action of the button is "Switch release." Pressing the button disables the output and sets the timeout of the event at certain time structure. The timeout event switches the output to true. Any other event resets the timeout to-1 value. Unfortunately, it seems that the tool gets messed up the image, so the VI is thus established.

  • Event Structure Weirdness

    Last night, SAP posted an interesting question on his blog (The Daily CLAD).

    In short, we create a dynamic event, enter it and generate two events with the data being 1 and 2.  Then we travel a structure of the event that is registered for the dynamic event.  Inside of the event is another structure of event which is also on the dynamic event inside a loop set FOR to run twice.  The data of the event was autoindexed and went straight to the final output.  Now logic would state that the output should be {1,2}.  But when I run it, I get {1,1}.  I thought it was really strange.  So of course, I got to play.

    I changed the buckle FOR to run 3 times.  Oh, it is here and waiting for another event.  If it is to see two events, as it should be.  It's just that for the second event data is not transmitted correctly.

    But let's play others.  I put another LOOP around the external event structure and did run twice.  He does not see the second event at all (that is to say, is there and waiting for another event on the second iteration).  Why not?  It is registered for it?  He saw the first event?  Why wouldn't it the second event in its queue?

    Now if I remove the inside OF the loop and let my loop FOR external, everything works perfectly as I expect.

    Now, it becomes even more strange.  I added a button and changing the value for the button of my external event structure (the two structures event with loops to go twice).  The structure of the external event is also ignorant of my button value change event.

    OR, what the #* $& @* is happening here?

    The problem is not with nested structures event, but with the shared record refnum. An event record refnum should belong only to a single event structure. As soon as share you, you get undefined behavior. It could work very well, he might behave in a totally random way.

    Example of David is wrong for the same reason. He may have worked when he ran, but it is not something that must be invoked. The structure of substantive event should have a separate record node.

  • When to use the structures of the event

    I wrote several applications using the state machine architecture.  Generally, these applications have two buttons (I created), a race and give up.  The abort button interrupts the guide and goes to a State of inactivity which loops until the run button is selected.  One thing that I don't like, my programs ending up with one or more local variable for the Cancel button.

    (1) should I use structures event for these types of programs?

    (2) is a program of event also structure a state machine?

    Why would you need local varables for the button abandon? Do simply lock action so it resets automatically.

    If your loop by turning in any case (e.g. for updating views) migh ask both controls. Any necessary event structure.

    ggress1 wrote:

    (1) should I use structures event for these types of programs?

    (2) is a program of event also structure a state machine?

    The event structures are mainly for the manipulation of interaction of the user on the front panel. I encourage you to learn more about the structures of the event so you can make an informed choice on the best architecture of code for a particular programming problem. Maybe you should show us some of your code so that we can decide by using the event structures should improve things.

    A program with event structures is generally much less forgiving of the rookie mistakes. Used properly, they can easily lock your program.

  • event structure vs case structure

    I am developing LabVIEW: tool of control and vision. Front Panel has a lot of buttons, each button will execute a single or a group of the screws.

    I found that:

    1. event structure is good for digital change. i.e. the user change a corordinate and motors are moved.

    2. the structure cases is suitbale where such that use click "run MTF", a case structure is executed to calculate MTF.

    I tried to use the structured event to pick up button click but it isn't reliable workign, such as the user clicks too quickly and LabVIEW does not record events or LabVIEW records the event even twice

    However, I have a number of clicks functional structures. My block diagram will be uncontrollable.

    Any idea/tip/trick be greatly appreciate!

    -best

    If you understand how LabVIEW works and understand the principle of data flow, what I'm going to say the will of sense.

    The idea of a Structure of the event, it's that he's sitting there, don't take no time CPU until an event (usually a change in a Front Panel control) takes place.  Then he does everything you ask in its event arguments.  The trick is to do almost nothing in the structure of the event, but to say another loop, running in parallel, to do something.

    The key here idea is you have two loops, running in parallel, independently, at their own pace.  One, the event loop, waiting for an 'event '.  When it happens it it "sends a message" to another loop (or loops) that make treatment (which may take some time) as defined by the event loop.  The point is that it is very fast to send him the message (which is usually done via a queue), so the event loop is able to respond much more quickly that the user can push buttons on a façade.

    However, when the hands of loop event off the Message 'go do this task' another loop, the task may take longer.  If the tasks are put in a queue and then they get finished, the next task is running.  The key thing here is that the two loops, the loop «Ask» (events) and the loop ' Do ', run indepedently and at their own speed, nor dependent on the other.

    Bob Schor

  • Create shortcuts to control in the structure of the event

    I create a structure event with radio buttons dialog box.  Is it possible to create shortcuts to select each option button, similar to the underlined letter to windows?  I use a chain with keyfocus = true control to change the radio button selection, but when the user moves elsewhere, focus is lost.  Is it possible to set the focus without control of the chain in the case of delay of vote when the focus is lost?

    Because it is universal... to capture the key event seems to be the best choice.  Mostly because I wouldn't give up my function & the tab order.  I also added a second table of char ASCII codes to search and manage shortcuts of capital letters.  Thank you!

  • conditional of the loop will not control read in a business event

    I made a simple conditional to the loop, with a timer and a generator of random numbers in the loop as a stop button attached to the conditional stop Terminal.  Everything works well and stop the loop when I click on the stop button. But I then wrap the conditional for the loop with a structure event and create an event to run the conditional for the loop.

    To my surprise, when I run this updated VI I can never get the loop to stop via the wired button until the conditional terminal stop.  How is what happens? And how to do this?

    change the case of the event > UNCHECK block façade up to the case of finishes (or whatever this text indicates actually in the lower left corner of the pop - up of the event edit)

    (~ ~ ~ oh-Magic 8-ball ~ ~ ~)

  • Trigger several events to a dynamically saved value of signage

    I have different controls for some pumps.

    I want to stop all with an emergency stop button.

    I use the event Structures to manage the user controls.

    In the previous version of my code, I register all events statically in the same vi. But to make the program compact and modular, in the attached version of the code, I use the references to the controls, and I go to a Subvi. In the Subvi I record the events of these references and I link the "event recording refnum" to the terminal dynamic events of the Structure of events.

    Everything works with the exception of the emergency stop.

    I can't use a reference of the emergency stop button to trigger the event, because the emergency stop opens the other files in vi for further confirmation from the user.

    When the emergency stop is confirmed by the user, I use the value property of a signalling to trigger the event stop of all structures event of the subgroup on the screws that control the pumps.

    Previously, I had only a single value of signage to trigger several events, but I saw that I have create the condition of critical competition and the Structure of events first, which handles the event, removes it from the queue, and other Structures of the event can't get the event.

    So, I use as signals of many boolean value pumps as much as I.

    But it does not always raise all events.

    Another detail, it is that I do not use the "Unregister for events function" in all the screws under that have Structures of the event. I saw no difference with this function, or without him...

    Apparently, Miss a clue of a general principle of LabVIEW.

    I join all of the template project.

    The main.vi starts the program.

    The problem of this thread is re-posted more clearly and it is resolved here:

    https://forums.NI.com/T5/LabVIEW/static-vs-dynamic-events-some-dynamic-events-are-flushed/m-p/318239...

  • No response to the events of the cluster.

    Hi all

    I am preparing for the CLD and find a problem with the exercise of ATM Simulator as shown in the attached file.

    Please follow the below steps to reproduce this problem.

    1 extract the files.

    2. open atm.lvproj, and then run main.vi.

    3 press card Simulator to enable user input.

    4. put 12345 in user input, and then press ENTER.

    5. left and right menu will display its function and you should be able to press the left and right, but they have no answer to your intervention.

    If you have an idea, please share it with goodness.

    Please note that I use LV2010, but I'm going down my code to 8.5 so that we can share more.

    Sincerely, Kate

    There are serious problems with dataflow doe to wrong choice of program design.

    You shouldn't ever have event inside the strctures case structures, especially structures event, each in a situation different from the structure of the case. Event structures are not dataflow leads, so they queue of events even if there is now way to the service of the event due to issues of data flow. Your events are defined to lock the front until the end of the event, so any event that cannot be handled by the program crashes to the top of the façade for ever.

    So: Get rid of the box structure and use a structure of single event with several instances of the event. That should be all you need. The structure of the event should be directly on the diagram of the while loop. Simplify! Put your business structure housing unique timeout and modulate the duration of the time-out period by an if necessary shift register.

    A good tool is also highlighted. Use the VI while looking at the chart in Slow Motion. You'll see where it gets stuck.

Maybe you are looking for