How many while loops in an applicatio​n is appropriat​e?

Hi,
I am writing an application that is growing and now I'm about to add the 5th while loop on the root level. So far, I have loops for:
1. Receiving data
2. Transmitting data
3. Processing commands
4. Handling front panel events
5. (about to be added) background timed events
My question is this - is there any "recommended" maximum number of while loops in the base VI or is it purely up to the application? I am wondering if it matters, or if I can simply add loops as needed. Other than combining the transmit and receive data which I don't want to do due to speed, there's not much else to combine.
Any comments?
Thanks,
Jason

Isn't LabVIEW wonderful? It is so easy to write applications that do many things seemingly at the same time in paralell.
I would not worry too much about the number of loops. Make sure that each loop is well behaved and only spins if there is really something to do. A single empty loop without any wait statement can be very taxing for the CPU and hurt responsiveness in all other loops.
As long as the UI is nicely responsive and the CPU is not pegged at 100% you're fine.
LabVIEW Champion . Do more with less code and in less time .

Similar Messages

  • How many Apple loops preinstalled with Garageband 09?

    Straightforward question: how many loops are included with Garageband 09? I can find hardly any (eg 4 drum loops, all cymbals) and it makes me wonder if something's missing, or if that is indeed all that is provided with the standard install of Garageband.
    Thanks.

    HangTime wrote:
    which is why i did not say to open it ;-)>
    Well, obviously there wasn't much chance it would work, but no harm trying.
    I did what you suggested - deleted all the files in the Receipts folder that start with GarageBand (after backing them up first) and tried to reinstall Garageband from the MacBook software DVD, but no joy - everything is still greyed out apart from the help files.
    So I dropped GarageBandExtraContent.pkg onto FileJuicer and that kept FileJuicer busy for a good 15 minutes. In the end it extracted a gigabyte of stuff from that 5.4Mb file, including a lot of AIFF and WAV files, though no CAF files, oddly enough. The WAV files mostly have cryptic names like 35m2aF6.wav (which turns out to be a string section, Full Strings Lite, playing a high C I think).
    However, I can't find any AIFF or WAV files with a date later than 2005. This makes me think I probably do have the full set of Apple Loops and that the set hasn't changed for a while. If anyone has the default install of Garageband 09 and wants to compare file lists, that might be a good idea...

  • Does anyone here knows how a while loop works?

    The following code works...
    DECLARE
    zz NUMBER := 1;
    BEGIN
    While zz < 10
    LOOP
    zz := zz + 1;
    END LOOP;
    END;
    If I put a prompt in it like so it does not....
    DECLARE
    zz NUMBER := 1;
    BEGIN
    While zz < 10
    LOOP
    prompt Look THEO I am looping...;
    zz := zz + 1;
    END LOOP;
    END;
    I get the following error...
    prompt Look THEO I am looping...;
    ERROR at line 6:
    ORA-06550: line 6, column 14:
    PLS-00103: Encountered the symbol "LOOK" when expecting one of the following:
    := . ( @ % ;
    I get the same kind of error if I put a create, select or pretty much any other statement than an assignment in the loop.
    Am I to believe that a while loop in SQL*Plus is particular to what kind of statement is in it?
    Any help would be appreciated.

    PROMPT is a SQL*Plus command. If you would like to output text to the screen while looping in a procedure you should use DBMS_OUTPUT.PUT_LINE(). This will also require you to use the following command at the SQL*Plus promptSET SERVEROUTPUT ON;Your code will look like thisDECLARE
        zz NUMBER := 1;
    BEGIN
      While zz < 10
        LOOP
          DBMS_OUTPUT.PUT_LINE('Look THEO I am looping...');
          zz := zz + 1;
      END LOOP;
    END;This will output Look THEO I am looping... 9 times. If you would prefer that it only be displayed 1 time then you can move the DBMS_OUTPUT.PUT_LINE between the BEGIN and WHILE commands.

  • How many PID loops could I run on cRIO RT?

    Hi,
    I am trying to create a temperature process controller. I have 3 RS232-enabled OMEGA mass flow controllers, 12 thermocouples, 6 heaters (that will be connected in sets of two), and 3 PWM-enabled fan banks.
    My thinking is that I would connect the heaters in parallel to a phase-angle-fired SSR (http://www.chromalox.com/catalog/resources/PDS-PK308-SSR.pdf). That way, I could use a 0-20 mA output signal from the cRIO to control the power appplied to the heaters. I would use PID, and scale the output of the PID to a 0-20 mA signal to control the process temperature. I also want cascade control - I want to have 2 additional thermocouples that are connected to the PID loop acting as limit sensors. If the temperature limit is exceeded in either thermocouple, the PID loop is "turned off" until reset by a user. I would want three of these configurations (2 heaters, 3 thermocouples, 1 SSR - x3, so 6 heaters, 9 thermocouples, 3 SSRs).
    Rather than control the PWM fans with a PWM output directly from the cRIO (which I heard can be painful) I found a PWM controller that is controlled by a 0-5VDC signal. I wanted to use a thermocouple as a process value, and the 0-5VDC signal would scale to control the fans to achieve the desired temperature. I would want three of these configurations (1 fan bank, 1 thermocouple - x3, so 3 fan banks, 3 thermocouples).
    So now, my REAL question - Would one cRIO chassis be able to control these 6 PID loops AND my OMEGA mass flow controllers? I'm just unsure of the processing power that is required of PID/limit control.
    I appreciate any help I get - If need any more specifics, please let me know!
    Thanks!

    Just to follow up - I have no problem using FPGA as well, if leveraging both the RT and FPGA systems will allow me to achieve my goal. I have heard, though, that FPGA is only good if you are only maintaining one set point for the PID loops. My fan bank PID loops will keep a constant set-point, however my heater bank PID loops will require constant changing (the heaters will be used to create a cycle that maintains one temperature for 60 mins, than goes to a different temperature for another 60 minutes, and repeats).

  • How this while loop is stopped

    The attached VI is an LabView example VI and I did a little modification. If I want to stop this VI, I will have to click the Wait loop stop button then click Set Occurrence button twice, finally click the Set loop stop button to stop the program. My question is, if we click the Wait loop stop button and click Set Occurrence button once, the conditional terminal sees the True signal, it's supposed to stop, but it doesn't stop until we click the Set Occurrence button again then click the Set loop stop button. We can see it from the Wait and Wait 2 LEDs. Any one can give some explanation? Thanks.
    Guangde
    Attachments:
    Generate Occurrence2.vi ‏23 KB

    Thank you for responding to my question.  I think I understand it now. The first click of the Set Occurrence button, the lower loop gets out of the current iteration. At next iteration, even though the conditional terminal sees the True signal, it can not exit because it's waiting for the loop to finish. Only after we send the Occurrence again then the loop will finish it's task and exit. Again, thank you for your help.
    Guangde

  • How can I opearate indicator outside while loop?

    I do small program, I have many while loops and I want to connect wire (in my application) from each loop to AND gate then to another while loop, but how can I operate these wires to agree with the change of my application inside while loops.
    If not clear :
    In another words, suppose I want to operate indicator ouside the while loop. How can I operate indicator outside while loop, so when my application become TRUE (inside while loop) the indicator will be ON (outside while loop) and when my application become FALSE(inside while loop) the indicator will be OFF (outside while loop).
    Help me if you have any idea please..........................

    Hi Rammo,
    For the wire to carry the boolean condition from the while loop to an 'and' gate outside, the while loop must stop running
    If you want the while loop to keep on running and still pass a boolean value to a destination outside the while loop, use any one of these: property nodes, global or local variables.
    i am still not clear as to what you intend to say by this sentence
    " I want the wire that comes out from the while loop will become TRUE if it in my application is TRUE inside while loop and the opposite is true. Because I want to connect the wire that comes out from while loop to AND gate than to another application"
    plz tell me if the first part of this mail of mine answers your doubt or do you need more information?
    regards
    Dev

  • Using while loops instead of for loops in arrays?

    I am new to java and doing a java tutorial on using arrays and for loops. What im trying to find out is how it is possible to use a while loop instead.
    I would be very grateful if anyone can suggest a way of changing my code to use a while loop.
    The code I have written is:
    public class DetermineGrade
    public static void main(String[]args)
    final char[] mark = {'A','B' ,'C' ,'D' ,'F' };
    char [] grade = new char[5];
    int [] Score ={95,35,65,75};
    for (int i=0; i<4; i++)
    if (Score >= 90)
    grade= mark[0] ;
    else if (Score >=80)
    grade = mark[1] ;
    else if (Score >=70)
    grade = mark[2] ;
    else if (Score >=60)
    grade = mark[3];
    else grade = mark[4];
    for (int i=0; i<4; i++)
    System.out.println("grade = " + Score + ", " + grade);
    Thankyou LB

    Im trying to underdstand the differences in the
    different loops. I can grasp the for loop but I dont
    see how a while loop works, or how it id different
    from the other?
    for (j = INIT; j < MAX; j++) {
        // do stuff
    }is the same as
    j = INIT;
    while (j < MAX) {
        // do stuff
        j++;
    }Lee

  • Does the inner while loop have to be stopped before the outer loop will run?

    too many while loops cause my controls to be very sluggish.

    Hello,
    The outermost while loop executes everything inside it over and over. Therefore, if you have a while loop inside another while loop, the first iteration of the outer while loop will execute the inner loop, and then the inner while loop will execute over and over again until it is stopped. At this time the outer while loop will perform another iteration, and the process will repeat until the outer loop is stopped. Generally, embedding while loops within while loops is not recommended.
    Please visit the below sites for more information on program efficiency.
    http://zone.ni.com/devzone/conceptd.nsf/webmain/b6605678ad7a09a8862568eb007a6d7a?OpenDocument
    http://zone.ni.com/devzone/learningcenter.nsf/03f7c60f17aad210862567a90054a26c/1b36040af87887078625
    6cbc006fe314?OpenDocument
    I hope this helps!
    --Liz F

  • How to find out how many recourds in recourd set  with out while loop

    hi
    i want to findout how many recourds in recourd set
    with out useing any loops like
    while(rs.next())
    count+=1;
    like this
    any mathod like(RecoundCount like )
    pls help me
    regards
    kedar

    If you dont want to use a scrollable result set do
    sql="SELECT COUNT(*) AS COUNT FROM TABLE"
    rs=stmt.executeQuery(sql);
    rs.next()
    count=rs.getString("COUNT");

  • How do i stop a while loop

    I'm new to labview and I'm having a problem stopping a while loop (running windows XP/2000 with the student edition of labview express 7).
    I'm doing a data acquisition program where I'm constantly reading in voltage and comparing it to a set point value, when the input voltage goes above the set point, i want the while loop to stop. How do I do this? I already have an LED going on when the criteria is met, but I'm not sure how to actually stop the loop (i.e. change the iteration value from true to false-i guess). If anyone can please assist me with this I would very much appreciate it.
    I've included my program too.
    Attachments:
    CO_Detection_Monitoring_System_Modified.vi ‏60 KB

    Hello Everyone-
    I've just posted a message about stopping a while loop and it was answered accurately and quickly- thanks to LV_Pro and PauloM- thanks much- its nice too see that there are many helpful people out there! Unfortunately, I have 2 more questions to ask of the forum.
    My application is almost completed- I just need to add an elapsed time counter that will tell me how long it took for my LED to trigger (from my set point-i.e. when from 0:00:00 until when my loop stopped).
    Now I've found a perfect elapsed time counter on the NI web site contributed from Mike Hall from Ohmeda Medical- the page is here.... http://sine.ni.com/apps/we/niepd_web_display.display_epd4?p_guid=D37E2493DC333076E034080020E74861&p_node=DZ52032&p_source=external
    So my first question is, it looks like I can just extend the while loop box in my 'CO detector... .vi' and paste just the code from the 'elapsed time.vi' while loop into my loop and I will be set- but do I need to change my wait until next multiple to be a 1000 too in my program? Probably, but I'm not sure hence the question- or other ideas would appreciated.
    My second question is now that my application is complete (after I add the elapsed time above), I need to exactly duplicate this process for 7 other DAQ inputs (i.e. right now I'm using only 1 of 8 analog inputs on the FP-AI110). So should I make my 'CO detector.. .vi' a separate program (I remember reading something about this in one of the posts earlier).
    Any help is very appreciated.
    Thank you again,
    Daniel
    Attachments:
    CO_Detection_Monitoring_System_Modified.vi ‏60 KB

  • How to stop a while loop when using tab control

    How do you use a tab contol to stop what is happening on one tab when you switch to another tab?  In the test example I attached, I have a while loop nested inside a case structure controlled by the tab control.  When I tab to page two the elapsed timer starts but when I switch to another tab it does not stop.  I can't come up with an easy way to stop or exit the while loop when I change tabs. 
    Thank you
    Danny
    Attachments:
    tab control.vi ‏24 KB

    I played with it a little more and came up with this fix.  This fixes it but is not tied to the changing tabs as I was looking for.  Is this just too many nested loops and a bad idea?
    Danny
    Attachments:
    tab control fix maybe.vi ‏26 KB

  • How to avoid Build Array function inside a For (while) Loop?

    Hi there,
    I have a simple question about how to avoid using Build Array function inside the loop. Now I want to remove the Build Array funtion inside the loop to improve the performance (To get better memory management). Any idea how to do that?
    Thanks a lot!
    Warmest regards,
    Chong

    It's been my experience that using the auto-indexing to build an array
    on a For loop is just as good as initializing and replacing elements.
    The For loop knows before it runs how many iterations it has to run and
    can allocate the array ahead of time.
    You're better off initializing and replacing when using a While loop
    because it does not know how many iterations it will run and can't
    pre-allocate the array ahead of time.
    Ed
    Ed Dickens - Certified LabVIEW Architect - DISTek Integration, Inc. - NI Certified Alliance Partner
    Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.

  • How to stop execution in while loop without stopping execution of other loops in the same vi

    HI
    I am quite a novice in Labview.
    I have a problem in my project. I used a while loop inside my vi to build an array of ten values along with other loops. Then I used a stop button to stop manually the while loop. But it seems like the loop doesn't stop in the middle of the array building and so other loops in the vi doesn't work until the while loop finishes building the array and as soon as while loop execution is over, the complete vi stops. But all that I wanted was to build the array using the shift register along with the control to stop building array anytime. And not to stop execution of other structures when the while loop finishes.
    Can anyone help me?
    Rahul

    Hi Rahul,
    Modified ur Vi to work with single button.
    But the subtract case is not in any loop.
    So, once both the loops stop, the subtract case will execute only once. Depending on state of subtaract boolean at that time, corresponding case will be executed and the Vi will stop.
    so think of a logic where u can put this also in a new loop.
    Or you can also incorporate it in one of the two loops and pass the other loop's data to it.
    Let us know how you will proceed in this regard
    I am posting your VI as well a VI with my modifications VI in Labview 7.0 so that Thomas can give his suggestions too
    Plus, always keep a time delay in your while loops.
    Oh sorry, the "arrayinouttestnewfinal.vi" is the modified vi
    Regards
    Dev
    Message Edited by devchander on 01-10-2006 06:15 AM
    Message Edited by devchander on 01-10-2006 06:19 AM
    Attachments:
    arrayinouttestnewfinalnew4.vi ‏59 KB
    arrayinouttestnewfinal.vi ‏63 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 out from infinite while loop in sub VI

    Dear Sir,
    how to out from infinite while loop in sub VI from main VI
    attached photo for solution but I can't understand it and i can't find the function in photo 
    please help
    Attachments:
    stop_subVI_frm_main.JPG ‏36 KB

    Asking how to get out of an infinite loop is like asking how to find the end of a circle. I'm not trying to be sarcastic but by definition, if there is a way out of the loop, then it is not infinite. I think what you are asking is how to avoid creating an infinite loop. Is there something about the suggestions you have been given that you do not like? My favorite suggestion is the notifier but maybe you just need an example. Turn on context help and read about the notifier functions in the code below.
    This is your top level VI
    And this is your subVI
    If this seems too complex then a global variable will work too. But what seems simpler can cause much more complex bugs. You can code fast and spend lots of time debugging or you can code slow and spend less time debugging. Personally I perfer writing productive code than looking for bugs any time.
    =====================
    LabVIEW 2012

Maybe you are looking for

  • Dynamically changing the functions in a menu based on the user (in SSHR)

    Dear All, I have a requirement to change the functions in a menu dynamically. For Ex: An employee is allowed to apply Advance only in the first one month of his/her joining. I created it as an EIT and attached the function, to the menu. Now, i want t

  • Synching new iPod 7 with iTunes

    Hi there. I just bought  a new iPod 7 instead of my old one. I ownloaded the new iTunes version as reuiqred. The iTunes showed me to do an uodate for the iPod. So I did. Now, the iPod showed me it was doing sync. several times. But each time, I check

  • Using SOAP without WSDL?

    Newbie to SOAP and Flex and I have a small pilot project to access a company's SOAP 1.1 web services. I am given the sample SOAP request/response messages embedded in HTTP. It seems Flex requires WSDL file for communication but I don't have it. Do I

  • Error code -69 when trying to sync laptop to ipod

    Hey there, I just got my nano (2nd gen) and first time it sync'd just fine. I bought some itunes and set up some podcasts and now everytime (5+) I connect the two I get: Attempting to copy to disk 'My Ipod' failed. An error code occured (-69). I've r

  • Question on Entity attribute for table with PK populated by trigger

    Hello, I am looking for guidance on setting up my Entity Object. I am working with an existing db where the primary keys for the tables ( ID Number(10,0) ) is populated by a trigger on insert. Should the attribute type for the ID column be Integer or