LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Timed loop duration - not what was requested

Solved!
Go to solution

Hi All.

I have a time loop (50 mSecs requested duration).  I get a poor response for that request.

 

pushkin_0-1643328440818.png

The white is the loop duration.  The green is my computation of execution.  The red is "Iteration Duration" from Timed Loop structure.  This is close to my execution time.

 

The LV is 2015 on Win 10.

 

The Timed Loop setup is;

pushkin_1-1643328876222.png

 

There does not seem to be any good reason why 50 mSec is not achieved.

Any suggestions?

Regards JC.....

 

0 Kudos
Message 1 of 7
(892 Views)

@pushkin wrote:

Hi All.

I have a time loop (50 mSecs requested duration).  I get a poor response for that request.

 

pushkin_0-1643328440818.png

The white is the loop duration.  The green is my computation of execution.  The red is "Iteration Duration" from Timed Loop structure.  This is close to my execution time.

 

The LV is 2015 on Win 10.

 

The Timed Loop setup is;

pushkin_1-1643328876222.png

 

There does not seem to be any good reason why 50 mSec is not achieved.

Any suggestions?

Regards JC.....

 


There are lots of good reasons why the timing isn't what you expect it to be, but I'm not at all sure what the problem is.  Is it too slow?  Is it erratic?  You won't be able to get closer than a couple of milliseconds +/- with Windows.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 2 of 7
(886 Views)

Hi and thank you.

I did find myself at fault.  I was computing the period between successive execution endings.  So the jitter of execution is reflected in the period.  You can see this from the ups and downs.  A better graph is below. Period is between successive starts of execution.

 

pushkin_0-1643332496387.png

 

My next is issue why does the execution vary so much.  Another item. 🙂

 

Regards JC......

 

0 Kudos
Message 3 of 7
(872 Views)

@pushkin wrote:

My next is issue why does the execution vary so much.  Another item. 🙂


Windows is a non-deterministic OS.  If you need your loop to iterate at a consistent rate, then you need to move to a Real Time OS, such as NI's Linux RT.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 7
(864 Views)

@crossrulz wrote:


Windows is a non-deterministic OS.  If you need your loop to iterate at a consistent rate, then you need to move to a Real Time OS, such as NI's Linux RT.


Honestly I always thought Timed Loops were for intended for RT targets.

 

Usually the answers to the posts asking why their program built around a Timed Loop does not do what they think it should reinforces that.

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 5 of 7
(840 Views)

@RTSLVU wrote:

@crossrulz wrote:


Windows is a non-deterministic OS.  If you need your loop to iterate at a consistent rate, then you need to move to a Real Time OS, such as NI's Linux RT.


Honestly I always thought Timed Loops were for intended for RT targets.

 

Usually the answers to the posts asking why their program built around a Timed Loop does not do what they think it should reinforces that.


I think that is exactly what it was intended for.  However, I guess they left it in the general palette because it does help if you need things inside the loop to execute in the same order every time.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 6 of 7
(832 Views)
Solution
Accepted by topic author pushkin

The reason it exists under Windows is because you need to be able to edit a VI intended for a real-time target on your Windows system. If it would not exist under Windows, LabVIEW would not be able to draw the structure and let you configure its specifics. LabVIEW does provide an emulation of the underlying mechanics under Windows in order to let you run your program for debugging reason on the My Computer target, but it is just that, an emulation not the real thing!

 

Using the Timed Structure for VIs not intended to run on a real-time target is NOT providing any real advantages over using a normal while loop. Definitely not in terms of providing a more real-time specific execution of your code! There is actually a very good chance that it may provide a worse experience in terms of performance under Windows than the normal while loop, since the compiler is very much tuned to perform optimizations on those normal loop structures but can't do it in the same way for the Timed loop structure. Instead the Timed Loop structure interacts more directly with the underlying OS on real-time systems, where its purpose is to provide a more real-time specific execution rather than the fastest possible execution. These two things are very much NOT the same!

Rolf Kalbermatter
My Blog
Message 7 of 7
(818 Views)