Several cases in a case structure ?

is it possible to have several in one case structure and using a boolean switch to run them ??
thanks.

ive done this but when it's on it only stays at one case sequence.
what have i missed ?
so close. :/
Attachments:
asspt1.vi ‏62 KB

Similar Messages

  • Can I put a READ function in a TRUE/FALSE case structure?

    Hi,
    I have a vi that operates as controller for a mechanical system of motors.  There are several sensors of various types, that provide input to the vi, including encoders, whose period is being measured.  The attached vi is the encoder period measuring part. It measures 15 periods and tells me the average of the 15 with each loop iteration.
    In my application, the encoder period measurement is not needed unless the vi knows that ALL THE OTHER sensors in the hardware configuration are measuring values within the desired range.  For example, Sensors A, B and C should all measure between 5-10.  If they are all showing values between 5-10, then, we want the encoder value to read and display.  If only one of the sensors, say A, is measuring 12, then, we don't want the period value to READ or be subsequently processed.  So, it is easy to set up the sensors A, B, C, to give a TRUE or FALSE based on whether they are within range or not, and if all 3 are TRUE, then, that value can easily be passed to the case structure that holds my READ function for the period.  Is this a good way to do this?  The goal is to eliminate unnecessary execution time that the period READ function would consume, as well as all subsequent calculations that are performed on the period value collected.  The period data is of no use if any one of the other sensors is not in the correct range.
    If any one of the other sensors is out of range, we want to skip the encoder READ step altogether.  So, it is easy to structure a BOOLEAN in my vi as shown in the attachment.  If I do it this way, will it throw an error, or just skip the READ until the BOOLEAN is true again?  Is there a better way to prevent the READ from happening if one of my other sensor values is not within the correct range?
    Thanks,
    Dave
    Solved!
    Go to Solution.
    Attachments:
    forum JUly 18.vi ‏26 KB

    Sure, you can put a Read inside a case structure. For your application, just check that your sensors are all within range (Comparisons palette), then AND the T/F's and use the result of that for your case structure. (If you are already doing the in-range check, I can't see it here because you have 5 subVIs that I cannot open here.
    Cameron
    To err is human, but to really foul it up requires a computer.
    The optimist believes we are in the best of all possible worlds - the pessimist fears this is true.
    Profanity is the one language all programmers know best.
    An expert is someone who has made all the possible mistakes.
    To learn something about LabVIEW at no extra cost, work the online LabVIEW tutorial(s):
    LabVIEW Unit 1 - Getting Started
    Learn to Use LabVIEW with MyDAQ

  • Can I use a formula node to start the execution of a case structure?

    Hi,
    I am working on editing a VI to make it much easier to understand (for colleagues and non LV users). For one reason or another, the VI's creators did not fully make use of the power of case structures and other structure types. In the application we need it for, the instrument cycles and repeats measurements on several objects. We are interested in measuring the motor currents for several motors in the system. As it stands now, for each sample object's run, there is a separate sub-vi diagram which displays its waveform trace and several indicators such as max current, time at max, etc. That code was contained within a T/F case structure and copied and pasted 20 plus times.... Obviously the vi became extrememly cluttered and needed a huge screen to see. The trigger for the current case structures is an EQUALS comparison between one input (which is the sample object counter; and this part I will likely leave unchanged since it makes a lot of sense already) and a constant which was defined 1 through 20+ for case. 
    I have since made one case structure and 20+ instances of that case and have labeled them (at the top selection box near the detent arrows) "1", "2", 3, etc. I am wondering if I can use a formula node to act as the "trigger" which sets each case structure running? I believe that a simple IF statement should work. Please see a snippet of my attempt at making this in C below.
    For the node, I defined X as the input and Y as the output. The input to the node, X, is connected to the sample object counter. The output, Y, is connected to the case selector of the case structure. My attempt at the code is below:
    int32 y
    For(x == 1)
       y = "1";
     For(x == 2)
       y = "2";
    etc, etc.
    Is that above code snippet correct? Do i need something like "ENDIF" or "end if" at the end? Does "y" have to be defined as "int32" or can it be something else?
    Thanks for the help!

    Is your formula node doing anything else besides what is shown?
    Why don't you just wire the value that is going into it at X directly into the selector of the case structure?
    Attachments:
    Example_VI_BD.png ‏2 KB

  • How do i output multiple arrays from a case structure to create one larger array

    I currently have a vi that has one hardware input that i needed to take a measurement then be moved and take a similar measurement at a different point.  To accomplish this i used a while loop inside a case structure.  The while loop takes the measurement  and finds the numbers i need while the case structure is changed per the new measurement location.  I want to take the data points i have created in each case and output them into a single table.  I assumed to do this the best way would be to get the data from each case into its own built array and build a larger array but I cant get the information out of the case structure so that it all inputs at different places.
    thanks for your help
    Attachments:
    Array.vi ‏30 KB

    Hi Ross,
    attached you will find a solution for your table building problem.
    I would suggest thinking about program design - having the same case content in several cases doesn't make sense. I also would not want my user to press several stop buttons depending on choosen measurement...
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome
    Attachments:
    Array.vi ‏45 KB

  • Problem with a case structure

    I have the following problem:
    I want that the structure from the TRUE case of the bigger case structure to start only when I switch from the button and activate the TRUE position. I observed with the probe tool that the structure is still executed in backgroun even if the bigger case is on FALSE. I want to make it start from the first position (the default case) of the inner case structure whenever I will switch from the button. I hope I made myself cleared. Thanks
    Solved!
    Go to Solution.
    Attachments:
    Untitled 3.vi ‏77 KB

    Hi maryus,
    your observation (or better assumption) is wrong.
    As long as you set your button to FALSE the inner case structure in the TRUE case is not executed!
    But: when you switch to TRUE case you wired the loop iterator to the inner case selector. So the inner case structure is not starting with it's first case but with the case corresponding to loop iteration count!
    You can see all this by using execution highlighting!
    Btw. when you have several cases in a case structure you can combine them to one case. It's all explained in the context help of the case structure! So you can combine cases (1, 3,4,6) and (2,5,7) into just one case each…
    Edit: Damn, Christian was faster (with same conclusions)…
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • Event structure vs case structure?

    I am developing an application that is fairly user input based... lots of boolean control buttons to do different things.
    In the past, I have avoided "value change" event structures, and instead went with a while loop, stacked sequence, and series of case structures. After having done it, I decided this was a terrible idea. This time, I intend to build an array from the booleans, convert it to a number, and feed it in to a single case structure. This will give me the option to add cases for different combinations of the booleans being pressed.
    I guess the question is: What is the best method for doing something like this?  Does one have advantages over the other?
    Edit: I wasn't that clear.  I would like a comparison between the "value change" event structure method, and just feeding everything in to an array -> case structure.  I also am worried that with the bool array -> case structure that I will run in to problems where I end up with too many control variables, and the value of the resulting number gets ugly very quickly. The application has several buttons... next, last, save, load, several different configure setup buttons etc.
    Thanks!
    Solved!
    Go to Solution.

    Aalenox wrote:
    I am developing an application that is fairly user input based... lots of boolean control buttons to do different things.
    In the past, I have avoided "value change" event structures, and instead went with a while loop, stacked sequence, and series of case structures. After having done it, I decided this was a terrible idea. This time, I intend to build an array from the booleans, convert it to a number, and feed it in to a single case structure. This will give me the option to add cases for different combinations of the booleans being pressed.
    I guess the question is: What is the best method for doing something like this?  Does one have advantages over the other?
    Edit: I wasn't that clear.  I would like a comparison between the "value change" event structure method, and just feeding everything in to an array -> case structure.  I also am worried that with the bool array -> case structure that I will run in to problems where I end up with too many control variables, and the value of the resulting number gets ugly very quickly. The application has several buttons... next, last, save, load, several different configure setup buttons etc.
    Thanks!
    Event structure. Among other things, it will allow your loop to "sleep." then wake up when an event happens. With a case structure it's going to be constantly polling. Event structure is pretty much always the right way to go in newer versions of LabVIEW that have it available. I assure you, your first solution was aboslutely wrong and you noticed that, your second is better and was common the way before event structures existed, now that event structures exist, you should go with those.
    CLA, LabVIEW Versions 2010-2013

  • Case Structure - multiple selectors, single exit

    I tried searching for an anwser to my question but I could not find one.
    I'm creating an interface for my graduation project (using LabVIEW 7.1) and I will be using several subpanel's, at this point I'm trying to create a selection method. During the design of the interface the users gave preference to buttons for switching between the different subpanels (there is a total of 4 buttons). And a subpanel is chosen based on a numeric value (I have taken the code from the viewer.vi example).
    Now I'm trying to work out some sort of case structure starting from the 4 buttons and resulting in a single numeric value. The idea being that when button 1 is pressed, subpanel 1 is active and every other panel is not. So far I haven't found a working one, especially because of the single numeric value I want to have.
    If the anwser is somewhere on this board then you have my apologies and I would appreciate a link to it.
    If something is not clear: feel free to ask questions.

    That's why a radio button control is better. It automatically allows only one button to be active. Clicking a new one will turn the others off.
    Try it! Just place any number of booleans (any style) inside the radio button control. The output will be a single number. If you wire it to a case structure, you'll get the control label for each as case name.
    (you can also allow or disallow "no selection", etc.)
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    RadioButtons.vi ‏10 KB

  • Timing a case structure

    I have a push button with mechanical action set to switch until release(so that it gives an impulse boolean ON for 1 sec). I want to know a way so that the case structure remains active for a specified time after the push button goes off.
    Thanks in advance.
    Solved!
    Go to Solution.

    If you are interfacing to real sensors, you probably need to poll them at regular intervals and an event structure is not the solution.  A simple state machine would suffice.
    You have several states, e.g.:
    no sensor triggered
    sensor 1 triggered
    sensor 2 triggered
    if you are in state 1, simply wait for any sensor to trigger and proceed to the relevant state
    if you are in state 2, and sensor 1 triggers again, don't increment, because the person has left. if sensor 2 triggers, increment the count and go back to state 1.
    if you are in state 3, and sensor 2 triggers again, ignore. If sensor 1 triggers, decrement the count and go back to state 1.
    ... or similar.
    LabVIEW Champion . Do more with less code and in less time .

  • Merging Signals From Case Structure

    Hello,
    I am making a scanning program which requires several cases to be evaluated within two for loops. I've hooked up both conditions in a while loop, and I know that because of the conditions only one of the wires will be executed. In two of them I modify a parameter and one I leave it alone, but I am unsure of how to connect the three to the module on the right. Any tips?
    Thanks for your help,
    gordonj005
    Solved!
    Go to Solution.

    When you drop a new case structure onto the block diagram, LabVIEW creates a structure with two cases by default.
    To add additional cases, right-click on the case structure and select "Add case".  You can either "Add case after" or "Add case before".
    You can learn a lot by experimenting, right-clicking on things and examining your options, and using the LabVIEW help.  Since it seems that you're pretty new at this (not knowing how to create additional cases was the clue-in), I'm trying to give you some tools for learning on your own.  I'm not trying to be mean. 

  • Execute case structure only once

    Hi everybody.
    I want to execute a case structure inside a while loop only once. The case strucutre is controlled by a counter, so that every time the counter has a value multiple of N, the program records an acoustic signal and calculate the main peaks of the FFT. The problem I have at the moment is that, every time the case is executed, it records and analyze the sound several times until the counter jumps to the next value. I want the case to execute only once every time the counter has a value multiple of N. I atttach the vi.
    Thank you for your attention guys!!!
    Attachments:
    Pulsations2.vi ‏243 KB

    GERD is right.  You should use a feedback node to store the previous count value.  If the current count is Not Equal AND the remainder is Equal To Zero run your case.
    Since your counts are all integers, I would also recommend changing the representation to an integer type.  I32 would likely be the most appropriate.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Programmat​ically change case structure range

    I think I already know the answer to this, but I'm going to ask anyway. In the attached image, is it possible to programmatically change the range of numbers the case uses?
    Tay
    Solved!
    Go to Solution.
    Attachments:
    case structure.png ‏3 KB

    To use a property node on a case selector, you need to have a reference to it.  There are several ways to open the reference, depending on where the object you want to reference is located.
    EASY - If the case selector is not inside another structure and has a unique name, use Open VI Object Reference with the name of the case selector as the input.  The owner is the block diagram reference and the object class is a case selector.
    FAIRLY EASY - If the case selector is inside another structure or structures and all structures and the case selector have names unique to their diagrams, open the structures from outside to inside as in case 1.  After you open the structure reference, get a reference to the appropriate diagram and repeat until you get to the final case selector.
    HARDER - Case selector has a unique name, but is buried in a container which does not.  Use the Traverse method to find all case selectors, then use the Label property of each to find the right one.
    HARDEST - Case selector does not have a unique name.  Use the Traverse method to find all case selectors, then find the one you want by the frame labels.
    The take-home message from this is that your life is much easier if you give your containers unique names.
    This account is no longer active. Contact ShadesOfGray for current posts and information.

  • Repeating case structure

    This program is supposed to recognize an input voltage of 5V and then proceed to start the vertical bar picture box moving either left or right, per the users choice. The user can also input the desired bar width, scroll speed, and cycle duration (time to get from left to right and back). I want the picture box to move left and right repeately. On frame #3 of the stacked sequence I have made a case stucture that would play the true program if the iteration for the larger for loop is even (or zero) and false if odd. When run, the program will only move left first then right and then stop completely. How do I get the case structure to consistently repeat between alternating the false and true cases?
    Thank you!!
    Attachments:
    vert rect with volt data.vi ‏1387 KB

    Chip,
    Please consider rethinking your code from scratch, the code is virtually unmanageable and full of race conditions due to overuse of local variables. It will never work as desired in its current form.
    You might also read my comment here: http://forums.ni.com/ni/board/message?board.id=170&message.id=112401&query.id=0#M112401
    Unecessary code: Once you create the image in frame 0, its content never changes. There is no need to carry the wire and rewrite the same data to a local variable of the image in subsequent frames.
    I would suggest NOT to use formula express VIs for simple operations sich as "divide by two", "2*x1*x2", etc. Since the formula is hidden it is impossible to see what is going on without clicking the express VI. Use plain wires and basic math nodes!
    Don't use value property nodes if the actual wire is right there. Just use a plain wire, eliminating the property node (property nodes pose a sever performance penalty).
    It is also very confusing to have multiple terminals with the same name (e.g. "Trial Duration (s)", etc.). You have four (!) instances of basically the same while loop, where the only difference is one diagram constant. They can all be combined into one and have the diagram constant be a function of the current "state".
    Race Conditions!!!
    As an example, lets have a look at your first FOR loop. Since several code elements are chopped up without any direct data dependency, there is no way to tell what occurs first. (LAbVIEW does NOT execute left to right!). For example, you cannot tell if "Number of Bars Drawn" (A) gets written first or one or two of its two locals (B,C) get read first.  Similarly, you cannot tell if D and E get updated before F and G get read. In a typical iteration, you'll probably get a random mix of stale and current values. There is no way to predict it.
    The insert shows an alternative implementation. Dataflow exactly determines the sequence of events and no race condition can occur.
    I am sure with very little work your code could be simplified to 10% of its current complexity. At this point we can start troubleshooting the problem you mentioned. Most likely, everything will fall into place.
    Message Edited by altenbach on 06-28-2006 01:09 PM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    VertRectWidth.png ‏32 KB

  • Output of case structures

    My problem is that outputs of two cases(of the same case structure) are used at the same time to get a new number.
    For example, output of case 1 times 20 plus output of case 2.
    How to implement it? Thanks.

    There is only one case active at the time, you can't have two cases at the
    same time, it would be a contradiction to the Case-structure (e.g. a Boolean
    is either true or false or unknown, but never two states at a time).
    But that's more a question of philosophy.
    I think I know what you want to do!
    You have to execute your Case-statement several times and store your several
    Case-Outputs. You should use a Case within a For oder While-Loop (For or
    While depends depends on your iteration condition: Fixed times or variable).
    Then wire the Case-Outputs to the Loop-Outputs and enable Auto-Indexing.
    Store your values in an array and scale and add the array after you have
    collected all the Case-Outputs.
    Another solution is to use a Shift-register of the While
    or For to create a
    running sum of the cases.
    Which one do you prefer ?
    Oliver Friedrich
    "haodage" schrieb im Newsbeitrag
    news:[email protected]..
    > My problem is that outputs of two cases(of the same case structure)
    > are used at the same time to get a new number.
    >
    > For example, output of case 1 times 20 plus output of case 2.
    >
    > How to implement it? Thanks.

  • How do I use a Case Structure with Strings?

    I need to use a string list to set up a set of cases to be performed. Is it possible to tell a single case structure to do "a, b, c, and d, but not e or f" or "do a, c, d, and f, but not b or e" etc... when you use a string containing the cases to be used?

    Blackavar,
    A case structure will only execute a single case at a time. If you want to have multiple cases execute in parallel, then you would need to have multiple copies of the case structure and split the string apart and wire them to all of the needed case structures.
    This could be done with reentrant subVIs to run truely in parallel. Anther method would be to have 6 different case structures, all with 7 cases each. The 7 cases would be "a", "b", "c", "d", "e", "f", and "0". Your input sting will need to be built up so that it will always be 6 characters long and then split up so that each character goes to one of the case structures. You would have your needed code for cases a - f. Case "0" would do nothing.
    Randy Hos
    kin
    Applications Engineer
    Nationsl Instruments
    http://www.ni.com/ask

  • How can I pass data generated in a SubVI inside a Case Structure out of the Case Structure?

    Hello,
    I am using a USB 2701 to control a heater.  I have three SubVIs that are all working properly on their own.  I'd like to use an Enum to select which of the SubVIs is running at a given time.  The problem is that no data is passing out of the case structure.  How can I pass the temperatures and heater outputs acquired by the SubVIs to the main VI?  I've attached my some of my code below.  I can't attach more than 3 files, but you can see how the main VI is configured.  Like I said, the SubVIs are working individually, so you shouldn't really need to look at them.
    Thank you,
    CJones581
    Attachments:
    RampHeater6-21-07.vi ‏305 KB
    69_Heater_Case.vi ‏23 KB
    HeaterTCD6-21-07.vi ‏210 KB

    CJones,
    You might check a couple of things.
    Your HeaterTCD... VI has a While loop with a stop button condition.  HeaterTCD pass out values only when it finishes running.  If it doesn't pop open the front panel (which usually doesn't happen when running a SubVI) you could run into a stuck loop because you don't have access to the Stop button.  This could appear in the form of no data being passed out (because the SubVI never stops running).  The primary VI opens the HeaterTCD VI, starts it, and waits for the VI to finish and pass final values .
    Secondary note: Unless you want your SubVI panel (which probably isn't open when running the main VI) to update continuously, consider moving your Temperature Graph and Temperature oC indicators outside the while loop.  Pass final values to them via a tunnel, since the main VI will only read their values after the loop finishes running, anyway.
    It might help to add error management to HeaterTCD like you have for RampHeater.  If you connect error lines with Error Outs to your main VI, that will help tell if there is an error somewhere that is preventing info output.
    RampHeater SubVI has the same issue with the stop button.  It is also probably getting stuck in the While loop waiting for a manual push of that SubVI's Stop button.
    An easy way to test this would be to set up a logic circuit so that when the While loop iteration counter reaches a certain number, it registers True and sends it to the conditional.  I know this isn't what you want to do long-term, but if that lets your SubVI return outputs it means that the SubVI was just never stopping.
    Hope that helps.
    David C, Applications Engineering
    David C
    Applications Engineering

Maybe you are looking for

  • Can I send more than one spreadsheets in an email?  How?

    I am trying to attach multiple spreadsheets to an email. But I can't seem to select more than one on my iphone 5 to send. Any suggestions?

  • Weird HTML space %20 error after 10.6.5 update

    I just updated our Snow Leopard Server to 10.6.5 for the many fixes within Podcast Producer. Unfortunately, I have came across a very weird error (or bug). All of our video podcast within the blogs were working fine before the update. Once updated, I

  • Gaps in DW not showing in IE7

    Hi all, I'm building a website using DWCS3's 'fixed layout with header and footer' The page looks great in DW but when I preview in the IE7 browser, it looks different. In DW, there is a small gap (around 20px) at the top of the sidebar and the main

  • Windows live, or skype with video for mac?

    Ok, i didn't know where to post this, but i just bought my macbook pro laptop and i was trying to find a version of msn that worked with webcam, but i couldn't find, i've found the old versions and some other fake without cam versions, i've also trie

  • Source for Document Type Layouts.

    Oracle Delivered XSLFO Style Sheets (Sourcing Style sheet, Standard Purchase Order Style sheet) for the Document Types(Sourcing RFQ Sourcing RFQ, Purchase Order Standard). Can any one tell me Where are these style sheets getting data from ? From whic