Run once inside timed loop

I have a timed loop that monitors equipment. Whenever there is a fault I have it send a notification email. My problem is how to stop it from sending email every single time the time loop is executed. I tried placing the send email inside a for loop but quickly realized that the entire loop itself is reiterted. Any help is much appreiciated.
Solved!
Go to Solution.

Hi icemaker
I'm not really sure what you mean. Wouldn't a case structure be a solution?
Could you post some code so we can see what you are doing?
Best Regards
David
NISW
Message Edited by Davidek on 10-02-2009 09:58 AM
Message Edited by Davidek on 10-02-2009 10:00 AM

Similar Messages

  • Can I run a fast timed loop?

    It appears that a timed loop cannot run faster than 100 hz. In other words, the "period" input for a timed loop cannot be less than 10. Is this true? I am using the Elapsed Time VI to measure time increments. The time increments output from this VI are at least 0.01 secs regardless of how fast I attempt to run the time loop. Perhaps the limitation lies in the Elapsed Time VI, not in the Timed Loop. Should I try a different approach to measuring the delta time between iterations of a time loop? TIA.
    -jlivermore

    Here's the simple way to measure loop timing:
    Actually, what else is running in your loop (e.g. property nodes, DAQ, etc.)? Can you show us your code? What is your LabVIEW version?
    Message Edited by altenbach on 09-29-2008 11:22 AM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    MeasureLoopTiming.PNG ‏7 KB

  • Unable to run Timed Loops

    Bit of an odd one that had me scratching my head.
    I have a development system consisting of a PC running a 7842R, acquiring analogue and digital data from the FPGA, loading it into a shared variable, and reading it out within a timed loop on the host as one parallel loop in a producer-consumer architecture.
    All's well until one day last week when I noticed my host VI becoming unresponsive.
    After a bit of digging, I find that the timed loop doesn't run at all. Replacing with a while loop with a wait at least allows me to show that the error is timed loop related, but it's not a viable long term option for me. Creating a new project and a new VI with a simple timed loop showed the same behaviour.
    A restart of the system, and rerunning the same VIs, and no problems since.
    So, questions:
    1) Has anyone else seen this behaviour?
    2) Any idea what causes it? A service crashing, for example?
    3) Is there a way of recovering without a reboot? If it's a service crash, I'm hopeful.
    The system will eventually form part of a production test environment, hence the query.
    Edit - also, wiring error terminals of a timed loop is a good way of highlighting errors of course.
    FWIW, LV2012 SP1 32bit, Win7 64bit, Core2 Duo, 4GB RAM, tassels from the handlebars etc.
    CLD

    The timed loop is used to read all elements from a DMA FIFO and load them into a buffer FGV, which spits out packets of N samples long once they've assembled within the FGV. Ordinarily, I'd do this with a timed while loop and be perfectly happy to do so. However, the elements are actually an interleaved array, meaning that I have to demux them in the correct order that they were loaded.
    I use timed loops for a number of reasons: on my current Windows host, I've found that using a while loop has caused me more problems with respect to disordered packets, and that at least with using multiple timed loops (two, at most), I can assign priority to the acquire loop. Finally, it's also a development platform, and will be deployed onto an sbRIO once the electronics integration is finished in a week or two!
    W.r.t. system resources, there's very little else running on that system, but that doesn't normally stop Windows
    I recognise it's not ideal to run a software timed loop under Windows, but when you cannot run a blank project with Optimizing timed loop rate.vi from the shipped examples with nothing else running, it makes me curious to know why!
    CLD

  • Timed loop inside a flat sequence not terminatin​g

    Inside a while loop there is an event structure.  Inside that there is a flat sequence.  On one of the frames there is a timed loop that quits after so many iterations.  The timed loop finishes but the flat sequence doesn't execute the next sequence.  What am I not doing right?

    First, you have too many local variables.  This could be leading to race conditions.
    I think you have a couple problems in the use of event structures.  It is a bad idea to put any long running code inside an event case.  It will prevent the Event Structure from handling any other events in the mean time.  You have several timed loops running that in that one sequence frame.
    But the bigger problem is the next sequence frame.  You have a while loop that only ends once all the queues are empty.  Can you guarantee that all the queues get emptied?
    You have laid out the code very neatly, but you have used a lot of odd things in there.  (Number to boolean array, to cluster, to unbundle the cluster to individual indicators.)  Why not just go from Boolean array to and index array function.  No need for the intermediate cluster conversion.  Why not set up the indicators as an indicator array and just write to them directly.
    The code is so much intertwined between when queues are created, filled, emptied, destroyed, events happen...  And this is all multiplied by at least 4 times for each camera.  And there are 4 major event structures going on.  This is a very ambitious project for an inexperience LabVIEW user.  You need to step back, get one thing working right, and design so that you can scale the architecture upward.  Many of the structures you have essentially duplicated and belong in subVI's.

  • Error -50103 occured with timed loop inside a while loop

    Hello everyone,
    i wrote an application to sample analog voltage from  DAQ6024E card (see the attachments).
    I have a big while loop in the VI because a I want to add some other functions later.
    In the "WHILE_Cont Acq&Graph Voltage-Int Clk.vi" I use a while loop inside the big while loop to read the samples. It's working properly.
    but when I use a timed loop inside the big while loop (see "TIMED_LOOP_Cont Acq&Graph Voltage-Int Clk.vi"), I get an error -50103 from the timed loop.  It seems that the first cycle is ok, but after the first cycle the error occurs.
    I don't know what happens with the timed loop, anyone can help me? what does the error -50103 mean? thanks a lot!
    PS: I am using LabVIEW 8.0
    Message Edited by molo511 on 10-22-2006 05:21 AM
    Message Edited by molo511 on 10-22-2006 05:23 AM
    Attachments:
    TIMED_LOOP_Cont Acq&Graph Voltage-Int Clk.vi ‏143 KB
    WHILE_Cont Acq&Graph Voltage-Int Clk.vi ‏75 KB

    hi molo511,
    I tested your program but only with simulated devices. I had to delete the wire to the timing, so that the timed while loop runs with 1kHz. Did you already try this? Because this works on my PC.
    I also found a link in our database that might be interesting for you.
    http://digital.ni.com/public.nsf/websearch/04BEDD9E9E91ED3486256D180048116D?OpenDocument
    Greets
    Philipp N.
    NI Application Engineer

  • While loop inside a timed loop

    Hi everybody!
       I'm using:
           - LV 7.1 + RealTime;
           - compactFieldpoint;
       I've noticed a strange behaviour, when I put a while loop inside a timed loop.  Let's fix timed loop with these settings:
           - 1 KHz clock
           - 1 ms period (yes, I know it's short....)
           - offset 0 ms
           - Phase 0
           - Discard missed period (ON) and MAintain original Phase (ON);
           - Timeout: -1.
       If inside this loo, I put a traditional while loop, waiting (say) for an event to occur, and if this event does not arrive, my cFP-2020 hangs! I mean, it becomes unreachable for the debugger, and, more, if I run a ping to it's address, after some cycles it becomes unreachable also from ping!
       Clearly, this code statement lock the fieldPoint, because if I remove the inner while loop all works.
      I know that with 1 ms period, timed loop always finishes late, but I set to discard missed period and timeout to -1. 
       It seems to me that sometimes Timed Loop add heavi overhead to programs, I'm turning to all while loop based tasks, even if my application has to be real-time!
       Advices welcomed! Have a nice day!
    graziano
    Solved!
    Go to Solution.

    I think the issue here is that putting your while loop inside a Timed Loop increases the priority for that task. Timed Loops can have dynamic priorities set over eachother, but they all run between Above Normal and Time Critical priority. My guess is that the debugger and built-in TCP functions run at Above Normal priority or less. This means your cFP isn't hanging, it's doing what it thinks is best. It's trying to finish this task before handling any lower-priority tasks.
    The suggestion to put a Wait function in your loop is an OK one. Keep in mind that you can actually set your wait time to zero instead of one and get the same positive benefit of handling other tasks. I would also suggest that you might look into waiting for this event in a lower priority (non-Timed) loop, and then transmit the appropriate data to your Timed Loop using an RT-FIFO or something. That might give you better handling. Just a thought....
    Jarrod S.
    National Instruments

  • Timed loop in a subvi, one or the other runs but not both.

    I have a vi with two sub vis. Each sub vi contains a timed loop that updates a global variable. In the top level vi I read from each global and display its content. When I run the top level vi I see only one global counting but not both. If I start and stop the top level vi the sub vis take turns counting but they never both count. If I replace the timed loop with a while loop in each subvi then both count. If I move the two timed loops from their respective sub vis and place them in the top level vi then both globals show counting. Can any body explain what is going on.
    I'm using Labview 2010 SP1.
    Attachments:
    Test Of Timed Loop.zip ‏72 KB

    Never Mind!
    When I cloned the subvi I forgot to change the structure name of the timed loop. Placing an error indicator inside the subvi disclosed the error -808 (Error -808 occurred at an unidentified location. Possible reason(s):LabVIEW:  The given name is already being used by the following timed structure.).

  • Run script in a loop inside sqlplus

    Hello all,
    Is there a way to run a script that we can run from windows command prompt inside sqlplus to run in a loop???
    for example on unix i can do something like
    for i in 1..10
    do
    ls -ltr
    ps -ef|grep pmon
    sleep 5
    done
    so can i do something similar inside of sqlplus ??
    lets say have a script called @active_session
    and now i am inside of sqlplus, but cant i run it in a loop ?? like sleep 5 sec and run @active_session and then sleep 5 sec and run @active_session ??
    i hope i have asked the question clearly....

    Hi,
    user8363520 wrote:
    Hello all,
    Is there a way to run a script that we can run from windows command prompt inside sqlplus to run in a loop???
    for example on unix i can do something like
    for i in 1..10
    do
    ls -ltr
    ps -ef|grep pmon
    sleep 5
    done
    so can i do something similar inside of sqlplus ??Your best bet might be to do it at the OS level, the way you're familiar with.
    For example:
    for i in 1..10
    do
    sqlplus  username/password@database @active_session
    sleep 5
    doneI'm not sure about the unix syntax.
    Make sure active_session.sql ends with a QUIT or EXIT statement.
    lets say have a script called @active_session
    and now i am inside of sqlplus, but cant i run it in a loop ?? like sleep 5 sec and run @active_session and then sleep 5 sec and run @active_session ??SQL*Plus wan't designed for this kind of thing. In particular, there is no reall loop mechanism built into SQL*Plus. You can do loops in SQL*Plus, but it's not pretty. See {message:id=4367027}
    Depending on what's in your script, you may want to do the whole job in PL/SQL, whcih does have loops.

  • Stopping Timed Loop inside a Reentrant VI

    I just converted a project over from 8.5 to 2009 and I found that some of the funtionality that was working in 8.5 no longer works in 2009 (probably for good reason...).
    Anyway, I found that if I tried to use the stop timed loop vi to stop any timed loops in reentrant vi's that I get a -804 error. The stop timed loop sub vi was in the same reentrant vi in the application, but I found it also did not work if it was outside the reentrant vi.
    It does get a little hairy when thinking which loop you are trying to stop because of the reentrancy, but if the names passed into the instances are different for the loops then it shouldn't be a problem right?
    See attached for a very simple example of this occuring.
    Note: Just running in windows...not in RT
    Solved!
    Go to Solution.
    Attachments:
    Stop Time Loop.LLB ‏41 KB

    I resorted to using an alternative way to stop the loops as well.  Does anyone at NI know if this is a feature or a bug or if there is anyway to use the stop timed loop function with a timed loop in a reentrant vi?
    Thanks.
    Whoops... Just read your post.  Thanks for the update.
    Message Edited by klessm1 on 01-06-2010 10:55 AM

  • Timed loop running parallel with Queues

    I was wondering if it is possible to have a Producer/Consumer Pattern with a timed loop that is not just executed when it is called by the queue or from the Producer Loop, but also executes the timeout after a given time.
    Thanks in advance, Oliver
    Attachments:
    example.png ‏42 KB

    lol
    thank you Norbert great advice
    I was so focused on wanting to use a Timed Loop that I totally forgot about the dequeue TimeOut
    cheers Olli

  • Timed loop and CPU usage

    Platform is WIN_XP Pro and machine is a P4 at 2.5Ghz with 512 Mb ram.
    LV7.1 + PCI 6229
    I am using  50ms Timed loop for running a state machine inside it
    and also a  whole lot of other things like reading / writing
    DAQMx  functions;  file I/O functions and such. As the
    project involves a  main and sub-panlel set up local variables
    could not be elimnated fully and there should be something like 150 of
    them. But not all are accessed always - maybe about 15 of them at any
    given time depending on the SM staus.
    Problem :
    Once started the "Finished late"  indication  is off and
    the  actual timing  alternates between 49 to 52 ms. The CPU
    usage is around 25%.
    But as time goes by,  the system gets unstable : After 15 minutes
    or so, the Finished Late indication is always ON and the CPU usage is
    gradually tending towards or exceeds 100%. 
    Obviously the machine control timing now gets affected and things slow
    down badly. Closing the application ands restarting repeats the above
    cycle.
    I am at a loss  to understand what is happening ?  WIll
    breaking down the single Timed Loop to multiple ones help  ? WIll
    that be an efficient way of parallel threading ?
    I can post the code but its quite large and will do it as a last resort.
    thanks
    Raghunathan
    Raghunathan
    LV2012 to Automate Hydraulic Test rigs.

    Hello,
    It sounds like an interesting problem.  It would be worth some experimentation to figure out what's going wrong - attempting to decouple major "pieces" of the code would be helpful.  For example, you could try breaking your code into multiple loops if that makes sense in your architecture, but perhaps you could even eliminate all but one of the loops to begin with, and see if you can correlate the problem to the code in just one of your loops.
    Another concern is that you mention using many local variables.  Variable read operations cause new buffer allocations, so if you're passing arrays around that way, you could be hitting a problem of forcing your machine to perform many allocations and deallocations of memory.  As arrays grow, this can be a bigger and bigger problem.  You can use other techniques for passing data around your block diagram, such as dataflow if possible (just simple wires), or queues where dataflow can't dicatate program flow completely.
    Hopefully looking into your code with the above considerations will lead you in the right direction.  In your case, removing code so that you can identify which elements are causing the problem should help significantly.
    Best Regards,
    JLS
    Best,
    JLS
    Sixclear

  • How to avoid data selection inside the loop?

    Hello Experts,
    I am working on one performance item and I have already applied some changes to the original version.
    Now, If I compare my new program with old program, I have good improvement in performance. I am checking if I can do anything on statements that are top on the below list. I think 40% for Modify statement is acceptable after my research (Below run is updating around 20M records which is real time volume for this application).
    As we can see 34% of run time to going for one SELECT query on custom table. Take a look at below high level flow of my program to understand above select query.
    1. Select data from ZABC
    2. Select data from Variant Table (Var1, Var2, Var3 etc.., 12 in real time)
    3. Loop Variant Table
    4. Select data from X, Y, Z table for Var<n>.
    5. Populate final internal table from ZABC, X, Y and Z table
    6. Modify ZTABLE with Final Internal table data
    7. End Loop on Variant Table
    As described in the flow of the program, ZABC table data is common for all the variants and need not to fetch multiple times. Hence I am doing it only once in my program. Below is that select query:
    select rrcty ryear rbukrs racct rcntr sum( amt1) as amt1  "Like I have 32 amount fields in original query
               from zabc
                into table i_zabc
                where ryear in r_year    " Two records in ranges with I and EQ
                and rvers = '001'
                and rrcty in r_rrcty        "Three records in ranges with I and EQ
                and rldnr = 'DT'
                group by rrcty ryear rbukrs racct rcntr
                order by rrcty ryear rbukrs racct rcntr.
    ZABC table is again having huge volume of data and we are fetching millions of records with above query. That is primary reason to take long time. May be that is okay as I am already using Indexes of this table. But, I am not comfortable with it as it can reach max. memory point and through run time error. Fetch Cursor is one reliable option that I can see here, but with that, I should move ZABC selection inside the variant loop which can cause fetching ZABC data 12 times (Let me know If I am missing anything here).
    Now, third statement in my trace results, with 10% of overall time is this:
    loop at i_abc assigning <fs_abc>. 
    loop at i_table assigning <fs_table> where low <= <fs_abc>-racct and high >= <fs_abc>-racct. 
    endloop. 
    endloop. 
    6 million executions with this complex WHERE condition is causing this statement to get 3rd position in trace results. I tried below two options which are, I think, taking even more time - (I am still monitoring these options)
    1) Removed WHERE condition on LOW, HIGH and applied filter inside the loop.
    2) Removed WHERE condition on HIGH only and applied filter inside the loop.
    Any suggestions on how to proceed with ZABC selection and I_TABLE loop.
    Let me know if you have any questions on above compose.

    Since I looked at this case before, let me try some quick suggestions:
    Is table ZABC related to table X, Y and/or Z and can the selection be limited by applying those 12 selection variants?
    If yes, try a join select involving these tables that could make your step 1 obsolete and replace steps 4 and 5.
    This might also get rid of the "loop inside loop" problem. Generally, make sure that the inner table is declared as a sorted table with a key that consists of the fields as used in the WHERE-condition of the inner loop. Use secondary keys for internal tables if your ABAP release permits and the task at hand warrants it.
    Finally, look at PACKAGE SIZE option for the (join) select to reduce memory consumption.
    Thomas

  • Share cluster data between 2 timed loops

    What is the best and safest way of sharing cluster data between 2 timed loops running. I could use locals, but that is risky, would shared variables work better? All I need to do is modify a couple of datatypes in a cluster that both threads use.
    Thanks...

    You could go the LVOOP route and create a singleton object. The object can be passed to parallel tasks an dsince it is singleton they will all share the same value. Ue of a DVR inside the object would allow you to have a single copy of the data. Your class would also give you the necessary accessors for reading/writing data.
    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

  • Help changing a run continuously VI into a run once

    Hi,
    I know that I am probably going to invoke the wrath of the labview gods with this request by not going through my tutorials again but I am unfortunately stuck and
    getting a bit of a brain freeze on this one.
    I have a VI for a flow meter, that runs perfect when I hit run continously but I need to add this to another VI that just runs once so I am trying to convert. 
    I have had previous suggestions in another thread to replace the for loop with a while loop. Add a Stop button on the front panel and wire it to the Stop it True terminal in the loop.
    Move the Waveform Chart and Flow Rate terminals inside the loop. I have done this but the VI does not run correctly, the dial just keep accumalating/adding and not resetting.
    Any alternate approaches that I can try would be greatly appreciated.
    Thank you.
    Attachments:
    Flow Meter 2.vi ‏56 KB

    I tried to do some cleanup and got away from that stupid Express VI.  Your loops really should be combined otherwise you have one nasty race condition with your local variable.  I also found a nice property node for the counter to reset its count.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines
    Attachments:
    Flow Meter 4.png ‏41 KB

  • Timed loop not starting - works after closing and opening project

    Refer the image below - a simple timed loop should run when the Run button is pressed. What happens is that the parallel vi runs (see arrow) but the vi inside the loop doesn't.  Both vi's shown run forever (i.e. the timed loop is only used to specify the CPU).  
    When I press the Abort Execution button, strangely it can then be seen that the execution highlighting runs into and through the timed loop and probe 50 is updated.
    This sorted itself out after I closed the project and opened it again so its not a critical issue - was simply wondering what could cause this?

    That program looks kinda weird.
    First of all, avoid to use flat sequence structures whenever you can, or use it only when you are going to initialize something, or when your program has an specific sequence.
    I think you have a problem the way you are conecting the subvis. Remember that in LabVIEW,  the flow of the data will determine the order of execution, and in your case, the conections looks kinda weird.
    I have a question; Do the subvis need to run simultainously?, or what do you need to do exactly

