Event structure help, basic execution

Hello,
I am a new user of the event structure and have a very basic question. I am trying to write a program to control some GPIB power supplies that executes intial user settings (voltage, current limit, etc.) a single instance before stepping into an event structure.
Once inside the event structure, the timeout event will be infinite, and the program will only update when there is a change to any of the front panel controls. The problem with my current approach is that I am rewriting the same code twice. Once, before stepping into the event structure, and a second time when the user front panel controls change. Is there a way to incorporate the initial code to execute only a single time in the event structure shell? If so, how do I go about doing that? I don't want to put it in the timeout event because I would like to avoid having the program refresh itself unless a front panel control changes. But I do need that single intial execution. Any help is appreciated. Thanks!

You can do one of the following teachinques:
First create an event for your main value changes and also assing the timeout to it. 
Place the timeout in a shift register initialized with zero and wire -a (=infinite) to the shift regsiter on the right. It will timeoutonce and then never again.
Use "Select" and wire =0 to the iteration terminal. Pick 0 for i=0 and -1 otherwise and wire the output to the timout terminal of the event structure.
Don't even use a timeout event, but use a value(sgnl) property write before the loop to trigger the main event with it. This way it will fire immediately after the event structure is ready for the first time. As a side effect, you can even bring the control to a defined state.
See how far you get.
LabVIEW Champion . Do more with less code and in less time .

