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

Similar Messages

  • 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

  • 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.

  • 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 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 .

  • Calling an event structure via a LED?

    Can I call a case in an eventstructure via the value change of a LED?
    The reason for this is the following:
    In my VI is a xy graph and the update of the dispaly and the x-scale takes a lot of time, so I would like to do the update outside of my main-loop to avoid that other processes get delayed. The attached VI is just an example.
    (In my real VI, I have a consumer and producer loop and lots of data processing, so in that case the disply update should not interrupt the data processing.)
    I tried to put the x-scale update in the event structure and call the event structure via the change of a boolean value, but that does not work. The event is not recognised and the x-scale does not change.
    Johannes
    LabVIEW 7.1
    Message Edited by johanneshoer on 11-11-2009 08:20 AM
    Greetings Johannes
    Using LabVIEW 7.1 and 2009 recently
    Attachments:
    Chart Test 16.vi ‏146 KB

    johanneshoer wrote:
    I don't understand. What do you mean by "resize index array"?
    Here's one example. Your code is on the left and uses two "index array" nodes. All you need is one, configured for two outputs.
    Also, of you want consecutive indices, starting at zero, you don't need to wire the index inputs.
    An alternative is shown on the right.
    Message Edited by altenbach on 11-11-2009 12:06 PM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    resizeindex.png ‏7 KB

  • 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.

  • Calling Previous Event(s) in the Event Structure

    I have a an event structure with 5 events doing different function. I want to create another event which would run 3 of the previous events with one click. Can anyone help me do that?

    If you did go the route of a parallel State Machine to the Event Structure (loop), then you should consider using an Action Engine that keeps track of the current state and the past history.  The Action Engine may have enough intelligence to determine if it is appropriate to roll back and how far..
    As Andre mentionned, you do have to make sure the software is well designed in order to avoid any deadlock conditions.
    RayR

  • Event structure - general

    hello
    this is probably something that had been treated millions times, however i could not find direct answers from previous threads on that, so i ask directly.
    i am a bit confused by the utilisation of event structures:
    first, one would expect that if the event is used, say in a while loop, then outgoing data would be kept trough the sequence, without having to wire trough the other events, unlike as depicted in the pic below. that should be to my understanding the definition of "use default values" on the outgoing data nodes.
    however it seems not to work like that. why? is there a way to force LV to do as i want (instead of "use default values", make him "use last input value")?
    wiring trough all the nodes make the event structures very unelegant.
    second: this is probably a very naive one, but i dont like the way i do it: in some events i have same operations going on as on turn on of the vi. in other words, when i initialise my system, i pass trough several operations, which also exist in the event structure. to make the diagram more elegant it would be usefull to call all those events programmatically a first time. up to now i do it by programatically signalling the values of some controls. however there must be a more elegant way, where i could just queue the events needed. any suggestions?
    Message Edited by Gabi1 on 05-17-2007 06:11 PM
    Message Edited by Gabi1 on 05-17-2007 06:13 PM
    ... And here's where I keep assorted lengths of wires...
    Attachments:
    event structure.PNG ‏10 KB

    Jarrod S. wrote: 
    Triggering events forces a thread swap to the
    user interface thread, which can slow down execution. It can also make
    a redundant copy of the data that has to get stored in the control
    whose value change was triggered, which you might not need. Enqueuing
    commands onto a queue does not have these limitations.
     To clarify Jarrod's comment, it's important to note that neither the event structure itself nor dynamic events cause a switch to the User Interface Thread.  Functions inside the event structure (e.g. property nodes, invoke nodes) can cause a switch to the UI Thread when they operate on UI components.
    In that discussion, Jason King points out that:
    "There is nothing specific about the event
    structure that requires the event-handling case to run in the UI
    thread.  In fact, there is not any event that will force it to run in
    the UI thread"
    "Reading from or writing to a front panel terminal or local variable does not cause the diagram to run in the UI thread."
    "Any actual processing of user interaction,
    however - either looking at user interaction to determine which events
    to generate or finishing processing a filter event after the event
    structure has had a chance to discard it or modify any of the event
    details - requires the UI thread."
    "Pretty much anything you do with the reference to
    a control or indicator will cause a switch to the UI thread (property
    nodes, invoke nodes, etc)"
    Certified LabVIEW Architect
    Wait for Flag / Set Flag
    Separate Views from Implementation for Strict Type Defs

  • Event structure in Sub VI

    Hello ,
     I have a developed a program which captures video and user can save images out of it. I have used .NET reference to handle the video part, and the VI is attached in this post. Now i have to make this VI as a sub VI and running this from Main VI. I tried creating event structure in Main VI which i used in sub VI , still i could not suceed. Kindly assist me in this regard
    Solved!
    Go to Solution.
    Attachments:
    Webcam-Control-Projekt-mit-Reference-Design-2013_original.zip ‏286 KB

    Hello Michael,
     I have attached a model in which Main VI calls the Sub VI using Event Structure. Two events can occur in Main VI and their corresponding event Structure is called in Sub VI using Register events. When i run this VI the out put is fine some times but other times i need to trigger event many times before i can see its effect in Sub VI, my doubt is that Register events are reliable, whenever (during the execution of LV) if event occurs will surely its code in the sub Vi gets executed?
    also I have put a indictor(numeric) in the SUb VI which i connect back to Main VI, when i run, i can see the result only in the sub VI not in the main VI.how to see in Main VI?
    I have used the this model (which is attached ) to implement my project(which i already mentioned) . one switch for starting the video and other for recording the image. The video is getting started with out any trouble, but imgae is recorded only few times when i press the button which is for image recording, most of the time second event fails to get executed. Also there are difference in output when i run with and without "Highlight execution", why this happens, is this because of Reg events?
     any more info if required let me know, i will provide.
    Attachments:
    Main_sub_VI.zip ‏18 KB

  • Extent of Coding inside Event Structure cases

    Hi all
    I am trying to understand the practices while using an Event Structure. I am used to developing most of my projects using an Event driven State Machine Architecture. Most times, I use Event driven-Queued State Machines. I have also used Producer Consumer Architecture with Event structure driving the producer.
    I have always believed that using lots of code, or lots of sub-vis inside one or more cases of an event structure is not a good practice. I reasoned that it will delay the capture of other events occuring while the current case is still executing. This was one of our points during design review, i.e., to reduce the code inside event strucutre cases to as minimal and necessary as possible. We used clusters/queues/LV2Gs inorder to pass on the required data, which will be processed in the other cases/loops.
    However, I happened to recently come across a couple of very old applications upgraded to LV2011. The applications used an event structure in one of the while loops, with one or more parallel while loops inside the Main VI. The event structure was the only code in this while loop, no case strucutres.
    These event structures had loads of code in each case, with sub-vis and nested sub-vis, even DLL function calls among them. Thats when I started to look for information on best practices using event structures and about any available details on the extent of coding allowed inside an event strucutre.
    One sub-vi which was called as a dialog box also had its own event structure (ending up as ensted event structures). I have read about nesting event structures and their disadvantages.
    Off course, the code is working and I am not sure if anyone had any execution problems with the applicaiton.
    However, I am wondering about the pros and cons of having the entire code inside event structure. I would have defined that code a nightmare. Its disturbing me to see that code and being unable to make it better.
    To my understanding, I wish to know if there is any definition or rule regarding the amount of code inside an event structure.
    Thank you

    The exception I use is User driven intefaces where every user action must get a response and each change must complete before the next. In those cases an event only implelmentation is generally fine.
    Now if that code does something that takes long enough for the user to question if the program is still alive should at least get a "Busy cursor" OR a progress bar OR an abortable progress bar where the user get s the option to abor out. THe last case may warrent a parallel process to crunch the numbers.
    But please keep in mind the above suggestions apply only to those User only" type things. Applcations that invlove the word "while" will generally get deamons and other common design patterns used to henld the implementation. But now I have drifted to design teory and away from the subject so ...
    Have fun!
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • Handling DAQmx Sampling Rate within Event Structure

    Hello all,
    I've been programming in Labview for a while now, but have recently been introduced to Event Structures. They are useful, however I think in the program below, the event structure is causing me trouble.
    VI (Written in Labview 8.0): http://myweb.dal.ca/~jwoodacr/Pendulum.vi
    The program itself is fairly straightforward, and by no means complete. One event allows the user to acquire data in real-time (Preview Data Event), and uses the Wait VI to control speed (I know this is not particularly accurate, but the preview does not have to be). The other event is meant to collect data with a well defined time interval between data points.
    The problem is, I can press the "Collect" button once, and the "Collect" event will run fine with the values of "Time to Collect" and "Data points / sec" that were input by the user prior to pressing Collect. But, if one wishes to press collect again, no matter how you change the "Time to Collect" and "Data point / sec" controls, the express VI "DAQ Assistant 2" will only remember the very first values you gave it, and will output data with these parameters. So, if you change "Time to collect" to from one (1) to two (2) seconds after having run it initially with one (1) second, it will continue to remember the one (1), and collect data for only one second.
    I've attempted to replace the express VI with all the proper DAQmx VI's used to collect in an identical fashion, but those also do not update past the initial conditions that are set. If you enable "Highlight Execution" and watch as the task proceeds, the numbers that are sent to the "DAQ Assistant2" VI are all as they should be, based on everything input on the front panel. It simply seems to ignore them upon execution.
    This seems an odd problem, but I am hoping someone may be able to shed some light on it, or has experienced something similar in the past.
    Thanks in advance.
    Cheers,
    Jeff

    The DAQ Assistant only initializes the first time it is called.  Thus each subsequent call, it does not care about the inputs into it.  Another option is use DAQmx VIs and use a property node to modify whichever propreties you want.  You must stop the task before changing its properties.
    Brian R.
    District Sales Manager
    Washington DC
    National Instruments

  • 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.

  • Daqmx "Done" event not triggering event structure

    I would like the user to be able to abort my daqmx task by pressing a button.
    I am attempting to use the method in this VI:
    https://decibel.ni.com/content/docs/DOC-15815
    It utilizes an event structure with the daqmx Control Task VI to abort.
    The example VI above works for me, on my system with my USB-6356 device, as expected.
    When I attempt to incorporate the same method into my VI it does not--despite having an identical arrangement, so far as I can tell.
    I believe that my problem lies with the event structure, and the dynamic registration.  I am unfamiliar with this and must be using it incorrectly.
    I have attached my VI, though it is cumbersome.  The code which I am struggling with is in the "Acquire" case.  As far as I can tell, I am doing exactly the same this in this particular case as in the example mentioned.  Yet in the example, the event structure completes, or aborts, whatever you want to call it, right after the "Wait Until Done" VI executes.  In my own VI, the "Wait Until Done" and "Clear Task" VIs execute, but the event structure does not register it.
    Here are my specific questions: is there anything extra or special that one must do in order for the Task to properly trigger a "Done" event and pass through the event structure?  At what point is the daqmx task "Done"? 
    thanks,
    Matt
    Attachments:
    BoomTubeMain.vi ‏175 KB

    natasftw,
    My event structure is identical to theirs; what you are seeing are the two different cases that exist in the event structure.  In both the example and the VI, there is a <task out>: Done and a "Dynamic Event": Value Change.  In the dynamic event case, I have my abort button and relevant code--this I believe is the code you were referring to, which you thought I was missing...  Regarding my multiple event structures, they should operate completely independently as they respond to different events.

  • How can i use the same front panel graph in more than one events in an event structure?

    i want to display the signals from my sensorDAQ in a graph.but i have more than one event in the event structure to acquire the signal and display it in the graph.the first event is to acquire the threshold signals and its displayed in the graph as a feedback.after the first event is executed, i will call the second event,where the further signals are acuired and compared with the threshold signals from the event 1.my question is how can i use the same front panel control in more than two events in the event structure?please answer me i'm stuck.
    Solved!
    Go to Solution.

    Hi,
    I have attached here an example of doing the same using shift registers and local variables. Take a look. Shift register is always a better option than local variables.
    Regards,
    Nitzz
    (Give kudos to good answers, Mark it as a solution if your problem is Solved) 
    Attachments:
    Graph and shift registers.vi ‏12 KB
    graph and local variables.vi ‏12 KB