Maybe you are looking for

  • Can't get embedded AP on 891W to accept clients

    Hi all. I have a very simple configuration that I'd like to do, which I have done before, but yet can't do now.  I have an 891W router, the embedded ap801 instad.  IOS on both is 15.2.  I have an SSID set up, using wpa-psk.  I have a fully working co

  • Creative mediasource organizer not recognizing zen microph

    I jusr recently had to restore my laptop to factory settings so I had reinstall creative. But now when I open the mediasource to try to get songs off of my microphoto on onto my laptop, it doesn't show my zen in the little dropdown where it shoes pc

  • Webutil and CalenderPJC Problem

    I have successfully integrated the Webutil CalendarPJC into my forms. It works fine on a single row block, but on a multi-row block the PJC has a strange reaction. I have a button on each line beside a date field. When you click on the button on a ro

  • Date Grouping by specific interval

    Hi all, I have a case where i need to build a query to count the dates and then group them by a specific interval, I mean the user may select a date range 1 year but group the result by 7 days, so the query must return counts of dates for every 7 day

  • Unable to see the discussion

    Hello, I am unable to see my discussion posted today with the following subject; "How to restrict MIGO (GR) and Reservation (MB21-221 Q) if WBS element is technically closed" Please help in finding the reason / solution. thanks