Similar Messages

  • Run-Time Menu and Event Structure~~HELP~~

    Hi, brothers,
    I'm new user for LabVIEW. Use the version of LabVIEW is 8.6
    One problem describe as below:
    Can Run-Time Menu and Event Structure exist simultaneously?
    Without Event Structure, Run-Time Menu works well, but Run-Time Menu works abnormally.after adding Event Structure,
    How do I modify the problem?
    Thank you for your help.
    Attached is the program.
    Attachments:
    PC_Adjustment.zip ‏44 KB

    Yes they can coexist, but not how you did it.
    Every iteration of the while loop you wait for an event in the event structure, and you look if the user has selected anything from the menu.
    To get this working you should add an event for <this VI>\Menu Selection (User):
    Ton
    PS you should add a stop button, the only way you can stop the VI is hitting the 'emergency stop' button, with hardware connected (like you have) this is not the adviced routine
    Message Edited by TonP on 09-26-2008 07:34 AM
    Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
    Nederlandse LabVIEW user groep www.lvug.nl
    My LabVIEW Ideas
    LabVIEW, programming like it should be!
    Attachments:
    Main_BD.png ‏5 KB

  • Event Structure Help

    So I wrote this program not knowing how event structures worked ahead of time, and I did pretty well except for 1 problem.  I set the event to continue on a value change of the "Continue..." button on the bottom right of the screen (block diagram is attached) but when I wrote it, I did so thinking that it would run all the code on the inside first, and then pause for me to pick what I wanted next (that big case structure on the right side) and then click the continue.  Instead the order of operations is backwards, it pauses and waits for me to click "Continue..."  in the very beginning, then runs the code inside. 
    This would be fine, if it didn't cause the test I was running to be a step behind.
    Is there a way to change the settings so that it runs the code, and then waits for the "Continue..." button, or do I need to re-write this from psuedo-scratch so that it does everything in the right order?
    Hope that was all clear, let me know if it's not.
    Attachments:
    Reversal Adjustment.jpg ‏297 KB

    Looks to me like the problem your running into is that the control selecting the case structucture is read as soon as you enter the case structure, i.e. at the same time the rest of your other code is executing.  By the time you reach your 'pause' the conditions for the next iteration are already set, and changes to the case structure control, will be read NEXT time through the loop, making it appear to be one step behind.  Use 'Highlight Execution' to verify.
    If you don't mind pressing the 'continue' button first, you can get rid of the shift registers, move the case structure to the left and feeding its outputs directly into the various subVIs directly.  The case will be selected by the 'NextUp' control when the 'Continue' button is pressed.
    -or-
    Move the code you want to run first outside the event structure.  Leave just the 'Next Up' control, the case structure, and the 'Continue' control inside the event structure.  
    When you execute, the code outside the eventstructure will execute using the defaults outside the 'while loop',  and pause at the event structure until the 'Continue' button is pressed.  When you press the 'Continue' button, 'NextUp' control is read selecting the case setting the shift registers for the next time through the loop. (you should probably use an error wire to force execution flow)
    Attached are abbreviated examples

  • Slow execution of a event structure(​Calling VI)

    The VI i created is gettin slow after execution of a particular set of event in an event structure(Calling VI).Is it because of improper use of shift register?
    I have attatched the VIs...Please run GUIdev and suggest solutions.Its really gettin on my nerves.
    Attachments:
    GUIFDR.zip ‏88 KB

    Hi altenbach
    Thanks for finding ways to optimize the code...but i have a few doubts.
    CPU burner:I took care of the cpu burner condition.I jst called those for trying out t main VI.I will be replacing those VI with developed ones.
        * Why are you bundling and then immediately unbundling all these pictures?
         Ans:chgd it
        * You have many overlapping objects on the front panel. Not good for performance.
         Ans:I am making a GUI so i thk i have no other choice but to overlap them.Also is there ny way to remove the frame from the picture box.I have just minimized and kept it.
        * Use an array of paths and index the desired element instead of reading via value property nodes.
         Ans: Can u site an eg for it..i dnt hav tht level of experience
        * There is no event for the stop button.
           Ans:Is it necessary?I will be modifying it in the future.
        * You don't need the timeout event.
           Ans: Modified it
        * Lots of near duplicate event cases. Once instance of each is enough, simply use control references.
           Ans:Each event case is either for moving out,moving in or clicking of the sliding button.How do i use a control referece for it?
        * Lots of duplicate code for the pictures and paths. Use an array of names, autoindex it on a FOR loop, and use only one copy of the code fragment.
          Anslease site an example so i can follow suite.
        * You seem to insert a VI at every iteration of the loop. Is this really necessary?
         Ans:Actually i wanted to insert a Vi only on the mouse down event, and continue running the same VI even if other mouse events take place.But i cant thk of a logic to avoid thm.But i really need a solution for tht.
    Can you explain in a bit more detail what you are actually trying to achieve with all this? Thanks! :
    My Vi as u can see is a GUI for downloading data from a hard disk and viewing and modifying the video and audio data.I will be interfacing the video and audio part later on as it is still being developed by my frnds.
    Also the problem of inserting a VI at every iteration is goig to pose a problem in the future as i want  to load each VI only for mouse clicks and let it run for all other instances.
    Please help me out
    regards
    Sankar

  • I need help with event structure. I am trying to feed the index of the array, the index can vary from 0 to 7. Based on the logic ouput of a comparison, the index buffer should increment ?

    I need help with event structure.
    I am trying to feed the index of the array, the index number can vary from 0 to 7.
    Based on the logic ouput of a comparison, the index buffer should increment
    or decrement every time the output of comparsion changes(event change). I guess I need to use event structure?
    (My event code doesn't execute when there is an  event at its input /comparator changes its boolean state.
    Anyone coded on similar lines? Any ideas appreciated.
    Thanks in advance!

    You don't need an Event Structure, a simple State Machine would be more appropriate.
    There are many examples of State Machines within this forum.
    RayR

  • How to determine the execution order of event structure

    Hi everyone,
    I have an event structure were it contains four events. All the four events has separate buttons to execute. Here, three events will generate numeric output, remaining one event (Finder) should find the order of those three events. For example, Three events namely A, B and C. I execute the events in the order of B, C and A. The finder event should find the order of previously executed events(B, C and A). 
    Thanks in advance.
    Solved!
    Go to Solution.

    Hello Vij@y,
    I could not look in to your VI because I dont have LabVIEW 2013 (I have 2010) but i tried to understand the situation you are explaining.
    Please find attached image of front panel I made for your reference.
    Here I generated two events sequently, no 3 first followed by no 1 and the same is displayed in sequence array. now you can use the build array function to actually add each event to this array as explained by many people in this forum.
    regarding the timeout event, either you can display the sequencer array in that event or you can display it in finder event and then you can reset the sequencer in finder event (I used reset button click event to reset sequencer back to zero value)
    regarding getting zero when you press finder/reset button before triggring any other event:- Is it not correct to have empty array when you have not trigger any event?
    I hope I put it well and may help you to find solution. 
    With Regards
    Miraz
    Kudos is better option to thank somebody on this forum
    Attachments:
    Sequence.png ‏70 KB

  • Help with Event Structure!.

    Hello,
    I am trying to config one event structure in the way I could change the range of sample graph to analyze it. 
    I have 3 graphs. The upper is the signal input.  In the middle is the signal fitted with some calculations and the bottom is the graph where I fix the sample width to analyze with anothers values.
    I put event structure in the way I read from file and later update the array of data to force the execution of Case "array 2". 
    Its only one example but I would like to change the value of "start" and " length" of sample signal but I cant get the data to show again. I tried diferent options, like put another event source inside of event case "array 2".
    I could join case 1 and 2, but the problem is with "start and lenght" control, I can`t get its display when i change the values.
    I created a example since its part of my program, to simulate the similar way i need.
    Thank in advance, Fred.
    Solved!
    Go to Solution.
    Attachments:
    example-eventStructure.vi ‏56 KB
    006_RR.txt ‏7 KB

    altenbach wrote:
    billko wrote:
    crossrulz wrote:
    You need to wire up the value of Array 2 to the output tunnel of the event case.  Currently, that output tunnel is set to "Use Default if Unwired".  So since you didn't wire up that tunnel, the value going into the shift register will become an empty array.
    That's one thing I am totally paranoid about.  I hate that the tunnels in an event structure are "Use Default if Unwired" by default, yet they don't show that little dot that suggests that it is.
    Of course they do! What makes you say they don't?
    I actually like the current behavior, especially for the boolean going to the stop button. I would not want to wire it in all the other cases where the loop should not stop.
    Maybe the behavior could be a bit fine-tuned. Automatic "Use default if unwired" should only apply to scalars. Tunnels for arrays and clusters, etc. should require a manual "use default if unwired" setting.
    Ha - it's because of my own paranoia about the "Default if Unwired" that led me to believe this.  I guess I always have something wired to every single case so I haven't seen it in ages.  I created one just now and specifically looked for the dot, and when I added a second case, there it was.  Of course if I wire something to that second case, it disappears.
    Bill
    (Mid-Level minion.)
    My support system ensures that I don't look totally incompetent.
    Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.

  • Stop execution of a loop in an event structure

    I tried searching the forums to avoid posting a duplicate, but most I could not open most of the vi's as they were higher version.
    I put in a dummy while loop in an event structire i intend to use. Once I start executing the while loop, I am not able to stop it using a control for some reason from the fornt panel control.
    I am not able to change the vale of the Stop control at all. I tried creating a seperate event for STOP, and I still could not stop the program when the While loop was executing.
    I imagine I am missing something really small. I would appreciate your feedback on this.
    Thanks,
    Nevil
    Solved!
    Go to Solution.
    Attachments:
    FrontPanel.vi ‏34 KB

    Right click on the event structure and choose "Edit Events" for the case that is giving you trouble.
    Be sure the checkbox to lock the front panel is unchecked.
    I suspect yours is checked, so your front panel is locked out until the event completes, thus you can never stop your loop.

  • Pop-up in event structure halts execution

    If I place a pop-up subVI in an event case of an event structure and this pop-up subVI contains a while loop and a stop button that would stop this while loop (thereby closing the subVI), will other events declared in the event structure be handled only after the user clicked the stop button of the subVI? If yes, is there a way for other events to be handled while the pop-up subVI is still running? 
    Solved!
    Go to Solution.

    Yes, it will stop everything in you rmain VI until the popup VI returns. The events will still be buffered, but they won't be handled by the event structure, until your pop up is closed (assuming your pop up is non-modal). If it's modal, the user won't be able to click anything at all, except controls on the pop up itself.
    If you still want the user to be able to interact with your front panel while the pop up is showing, and have the FP respond, you will want to launch the popup dynamically in its own parallel process. If you are using LV 2012 you can use the start asynchronous call node. If you are using an earlier version of LabVIEW, you will have to use the "Run" method with an invoke node.
    CLA, LabVIEW Versions 2010-2013

  • Event Structure/UI Help

    Hello,
    I'm stuck.....I am having some trouble figuring out how to make my attached VI behave as needed. The top level VI "EventStructure.vi" is a front panel UI interface to a label printing app (using ActiveX). When the VI is loaded it sits in the internal while loop until either the Print or Exit front panel buttons are pressed. If the "Select Product" drop down has a value change I would like it to go out to the particular label file for that product and read a Serial Number variable from the label file and report back the serial number to the front panel. I would like to have the VI front panel hold that serial number until there is another value change on "Select Product" but right now it only holds it on the front panel until the next time through the while loop. Also, the string containing the path to the label file only holds in memory until the next time through the while loop where it is cleared. Is there any way to have these values hold in memory and only change when there is a value change on the "Select Product" combo box? I do understand that this behavior is the general way Event Structures work but I am unable to figure out a better way to do this without using an Event Structure. The sub-vi "GetNextSerialNumber" calls an external application using ActiveX and it takes a while (4-5 seconds) for that application to load and process the ActiveX commands so I only want to call the external application when there is a value change on the "Select Product" combo box.    
    Solved!
    Go to Solution.
    Attachments:
    EventStructure.vi ‏32 KB
    ActiveX_Print.vi ‏17 KB
    GetNextSerialNumber.vi ‏16 KB

    You need to store any values you want to retain in shift registers. This will allow you to pass the value from one iteration of the loop to the next.
    Mark Yedinak
    "Does anyone know where the love of God goes when the waves turn the minutes to hours?"
    Wreck of the Edmund Fitzgerald - Gordon Lightfoot

  • Event structure-Plese help

    I have made a GUI for communcation between two pc with various parameters.
    I have used an event structure for 1st PC because i have 3-4 parameters which i want to run as i press the boolean on front panel.
    However my problem is suppose I press the 1st boolean, I want the 2nd pc to receive and respond that data has been received. And since there are 3-4 parameters, i will have to use event structure for 2nd PC too. But there will be no one to control front fanel of 2nd PC.
    So, how do i do it. Any alternative to event structure in which it resoponds to data recieved and not on user input.
    Thanks. 

    In my experience with serial communications, you will want a loop for nothing but reading from the port.  You can use a global or a Notifier to tell this loop to stop.  You will want a second loop for GUI and message handling.  So I encourage the use of the Event Structure here, using User Events to send the commands/data to this loop.  Then you will want a third loop for sending commands through your serial port.  Send the commands/data to this loop using a queue.
    So the process will go like this for PC-2:
    1. Read command through serial port.  Serial Read loop sends this message to GUI loop via User Event.
    2. GUI loop processes user event, does whatever is needed, and sends the response to the Serial Write loop via a queue.
    3. Serial Write loop reads the message to send from the queue and writes it through the serial port.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Please help me fix this event structure

    Hi there. I have this VI that has an event structure in it, I was changing some aspects of the vi, broke the wire to the stop event, and "poof" the VI is broken and I do not have the ability to fix this with my BASE package of labview.
    Can someone fix this issue with the event structure for me? It is broken in  "FC80-Serial-Event-80KW Blower.vi"
    The VI "FC80-Serial-Event-19.vi" is an example of the event structure when It is working properly.
    I have attached both.
    Thank you for your time and efforts.
    Attachments:
    FC80-Serial-Event-191.vi ‏289 KB
    FC80-Serial-Event-80KW Blower.vi ‏237 KB

    Try this.
    Attachments:
    FC80-Serial-Event-80KW%20Blower[1].vi ‏249 KB

  • Calling a VI in a subpanel with parameters inside an event structure and using an abort button

    Hi all,
    I have a control panel with a tab control and two tabs have a sub panel in them.  At runtime I load the VIs I want in to the sub panels.  In the control panel event structure I want to start each of the VIs and monitor the execution state so I can abort the VI while it is running.  One method I use can run the VI and the abort event will work (see example).  The second method I use does not and this is what I want to do!  I have many inputs to the VI I want to pass so placing the VI in the event blocks everything else and it has to wait until the VI has completed, so I cannot monitor the execution state.
    I have attached an example of what I want to do.
    Any help appreciated.
    Martin
    Solved!
    Go to Solution.
    Attachments:
    SubPanel.lvlib ‏2 KB

    Hello,
    You can do this with queues. 
    The main vi and subpanel vi's should be based on the producer/consumer (events) and you handle the front panel events accordingly in the respective vi's. 
    Name the queues in obtain queue , for example the Main being MainQ, subpanels SubPanel1Q, SubPanel2Q. When you start the application, initialise the main vi and also run both of the subpanels (just to make sure that the queues are first obtained by themselves). Then you can use obtain queues to do inter vi communication.
    For example if you need to send data from main to subpanel1, use obtain queue and use the name SubPanel1Q, pass the required data & command and voila. Subpanel1 vi will receive your message. You can do this anyway you want. Hope this helps.
    Beginner? Try LabVIEW Basics
    Sharing bits of code? Try Snippets or LAVA Code Capture Tool
    Have you tried Quick Drop?, Visit QD Community.

  • I using an event structure for an input box and also for hardware input

    Hi there!
    I have many input boxes and display boxes on my user interface and i have a case for it in the event structure. If the user changes the values of the input boxes, the particular event case writes this new value to the hardware. However, in the timeout section of the event structure, we read the inputs from the hardware and we set the value for its related display object.  Within the timeout section i set the value for the related user interface display component, by making use of the property node value.
    Furthermore, for most of the display components, i have a event case for a value change associated with it. In that event case, i check for range errors and so forth.
    My assumption was that when i read the value in from the hardware and set the property node value, the user interface component's value will change and it would then trigger the event of the value changed for that component. 
    My assumption worked to the point of updating the component's value, however, it did not trigger the event  for the value changed for this component.
    Please advise me on how to achieve what i wish to.
    Thanks.
    Regards,

    Local variables are actually much more efficient than property nodes as far as execution speed goes. Take that same VI and delete the property node and instead write to a local variable inside the loop. You'll see the speed nearly identical to writing directly to the indicator. But note that variables also cause a copy of the data to be created. So if you're just using the "Value" property, you're much better off using a local variable. But don't use both at the same time. If you are reading/writing other properties when you update/read the value, you might as well use the value property.
    Sometimes you can't get around using either variables or property nodes. Initializing controls to saved values from an ini file is one example. But in this case, they are only written to once as the application starts so the performance hit is negligible.
    One thing you can do is store values in a shift register as they are read and pass this through your application so the last value read can be accessed from anywhere. You can even create a cluster that runs through the shift register to hold several values in a single register. This can be expanded a bit farther to create what's called a Functional Global. This basically a subVI with a While loop that only runs once on each call. It has a shift register to store data and a Case structure to Read or Write data into the register. There's a pretty good example that ships with LabVIEW showing how these work. Open the Example finder and search for "Functional Global Communication". This example shows how to use them to pass data between two independent loops, but they work just as well in a single loop application.
    One of the big advantages of these Functional Globals over the standard LabVIEW Globals and local variables is that you can add cases to manipulate the data in addition to just storing it. Also, since it's a subVI, access to the data is protected to one caller at a time whereas variables can have multiple reads and/or writes at the same time. This can cause race conditions.
    Hope that helps a bit.
    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.

  • How to make Vi file as input file in Event structure?

    Hiii All..
    i got problems when to construct a event structure. The file input  (vi format) doesnt have source of wire connection to conect the wire (shift register) .For your information the vi that i create only contain simple mathematical equation.
    I already study the New Event Handler Example. but the file input for that example (acquire data.vi) have a source of connection. anyone can help me? 
    thank you very much
    [email protected]
    Solved!
    Go to Solution.
    Attachments:
    TOTAL.vi ‏18 KB

    Well, in your subVI you do need to wire up some inputs and outputs to your connector panel.  As I said, a basic LabVIEW skill that you will find in the tutorials.
    You have a number of inputs to your subVI.  More than you would want to attach to a connector panel.  You should perhaps use a cluster to group them together.
    To get you started, here are the steps to connect a control or indicator to the connector panel.
    1.  Open subVI.
    2. Right click on icon at upper right.  Show Connector.
    3.  Hover over a block you want to be a connector terminal, it will change to a spool of wire.  Click.
    4.  Go to the control or indicator on the front panel that you want to associate it with.  Click again.
    5.  Repeat as needed for other controls and indicators and save your subVI.  Now the subVI instance in your main VI can have wires connected to it.
    You should plan your connector panel so that controls are on the left side of the panel, and indicators on the right.  This will allow data to "flow into" and "flow out of" the subVI in a normal looking left to right orientation.

Maybe you are looking for

  • Unable to load driver for Storage for Windows 2008 UCS B230 M2

    I am trying to Boot from SAN windows 2008 R2. I  have configured and connected the Cisco UCS Chassis and FI to our Network & Storage .I am  having problem to install Windows 2008 R2 Server on Blades as it is not able to see Storage LUN while installa

  • How to display arraylist in jsp

    I try to display arrayList past from servlet my code looks like <%@ include file="/expires.jsp" %> <%@ page language="java" import="java.sql.*" contentType="text/html;charset=UTF-8"%> <html> <head> <meta http-equiv="Content-Type" content="text/html;

  • How to deploy war webapp on standalone weblogic ?

    Hi All We have several war files and an ear file. A few war files are shared libraries, other war files are webapp and an ear file. How do we deploy a war file to standalone weblogic ? Must we explode the war file in order for weblogic to deploy or c

  • Steve Muenchs file upload sample (No. 69) does not work with JDev 10.1.3.1

    Hi, I installed and started Steves sample about uploading and storing OrdImage types (http://otn.oracle.com/products/jdev/tips/muench/jsfordimage/JSFOrdImageExample.zip). When I try to upload a file I get an exception: java.io.EOFException: Per-reque

  • Marketing Attribute in Condition Table (Listing)

    Hi Guys !! Usage in a condition table for listings. Can a marketing attribute be added to the field catalog and used as part of the access seq when proposing a listing in an order or activity journal? Urgently Help needed.