Maybe you are looking for

  • Blue Screen of Death (B.S.O.D.) when inserting cd for import into ITunes...

    Hello All - I'm new to this forum. I'm so frustrated with Itunes crashing all of a sudden. It was running great for the first about 100 cds that I imported. I was running the latest version and abruptly started getting the B.S.O.D. the moment I inser

  • User-Exit for Checking Customer and Sale order type in Sales Order Creation

    Hi Experts,   While creating the Sales Order once i enter sold-to-party and enter line item, i have to check the customer against the sales order type. Please suggest me if any user-exit or enhancement or BADI available for it. Thanks & Regards, -VM

  • Problem in ant script (starting tomcat)...

    Hi, in my ant script (build.xml) I have some targets to start/stop tomcat:     <!-- ================================ -->     <!-- start/stop tomcat servlet engine -->     <!-- ================================ -->     <!-- check whether server is alre

  • Operating System?

    I just was given a I Book G3 - So, I have booted it up and checked it all out and then reached a point to where I need information. For some reason I can't tell what the operating system is. Even on my G4 PPC I couldn't tell you if I have Leopard, Ti

  • I-pod now in chinese how do I change it back to english

    i all, my father is sick in hospital so I gave him my i-pod to listen to audio books etc. He managed somehow to put the all the menus into chinese which I can't change back into english as I can't read chinese. Any tips other than resetting it back t