LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Labview

Solved!
Go to solution

Hi friends,

 

How much time one iteration of while loop?

 

Have a nice work.

0 Kudos
Message 1 of 10
(3,271 Views)

It completely depends.  What is in the loop?

 

In short, a While Loop cannot iterate until EVERYTHING inside of it completes.  So if you have a wait for 1 second inside of your loop, the loop will iterate at around 1 second.

 

3 Hour Introduction
6 Hour Introduction
LabVEW Basics
Self Paced training for students
Self Paced training beginner to advanced, SSP Required
LabVIEW Wiki on Training
Learning NI
Getting Started with NI Products


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 2 of 10
(3,266 Views)
Please use something other than 'LabVIEW' for a subject. Every post here is related to LabVIEW.

Your question does not make much sense. The iteration time is dependent on what is inside the loop as well as the processor in the pc. It is also something that you can easily test yourself. Do you have a specific VI?
Message 3 of 10
(3,262 Views)
Solution
Accepted by topic author star-123

Do you want to measure the loop time of an existing while loop?

 

try this:

 

0 Kudos
Message 4 of 10
(3,249 Views)

Is the code for one iteration?

0 Kudos
Message 5 of 10
(3,209 Views)

Did you try it?

 

(Learning by doing is a concept often used… :))

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 10
(3,204 Views)

@1085 wrote:

Is the code for one iteration?


It updates with each new iteration, measuring the time difference since the same code was called the last time, i.e. in the previous iteration.

 

I typically use a custom format of "%.2ps" or similar for the time display. (right-click...display format...advanced editing mode). This way it displays in nice si units (200.00ns, 12.40ms, 3.12s, etc) 

0 Kudos
Message 7 of 10
(3,154 Views)

Also note that execution times depend a lot on the system you use if you have no wait times included in the loop.

 

Long story short:

You cannot tell in advance how fast a single loop iteration is on your machine until you test it.

 

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 8 of 10
(3,147 Views)

In addition the loop time can change from iteration to iteration depending on what background processes are running on your PC.  A virus scanner starting up or an OS auto-update can slow down your loop significantly in some cases.  If you need deterministic operation you'll need a Real-Time PC/OS.

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019 - Unfortunately now moving back to C#, .NET, Python due to forced change to subscription model by NI. 8^{
0 Kudos
Message 9 of 10
(3,113 Views)

I think you guys are way overcomplicating the discussion. There was never a question on how to reliably keep a fixed loop time or how to run (or not run) the loop as fast as possible.

 

All he wanted is to measure the actual loop time (e.g. for benchmaking or validation, I guess).

It was a measurement question, not a control question and consisted of only eight words! 😄

 

Once the actual measurment results turn out to be puzzling (e.g. too much jitter, longer than expected, etc.) we can revisit this disucssion.

 

0 Kudos
Message 10 of 10
(3,105 Views)