While loop issue

I've been working on this assignment for a few days and got through my problem with the IF/ELSE IF statement. Now I am running into a problem with what I assume is some poor coding of my WHILE loops.
I have this data file to input and read from:
40      Light Karen L
81       Fagan Bert Todd
60       Antrim Forrest N
95       Camden Warren
52       Mulicka Al B
89        Lee Phoebe
75      Bright Harry
92      Garris Ted
43      Benson Martyne
100       Lloyd Jeanine D
73      Leslie Bennie A
70      Brandt Leslie
89      Schulman David
90      Worthington Dan
70      Hall Gus W
50      Prigeon Dale R
63      Fitzgibbons RustyMy code is as such:
import java.io.*;
import java.util.*;
public class prgrm8
{ public static void main(String [] args) throws Exception
{ Scanner inFile = new Scanner(new FileReader("prgrm8.dat"));
     PrintWriter outFile = new PrintWriter("prgrm8.out");
          int value, ctr = 0, ctrR = 0;
          double sum = 0;
          String name = " ";
          String line = " ";
          String msg = " ";
          String filename = "prgrm8.dat";
          StringTokenizer st;
          outFile.println("REPORT");
     while(inFile.hasNextLine())
          line = inFile.nextLine();
          st = new StringTokenizer(line);
          value = Integer.parseInt(st.nextToken());
          name = st.nextToken();
     while(st.hasMoreTokens())
          name = name + " " + st.nextToken();
          st = new StringTokenizer(name);
          ctr++; 
     if(value >= 90){      
               msg = "OUTSTANDING";
     }else{
     if(value >= 70){
                    msg = "Satisfactory";                                   
                     sum += value;
                    ctrR++;
     }else{
                    msg = "FAILING";
          outFile.println(value + " " + name + " " + msg);
          outFile.println(ctr + " " + "processed names");
          outFile.println(ctrR + " " + "between 70 and 89 inclusive");
     if(ctrR <= 0)
          outFile.close();
}and I am outputing the following to my outFile:
REPORT
63 Fitzgibbons Rusty FAILING
1 processed names
0 between 70 and 89 inclusiveSo I am validating when compiling now, but I am not getting the intended results( I am wanting output each students grade, name, and the corresponding message, then get the total number of names processed(ctr), and then the number of grades between 70 and 79(ctrR) . Any advice is helpful, and thanks in advance!

Here
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.Reader;
import java.io.StreamTokenizer;
import java.util.HashMap;
public class Prog8 {
    public static void main(String[] args) {
        HashMap<String, Integer> map = new HashMap<String, Integer>();
        Reader r = null;
        StreamTokenizer st = null;
        PrintWriter pw = null;
        try {
            r = new BufferedReader(new FileReader("prgrm8.dat"));
            st = new StreamTokenizer(r);
        st.lowerCaseMode(false);
        st.eolIsSignificant(false);
        st.slashSlashComments(false);
        st.slashStarComments(false);
        String s = null;
        int i = 0;
            while (st.nextToken() != StreamTokenizer.TT_EOF) {
                switch (st.ttype) {
                case StreamTokenizer.TT_NUMBER:
                    i = (int) st.nval;
                    break;
                case StreamTokenizer.TT_WORD:
                    s = st.sval;
                    break;
                if (!map.containsKey(s) && !map.containsValue(i)) {
                    map.put(s, i);
                } else {
                    System.err.println("Record already exist.");
            pw = new PrintWriter("prgrm8.out");
            int j = 0, k = 0, l = 0;
            for (String string : map.keySet()) {
                if (map.get(string) >= 90) {
                    pw.println(map.get(string) + " " + string + "OUTSTANDING");
                    j++;
                } else if (map.get(string) <= 89 && map.get(string) >= 70) {
                    pw.println(map.get(string) + " " + string + "PASSING");
                    k++;
                } else {
                    pw.println(map.get(string) + " " + string + "FAILING");
                    l++;
            pw.println(j + " OUTSTANDING, " + k + " PASSING, and " + l + " FAILING");
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                pw.flush();
                pw.close();
                r.close();
            } catch (IOException e) {
                e.printStackTrace();
}P.S. untested
let me know.
Edited by: Oclamora on May 15, 2010 6:56 PM
spelling edit

Similar Messages

  • BPEL While Loop Issues

    I have a BPEL process that polls a DB table for records. The DB Adapter has the both Database rows per transaction and Database Rows per XML set to 10. A While loop in the BPEL process loops over all the 10 records, applies suitable transformation and continues with processing. For testing purpose, I inserted 15 records into the table. As expected, 2 instances of the BPEL process were created. The first instance received 10 records and the second one 5. The second instance processed all 5 records but the first instance executes the loop just once, then the condition is evaluated to false and the rest of the records are not processed. Since the second instance is able to loop through all the records, the configuration is correct. I am not sure why the first instance is exiting the loop after just one iteration. I have a simple bpel process to reproduce this issue and I can share it. Following are the versions used:
    Jdev: 11.1.1.7
    BPEL: 1.1
    All help appreciated.
    Thanks,
    Divya

    I have uploaded the BPEL project as well as the sample DB:
    https://community.oracle.com/docs/DOC-893469?sr=stream
    https://community.oracle.com/docs/DOC-893468?sr=stream
    The input XML is below:
    <BpelTest><key>110</key><value>Lyndon Johnson</value><status>S</status></BpelTest>-<BpelTest><key>120</key><value>George Washington</value><status>S</status></BpelTest>-<BpelTest><key>130</key><value>Benjamin Franklin</value><status>S</status></BpelTest>-<BpelTest><key>140</key><value>Abraham Lincoln</value><status>S</status></BpelTest>-<BpelTest><key>150</key><value>Richard Nixon</value><status>S</status></BpelTest></BpelTestCollection>
    Thanks,
    Divya

  • Iteration Speed issue when Indexing 3D array wried to a while-loop

    Brief Description of my Program:
    I am working on the real-time signal generation by using LabView and DAQmx (PCI-6110 card). My vi reads the big data file (typically 8MB txt file containing about 400,000 samples (complex double precision). Then, the signal is pre-processed and I end up with a huge 3D array to feed while-loop (typically 3D array dimension is N x 7 x M where N & M >> 7). Inside the loop, that 3D array is indexed and processed before the results are written to the DAQmx outputs. I have a speed issue when indexing the large 3D array (i.e, 3D array having a large sub-array size). My while-loop could not run fast enough to top-up the DAQmx AO buffer (at the output rate of 96kHz). It could run faster only if I use smaller 3D array (i.e, smaller-sized sub-arrays). I do not quite understand why the size of 3D sub-array affects the rate of looping although I am indexing same sub-array size at each iteration. I really appreciate your comments, advices and helps.
    I include my 3D array format as a picture below.
    Question on LabView:
    How does indexing an 3D array which wires to the while-loop affect the speed of the loop iteration? I found that large dimension of sub-arrays in the 3D array slows down the iteration speed by comparing to indexing the same size of sub-array from smaller-sized sub-arrays of the 3D array to perform signal processing inside the while-loop. Why? Is there any other way of designing LabView Program to improve speed of iteration?
    attachment:

    Thank you all for your prompt replies and your interests. I am sorry about my attachment. But, I have now attached a jpg format image file as you suggested.
    I had read the few papers on large data handling such as "LabVIEW Performance and Memory Management". Thus, I had already tried to avoid making unnecessary copies of data and growing arrays in my while-loop. I am not an expert on LabView, so I am not sure if the issues I have are just LabView fundamental limitations or there are any other ways to improve the iteration speed without reducing the input file size and DAQ output rate.
    As you request, I also attach my top-level vi showing essential sections such as while-loop and its indexing. The attached file is as an image jpg format because the actual vi including Sub-VIs are as big as 3MB in total. I hope my attachment would be useful for anyone who would like to reply my question. If anyone would like to see my whole vi & llb files, I would be interesting to send it to you by an e-mail privately and thus please provide your e-mail address.
    The dimension of my 3D array is N x 7 x M (Page x Row x Column), where N represents number of pages in 3D array, and M represents the size of 1D array.  The file I am currently using forms 3D array of N = 28, & M = 10,731.  Refering to the top-level vi picture I attached, my while-loop indexes each page per iteration and wrap-around.  The sub-VI called "channel" inside the while-loop will further index its input (2D array) into seven of 1D arrays for other signal processsing.  The output from that "channel" sub-VI is the superposition of those seven arrays.  I hope my explaination is clear. 
    Attachement: 3Darray.jpg and MyVi.jpg
    Kind Regards,
    Shein
    Attachments:
    3Darray.jpg ‏30 KB
    MyVI.jpg ‏87 KB

  • How can I update cluster items from inside a while loop that does not contain the cluster?

    I have a VI that contains front panel clusters and two while loops. The main cluster contains items such as a doubles "distance" and "stepsize" and boolean "step" (a whole buch of this type stuff). The first loop contains an event structure to detect front panel changes and the second contains code and sub VIs to perform operations based on detected events.
    The operator can enter data into either double or click the boolean. If distance is changed the second loop does what is required to process the change. The same happens with stepsize. If step is clicked the ±stepsize value is added to distance and the result is processed. In each case the front panel should track the result of the input and subsequent processing.
    Because the clusters are outside the while loop, they are not updated unless I click 'highlight execution' which seems to allow updating each time the execution highlight is updated. There are other issues if I move the clusters into one of the loops.
    I've tried referencing the clusters and using local variables and nothing works. It looks like overkill to use shared variables for this.
    Any ideas would be greatly appreciated.
    Thanks,
    Frank    

    Hi Ben,
    Thank you for the response. I followed the link and tried reading everything you posted on AEs but I'm afraid that I didn't understand it all. It seems that each AE example had a single input and a single output (e.g. a double). Is this the case? 
    What I have is a couple of front panel clusters containing (approximately) 18 control doubles, 8 indicator doubles, 5 boolean radio button constructs and 26 boolean control discretes. I clusterized it to make it readable. In addition I'll eventually have a cluster of task references for hardware handles.
    All I want to do is update the front panel values like I would do in a C, VB or any other language. I've tried referencing the cluster and using the reference from inside the loops. I've tied using local variables. Neither works. I'm experimenting with globals but it seems that I have to construct the front panel in the gloabal and then I wouldn't know how to repoduce that on the front panel of the main VI.  Sometimes it seems that more time is spent getting around Labview constructs than benefitting from them.
    I hope the 'Add Attachment' function actuals puts a copy of the VI here and not a link to it.
    Thanks again for the suggestion,
    Frank 
    Attachments:
    Front Panel Reference.vi ‏33 KB

  • How to use while loops to implement a simple climate control.

    Hi,
    I am currently a 4’th year computer systems engineering student in South Africa doing a primitive climate control project in LabVIEW 8.0. Although my knowledge and skill level of LabVIEW is far from that of an expert, I really enjoy working with it. The project consists of a motor driving some fan blades, a resistor heater and an analog temperature sensor. The basic functionality entails that a user specifies a desired temperature and then the program will heat if the current temperature is lower than desired or cool if the current temperature is above the desired temperature.
    What I want to add is an acceptable temperature difference so that the fan and heater do not switch constantly as the threshold temperature is reached. Rather leave the current temperature to linger between the maximum (current + acceptable difference) or minimum (current – acceptable difference) allowed temperature before heating or cooling it to the desired temperature once again.
    I have attached 2 VI’s:
    Final Assignment: I tried to achieve the sensible climate control by making use of a formula node. As soon as I substituted the if statements in the formula node with while statements, the VI did not respond. It did not give any errors, it just didn’t respond.
    Final Assignment2: I tried the same but by making use of while loop structures. The while where my Input DAQ is works fine, but none of the other while loops work.
    Please advise me on possible solutions for my problem/project.
    Thank you in advance.
    D. Weppenaar
    Attachments:
    Final Assignment1.vi ‏254 KB
    Final Assignment21.vi ‏256 KB

    1. Your VI does not respond because your formula node is trapped in an infinite loop and cannot exit if you're out of the deadband. Replace the words "while" with "if" (or similar) and you might be getting somewhere. Sorry, I don't have DAQ installed, but what determines the loop rate?
    2. You have a dataflow issue. Only the inner loop on the left will run. All other loops must wait because they depend on data from the first loop. data is only available at an output tunnel of a loop once the loop finishes and a loop cannot start until all input tunnels contain data. Also the first loop can never stop, because the stop button is outside the loop and will never get read once the inner loop starts. The stop button needs to be in the innermost loop.
    Most likely, all code segments should run synchronized, so delete all the inner loops. They serve no purpose. All yon need is the big outer loop as in the first code.
    There are many ways to directly observe what is going on. For example you could run the VI in execution highlighting mode while watching the diagram.
    Clearly, you need to become more familiar with LabVIEW basics. Maybe do a tutorial? Right now you might think that dataflow is a hindrance while in fact it is one of the most powerful advantages of dataflow programming. You simply need to be familiar with its logic.
    LabVIEW Champion . Do more with less code and in less time .

  • SubVi with feedback nodes used more than once inside a While Loop

    All,
    I have a subvi that does a set of operations and uses 3 feedback nodes. I am using this subvi inside a While Loop a total of 4 times. I've noticed that all instances used share the same result at each corresponding feedback node but I would like to have an individual result from each of them. Is there an easy way to go around this problem? I have come up with ways to avoid this: a) create a different vi for each time the subvi was used. b) use global variables instead of feedback nodes. Is there any easier way to go around this issue?
    ExamplePlease note that both subvi's are the same) If on my first subvi I calculate a maximum value and get 1.29 (then goes to feedback node) on my second subvi i get 1.01 my feedback node at the second subvi still registers the maximum value to be 1.29. (and I want it to be 1.01!)
    Hope this is not too confusing, I've been scratching my head with this for a while, can't find the "easy" button. Thanks in advance.
    -Pop
    Im using 9.0.
    Solved!
    Go to Solution.

    Attaching the code would be helpful. Anyway, I am not sure how multiple feedback nodes are supposed to operate so I will defer that to others to answer. As far as being able to use distinct values or instances if you are using a subVI you could mark it as reentrant. That way each call to it will behave as it it were a copy of the VI and it will have its own memory space. This should include the feedback node. You may be ending up with a single subVI and in reality a single feedback node. If you need to pass data between calls than simply wire the data through. You could also use an Action Engine to store and retrieve values. An AE is a MUCH better solution than a global variable.
    Mark Yedinak
    "Does anyone know where the love of God goes when the waves turn the minutes to hours?"
    Wreck of the Edmund Fitzgerald - Gordon Lightfoot

  • Capturing of time taken by a while loop in bpm

    Hi ,
    I have a busniess process ,and my receive step is defined in a while loop.
    so it starts with a while loop.
    I want to keep a condition on the while loop that it should receive the messages only for a period of 1 hour ,and if it exceeds this period it should end up the process triggeringa mail.
    I mean to say if there are 12 records to be processed through the while loop ...and if I receive only 11 records ..it will be waiting for that final record in an infinite loop ..so I dont want that ...instead if the total no of records are reached then it should move forward ..If it is waiting for the missing records for an hour ..I should stop the process and trigger a mail to the queue monitor saying that record is missing...I have finished the process without this processing time condition successfully..
    I am new to XI and I dont have any idea on how to capture this processing time of while loop.
    can some one please help me out in this issue...
    Thank you in advance...

    Hi Latika,
    Yeah I understand we can go with fork but why I am going with this is ,I have already designed a Payload dependent loop ,by using while loop.so it makes my job simple ...
    Now I am converting it to time dependent loop,so only the final question I have is...In the time dependent loop documentation ..they have taken it as infinite loop and only kept the time limit in the deadline branch...so when the deadline reaches they trigger something.
    If you go to the documentation of time dependent loop(http://help.sap.com/saphelp_erp2005vp/helpdata/en/08/16163ff8519a06e10000000a114084/content.htm) ..they took the infinite loop...in this loop if I mention the counter ..and if this record count triggers before the time limit...it should come out of the block...would it work this way ?
    Thanks a lot...

  • Plot XY graph from while loop

    I am trying to make a curve tracer with a DC power supply, DAQ, and Labview 7.1. Everything is ok, until I want to plot an x-y plot from a while loop. I can do this function fine using a for loop and cluster cells, but I need the while loop for the interruption function. When I change to the while loop, it had data formating issues, but I believe I have it to something that should work. It seems like my xy plots want to graph (the auto scale moves the axis respectively) but I do not get a line. I'm not sure if Labview is seing this as just one point and not an array, or if there is a labview bug. Attached is my code with a few different trials to make an xy plot. If anyone can be of help I would be very thankful.
    -Jon
    Attachments:
    Curve_trace_w_relays_while.vi ‏122 KB

    If it works in a FOR loop, but nor in a while loop, most likely your output tunnels are not autoindexing (FOR: on by default, WHILE: off by default). Right-click on the output tunnels and select "enable indexing".
    If you want to watch your graph update during the while loop, you could accumulate your x and y data in a shift register and graph it. (See attached modification).
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    Curve_trace_w_relays_whileMOD.vi ‏74 KB

  • Time Measurement in a While-Loop

    Greetings gentleman;
    I am a little bit new at Labview, and though i searched for an answer without posting, i was not able to find one.
    So here is my question, i would like to know how can i measure time of a loop sequence, in other words, how much time does my VI take to execute the whole main loop ?.
    A little explanation, the attached VI tries to be a Markov Chain, it takes some values in the first case structure depending of the previus loop, then, if the values are correct, it goes to the next step and so on. It is quite simple, yet, my issue lies with the time measurement. Since this is a probability "distribution" it could take infinite time to execute one single loop if it does not meet the requierements, but is programmed to meet them so an average timing should work.
    So, if you look at the While loop, the big one, that i would like to measure how much time does it take to do one round.
    Thanks for the help, i would be glad to read some ideas on how to measure that.
    Kind regards,
    Stgo.
    Solved!
    Go to Solution.
    Attachments:
    Markov Chain.vi ‏30 KB

    You can find a few examples in the NI Example Finder by searching for 'speed test' or 'benchmark'.
    Essentially, you create a flat sequence structure inside your while loop. In the first frame, you measure the current tick count. In the middle frame, you run your code. In the final frame, you measure the tick count again, and subtract the first count from this. This gives you the execution time to run the code.
    You can see a community page on it here.
    There's a high resolution tick/time count VI hanging around somewhere which is excellent for benchmarking and improving efficiency, used in place of the Tick Count (ms) primitive.
    Edit - remembered where it was
    https://decibel.ni.com/content/blogs/EvanP/2010/10/04/tick-count-us--microsecond-timing-granularity-...
    CLD

  • Outputting sine wave to motor -- While loop placement?

    I'm having trouble creating a basic Labview program to drive a motor with a sine wave. I'd like to output one sine wave at a time to my motor and look at the response to eventually get a Bode plot. I'm using the Sine waveform VI and I've got a PXI-7358 controller card.
    I'm having trouble figuring out what goes in the while loop. I'd like to output, for example, a 10Hz sine wave to my motor. But when I create a VI as shown below (& attached), my output waveform frequency is nowhere near my input frequency. When I type 10Hz I get no movement out. At 10.01 Hz input the motor oscillates at a few Hz, and at 10.1Hz input the motor oscillates wildly. I don't think it's a problem with my motor or my PID settings, because even when I eliminate the motor commands altogether (second figure below), I get the same unpredictable relation between the frequency I type in and the Waveform graph.
    It seems that the output waveform depends on some sort of difference between the while loop execution rate and the PXI-7358 command generation rate. It seems to me that the Sine Waveform.vi should be outside the while loop, but in that case the Load Position.flx only seems to grab one position. Is there a good way to have direct control over output frequency of the sine wave?
    Attachments:
    one_axis_move11.vi ‏20 KB
    one_axis_move12.vi ‏12 KB

    matthewg,
      Dennis is right, let’s keep this to one forum since it is the same topic of discussion, and I will address some of the issues with your code there.
    Chris_G
    Sr Test Engineer
    Medtronic, Inc.

  • Imaging.s - while loop - preboot bundle

    I've noticed that either 11.2 or 11.2.1 has added a while loop to imaging.s
    the comments indicate it is to allow multiple activities to take place.
    i have a preboot bundle that runs img to lay down some zmg files. nice and simple.
    in this new scenario, the preboot script just repeats (never exits).
    I've had a look around but i haven't found anything that i'm suppose to change to suit the new regime.
    anyone else in this situation ?
    currently, i've comment out the while loop in imaging.s to allow execution as we would expect it, but it's not the right answer as it will have to be edited for every update.
    in my script should i be attempting to export a result code so that the "export IMGSUCCESS=1;break;" lines can get acitivated ?
    Code:
    #!/bin/bash
    # imaging.s
    . /bin/config.s auto
    mountFloppyifLS120
    # Do imaging in a loop and break out when done.
    # This allows advanced script in an auto session to check for more work to do
    while [ 1 ]; do
    #check for environment variable with command to run
    if [ "a0" = "a"${#IMGCMD} ] ; then
    /bin/img a
    #Return codes for img:
    # 0 SUCCESSFUL, but no changes on hard drive(s)
    # 1 SUCCESSFUL, new image placed on hard drive(s)
    # 2 SUCCESSFUL, proxy had no work to be done
    # 4 SUCCESSFUL, advanced script brought down to be run
    # 1124 SUCCESSFUL, Third Party Imaging Task
    else
    if test -f "$IMGCMD" ; then
    # if the file is a regular file, assume it is a script and in unix format
    /usr/bin/dos2unix $IMGCMD
    /bin/chmod +x $IMGCMD
    fi
    $IMGCMD
    fi
    RESULT=$?
    if [ $RESULT"a" = "0a" ] || [ $RESULT"a" = "1a" ] || [ $RESULT"a" = "2a" ] || [ $RESULT"a" = "1124a" ] ; then
    export IMGSUCCESS=1
    break;
    elif [ $RESULT"a" = "4a" ] ; then
    dos2unix /bin/zenAdvancedScript
    chmod +x /bin/zenAdvancedScript
    . /bin/zenAdvancedScript
    mv /bin/zenAdvancedScript /bin/zenAdvancedScript.sav
    else
    echo ZENworks imaging failed with error:$RESULT.
    echo ZENworks imaging failed with error:$RESULT. > /tmp/img.log
    break;
    fi
    done
    #always run sidChange. It checks to determine if it will do any work or not
    sidChange
    if test -f /update/ZUpdate.s ; then
    #update to new version of ZEN imaging client
    . /bin/update.s
    fi
    /bin/grub.s auto

    peterhine,
    It appears that in the past few days you have not received a response to your
    posting. That concerns us, and has triggered this automated reply.
    Has your problem been resolved? If not, you might try one of the following options:
    - Visit http://support.novell.com and search the knowledgebase and/or check all
    the other self support options and support programs available.
    - You could also try posting your message again. Make sure it is posted in the
    correct newsgroup. (http://forums.novell.com)
    Be sure to read the forum FAQ about what to expect in the way of responses:
    http://forums.novell.com/faq.php
    If this is a reply to a duplicate posting, please ignore and accept our apologies
    and rest assured we will issue a stern reprimand to our posting bot.
    Good luck!
    Your Novell Product Support Forums Team
    http://forums.novell.com/

  • Can we execute a query in resultset while loop

    can we execute a query in resultset while loop
    for ex:
    rs=st.executeQuery("SQL");
    while(rs.next())
    rs1=st.executequery("SQL1");
    while(rs1.next())
    }

    If you do this, you lose "rs". Create a second
    Statement object for the other query.This is right. We have done it many times, It is not the issue as long as you use different statement with in the body of the loop

  • How to structure a control and its display in the same while loop and same display panel (instead of display panel and a seperate parameter-setting panel )

    As you can see, I need to adjust the Target position to certain value (like 1068.88), the actual position is showing 1066.99.  What kind of flow control structure will achive this goal?
    Notice the Labview example "Vibration analysis"  may shed some light on this issue.  Will someone give out a simpler code to show how it works?
    Attachments:
    Spectrometer Control V3.0.vi ‏113 KB

    lightblue,
    Just to make sure we are on the same page, you would like to set the position, then monitor it.  Is that correct?  In that case, you might have a few options.  You could have a sequence that would set the position, and then a while loop that would monitor the position, however this wouldn't allow you to update anything else.  The other option would be to use parallel while loops, which would be similar to the parallel sequence structure you have below.  The only issue with this would be that if you are calling the driver from both loops, you could run into errors.  The Vibration Analysis.vi takes the setpoint, then calculates the actual available position, so it won't serve as a very good example, code-wise. 
    Hope this helps!
    Andy F.
    National Instruments

  • Multiple DAQ Cards, Multiple While Loops

    I'm writing a code to support 3 small test stands that each have the same outputs and inputs as the others. I'm running them all off of an 8-slot DAQ. Each test stand has its own dedicated RTD Card and Analog Out card, but they all share a 32-channel Analog Input card.
    I'd like to decouple the 3 test stands as much as possible - if I have to take out an RTD card or Analog Output card, I don't want the entire LabVIEW program to stop running. I want to be able to keep running and logging data on the other two test stands if I were working on the other test stand. Is there a way to do this with only 1 cDAQ? Is it simply a matter of creating separate, independent while loops for each test stand? If so, would LabVIEW have issues with each while loop writing its own measurement file in parallel with the others?
    Thank You.

    Is it safe to assume you've been running the three tests?  Some of your post makes it sound like you've run them coupled while other parts make it sound like you haven't successfully had all three tests running simultaneously.
    If you aren't running them, are you using hardware timing (counters) for your tasks?  If you're looking to use counters, you're only using one per task, correct?  The cDAQ will only have four counters total to be shared between your loops.
    I can't remember off the top of my head if it is the task or the computer that reserves a cDAQ chassis.  I want to say it's the computer so you can run multiple tasks from the same cDAQ.  But, you'd still need to choose ctr0, ctr1, ctr2, etc in each task so that you don't share these resources between tasks.
    Are you looking to pull the shared module out frequently?  If not, are you gaining enough functionality to justify buying two redundant modules to gain decoupling?

  • SubVI with while loop + event structure not working in multi tab VI

    Hello Everyone,
    I am developing an interface for the control of a prober using Labview 2012, and I am stuck with some issue.
    To start with I provide you with a simplified version of my control interface VI, and with the sub-VI used to build and manage the wafer maps.
    The VI consists of several tabs: Prober Initialization, Wafer Handling, Wafer Map, Status, Error.
    The sub-VI can:
    1/ initialize the grid to display the map (sub VI Init Grid not provided here)
    2/ import XY coordinates from a txt file (sub VI Wafer Map Import)
    3/ display the coordinates and index of the die below the cursor
    4/ and when a die position is double clicked, and the boolean "Edit Wafer Map" is true, then the user can change the state (color) of the die between On-wafer die and Selected Die
    My issue:
    If I use the sub-VI by itself, it works fine. However when I use it as a sub-VI in the tab "Wafer Map", the map does not build up and I can no further use the embedded functionalities in the sub-VI.
    I suspect the while loop + event structure of the sub-VI to be the bottleneck here.
    However I don't know which way to go, that's why I'd be glad to have some advice and help here.
    Thank you.
    Florian
    Solved!
    Go to Solution.
    Attachments:
    Control Interface.zip ‏61 KB

    Hi NitzZ,
    Thank you for your reply.
    I tried to save the VIs in LV10, please tell me if you can open them now.
    Inside he event structure there is quite some code, and since I don't want to make the main vi too bulky, I would like to keep it as a sub-VI. 
    As you can see from the sub-VI, the event structure is used for extracting cursor position and tracking the double click action. These events are linked, through a property node, to the image "Wafer Map" which is passed to the main vi through connector pane.
    All values are passed this way as well (through connector pane). Is there another way?
    Maybe "refnum", but I don't really understand how to use them...
    If I use the event structure in the main vi, the wafer map is still not working. I tried it earlier.
    To implement the multi tab front panel, I used a tab control, and a for loop + case structure. For each element of the case structure, there is a corresponding action.
    For the case where I put the code (element=2) for Wafer Map, I also control the execution of the code with a case structure activated by the button "REFRESH". Otherwise I end up with a freezing of the panel right after the start.
    I hope these comments help you understand better.
    Regards,
    Florian
    Attachments:
    Control Interface.zip ‏104 KB

Maybe you are looking for

  • How do I install firefox on my computer I have downloaded it already,I am a first time user.

    I downloaded mozilla firefox,and i dont know how to install it,can you help me/

  • Check field values wad

    Hi everyone, I'm working on a template in wad and I have to check whether the user has choosen values in different dropdown boxes or not. How do I do this? I tried different things with the command wizzard and javascript but don't know how to impleme

  • Dates prior to Jan. 1, 1970 in milliseconds???

    In my jsp, using tags, I'm trying to convert a birthdate, retrieved from a database, in the format of MM/DD/YYYY into milliseconds. It's very possible this date would be prior to 1970. I've tried using <fmt:parseDate> and <fmt:formatDate>. Appreciate

  • Movement Type for Finished Goods transfer

    Hello all; I'm looking for the correct movement type to use to execute a stock transfer between consignment accounts. I have a sold to with consignment inventory and I need to transfer it to another consignment sold to account (with serial numbers).

  • Frm - 41337 - can not populate the list from record group

    Hi I have created a form with 4 combo boxes. And i am trying to populate the 4 combo boxes dynamically. Here is my table structure. BUS_FUNCTION VARCHAR2(500), SEQ NUMBER, STEP1 VARCHAR2(500), STEP2 VARCHAR2(500), STEP3 VARCHAR2(500), STEP4 VARCHAR2(