Using Simulink    

Determining Block Update Order

During a simulation, Simulink updates the states and outputs of a model's blocks once per time step. The order in which the blocks are updated is therefore critical to the validity of the results. In particular, if a block's outputs are a function of its inputs at the current time step, the block must be updated after the blocks that drive its inputs. Otherwise, the block's outputs will be invalid. The order in which blocks are stored in a model file is not necessarily the order in which they need to be updated during a simulation. Consequently, Simulink sorts the blocks into the correct order during the model initialization phase.

Direct Feedthrough Blocks

In order to create a valid update ordering, Simulink categorizes blocks according to the relationship of outputs to inputs. Blocks whose current outputs depend on their current inputs are called direct feedthrough blocks. All other blocks are called nondirect-feedthrough blocks. Examples of direct-feedthrough blocks include the Gain, Product, and Sum blocks. Examples of nondirect-feedthrough blocks include the Integrator block (its output is a function purely of its state), the Constant block (it does not have an input), and the Memory block (its output is dependent on its input in the previous time step).

Block Sorting Rules

Simulink uses the following basic update rules to sort the blocks:

The result of applying these rules is an update list in which nondirect-feedthrough blocks appear at the head of the list in no particular order followed by direct-feedthrough blocks in the order required to supply valid inputs to the blocks they drive.

During the sorting process, Simulink checks for and flags the occurrence of algebraic loops, that is, signal loops in which an output of a direct-feedthrough block is connected directly or indirectly to one of the block's inputs. Such loops seemingly create a deadlock condition since Simulink needs the input of a direct-feedthrough block in order to compute its output. However, an algebraic loop can represent a set of simultaneous algebraic equations (hence the name) where the block's input and output are the unknowns. Further, these equations can have valid solutions at each time step. Accordingly, Simulink assumes that loops involving direct-feedthrough blocks do, in fact, represent a solvable set of algebraic equations and attempts to solve them each time the block is updated during a simulation. For more information, see Algebraic Loops.

Block Priorities

Simulink allows you to assign update priorities to blocks (see Assigning Block Priorities). Simulink updates higher priority blocks before lower priority blocks. Simulink honors the priorities only if they are consistent with its block sorting rules.


 Processing at Each Time Step Atomic Versus Virtual Subsystems