DSP Blockset | ![]() ![]() |
Excess Algorithmic Delay (Tasking Latency)
Under certain conditions, Simulink may force a block to delay inputs longer than is strictly required by the block's algorithm. This excess algorithmic delay is called tasking latency, because it arises from synchronization requirements of the Simulink tasking mode. A block's overall algorithmic delay is the sum of its basic delay and tasking latency.
Algorithmic delay = Basic algorithmic delay + Tasking latency
The tasking latency for a particular block may be dependent on the following block and model characteristics:
Simulink Tasking Mode. Simulink has two tasking modes:
Select a mode by choosing SingleTasking or MultiTasking from the Mode pop-up menu in the Solver panel of the Simulation Parameters dialog box. The Mode pop-up menu is only available when the Fixed-step option is selected from the Type pop-up menu. (When the Variable-step option is selected from the Type pop-up menu, Simulink always operates in single-tasking mode.) The Auto option in the Mode pop-up menu automatically selects single-tasking operation if the model is single-rate (see below), or multitasking operation if the model is multirate.
Many multirate blocks have reduced latency in the Simulink single-tasking mode; check the "Latency" section of a multirate block's reference page for details. Also see "The Simulation Parameters Dialog Box" in the Simulink documentation for more information about the tasking modes and other simulation options.
Block Rate Type. A block is called single-rate when all of its input and output ports operate at the same frame rate (as indicated by identical Probe block measurements or sample time color coding on the input and output lines). A block is called multirate when at least one input or output port has a different frame rate than the others.
Many blocks are permanently single-rate, which means that all input and output ports always have the same frame rate. For other blocks, the block parameter settings determine whether the block is single-rate or multirate. Only multirate blocks are subject to tasking latency.
Note Simulink may report an algebraic loop error if it detects a feedback loop composed entirely of multirate blocks. To break such an algebraic loop, insert a single-rate block with nonzero delay, such as a Unit Delay block. For more information about algebraic loops, see "Algebraic Loops" in the Simulink documentation. |
Model Rate Type. When all ports of all blocks in a model operate at a single frame rate, the model is called single-rate. When the model contains blocks with differing frame rates, or at least one multirate block, the model is called multirate. Note that Simulink prevents a single-rate model from running in multitasking mode by generating an error.
Block Sample Mode. Many blocks can operate in either sample-based or frame-based modes. In source blocks, the mode is usually determined by the Samples per frame parameter; a value of 1
for this parameter indicates sample-based mode, while a value greater than 1
indicates frame-based mode. In nonsource blocks, the sample mode is determined by the input signal. See the online block reference for additional information on particular blocks.
![]() | Basic Algorithmic Delay | Predicting Tasking Latency | ![]() |