Troubleshoot Unexpected Measured Stop Time Value

Some issue is causing the measured stop time from the model to deviate from the requested stop time in the model.

What This Issue Means

If you change the step size of a real-time application at run time, the real-time application sometimes executes for fewer steps than you expect. The number of execution steps is:

floor(stop time/step size)

When you compile code for a model, Simulink® Coder™ calculates the number of steps based on the current step size and stop time. If the stop time is not an integral multiple of the step size, Simulink Coder adjusts the stop time to an integral multiple. If you change the step size without rebuilding the model, Simulink Real-Time™ uses the new step size and the previously adjusted stop time. The resulting model sometimes executes for fewer steps than you expect.

 Example

Try This Workaround

Check that the original stop time (as specified in the model) is an integral multiple of the original step size.

Related Topics