Troubleshoot Overloaded CPU from Executing Real-Time Application

Some issue is producing a CPU overload when executing a real-time application.

What This Issue Means

A CPU overload indicates that the CPU is unable to complete processing a model time step before restarting for the next time step. When this error occurs, the target object property CPUoverload changes from none to detected. One of the following can occur:

  • The Simulink® Real-Time™ kernel halts model execution.

  • If you allow the overload, model execution continues until a predefined event occurs (see Permit CPU Overloads for Diagnosis). If the model continues to run after a CPU overload, the time step lasts as long as the time required to finish the execution. This behavior delays the next time step.

For more information and test models, see www.mathworks.com/matlabcentral/fileexchange/23507.

Model design or target computer resources cause CPU overloads. Possible reasons are:

  • The target computer is too slow or the model sample time is too small (see Limits on Sample Time).

  • The model is too complex (algorithmic complexity).

  • The model does disk I/O on the target computer hard drive.

  • I/O latency, where each I/O channel used introduces latency into the system. I/O latency can cause the execution time to exceed the model time step.

    To find latency values for Speedgoat boards, contact Speedgoat technical support.

Try This Workaround

The Simulink Real-Time kernel usually halts model execution when it encounters a CPU overload. You can configure the Simulink Real-Time model to allow CPU overloads. Use this capability to support long initializations and for overload diagnosis.

Permit Long Initialization Time

For some real-time applications, normal initialization can extend beyond the first sample time. Use the TLCOptions property xPCStartupFlag with the smallest effective value, up to approximately 5.

Permit CPU Overloads for Diagnosis

During execution, hardware-specific factors can cause the real-time application to process data beyond the sample time. Use the TLCOptions properties xPCMaxOverloads and xPCMaxOverloadLen to diagnose and address this issue.

Note

Allowing the target computer CPU to overload can cause incorrect results, especially for multirate models. Use these TLC command-line options only for diagnosis. When your diagnosis is complete, turn off these options.

See Also

Related Topics