How to make a loop run for specific period of time ?

hello !
i'm new to labview and could'nt found how to make a loop run for 2 sec for example, and then to exit.
Solved!
Go to Solution.

Hi Hookso,
You can do it using the different loops like While loop and For Loop. Roderic has already stated how to do it using a for loop. I have illustrated in the attached vi how to do it using a while loop and Elapsed Time function. Take a look.
Regards,
Nitzz
(Give kudos to good Answers and Mark it as a Solution if your problem is Solved) 
Attachments:
Untitled 2.vi ‏36 KB

Similar Messages

  • How to get a loop run for 1 instance every time a button is pressed

    I need to get a loop run only once everytime a button is pressed.
    Please help me.

    Read the help built into LabVIEW
    Here's online version of the help: http://zone.ni.com/reference/en-XX/help/371361L-01/glang/event_structure/
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • How to keep that valve open for certain period of time and shut off automatically

    Hi everyone,
    The objective of the VI is to measure pH and then open acid or base valve based on pH valve. Below is my UNFINISHED VI
    My question is:  if, for example, the  pH is 10, then, the program will open acidic valve for 5 seconds and then shut off automatically. After that, wait for 5 second. this process will go on and on as I use while loop, but I just dont know how to control the valve on for 5sec and off and then wait for 5sec.
    Anyone can help me out?    Thank you very much
    In the picture, please enter those values before running
    P.S The VI is based on previously posted vi by someone who made it 1 yrs ago.
    Attachments:
    project_trial_1_26.vi ‏27 KB
    Capture.JPG ‏79 KB

    1. The reason the valves close immediately is that the Elapsed Time VI does not cause any wait, it only measures the time. So the valves closed within a small fraction of a second of the time they opened.
    2. I modified your VI to wait until the Elapsed Time has ended.  See the "wait" state.  I probably modified some of your other functionality in the process, but this shows one way you could do the timing. 
    3. You do not need any Value property nodes.  They should never be used if the value can be wired directly.
    4. You do not need any sequence structures. Dataflow will determine the order of things occurring.
    5. If you use an enum for the state machine (and it is a good way to name and select states), you should make it a type def. Then when you need to change it as I did to add several states, you only need to change the Type Def in one place and the changes propagate through to every place you used the control or constants derived from it.
    6. I added a Halt state which will close both valves before stopping the program.  When you are controlling a real world process, it is important to consider the start up and shutdown requirements. For example the digital outputs of the USB-6008 default to inputs when the device is first powered up. And, the inputs are pulled high by a 4700 ohm resistor (at least I think I recall that value). Will this open your valves before the program starts running and sets the I/O lines to outputs and forces them low?
    The USB-6008 has rather limited drive on the digital lines. You will probably need a buffer between it and the valve coils.
    PID and PWM are more complicated than I want to get into here.  First, are your valves proportional or on/off? Second, (assuming that they are on/off) how fast can you open and close them without destroying them in the first week? What is their expected lifetime in terms of the number of operations? How fast do you need to be able to change them to keep your pH where you want it?  Are these values compatible?
    Lynn
    Attachments:
    pH State.ctl ‏12 KB
    project_trial_1_28.2.vi ‏66 KB

  • Can I make a function wait for a period of time?

    Hey everyone
    I just wanted some idea's on how best to tackle this problem
    in actionscript.
    All I want is that when a button is pressed it fades out the
    current page and then fades in the new page to be displayed. How
    ever when trying to fade out the current page i doesn't because it
    goes to the label and starts to play but the next part of the
    script tells it to go straight to the label to load the new page.
    Does anyone have a clever way of making it wait till the current
    page is faded out?
    If worse comes to worse can I just make it wait a set period
    of time before fading in the new page?
    Ive attached a bit of the current code and comment it with
    where the current page is faded out.
    Thanks in advance for any help
    Gaunt

    What I'm struggling to get my head round though is how to I
    get it to know when the fade out code is finished?
    Because the way I have programmed it at the moment,
    everything is done from one action script that registers the last
    viewed page and then when the new page is clicked it will just call
    gotoAndPlay to the point where my pages_mc will play fading out the
    current page, then after that it will call gotoAndPlay on the
    pages_mc to play the fade in of the new page.
    I just dont see how I call the second gotoAndPlay function
    once I know the first gotoAndPlay function has ended.
    Does that make any sense or am I just being stupid??
    Thanks for the help again though kglad

  • Issues with Shared Variables in Systems Running for Extended Periods of Time

    I am designing a large SCADA system using LabVIEW DSC and cRIOs. My plan is to use shared variables to communicate the majority of the information across my network (much like "tags" in a normal SCADA system).
    I'm wondering if anyone has experienced issues (connection failures, etc...) with shared variables running on systems for months (both real-time and windows based PCs) without the cRIO or PC being restarted/redeploying the variables. What is the stability of the Shared Variable Engine over extended periods of time?
    Thank you for the input.
    --CLD--
    LV 6.1, 8.6.1, 2011 SP1, 2012 SP1

    I have a system with 2 cRIO's each with Ethercat extension chassis.  Each cRIO hosts ~100 NSV's and is running the scan engine at 40 Hz.
    Each cRIO is coupled to a HMI that has front panel control bindings to NSV's hosted on the cRIO as well as a windows hosted mirror library (used for citadel db logging) that is also bound to the cRIO NSV library.  The cRIO's have monay months of contiguous run time without reboot and I closely monitor cpu and memory usage and also rt performance metrics and will log faults if there are any such events.  I also use NSV's for messaging from the HMI to the cRIO for such things as setting zero offset values and deploying configuration parameters.  My overall findings are that the SV engine and the PSP are stable and efficient (especially NSV<->NSV and NSV<->HMI binding)

  • After Server running for a period of time, get Connection Errors

    Hi All,
    We're experiencing some serious issues during performance testing.
    Its only occurring with WebLogic 10.3 and only occurring with connections of type oracle.jdbc.driver.OracleConnection.
    After a good while testing, the server fills up with the following exceptions....
    <09-Oct-2009 15:34:17 o'clock IST> <Warning> <JDBC> <BEA-001129> <Received exception while creating connection for pool "jdbc/sdoPool": Io exception: The Network Adapter could not establish the connection>
    Here is the configuration of the jdbc/sdoPool :
    Driver Class Name: oracle.jdbc.OracleDriver
    Properties -->
    user=SOL_ISMART_USER
    class=oracle.jdbc.pool.OracleConnectionCacheImpl
    protocol=thin
    Initial Capacity: 1
    Maximum Capacity: 100
    Capacity Increment: 1
    Remove Infected Connections Enabled
    Code to get Connection....
    DataSource dataSource = null;
    try
    dataSource = (DataSource) ctxt.lookup( "java:comp/env/jdbc/"+poolName );
    catch ( NamingException ne )
    dataSource = (DataSource) ctxt.lookup( poolName );
    Connection conn = dataSource.getConnection();
    OracleConnection vendorConn = (OracleConnection)((WLConnection)conn).getVendorConnection();
    vendorConn.setClientData( "LOGICAL_CONNECTION", conn );
    return vendorConn;
    Here is my code to close the connection.....
    if ( con instanceof OracleConnection )
    if ( ( (OracleConnection) con ).getClientData( C_LOGICAL_CONNECTION ) != null )
    Connection logicalCon = (Connection) ( (OracleConnection) con ).getClientData( C_LOGICAL_CONNECTION );
    // release connection - defense against connection leaking
    ( (OracleConnection) con ).setClientData(C_LOGICAL_CONNECTION, new Object());
    logicalCon.close();
    logicalCon = null;
    con = null;
    else
    con = null;
    else
    if ( !con.isClosed() )
    con.close();
    Any advice / help greatly appreciated.
    Ronan

    The issue did seem to reduce when the initial connections were increased and the error also became less frequent when the login delay was implemented.
    However, since my code is generating Maps the connection was being used to determine the orientation of the North arrow on the map for the particular view ... The ultimate solution was to remove the render-time database connection and calculate the orientation angle in code.
    Thanks,
    Ronan

  • How to make a job run on a appointed node

    I have a problem. The database is Oracle 10g, RAC, two nodes
    There are some job which run on everyday night. Now, something happened, the job run on Node A can't work as normal, but if run on node B, It will work well.
    so I just want to submit the jobs on Node B, I submited the jobs on Node B, but the jobs always run on Node A.
    I want to know how to make a job run on a appointed node.

    the Job just transfer some procedure to add partitions for some table, to merge the records from some tables to one table and so on.
    the problem is when the job run on Node A, it is very very slow, the procedure would run hours and not success end, but if on Node B it will successfully end in seconds.
    restart the Node A would be a way for the problem, but may it will leave a hidden trouble. I want save the scene to find out the problem
    so can you help me

  • How to make a JApplet run in a Browser

    HI ALL:
    Can anyone tell me how to make a JApplet run in a IE.
    I am using JComponents and Visibroker for JAVA ORB for connecting to another ORB's which would in-turn connect to a C++ Server and finally to the SQL Server.
    I am getting a NoclassFoundException whenever I am running my JApplet.
    My code is >>
    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    <html>
    <head>
    <meta http-equiv="Content-type" Content="text/html;charset=iso-8859-1">
    <title>
    ORB ISSUE TRACKING SYSTEM
    </title>
    </head>
    <body>
    <Applet
         CODE="file://D:/IssueTrackingSystem/IssueTrackingSystem.class"
         Width=700
         Height=700
         Align=middle
    >
    <param name="CABBASE" value="IssueTest.cab">
    </Applet>
    </Body>
    </Html>
    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    The Cabase file is a winzip file having all the ORB's compliant classes and my source classes to interact with the ORB Server.
    Help is urgent.
    Regards
    Ritesh

    I have been having exactly the same problems but I was using JDK 1.2.
    I discovred the problem could be resolved by using the Plug-in on navigaor or IE and bingo it was perfect.
    I also discovered that using the AppletViwer would allow me to see the applet. Then I upgraded to JDK1.3 or 2 or whatever it is and nothing.
    I recompiled the classes using the !.3 still nothing. The applet vewer don't work and the plug in don't work.
    I tried to recompile using the oldjavac ( I assume 1.2) and nothing I do will make this JApplet run. Ordinary a�pplets are OK. Applications with swing are OK, but JAPPLets are dead
    I have come to the conclusion SUN has screwed up big time and are frantically scrabbling about looking for a fix. I have reveert to javascript/DHTML as this is both consistent and stable and for considerably less effort and aggravation you can get 90% of the functioonality.

  • How to make a function take a specific group of constants

    I know i asked this before, maybe a year ago, but I totally forgot how to do it, and I haven't been programming much lately. But I was wondering if somebody can tell me how to make a certain function take specific constants. For example there are java functions, of which I can not remember that will only take certain values. So the function might look like:
    public getInfo(String INFONAME){}Where INFONAME has to be like one of two names or something, and they are constants that are defined somewhere else. If anybody knows what I mean by this, and knows how to create functions like that please let me know. Thank you.

    here's an overkill,
    import java.util.*;
    abstract class DoWhatever {
        public static Hashtable ht = null;
        public static Object DoWhat( String s, Object obj ) {
         if( null == ht ) {
             ht = new Hashtable();
             ht.put( ThisDoWhatever.NAME, new ThisDoWhatever() );
             ht.put( ThatDoWhatever.NAME, new ThatDoWhatever() );        
         return ( (DoWhatever) ht.get( s ) ).doWhatever( obj );
        public abstract Object doWhatever( Object obj );
    class ThisDoWhatever extends DoWhatever {
        public final static String NAME = "this";
        public Object doWhatever( Object obj ) {
         System.out.println( NAME );
         return null;
    class ThatDoWhatever extends DoWhatever {
        public final static String NAME = "that";
        public Object doWhatever( Object obj ) {
         System.out.println( NAME );
         return null;
    public class DoThisOrThat {
        public static void main( String[] args ) {
         DoWhatever.DoWhat( args[ 0 ], null );
    }

  • Does anyone here know how to make a background soundtrack for a Tai Chi Video?

    Good morning,
    Does anyone here know how to make a background soundtrack for a Tai Chi Video in Garageband. I have been looking around at the different sounds and music in Garageband but I have not been able to find anything that would go with the video.
    Here is an example of a Tai chi video if you were wondering
    http://youtu.be/a6pJf2otwv8
    I want to create something like this for a video I did for a fitness gym for a Yoga instructor and Tai Chi instructor.
    Any tips would be appreciated.

    Brandon,
    you will not have to do any importing in GarageBand. Intalling Mainstage will extent GarageBands Loop Library and Instruments Library.
    After you installed MainStage the additional loops and Instruments will show in GarageBand just like all other Loops. you will simply see more loops.
    For example:
    or:

  • How to make Attribute Change run alignment & Hierarchy changes in Aggregat

    Hello
    I want to understand that How to make Attribute Change run alignment & Hierarchy changes in Aggregate?
    I posted previously the same question but there were not good answers and i was not able to understand clearly .....
    If there is Process chain XXY which makes Attribute change run for Master Data 0SPELLING ?
    Now there is Aggregate TRT which includes :
    0SPELLING , Fiscal Period , Purchase Product, Purchase Category ?
    Now pls answer following question ?
    1) Does the Process Chain XXY which makes only attribute change run alignment for 0SPELLING , Will this process chain automatically do the Change run alignment for 0SPELLING in Aggregate TRT ? YES or NO
    2) If Yes, then we are just suppose to do Roll up for Aggregate TRT after Process chian XXY completes and finish job ?
    3) If No, then what steps are suppose to be DONE so as to make sure that Aggregate TRT has new values and perfect values for 0SPELLING ?
    Please answer and coorect if i have any wrong question....

    for e.g.
    u have 0spelling whicha has attributes x,y and z on day 1 with 10 records
    so do ur aggregates on day1 with same values
    now on day2 u had new values of attributes y,z,s,d and new hierarchies and so u add new records
    with data load u will load the data with version M of modified and is not available for reporting
    If u do attribute change run then this modified version is activated to A i.e. active version .
    It will also do the change run alignment for Aggregate for new attribute values and new hierarchy values for aggregate.
    now in order for this data to be available for reporting u will need to do the roll up of aggregate.....
    if u roll up aggregate before attribute change run , new data is not avaialable for reporting
    if u roll up aggregate after attribute change run, then data is available for reporting
    if u dont roll up aggregate eventhough new data is in dataprovider, still new data will not be available for reporting.
    this is how it works

  • How to make Attribute Change run alignment & Hierarchy changes in Aggregate

    Hello
    I want to understand that How to make Attribute Change run alignment & Hierarchy changes in Aggregate?
    I posted previously the same question but there were not good answers and i was not able to understand clearly .....
    If there is Process chain XXY which makes Attribute change run for Master Data   0SPELLING ?
    Now there is Aggregate TRT which includes :
    0SPELLING , Fiscal Period , Purchase Product, Purchase Category ?
    Now pls answer following question ?
    1) Does the Process Chain XXY which makes only attribute change run alignment for 0SPELLING ,   Will this process chain automatically do the Change run alignment for 0SPELLING in Aggregate TRT ?         YES or NO
    2)  If Yes, then we are just suppose to do Roll up for Aggregate TRT after Process chian XXY  completes and finish job ?
    3) If No, then what steps are suppose to be DONE so as to make sure that  Aggregate TRT has new values and perfect values for  0SPELLING ?
    Please answer and coorect if i have any wrong question....

    for e.g.
    u have 0spelling whicha has attributes x,y and z on day 1 with 10 records
    so do ur aggregates on day1 with same values
    now on day2 u had new values of attributes y,z,s,d and new hierarchies and so u add new records
    with data load u will load the data with version M of modified and is not available for reporting
    If u do attribute change run then this modified version is activated to A i.e. active version .
    It will also do the change run alignment for Aggregate for new attribute values and new hierarchy values for aggregate.
    now in order for this data to be available for reporting u will need to do the roll up of aggregate.....
    if u roll up aggregate before attribute change run , new data is not avaialable for reporting
    if u roll up aggregate after attribute change run, then data is available for reporting
    if u dont roll up aggregate eventhough new data is in dataprovider, still new data will not be available for reporting.
    this is how it works

  • Hello. How can I make it so firefox remembers which links I've visited as on the music singles pages for longer periods of time and more links?

    I frequently use the singles pages on wikipedia, for example: http://en.wikipedia.org/w/index.php?title=Category:2012_singles&from=D
    So I had already clicked on the links some months ago on the 2012 singles pages, but firefox forgot that I had clicked on the links there. How can I make it so it remembers for longer periods of time without causing problems to firefox? Also, I want it to remember what links I've clicked on the 2013 singles pages, because I am also keeping up with that. Can I tell firefox to remember all history for these pages, such as 2012 singles, or 2013 singles specifically? I just want firefox to remember what links I've visited, as in, the songs in the 2012/2013 singles pages, and not forget those, because I have already downloaded those so I want firefox to keep track. What are my options? Please let me know, and I hope you understand the problem I am describing.

    My Firefox remembers history from over a year ago, and unless you are using a setting or external tool to clear it, or load huge numbers of pages/download huge numbers of files, Firefox should pretty easily remember links you've accessed in recent months.
    To see what Firefox has computed as the number of URLs to remember, you can check here:
    (1) In a new tab, type or paste '''about:config''' in the address bar and press Enter. Click the button promising to be careful.
    (2) In the filter box, type or paste '''.hist''' and pause while the list is filtered
    (3) Look for '''places.history.expiration.transient_current_max_pages'''
    Mine's set to 104858. I don't know how that was determined.

  • How to make a good referencing for my web site

    hi. i start with muse and would like to know how to make a good referencing for my web site; thanks for your answers...

    Google and search the forum for: SEO or Search Engine Optimisation

  • How to make saved IR available for all users

    Hi,
    I've created IR and saved it to several tabs based on search conditions.
    But they're only visible for developers.
    How to make these tabs available for all end-users ?
    Does version 4.0 support this option ?
    Thank you!

    Hi
    At present this feature is not included, although I believe it may be in 4.0. Many people have provided workarounds for this. None of which I have tried. I cannot find the original thread but here is a solution from a chap called Ruud
    >
    One way to share your saved reports with others is to 'Publish' your report settings to a few intermediate tables in your application and have other users 'Import' your settings from there. The reason for using intermediate tables is so that not all your saved reports need to be 'visible' to other users (only those that you've chosen to publish).
    Basically you have available the following views and package calls that any APEX user can access:-
    - flows_030100.apex_application_pages (all application pages)
    - flows_030100.apex_application_page_ir_rpt (all saved reports - inclusing defaults and all user saved reports)
    - flows_030100.apex_application_page_ir_cond (the associated conditions/filters for above saved reports)
    - wwv_flow_api.create_worksheet_rpt (package procedure that creates a new saved report)
    - wwv_flow_api.create_worksheet_condition (package procedure that creates a condition/filter for above saved report)
    The way I've done it is that I've created 2 tables in my application schema that are straightforward clones of the 2 above views.
    CREATE TABLE user_report_settings AS SELECT * FROM flows_030100.apex_application_page_ir_rpt;
    CREATE TABLE user_report_conditions AS SELECT * FROM flows_030100.apex_application_page_ir_cond;
    ( NB. I deleted any contents that may have come across to make sure we start with a clean slate. )
    These two tables will act as my 'repository'.
    To simplify matters I've also created 2 views that look at the same APEX views.
    CREATE OR REPLACE VIEW v_report_settings AS
    SELECT r.*
    p.page_name
    FROM flows_030100.apex_application_page_ir_rpt r,
    flows_030100.apex_application_pages p
    WHERE UPPER ( r.application_name ) = <Your App Name>
    AND r.application_user 'APXWS_DEFAULT'
    AND r.session_id IS NULL
    AND p.application_id = r.application_id
    AND p.page_id = r.page_id;
    CREATE OR REPLACE VIEW v_report_conditions AS
    SELECT r.*
    p.page_name
    FROM flows_030100.apex_application_page_ir_cond r,
    flows_030100.apex_application_pages p
    WHERE UPPER ( r.application_name ) = <Your App Name>
    AND r.application_user 'APXWS_DEFAULT'
    AND p.application_id = r.application_id
    AND p.page_id = r.page_id;
    I then built 2 screens:-
    1) Publish Report Settings
    This shows 2 report regions:-
    - Region 1 - Shows a list of all your saved reports from V_REPORT_SETTINGS (filtered to only show yours)
    SELECT apex_item.checkbox ( 1, report_id ) " ",
    page_name,
    report_name
    FROM v_report_settings
    WHERE application_user = :APP_USER
    AND ( page_id = :P27_REPORT OR :P27_REPORT = 0 )
    ORDER BY page_name,
    report_name
    Each row has a checkbox to select the required settings to publish.
    The region has a button called PUBLISH (with associated process) that when pressed will copy the settings from
    V_REPORT_SETTINGS (and V_REPORT_CONDITIONS) into USER_REPORT_SETTINGS (and USER_REPORT_CONDITIONS).
    - Region 2 - Shows a list of already published reports in table USER_REPORT_SETTINGS (again filtered for your user)
    SELECT apex_item.checkbox ( 10, s.report_id ) " ",
    m.label,
    s.report_name
    FROM user_report_settings s,
    menu m
    WHERE m.page_no = s.page_id
    AND s.application_user = :APP_USER
    AND ( s.page_id = :P27_REPORT OR :P27_REPORT = 0 )
    ORDER BY m.label,
    s.report_name
    Each row has a checkbox to select a setting that you would like to delete from the repository.
    The region has a button called DELETE (with associated process) that when pressed will remove the selected
    rows from USER_REPORT_SETTINGS (and USER_REPORT_CONDITIONS).
    NB: P27_REPORT is a "Select List With Submit" to filter the required report page first.
    Table MENU is my application menu table where I store my menu/pages info.
    2) Import Report Settings
    This again shows 2 report regions:-
    - Region 1 - Shows a list of all published reports in table USER_REPORT_SETTINGS (filtered to show only other users saved reports)
    SELECT apex_item.checkbox ( 1, s.report_id ) " ",
    m.label,
    s.report_name,
    s.application_user
    FROM user_report_settings s,
    menu m
    WHERE m.page_no = s.page_id
    AND s.application_user :APP_USER
    AND ( s.page_id = :P28_REPORT OR :P28_REPORT = 0 )
    ORDER BY m.label,
    s.report_name,
    s.application_user
    Each row has a checkbox to select the setting(s) that you would like to import from the repository.
    The region has one button called IMPORT that when pressed will import the selected settings.
    It does this by using the 2 above mentioned package procedure to create a new saved report for you
    with the information form the repository. Be careful to match the right column with the right procedure
    parameter and to 'reverse' any DECODEs that the view has.
    - Region 2 - Shows a list of all your saved reports from V_REPORT_SETTINGS (filtered to only show yours)
    SELECT page_name,
    report_name
    FROM v_report_settings
    WHERE application_user = :APP_USER
    AND ( page_id = :P28_REPORT OR :P28_REPORT = 0 )
    ORDER BY page_name,
    report_name
    This is only needed to give you some feedback as to whether the import succeeded.
    A few proviso's:-
    a) I'm sure there's a better way to do all this but this works for me :-)
    b) This does not work for Computations! I have not found an API call to create computations.
    They will simply not come across into the repository.
    c) If you import the same settings twice I've made it so that the name is suffixed with (2), (3) etc.
    I did not find a way to update existing report settings. You can only create new ones.
    d) Make sure you refer to your saved reports by name, not ID, when matching APEX stored reports and the
    reports in your repository as the ID numbers may change if you re-import an application or if you
    auto-generate your screens/reports (as I do).
    Ruud
    >
    To me this is a bit too much of a hack and I personally wouldn't implement it - it's just an example to show it can be done.
    Also if you look here in the help in APEX Home > Adding Application Components > Creating Reports > Editing Interactive Reports
    ...and go to the last paragraph, you can embed predicates in the URL.
    Cheers
    Ben
    http://www.munkyben.wordpress.com
    Don't forget to mark replies helpful or correct ;)
    Edited by: Munky on Jul 30, 2009 8:03 AM

Maybe you are looking for