LabVIEW Embedded

cancel
Showing results for 
Search instead for 
Did you mean: 

Create a Time Budget

Time budgeting is essential to ensuring the proper timing of a real-time application. Use the techniques described in this topic to create a time budget that you can use to design the timing and prioritization of the tasks in your application.

Time Budgeting Techniques

Time budgeting involves determining the amount of time required to execute each task in the application, and setting the rates and priorities of the tasks accordingly.

Measuring Execution Times

Use the RT Benchmarking Example template to determine the duration of each task in your application. To be safe, allow the benchmark to run for several thousand iterations and record the worst-case execution time as the task duration. Then build a time budgeting table for the application by recording the duration, period, and priority of each task, as shown in the following example.

Task Duration (µS) Period (µS) Priority
Control8001000Time-Critical
Monitor100025,000Above Normal
Log1,6005,000Normal

After you construct the table, you can determine the theoretical CPU utilization of the tasks in the application using the following formula.

CPU Utilization = Sum[Task1 ... Task N](Duration / Period)

By plugging the numbers from the previous table into this formula, you can see that the CPU utilization in this example is 800/1000 + 1000/25000 + 1600/5000 = 1.16, which is over 100% CPU utilization. Because the monitoring task in this example is set to a higher priority than the logging task, the RTOS schedules the logging task immediately after the control task finishes its iteration. The RTOS schedules the logging task only after the monitoring task finishes an iteration, leaving insufficient time for the logging task to meet the requested period.

Rate Monotonic Analysis

Most LabVIEW RT applications benefit from the use of rate monotonic analysis as a time budgeting technique. Rate monotonic analysis involves setting task priorities based on the required rate of each task. The higher the required rate of the task, the higher the priority.

0 Kudos
Message 1 of 1
(2,613 Views)