Transfering a case structure to event structure

Hi, I am trying to transfer case structures that are currently set up to a control that if on prompt the user where to save and then save all following files to that location till end of program and if off the do nothing. I would like to enable these to be switched on and off at any point and know to use an event structure. The problem is I am new to coding with an event structure and have been able to get the button to work but not continuously save. I attached a screen shot of the original case structure and was wondering if someone could show me how to change it to the event structure format with the same functionality. I'm getting a little lost and confused. Thanks!
Attachments:
alltruecases.jpg ‏534 KB

I can't attach the vi due to the size and I do not think a simplified piece of code is going to help. I did however go through and stitch two jpegs together of the main two sequences. hopefully this gives a better idea of what I am trying to do and where to go from here. thank you.
Attachments:
1.jpg ‏669 KB
2.jpg ‏317 KB

Similar Messages

  • Case order of EVENT structure

    LV 8.2.1 - Regarding the order of cases in an EVENT structure:
    1... Is there any performance (speed) advantage to having the most-commonly used events near the top of the list?  Does it have to search through a list to find which case to execute, or does it happen some other way?  If it searches thru a list, then I want to have the high-frequency events near the top of the list, and the rarer ones nearer the bottom.
    2... If #1 is "no advantage" then what is the point of the REARRANGE CASES dialog?  Why would I want to rearrange them?  Maybe just to collect them into groups of similar function - is that all?
    3... When you SORT CASES in the REARRANGE CASES dialog, what order does it put them in?  The help window says "alphabetical" , but that's plainly not true, because my list includes "Stop" and "Clear", and it orders "Stop" before "Clear" after a sort.  It doesn't put the user events together.  A simple test shows that SORT puts them back in the order you added the cases to the structure.  Is there a point to that?
    Steve Bird
    Culverson Software - Elegant software that is a pleasure to use.
    Culverson.com
    Blog for (mostly LabVIEW) programmers: Tips And Tricks

    is it possible you have some invisible chars (like a leading space) or that one of the words starts with an uppercase letter and the other with a lowercase one?
    Nope.  Try it yourself with the Wed, Thur, Friday trick.
    The EVENT structure cares about what order you created the cases in.
    The CASE structure cares about the order of whatever drives the selector.
    Alphabetic order seems to have nothing to do with it. 
    From your reference thread:
    However, this does tell you that if you want to squeeze every ounce of performance out of your event-handling code, make sure the most frequently run event-handling diagram is the first one in the list.
    This from a LabVIEW R&D engineer.
    Hmmm. 
    Steve Bird
    Culverson Software - Elegant software that is a pleasure to use.
    Culverson.com
    Blog for (mostly LabVIEW) programmers: Tips And Tricks

  • Add event cases to an event structure using scripting

    Hello,
    Iam trying to (using scripting) update an event structure (add event cases) on a vi that is not on memory.
    i get error 1054 The specified object was not found.
    here is a picture of it.
    any help in this will be greatly apreaciated.
    Solved!
    Go to Solution.

    Another suggestion, the following VI is a wrapper for Traverse for GObjects VI and allows you to specify the name of the object you want. I always use this VI, I never use the Open VI Object Reference function, for the reasons tst mentioned:
    vi.lib\Utility\traverseref.llb\TRef Find Object By Label.vi
    Darren Nattinger, CLA
    LabVIEW Artisan and Nugget Penman

  • How to Transition to a Specific Case from an Event Structure Trigger?

    Can someone help me troubleshoot my program. I've attached my VI so you can follow along with what I am describing. So here is the scenario:
    I have a program that consists of four test states, stop test, request test info, and end program (cluster of 7 booleans). Each test state sends a serial command to a DUT, receives ACK packet, opens relays which disconnects the serial connection and DUT will continuously test by itself. If the user wants the end the test early, they can hit the "Stop current test" which will close the relay reestablishing serial communication, wait 10 secs for device to enumerate on the PC, and then send the serial command to stop the test. From here, the user can request test information from the DUT by hitting the "Request info" button.
    So my dilemma is when I try to implement a time limit for cases 2 - 4. For case "M1-Idle", the program works flawlessly since there is no time limit. The program will send the serial command, transitions to "Open Relay" case and switch back to the "Idle" state to wait for the "Stop" command. The user has to hit stop whenever to close the relay, request info and/or continue testing.
    For case 2 through 4, there is max time limit of 3 hours. This is where I am having difficulty opening the relays and then entering the timer count down case structure to start the timer. Question is, if I am using the Event Structure to trigger on a user action event (i.e. user presses "Run M2-Normal" - Menu.M 2: Value Change) it sends the command and move on to "Open relay" to break the serial connection as intended. Since the next state of "open relay" is "Idle" how can I add case selector to select "M2 - Timer" instead of "Idle" given that it was based on user selection of "Run M2" event?
    Is that even possible? I tried using the feedback node on the state enum but its coming from the case state and not the event state so it doesn't enter properly into the timer state. Any help or ideas is greatly appreciated. Thanks in advanced.
    Main_Working_Copy.vi is the main portion of the program.
    Best regards,
    Henry
    Attachments:
    Main.zip ‏106 KB

    Hi Ofek_zeevi,
    Welcome to the Support Communities!
    The article below explains how to gift a song in the iTunes Store.
    Some songs are not available as an individual purchase.
    iTunes 11 for Mac: Give music and video
    http://support.apple.com/kb/PH12293
    I hope this information helps ....
    Have a great day!
    - Judy

  • 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

  • Case structure & event structure

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

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

  • Switching from case to event structure

    I once down converted some LV 7.0 code to 6.0 and it (automatically) converted an event structure to a case structure.  When trying to upgrade some code to change a case structure to an event structure, I didn't see any means for doing that (a flat sequence, yes... event structure, no).
    Is there a way to convert a case to an event structure -- if not, why not?
       ...Dan

    No, the question is very valid!
    The resulting code does not need to make sense immediately, but I have desired this functionality (=convert case structure to event structure) at several occasions. I have many legacy programs that were made before the introduction of the event structure. Some contain big case structures with many cases, one is the "idle" case which only contains a small wait statement, while others are executed if certain controls change their value. (Sort of a poor man's event structure emulation ). Upgrading this old code would require a simple replacement of the case structure with an event structure so each event case contains the code of one of the original cases, followed by a quick manual cleanup (assignment of the event triggers, etc.).
    Without such a conversion tool, my code upgrade is major work, especially if there are many cases and dozens of shift registers crossing the case structure. Basically, I need to rebuild things from scratch.
    Summary: It would be useful to be able to easily convert between event structure and case structure and vice versa using a "replace" command. I even remember asking for this functionality.  I would use it!
    LabVIEW Champion . Do more with less code and in less time .

  • Event structure inside a case structure

    Hi,
    I've got a problem w/ my porgram, and managed to boil it down to this
    simple example.  The program basically hangs if you change the
    Numeric value when the boolean is false.  I don't understand
    why.  I suspect it has to do with the way event structures are
    treated, but if someone cou please explain this I'd be greatful.
    Also, now imagine I have 7 numeric controls, handled by 7 cases in that
    event structure, and I actually want to do things in response to the
    value change for each.  Can someone suggest an elegant way to do
    that?  I thought what I had here was a good design, but apparently
    not.
    Bjorn
    (I'm using labview 7.1)
    Attachments:
    EventInCase.vi ‏24 KB

    It is generally a bad idea to place event structures into cases. Events structures need to be able to breathe.
    Maybe you can redesign your program and place the case structure inside the event structure, for example? (Also have a look at the online help for the event structure, especially the link "caveats and recommendations for using events ".)
    Detailed analysis:
    Your event case for the numeric is set to "lock front panel until event completes".  If you change the numeric while the case is false, the evet structure cannot execute, so the front panel locks forever. The observed behavior is as expected. All clear?
    In addition, if the case is false, the main loop spins at nearly infinite rate, consuming all available CPU. Place a small wait to be more cosiderate to everything else running on your rig.
    LabVIEW Champion . Do more with less code and in less time .

  • How can I determine whether to use an event structure or a case structure?

    I'm starting a large project and need a state machine. I can't decide on whether to use a case structure or event structure. Is there an article  or other information that describes criteria for selecting between the two approaches?
    Thank you,
    Chuck
    Solved!
    Go to Solution.

    Hi Chuck,
    Well case structures and event structures differ quite alot.  Here's a link for indepth information on Event Structures, and using them in state machines: http://zone.ni.com/devzone/cda/tut/p/id/2962.  Hopefuly this will help you make up your mind.  
    Let me know if you have any questions after reading it. 
    Regards,
    Dominic Walker
    Cardiff University
    Electrical and Electronic Engineering Student

  • Maximum size of an event structure

    I have just a short question about the maximum size of a event structure, and did not found it yet in the forum.
    I have an event case with 35 event cases. How many are allowed, what is recommended and is there a huge loss of performance by seizing it up?
    Thx for answer

    As far as run-time performance is concerned, the number of event cases in an event structure should have no noticeable effect.  Worst-case scenario, when the event structure is woken up due to an event occuring in the system, it does a linear search through the list of event cases to figure out which event-handling diagram matches the event that it pulled off the queue.  These tests are pretty quick (3-4 comparisons per event-handling diagram) so I can't imagine it really would have any effect on performance.  However, this does tell you that if you want to squeeze every ounce of performance out of your event-handling code, make sure the most frequently run event-handling diagram is the first one in the list.
    The only performance issue I could see arising is what Damien mentioned - at edit time, it may take longer to make edits to the event structure (eg adding new event cases, changing the events a given diagram is associated with).  I don't know that I've seen any issues because of this (the largest application I've written has an event structure 40 different event-handling cases), but I think this is where any potential performance issues reside.
    Hope this helps.
    J
    Jason King
    LabVIEW R&D
    National Instruments

  • Save as previous version causes events to disappear in event structure

    I am using 2009 and I am trying to save a VI as previous version...saved it in 8.6, 8.5,8.2 and 8.0.
    I mass compiled the Main VI in 8.6 and tried to open it.  I get about 30 errors one for each event case and the event structure has no events added. 
     "Event Data Node:Contains unwired or bad terminal"
    I am attaching a zip file containing my 8.6 source code which I down converted from LabVIEW 2009.  I am trying to open it in 8.6
    Is this a bug or am I doing something wrong?
    Brian
    Attachments:
    8.6.zip ‏556 KB

    Hey Brian,
    This was reported to R&D (# 194525) for further investigation. A possible workaround for this issue is to save the VI to LabVIEW 8.6 and then save it to the various versions you wish to save the VI to. Also, another workaround is to manually re-enter the event specifiers to your cases.
    When I saved the VI from LabVIEW 2009 to 8.2, the only thing that seemed to be out of place was the event specifiers. You can re-configure these by right-clicking on the event structure and selecting "Edit Events Handled by This Case...". Also, when I first saved the VI to LabVIEW 8.6 and then to LabVIEW 8.2, everything seemed to be in order.
    Thanks for your feedback. Let me know if I can clarify any of my proposed workarounds.
    Hope this helps.
    -Ben
    WaterlooLabs

  • Change the condition in event structures

    Hi all,
    I am a student, currently doing a project. I'm very new to labview and I don't really know much of the function in labview. Anyway, I have this timer made using event structure if I'm not mistaken (I downloaded this timer from one of the post in this forum). This timer will start at 0s, count to 20s, then stop. So what can I do to change the end time of this timer?? Let's say stop at 50s??
    Attached is the program. Kindly please explain to me or modify the program and attached back as a reply. I've been trying to figure it out from the help function, but still don't understand.
    Thank you very much in advance!!!
    Solved!
    Go to Solution.
    Attachments:
    TIMER s.vi ‏13 KB

    Hi,
    Thanks for your inquiry. The VI attached uses a couple of programming structures: While loop, Event structure and Case structure. What you would have to change is actually the case structure. Before we go to that, let us go through the different structures. Open up the block diagram by going to the Menu bar of the front panel and navigate to Window->Open block diagram.
    The While loop is like a Do Loop in text based programming. It will execute until a condition is met. From the attached VI, it stops running when you click the exit button.
    The Event structure is a structure which consists of subdiagrams. The structure responds to interactions with front panel objects. For example, if you click the start or stop button in the front panel, the event structure will switch to a case which corresponds to this interation. In the attached VI, the case, which corresponds to intreaction with the start or stop button, is called  "Start", "Stop": Value Change. Each case will contain an event-handling routine.
    Case structures are like switch statements in text programming. Take a look at the "Start", "Stop": Value Change event. It contains a routine which consists of a case structure. The case structure responds to the input terminal called Start (which is actually the start button on the front panel). The case structure switches between cases according to this input. To view the different cases just cycle through the case structure by clicking the left and right buttons. There are only two cases: True or False as the input is a boolean.
    Now lets take a look at the VI. Take a look at the "Timeout" case of the event structure. This is where the modification needs to be made. Modify the case structure by editing the cases. Change the numbers in case structures: ..20000 to ..50000  and 20001.. to 50001.. This should do the trick.
    Regards,
    Alan Bong

  • Event structure

    Hello
    I 'm programming with LabView 7.0 and I use event strucutre. I've got few buttons with similar actions. I want to know how can I detect wich button has been pressed. It will allow me not to multiply cases in the event structure.
    Thanks for your help.
    Benoit

    Hi
    I'd suggest you to use the producer consumer pattern.
    So each time one of those buttons is clicked, you produce the same element (usually this means enqueueing something). The consumer then start always the same action.
    To see which button was pressed, you can write a numerical constant, depending on the case of the event-structure to an indicator. In the consumer you then will be able to read the value and decide what to do exactly.
    Another way is to wire the control refnum to a property-node - so you can read the properties of this button.
    Hope this helps.
    ThomasMessage Edited by becktho on 06-17-2005 11:23 AM
    Message Edited by becktho on 06-17-2005 11:24 AM
    Using LV8.0
    Don't be afraid to rate a good answer...

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

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

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

  • Event Structures​-best way to implement this UI?

    I am trying to write a VI to control & read data from 4 different "channels" (each measuring a DUT) at once.  I have written all the VI's for initializing instruments, communicating with the devices (VISA, GPIB), setting bias, reading data, etc...that has all completed. I just need to write the overall program with the user interface to allow the user to control these 4 channels & display the measured data.....as it turns out, this is the tricky part! My head is spinning from trying to figure out how to handle all the possible events.
    Basically for each channel, I want the user to be able to
    -enable/disable it  for measurement (e.g. if  there is no device loaded in Ch.3, we don't want to measure Ch.3..maybe disable/grey everything)
    -set bias conditions (only if channel enabled). Allow user to change bias "in real-time" by increment/decrementing (e.g. incrementing from 5.00 V to 5.01 V, for example).
    -turn biasing on/off (again, only if channel is enabled)
    Also,  I want each channel to display its measured data (e.g current, temperature reading)..every second or so. No graphs or anything fancy (for now! ), just numeric indicator. 
    Honestly, this all sounds so simple but I'm having trouble figuring out the best way to implement this, due to the fact that 1) there are multiple channels needing to be monitored for events  2) large number of user events that could occur (seems like at least 4 per channel - enabling/disabling, turning bias on/off, incrementing/decrementing bias values, etc ), Also the if a channel IS enabled, i want to be continously reading/displaying the data.  What is the best way to handle this? Should i have 4 separate while loops, each with an event structure to handle events for that particular channel..or will that give me grief somewhre? 
    Also, I have another nagging question. Pretty much all the examples I see re: Event Structures and booleans involve latched booleans, eg. buttons that are just pressed once and pop back up...e.g. buttons you press to tell it to complete a task (e.g. "Acquire Data" or "Stop") , and once it's pressed it's over and reset.  In my case, some of the booleans would not be latched...e.g. the "Enable Ch.2" button would be 'TRUE" as long as i want Ch. 2 to be read....does that make sense? Then, say hours later,  if i did want to disable that channel,  i would change it to "FALSE" and while that would be an "value change", the new value would not be "TRUE"..does that make sense? So  not sure if that would be dealt with the same way in an Event Structure. 
    Hope this all makes sense and many thanks in advance for any help!!!

    You're halfway there. I'd say the best solution is a producer/consumer structure, the event structure is used to generate queued commands to the consumer loop.
    All data is handled in the consumer loop, where you among other things have an array of clusters of channel/instrument settings. (I usually have several cluster, one for test data, one for instrument settings, one for general settings and so on)
    The event structure can have a 1 sec timeout, in which you queue up a Measure command.
    In the consumer, in the measure state you loop through your instruments and if enabled you measure them and update their indicators.
    The general (smart) way to setup the queue is with a cluster containing 2 elements, a typedef'd Command and a variant.
    This way you can send data with the command in any form which is then interpreted in the consumer.
    If, e.g. you press the Enable button on a channel, you can enqueue Enable and the channel number.
    /Y
    LabVIEW 8.2 - 2014
    "Only dead fish swim downstream" - "My life for Kudos!" - "Dumb people repeat old mistakes - smart ones create new ones."
    G# - Free award winning reference based OOP for LV

Maybe you are looking for