Timed loop

Hi all ! I have a question ...
I have a timed loop (which run on RT target ) . I  parameter this loop with  1Khz clock and 1 ms period. The aim of my program is to transmitt/send CAN frames. When i parameter my programm to send a frame every 10s, I receive my frames after 9993 - 9994ms ! I also tested my program with 1 Mhz clock and 1000 µs and i still have the same problem.
I'm almost sure it doesn't come from my program, because i tryed to use an external timing source instead of the internal clock and it works perfectly ! And it can't be beacause my subvi takes too much time, because i receive the frame 6-7ms BEFORE ! It's like the internal clock run faster that it should .... I don't really undrstand, could someone help me ???
Thanks... 

Hi,
I can't believe that the use of the 1MHz clock can give this result but the timing must be always accurate using the 1KHz clock.
I don't think the timed loop itself is the problem. Are you using a timing function or tick count function in your VI or subVIs?
Are you using a PXI target? because it seems that the timed loop is not accurate only in PXI.
Investigate and let me know.
Regards.
Omar S. NI

Similar Messages

  • 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

  • Questions about parallel and series sturcture in SCTL (single clock timed loop) in FPGA VI

      I am using LV 8.2.
      I have wriiten a FPGA VI, in this VI, there are 3 filters inside the SCTL (single clock timed loop) (I use the shift register to be the effect of unit delay). Would I save the resources of the FPGA used (such as slices and LUT) in the compliation report if I use 3 SCTL ( 1 SCTL contain 1 filter)  and cascade them in series?
      Thank you! 

    Sorry, I am afraid that you have misunderstood my meaning.
    Here is the method you suggested before:
      I mean I use the shift registers attached in the while loop, not in the SCTL. The number of shift registers used will not be decreased when we increase the number of SCTL in the second plate of the flat sequence structure.  Totally , there are 6 pairs shift registers for 3 filters (1 filter needs 2 pairs). I mean I put the calculation parts, such as b0*x[n]+b1*x[n-1]+b2*x[n-2] inside the SCTL ( the operations of multiplication and add). Instead of putting 3 filters numeric operation part in one SCTL. will we reduce the resources used if we use 1 SCTL to do the operation parts of 1 filter? As the code inside each SCTL will be reduced.
      Maybe you tell me if such approach will reduce the reosources used? Or there is no difference?
      Thank you!

  • LabVIEW RT, Timed loop, finished late, Call by reference

    I have a timed loop triggered by the sample clock of a DAQ-Card. The sample Clock is 8 kHz and the loop will run with dt = 4. Normally the loop is running without finished late[i-1]. But from time to time it happens that the loop is running extremly longer which means instead of 0.5 millisec it needs 4 - 5 millisec. It seems this doesn't never occur while accessing DAQmx.
    The application uses plugin technologies and some of the VIs in the timed loop are preloaded and called by Call by Reference.
    Does those VIs inherit the priority, execution system and CPU of the timed loop?
    The application is running on LV RT 2009 on a Dual core PXI-Controller. The timed loop is bound to CPU 1. There is no  difference runinng the application from the development environment or as a startup application.
    For the measuring test  I modified the application in a way that I don't have:
    disk access for storing the result file
    TCP/IP communication
    Controls on the front panel of the top level VI
    Waldemar
    Using 7.1.1, 8.5.1, 8.6.1, 2009 on XP and RT
    Don't forget to give Kudos to good answers and/or questions

    To keep you informed:
    I stripped the application and have left only the measurement storing module and the timed loop. The loop was using the microsecond timer running each 500 µsec. Additional all Non-Real-Time modules were loaded and only one module creates a XML string and sends it to the communication layer which will drop it because no TCP/IP port is open. The creation of the XML string is done each 300 ms.
    In this case I don't have any finished late iterations
    Next I added the DAQ Module. Now I get finished late again but with a lesser frequency as original.
    I removed all unnesseccary tasks from the DAQ moulde leaving one task for a PXI-4204 for using as the clock source for the timed loop. No I get finished late seldom.
     I removed the module which will send the XML string and I don't get finished late.
    Next I was adding code to see memory allocation. I can when memory allocation is changing but it is not related to the finished late iterations.
    Next time I have the chance to do more tests I will see which DAQ task triggers the finished late iterations. I have one AI task on a PXI-4204,  4 Counter tasks on a PXI-6602, 1 DI task on a PXI-6514, 1 DO task on a PXI-6514, 1 DI task on a PXI-6259, 1 DO task on a PXI-6259, 1 AO task on a PXI-6259 and 1 AO task on a PXI-6711.
    The AI task on the PXI-4204 is running in Continous Sampling (Single Point HW Timed is not supported), all other tasks exept the DI and DO are Single Point HW Timed.
    Waldemar
    Using 7.1.1, 8.5.1, 8.6.1, 2009 on XP and RT
    Don't forget to give Kudos to good answers and/or questions

  • 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

  • Using timer/counter with PCI-6221/USB-6210 to control timed-loop VI

    Dear all,
    I need to ask about two devices and one of their functionalities, PCI-6221 and USB-6210. For our NI-based system, we need to control some timings in a Timed-Loop vi, for that currently we are using PCI-6221 and we give external TTL signal (at 1 kHz) to it,
    recenntly we need to make some changes and for that we found USB 6210 DAQ to be more suitable, but we need to clear ourselves on some specific things.
    Can the counter/timers functions available in the either PCI 6221 or USB 6210 can be used to control the Timed-loop VI by giving external clock or by using their own internal clock source?
    Although we are using external clock with the PCI 6221 but we want to know about the usage of their internal clock, also are controlling timed-loop also possible for USB-6210
    Also... What if we use the RTOS, are they still able to control the timed-loop VI  without giving any 'EXTERNAL CLOCK' and using the internal clock sources of the DAQs
    Waiting for reply,
    Bests,
    RaJaf
    Solved!
    Go to Solution.

    Ben,
    I having read previous email which I send earlier with general overview, we discussed in more detail within our team and I am giviing the specific answers.
    Please check in RED the most recent answers. Blue are the questions/suggestions by your side.
    1.    Using Internal hardware clock of PCI-6221 would enable us get rid of external clock, but how to divert the internal hardware clock to the current settings. Any idea  (can you provide us with some reference manul for otherwise). I mean is there some flag-bit etc. or VI
    2.       Is it also meant that with the installation of RTOS the timed-loop can directly get the timing source from the internal hardware clock PCI-6221? --- How???
    3.       In order to make desktop to work as RT system, what is the hardware (motherboard, processor, etc..) requirement? What are the LabVIEW modules (specific name) that needed to be installed? Our platform is LabVIEW 8.6. (Currently we have windows-7 with i7 core processor)
    What kind of application are you intending for this system? ---- high-speed laser scanning system.
    Are you most concerned about accuracy, speed, or responsiveness? To control the laser mirror scanner to move at 1 kHz or 2 kHz speed. On the other hands, using PCI-5105 (128 MB memory) as a DAQ for real-time/on-the-fly data processing.
    Bests,
    RAJAF

  • Timed Loop in Producer/Consumer Loop

    Hello!
    I have a producer/consumer loop LabVIEW program setup to allow me to properly capture images that are quite large (8MP) at approximately 14 frames per second (FPS). The program works great when the consumer loop is a 'while loop' (records at 14fps no problem), but I wanted to make it into a timed loop, so that I may vary the FPS as required. An oddity arises when I do this. Anywhere below 12fps, the loop works fine and the data is recorded properly. However, when I bump it up to 13fps, the consumer calculated FPS goes haywire and starts jumping between ~9 and ~13fps (data processing gets bogged?). When I set the required FPS to 14, the loop executes at a steady 7FPS maximum. Is there something I can do to rectify this situation?
    I have attached my .VI
    Thanks in advance!
    Solved!
    Go to Solution.
    Attachments:
    ProcessSplitJPG-FPS.vi ‏100 KB

    Palanski,
    Are you using LabVIEW Real-Time? Timed loops in a windows OS don't really increase determinism more than a while loop with a wait until next multiple timer. Before you changed the producer consumer loop to include a while loop was the programming running correctly? You may also want to vuse the VI analyizer to see how long things are taking to run. I would leave the producer consumer loop in the traditional set up and change the FPS by controlling the wait timer, after benchmarking your code this should be done the same way as you have it for the timed loop
    Sam S
    Applications Engineer
    National Instruments

  • 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

  • What is the best/most effective way to dynamicall​y build a timed loop in LabView?

    I am relatively new to labview (not to code in general) and am looking for the "LabVIEW" way to dynamically build a timed loop. This is what I am trying to accomplish:
    I have several heaters controlled through labview using Labview's PID toolkit. This works great. I have no issues with DAQ in general. However, throughout an experiment, I want to change the set point of each heater. I could set this up fairly easily using either a timed loop or the wait vi if I knew exactly how many different set points there would be.
    If possible, I would like to be able to read in a config file that includes the different times and set points for all heaters and dynamically create a loop that can handle this. I have tried using the Elapsed Time vi with an array of time targets; however that didn't seem to work.
    Has anyone been able to do this? Does anyone know where I could learn about using LabView in this manner? All help is appreciated.

    DHagan wrote:
    I am relatively new to labview (not to code in general) and am looking for the "LabVIEW" way to dynamically build a timed loop. This is what I am trying to accomplish: I have several heaters controlled through labview using Labview's PID toolkit. This works great. I have no issues with DAQ in general. However, throughout an experiment, I want to change the set point of each heater. I could set this up fairly easily using either a timed loop or the wait vi if I knew exactly how many different set points there would be. If possible, I would like to be able to read in a config file that includes the different times and set points for all heaters and dynamically create a loop that can handle this. I have tried using the Elapsed Time vi with an array of time targets; however that didn't seem to work. Has anyone been able to do this? Does anyone know where I could learn about using LabView in this manner? All help is appreciated.
    Write a tab-separated spreadsheet file makes it easy to use the write/read from spreadsheet files. Assuming you have a 2D-array of your times and set points it's just a question of setting up a for-loop going through the array row-by-row and extract the elements (expanded index array) to set your points and wait time.
    /Y
    LabVIEW 8.2 - 2014
    "Only dead fish swim downstream" - "My life for Kudos!" - "Dumb people repeat old mistakes - smart ones create new ones."
    G# - Free award winning reference based OOP for LV

  • Timed Loop timing source - Control Loop From Task is too slow

    I'm trying to make a Timed Loop run at a period of 2 ms, with an analog input task running at 50 kHz as timing source. The input analog signal is scaled and fed into a synchronised analog output task on the same multifunction DAQ board. Using the built-in 1 kHz or 1 MHz clock as timing source for the Timed Loop works great, except for a slight time lag between the loop and my AI/AO tasks which over time becomes unacceptable because my task will be running for up to an hour. However, when I use the DAQmx Create Timing Source: Control Loop From Task vi to create a timing source, everything slows down and the fastest loop time I can get is around 20 ms. Any suggestions to get around this would be highly appreciated!
    System: LabVIEW RT 8.0 with DAQmx 8.0 running on an NI PXI-8186; NI PXI-6251 used for analog input.

    You're welcome!
    You can build an array, and if your data is not hugh (100's of MB) this may be the easiest solution. However, we aways suggest implementing the Producer/Consumer Architecture. Keep the PID in the Producer loop, but move the File IO to the Consumer. Also, it  appears that your instrument uses some form of serial communication, so that could cause lags in your system....
    What is your application about in general, what performance are you hoping for, etc?
    Joshua B.
    National Instruments
    NI Services
    NI Support Resources
    NI Training Resources

  • 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

  • Memory leak in Real-Time caused by VISA Read and Timed Loop data nodes? Doesn't make sense.

    Working with LV 8.2.1 real-time to develop a host of applications that monitor or emulate computers on RS-422 busses.   The following screen shots were taken from an application that monitors a 200Hz transmission.  After a few hours, the PXI station would crash with an awesome array of angry messages...most implying something about a loss of memory.  After much hair pulling and passing of the buck, my associate was able to discover while watching the available memory on the controller that memory loss was occurring with every loop containing a VISA read and error propogation using the data nodes (see Memory Leak.jpg).  He found that if he switched the error propogation to regular old-fashioned shift registers, then the available memory was rock-solid.  (a la No Memory Leak.jpg)
    Any ideas what could be causing this?  Do you see any problems with the way we code these sorts of loops?  We are always attempting to optimize the way we use memory on our time-critical applications and VISA reads and DAQmx Reads give us the most heartache as we are never able to preallocate memory for these VIs.  Any tips?
    Dan Marlow
    GDLS
    Solved!
    Go to Solution.
    Attachments:
    Memory Leak.JPG ‏136 KB
    No Memory Leak.JPG ‏137 KB

    Hi thisisnotadream,
    This problem has been reported, and you seem to be exactly reproducing the conditions required to see this problem. This was reported to R&D (# 134314) for further investigation. There are multiple possible workarounds, one of which is the one that you have already found of wiring the error directly into the loop. Other situations that result in no memory leak are:
    1.  If the bytes at port property node is not there and a read just happens in every iteration and resulting timeouts are ignored.
    2.  If the case structure is gone and just blindly check the bytes at port and read every iteration.
    3.  If the Timed Loop is turned into a While loop.
    Thanks for the feedback!
    Regards,Stephen S.
    National Instruments
    Applications Engineering

  • How to pause and restart a timed loop in Labview

    I am trying to pause and then restart a timed process (series of stepd that happen at precise times), which is implemented using a timed loop.
    I was wondering if anybody out there can give me a hint.
    Thanks

    Roxanne,
    Well, it's not exactly a "pause", but here's a way to stop and re-start your Timed Loop.
    See the attached example in LV2010.
    A While Loop and a Queue are used to allow you to start and re-start the Timed Loop.
    The "Stop Timed Structure" vi is used to stop the Timed Loop.
    Releasing the Queue stops the While Loop when you end the program.
    Note that the example is very similar to the NI template "Producer/Consumer Design Pattern (Events)". (File>>New)
    steve
    Help the forum when you get help. Click the "Solution?" icon on the reply that answers your
    question. Give "Kudos" to replies that help.
    Attachments:
    timed loop.vi ‏39 KB

  • Why do we lose counts through a timed loop?

    I have written a program to count the rising edges of a square wave produced by a function generator using the DAQmx functions. The counter is read in a time loop with a period of 1 second, so we take a sample once every second. It appears that the program is working correctly accept for the fact the the counts are continuously 2% lower than they should be. We are guessing that this is due to the fact that the timed loop really isn't taking a full second to complete each iteration. Any suggestions on how to fix these timing errors? The counters are read from the NI 6608 Device if that is of any help.

    Please post images of your code so that we can be off assistance.
    Thank you,
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • Timing loop speed

    Hello,
    Is there a limit to how fast a timed loop can run with an accurate timestamp? I would like to sample at *exactly* every 200 msec, however my output file indicates that it is ~ 200 +/- 10. Is there a better way to create my timestamp? BTW - the Init.vi notes the time in seconds since 1/1/2000 and all subsequent time is relative to the start time. THis is a desired output format that I cannot change. Thanks.
    Attachments:
    InitFile.vi ‏20 KB
    CNAP Daq.vi ‏101 KB

    Why are you using a timed loop?
    In order to sample at precisely 200msec intervals, I suggest you use hardware timing and NOT software timing.  The onboard clocks on the DAQ boards are much, much more accurate than anything you can do in software, timing-wise.
    What I would do is get rid of the timed loop, use hardware timing for the DAQ task, and collect the data as a waveform.  The waveform datatype contains timing information.  Look at some of the examples that ship with LabVIEW.  "Find Examples"..."Hardware input and output"..."DAQmx"..."Analog Measurements".
    Your timestamp is only accurate to ~16msec because it obtains the time from the Windows clock, and that's how accurate the Windows clock is.  That's the best it's ever going to do, so if you need better than that, use hardware timing for your DAQ.
    Hope that helps a bit...
    d

  • 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

  • Detecting peaks in blood pressure waveform.

    Hello all. I am studying human pulse waveforms and attempting to detect peaks in real time. I have a continuous stream of data coming in a serial port, this is converted from characters into integer values which are then plotted as a moving waveform.

  • Missing Subtypes of the Infotypes !!

    Hello, When we migrate the system from old version 4.6B to ECC 5.0, some of the customized subtypes of the infotypes(0035 and 0040) are missing in the new version. Only the standard subtypes are displayed. The spro path for the same is SPRO->Personne

  • How to add video to slideshow?

    I am new to Photoshop Elements 9 and Premier Elements 9. I created a slideshow of still images and have old family movies converted to DVD that I would like to incorporate. I used MPEG_Streamclip 1.2 to convert the VOB to avi, I inserted the avi into

  • Why cant i download 10.6 in itunes?

    I cant download i tunes 10.6 it gets so far then stops and comes up with an error message

  • Specifying where to download from

    Is it possible to specify where the software comes from when I download? I live on the east coast and all the software seems to come from the west. Even with a broadband connection the disk images for 9iAS and 9iDS look like 2-3 hours each. If I coul