Use System Objects in Feedback Loops
If your algorithm needs to process nondirect feedthrough data through the System object™, use the
updateImpl methods. These methods
process nondirect feedthrough data through a System object.
Most System objects use direct feedthrough, where the object’s input is needed to
generate the output. For these direct feedthrough objects, the
step method calculates the output and updates the state values. For
nondirect feedthrough, however, the object’s output depends on internal states and not
directly on the inputs. The inputs, or a subset of the inputs, are used to update the
object states. For these objects, calculating the output is separated from updating the
state values. This enables you to use an object as a feedback element in a feedback
This example shows how to implement a delay object with nondirect feedthrough.
In MATLAB®, select New > System object > Basic.
Select Insert Method and implement the
outputImplcalculates outputs from states and/or inputs.
updateImplupdates state values from inputs.
When implementing the
outputImplmethod, do not access the System object inputs for which the direct feedthrough flag is false.
If the System object supports code generation and does not use propagation, Simulink® can automatically infer the direct feedthrough settings from the System object MATLAB code. However, if the System object does not support code generation, the default
isInputDirectFeedthroughImplmethod returns false (no direct feedthrough). In this case, override this method to specify nondirect feedthrough behavior.
The processing of the nondirect feedthrough changes the way that the software calls the System object methods within the context of the Simulink engine.