Variation of Timed Loop Period on a Non Real-Time Operating System

Updated Dec 10, 2018

Reported In

Software

  • LabVIEW
  • LabVIEW Real-Time Module

Issue Details

I want to run a loop at a certain rate (50 ms) and for this I set the period input of a timed loop to 50. However, when I log the data to a file along with a timestamp, I notice that there is a variation in the execution rate, i.e. the timestamps are spaced at 45 ms, 47 ms, 53 ms etc. but never exactly at 50 ms. Why does this occur?

Solution

The reason this occurs is that the operating system does not allow the LabVIEW program full control of the scheduler. Since these operating systems allow multitasking and multiple threads, different applications running in memory have to share processor time. While one program is running, the others have to wait. This is the reason why the execution rate of the loop is not constant.

The solution to get as constant and accurate a rate as possible is to reduce the number of processes running in memory. However, the best way to obtain deterministic execution is to switch to a real-time operating system which is included in the LabVIEW Real-Time Module.

WAS THIS ARTICLE HELPFUL?

Not Helpful