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.

Similar Messages

  • Wiring inputs n outputs for case structure

    Hi everyone...
    I have a simple basic question...How to wired the correct tunnel for output in case structure.Because when I try to wire the build array to the case structure, It shown as white terminal....How how to make solid color terminal for output tunnel...Actually I forgot how to wire it correctly..so...I hope u guys can remind me again...thank u very much...
    Attachments:
    Cepat21.vi ‏43 KB

    Hi Altenbach...
    Thank u very much for ur
    help.I'm always make a careless mistake.thanks to u guys.Now,I'm be able to display my
    data into table something like attachment below.Actually I'm using IIOA
    to parse the value into string...something like that...
    V = 238.25 I = 23.82 P = 5676.12
    V = 237.79 I = 23.78 P = 5654.28
    V = 237.35 I = 23.74 P = 5633.54
    V = 236.94 I = 23.69 P = 5614.09
    V = 236.56 I = 23.66 P = 5596.12
    V = 236.22 I = 23.62 P = 5579.80
    V = 235.91 I = 23.59 P = 5565.29
    V = 235.64 I = 23.56 P = 5552.72
    V = 235.42 I = 23.54 P = 5542.22
    V = 235.24 I = 23.52 P = 5533.88
    V = 235.11 I = 23.51 P = 5527.78
    V = 235.03 I = 23.50 P = 5523.98
    V = 235.00 I = 23.50 P = 5522.52
    V = 235.02 I = 23.50 P = 5523.40
    V = 235.09 I = 23.51 P = 5526.62
    V = 235.21 I = 23.52 P = 5532.16
    V = 235.37 I = 23.54 P = 5539.95
    V = 235.58 I = 23.56 P = 5549.92
    V = 235.84 I = 23.58 P = 5561.99
    Then I try to convert this string into numeric or dbl coz I want to
    merge it with signal.So, it looks like complicated like u imagine.
    Now,I have one other question.refer to my vi, I have used elapsed time
    so that it will run from the start time until target time.But its only
    can be determined in seconds.So, how can I modify it with using elapsed
    time for day.I mean this prog will start on Monday for example n stop
    at wednesday.It means it will run for 3 days...thank u very much...
    Attachments:
    build table1.PNG ‏36 KB
    Cepat2122.vi ‏165 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

  • Changing an output box in a case structure to an input box

    Hi, I have been struggling with the following problem in Labview:
    Hi, I was working on a wiring diagram in Labview and I was trying to
    wire an absolute value symbol to the right border of a case structure.
    The problem is that I get an output box (an white filled box with an
    orange border) instead of an input box (an orange filled box). How
    would I change the output box into an input box? I have tried Ray
    Kong's method, which is to add a constant and that would make the box
    solid. It worked only once but when I tried it on another output box
    it did not work. Any suggestions would be appreciated. Please
    include step by step instructions as I am still learning Labview.
    Thank you
    Muhammad Asfour

    The box type will be appropriate for what you have wired to the box.
    When you say you want an "input box", do you REALLY want an input box (ie, a
    connection bringing a value from outside of your case statement to the
    inside of your case statement) or do you mean that you want your output box
    (a connection bringing data from inside your case statement to the outside)
    to be solid orange? The output box will go solid orange when you have a
    connection from EACH case to the box. Remember that a single output box
    (usually on the right side of the case statement) must be connected to
    something in each case of your case statement. It will be filled white
    until all cases are wired.
    Write back if this isn't clear of if I have mis-understood your situation.
    Hope this hel
    ps.
    Jim
    "Muhammad Asfour" wrote in message
    news:[email protected]..
    > Hi, I have been struggling with the following problem in Labview:
    >
    >
    > Hi, I was working on a wiring diagram in Labview and I was trying to
    > wire an absolute value symbol to the right border of a case structure.
    > The problem is that I get an output box (an white filled box with an
    > orange border) instead of an input box (an orange filled box). How
    > would I change the output box into an input box? I have tried Ray
    > Kong's method, which is to add a constant and that would make the box
    > solid. It worked only once but when I tried it on another output box
    > it did not work. Any suggestions would be appreciated. Please
    > include step by step instructions as I am still learning Labview.
    >
    > Thank you
    >
    > Muhammad Asfour

  • White tunnel in a case structure at every output

    I´m working with a TCP READER in a case structure. But every output fron the case get white tunnel. What`s happening?

    A white tunnel on an output of a case structure indicates that the tunnel is unwired in at least one case. If you're using LabView 6.1 or 7, one option is to right-click on the tunnel and select Use Default If Unwired. But I prefer to wire to the output tunnels in every case: it removes any question about what value is presented to the case outputs.

  • How do I delay 1 of many outputs exiting a case structure?

    I have a system here which is sort of a finite state machine, using digital I/O, I am monitoring a series of digital inputs which in turn form a binary number which is the input to a case structure. Depending on the binary string (number) that is read by the case structure, a particular series of boolean constants (T or F) exit through the case structure which are then used as my digital outputs (in my case they are controlling a series of relays). Basically, I have a condition where I would like one of the relays to be time delayed when switching in one direction, but not in the other. The problem is that when I do delay this bit, it also delays all of the bits coming from the case structure.
    i.e. all the relays are delayed. How can I delay just one of them?

    Well, I can't think of a really easy way. You could generate a delayed pulse on a counter output, instead of using a digital line. Otherwise you will need to keep track of the delay time in your loop somehow. The timing is only going to be as accurate (deterministic) as your loop rate, and will be operating system dependant. You may have some jitter. Attached is an example of a software delayed boolean indicator. Download both VIs.
    -Jim
    Attachments:
    delayed_relay.vi ‏30 KB
    boolean_trigger.vi ‏14 KB

  • Case structure no false output

    Hey guys,
    To start off, I am very new at Labview.  I have posted about this project before but my professor has changed the assignment slightly.
    - Generate a random set of N points (x,y) between 0 and 100
    - Find the closest point to each point
    - Calculate the number of points with a closest point of less than D
    - Graph the points with the points with a closest point of less than D clearly marked
    So far I have manged to get everything done except for the last part, at least completley.  My approach was to create a case structure with < D as the requirement, if true build array if false I wanted it to do nothing, but I can't seem to do that.  I tried using a number ourside of the array size but that doesn't seem to work either.  Then I tried using a a shift register to do the same thing but had the same problem.  I could use some help if at all possible.  I have posted both codes below.  1_9 is the case structure alone and 1_10 is the shift register approach.
    Attachments:
    Assignment 1_10.vi ‏27 KB
    Assignment 1_9.vi ‏31 KB

    Not bad- monor tweaks set off with some color attached.
    NOTE use BD comments. Watch your data types (point closest should be an Integer type not a double) use increment rather than adding 1. kill the iteration indicators you are outo indexing off of an array generated with the Number of Points(N) control- there is no need to write N number of times to each indicator.  why you CHOSE to cross the wires into and out of the fourth loop baffles the mind
     EDIT: the SR should be initialized with an EMPTY array I just noticed that it has 1 element. that is a bug
    Jeff
    Attachments:
    Assignment 1_10_MOD.vi ‏26 KB

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

  • How can i use a string as a control for case structure?

    my vi is reading data. the output is a string,how can a string can control the case structure? because the there's a constructed vi in that case structure that wll perform a tast after the main vi read.
    Thank You
    (Can you please give me a simple example how can do this)

    Try this vi. You shouldn't have any problems just connecting a string to the case selector.
    BJD1613
    Lead Test Tools Development Engineer
    Philips Respironics
    Certified LV Architect / Instructor
    Attachments:
    string_to_control_case_structure.vi ‏10 KB

  • How to get a case structure to execute only once in a loop

    I have a while loop that is monitoring temperature. Once the temperature meets or exceeds a given setpoint I want to start a timer. At this point I don't want to monitor the temperature anymore. That is, if the temperature should drop below the setpoint, I don't want to execute the case structure again when the temperture meets or exceeds the setpoint(the temp may oscillate about the setpoint for a given period of time). In any event, I need the case structure to execute only one time, not every iteration of the loop.

    You can put a local Boolean variable "Flag" inside that case structure and
    set "Flag" to False. Outside the case structure, use an "AND" function
    output to control the case structure. The "AND" function has two inputs. One
    goes to the comparison results between real temp and setpoint. The other
    inputs connects to the "Flag" variable. In this way, once you entered that
    case structure, the "Flag" will be turned to False, and then in next
    iteration, you won't get into the case again because the "AND" function will
    be False as your "Flag" is False now.
    Hope this helps.
    Rentian
    1. Inside the case structure, put a
    "BB Herman" wrote in message
    news:[email protected]..
    >I have a while loop that is monitori
    ng temperature. Once the
    > temperature meets or exceeds a given setpoint I want to start a timer.
    > At this point I don't want to monitor the temperature anymore. That
    > is, if the temperature should drop below the setpoint, I don't want to
    > execute the case structure again when the temperture meets or exceeds
    > the setpoint(the temp may oscillate about the setpoint for a given
    > period of time). In any event, I need the case structure to execute
    > only one time, not every iteration of the loop.

  • Resetting a Case structure

    I am writing a VI that reads in a signal to a comparator and sends the
    output
    to a
    case structure.
    The ides behind the project is EMG (monitoring muscle active/inactive
    times).
    The case structure is as follows:
    If 1: count up and if count reaches 10 then green LED on (represents muscle
    active)
    If 0: count up and if count reaches 10 then red LED on (represents muscle
    inactive
    and should be exercised.)
    My question is how could I reset the case structure to start again: i.e, If
    Case=0
    and the inactive time reaches 10 and RED LED comes on, I want this to then
    turn
    off
    and put the count back to 0 if it switches to Case=1.
    (The idea is that this RED LED is representing a Vibrate motor (which I
    will
    output
    to using DAQ) . The motor will switch on as the RED LED does to indicate to
    a
    user
    muscle should be exercised but I do not want the motor to be on constant, I
    need it
    to turn off when the muscle is exercised and then restart the count again)
    I probably haven't explained this very well but I have attached my VI.
    Any help would be appreciated
    Solved!
    Go to Solution.

    PinkLady4128 wrote:
    The case structure is as follows:
    If 1: count up and if count reaches 10 then green LED on (represents muscle
    active)
    If 0: count up and if count reaches 10 then red LED on (represents muscle
    inactive and should be exercised.)
     What is the count interval? How is the count increment triggered (time ie: every second?)
    My question is how could I reset the case structure to start again: i.e, If
    Case=0 and the inactive time reaches 10 and RED LED comes on, I want this to then
    turn off and put the count back to 0 if it switches to Case=1.
    Do you want the reset to occur automatically and restart?  Do you want someone to notice the RED LED?  If it resets, do you want to start again but keep the RED LED on which also indicates that the motor is running?
    (The idea is that this RED LED is representing a Vibrate motor (which I
    will output to using DAQ). The motor will switch on as the RED LED does to indicate to
    a user muscle should be exercised but I do not want the motor to be on constant, I
    need it to turn off when the muscle is exercised and then restart the count again)
    So while it is counting, if there is muscle
    movement detected, do you want the motor to stop and the RED LED to turn
    off?
    I probably haven't explained this very well but I have attached my VI.
    You forgot to attach your VI

  • In the attached VI I dont understand why data from the inner case structures are not being transmitted to the array.

    In the attached VI I don't understand why data from the inner case structures are not being transmitted to the array.
    Thank you.
    Solved!
    Go to Solution.
    Attachments:
    TEMP.vi ‏25 KB

    It took me some time to figure what you are trying to do but I think I have it now.
    The SR is still required.
    What is happening is your "Bundle By Name" is replacing all of the fields of the cluster, not just the value coming out of the case structure. So to maintain the cluster stuff you do in earlier iterations you can either...
    1) Put the "Index array, Bundle by name, and Replace array" inside the case structure and ONLY bundle the value you are setting in that iteration. (as you will see Tim post shortly)
    OR
    2) Move the Index array before the Case, unbundle all of the fields and feed teh case structure and run them across the case so that ALL of your output tunnels come from the coresponding input tunnel EXCEPT for the filed you are trying to set.
    Ben
    Message Edited by Ben on 05-05-2010 01:31 PM
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • The case structure is not working well on comaring two strings using true or false string matching VI

    I need an execution of commands after the reply from the instrument matches with the string I provided for that i used true or false string match VI on which the true string the matching command and the string is the reply from the instrument. And I put the further executionable commands in frame after frame of sequence loop in the true of the case structure. Amd finally I given all the output strings to the concatenate string to get all the replies as one loop. But when I execute the program the desired result is not available. So kindly please help me to overcome this problem.  
    Attachments:
    basic serial with changes.vi ‏24 KB

    You VI makes absolutely no sense and I would recommend you start with a few simple LabVIEW tutorials before trying to tackle this.
    What is the point of the FOR loop with 1 iteration, it might as well not even be there, same difference.
    Why is there an abort primitive in the FOR loop, this mean the program will unconditionally stop abort before any downstream code will ever go into action. The program will never get past the FOR loop.
    You created a circular data dependency and LabVIEW inserted a feedback node automatically, making things even worse. (see also)
    You need to learn about dataflow, execution order, and data dependency.
    You need to learn about the various types of tunnels (plain, autoindexing, etc.)
    There is a tremendous amount of duplicate code. Large code sections are the same, differeing only by a string. You should only have one copy of that code inside a proper state machine. Have a look at the design templates and examples that ship with LabVIEW.
    LabVIEW Champion . Do more with less code and in less time .

  • How do I get a case structure's panel?

    I am trying to place a boolean indicator within a case structure via LabVIEW scripting and am not having any luck.
    I started with the following source code, which creates and populates a case structure from an array:
    https://decibel.ni.com/content/docs/DOC-22703
    So my code, rather than put an enum inside each case, creates some compound arithmetic and a mask for each case.  This is all working fine.  I now want to place boolean indicators on the front panel that correspond to each case, and this is where my problem is.  I can create the indicators, but when I look at the block diagram view, all of the indicators are located outside of the case structure, rather than the indicators being inside of each respective case.
    I think the reason is that a boolean indicator is created by passing a reference to the front panel.  But the problem with this is that the VI panel reference does not indicate that the boolean should be placed inside the case structure, just on the panel, so when you view in block diagram mode, it's just thrown the indicators all outside the case structure and wired them up via tunnels.  I am getting the panel reference by accessing the OwningVI field of my CaseSel object.  I feel like there must be some field I should be able to access that indicates to put the block-diagram boolean inside of the respective case structure, but I can't find it.
    I've attached a file with 3 pics in it.  One shows a pic of the code I'm using to create the indicators.  One shows the type of output I'm looking for.  One shows the type of output I'm getting.
    Solved!
    Go to Solution.
    Attachments:
    lv_case_struct.jpg ‏221 KB

    Before you connect the wire to the terminal, call the Move method on the indicator's terminal and use one of the case structure's Diagrams[] as the owner. This will move the terminal into the structure.
    Try to take over the world!

Maybe you are looking for

  • MacBook Pro only boots in safe mode with pink vertical stripes across screen.

    So on Friday night I was using Chrome on my MacBook Pro, when all of a sudden little squares of light flashed randomly across the whole screen and everything but the mouse froze. I thought that was weird, so after a few minutes I forced my computer t

  • Merged child project's TOC not appearing in parent project's TOC

    System Information Windows XP Professional, SP2 Windows Explorer 6.0 RoboHelp X5.0.2 Generating RoboHelp HTML Help (.chm) Issue I had the following Help projects: 1. CombinedProductHelp.chm (parent project) 2. ProductHelp.chm (child 1 project) 3. Pro

  • Serial number inquiry

    I am looking for the quickest way to view the transaction history of a specific serial number.  For example I want to see the PO no., Rcpt no., Invoice no., etc... The serials number management report basically provides the data I want, but in the Se

  • Upgrade from SQL server developer 2008 R2 to SQL Server developer 2012

    Hi, We have bought 5 licenses of SQL server developer 2012. This licenses provided us an option to use SQL server 2008 R2. And we have been using 2008 R2 till now. But now we want to upgrade to SQL server developer 2012 edition I want to know the pro

  • Adobe flash plugin crashes when I open Frontierville in Facebook

    9 out of ten times that I open Frontierville in Facebook I get an error that says "Adobe Flash plugin has crashed". I have reinstalled the plugin numerous times. I cleared my cache. Finaly, after 2 days of this I uninstalled and reinstalled both Fire