5.1.109. Task period overrun (pkn_TaskPeriodOverrun)

Get the count of overruns for a given model rate (periodic task). Supported targets

All targets Required license

None (Main library). (See Section 2.3, “Licensed Features”.) Description

Each rate in a model is represented by a task. A task contains all the functionality to iterate that model rate. Simulink has a specific scheme for executing each task to simulate the model on the host PC, or to run the model on a target ECU. While arbitrarily large models can be run on the host PC, where the model is not run in real time, there is a limit to the size of model that can be executed on the target ECU in real time. The pkn_TaskPeriodOverrun block provides feedback on how many times a model rate (periodic) task has overrun its rate.

For example, if a model contains a 5 millisecond rate then the pkn_TaskPeriodOverrun block counts the number of times the 5 millisecond model rate task becomes ready to run when the 5 millisecond task is already running.

A model rate task may overrun its period for a number of reasons:

  • The quantity and type of blocks required to execute every period is too much for the target ECU to achieve.

  • A higher priority model rate task or tasks (those with shorter periods) uses up processor time that the lower priority model rate tasks require to complete within their period.

Together with the psc_CpuLoading block, and the pkn_TaskDuration block, the pkn_TaskPeriodOverrun block can provide an indication of where the majority of the model processing takes place, useful when attempting to optimise the model. It is useful to record the output of these blocks across the lifetime of the model development — a graph of these values against time will help to indicate if the model will become too large for the ECU as development progresses. Inports

  • sim_overruns

    Only used under simulation and when the parameter Provide simulation inputs is ticked. The outport overruns is set to the value of this inport for simulation purposes.

    Range: [0, 255] counts Outports

  • overruns

    The saturated counts of periodic overruns for the model rate task since the ECU was powered on (or reset). Under simulation, if the Provide simulation inputs parameter isn't ticked, the outport is set to the minimum of its range.

    Range: [0, 255] counts

    Value type:integer Mask parameters

  • Sample time (task)

    The periodicity of the model rate to measure.

    Range: [0.001, 3600] seconds

    Value type:float
  • Sample time (block)

    The periodicity of the block. The task and block sample time allow the model rate task measurement to occur independently from the task itself.

    Range: [0.001, 3600] seconds

    Value type:float
  • Provide simulation inputs

    Tick to enable inport sim_overruns.

    Value type:boolean Notes