Organizing Deterministic and Non-Deterministic Tasks in a Real-Time VI
- Updated2023-02-17
- 3 minute(s) read
Organizing Deterministic and Non-Deterministic Tasks in a Real-Time VI
What to Use
- Timed Loop
- While Loop
- RT FIFO Create, Write, Read, and Delete nodes from the Real-Time Nodes category
- Stop Timed Structure
What to Do
Create the following diagram to organize a deterministic and non-deterministic task in a real-time VI.
Customize the gray sections for your unique programming goals.

|
|
Place a deterministic task in a Timed Loop. A Timed Loop executes each iteration at the period and priority you specify. The highest priority Timed Loop executes before lower priority items in a VI or application. |
|
|
Place a non-deterministic task in a While Loop. In this example, the While Loop includes an indicator that transfers data to the user interface on the panel. Panel controls and indicators do not transfer data deterministically, so using an indicator in a Timed Loop could introduce enough jitter to prevent deterministic execution for the task. |
|
|
Use RT FIFO Write to transfer data from a deterministic task to a non-deterministic task. |
|
|
Use RT FIFO Read to access data produced by a deterministic task. When using RT FIFO Read in a non-deterministic task, set the timeout in ms to -1 to ensure that the node never returns null values. |
|
|
Stop Timed Structure aborts the execution of the Timed Loop when the While Loop stops. In this example, the While Loop stops when it receives a True Boolean value from a control on the panel. Controls do not transfer data deterministically, so you should never stop a Timed Loop directly from a control on the panel. Stop Timed Structure allows both loops to stop based on the stop condition of the While Loop without placing a control directly in the Timed Loop. This avoids introducing jitter into the Timed Loop. |
Troubleshooting
Make sure to configure a Timed Loop with a period large enough to perform the deterministic task and still have idle time during the iteration to allow lower priority loops and structures to execute. Because Timed Loops preempt other tasks, a Timed Loop can monopolize all of the processor resources and prevent lower priority tasks from executing.
Examples
Search within the programming environment to access the following installed examples:- Using the Timed Loop with RT FIFOs
Related Information
- Determinism and Jitter in a Real-Time System
Determinism is the characteristic that describes how consistently a system executes tasks within a time constraint.
- Separating Tasks to Optimize a Real-Time Application
Task separation involves running distinct tasks in parallel loops to create an application.
- Transferring Data to Deterministic Code