Table Of Contents

Organizing Deterministic and Non-Deterministic Tasks in a Real-Time VI

Version:
    Last Modified: September 20, 2016

    In a real-time VI, a task that must finish on time for the VI to accomplish its purpose is a deterministic task. By proactively separating a deterministic task like reading a signal from a non-deterministic task like transferring data to a user interface, you mitigate jitter in the deterministic task. Place a deterministic task in a Timed Loop and a non-deterministic task in another loop to ensure that the deterministic task reserves enough processor resources to execute within the time period you set.

    What to Use

    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 LabVIEW for the following installed examples:
    • Using the Timed Loop with RT FIFOs

    Recently Viewed Topics