Package: matlab.system.mixin
Nondirect feedthrough mixin class
matlab.system.mixin.Nondirect
is a class that
uses the output
and update
methods
to process nondirect feedthrough data through a System
object™.
For System objects that use direct feedthrough, the object’s
input is needed to generate the output at that time. For these direct
feedthrough objects, running the System
object calculates the
output and updates the state values. For nondirect feedthrough, however,
the object’s output depends only on the internal states at
that time. The inputs are used to update the object states. For these
objects, calculating the output with outputImpl
is
separated from updating the state values with updateImpl
.
If you use the matlab.system.mixin.Nondirect
mixin
and include the stepImpl
method in your class definition
file, an error occurs. In this case, you must include the updateImpl
and outputImpl
methods
instead.
The following cases describe when System objects in Simulink® use direct or nondirect feedthrough.
System
object supports code generation and does
not inherit from the Propagates
mixin — Simulink automatically
infers the direct feedthrough settings from the System
object code.
System
object supports code generation and inherits
from the Propagates
mixin — Simulink does
not automatically infer the direct feedthrough settings. Instead,
it uses the value returned by the isInputDirectFeedthroughImpl
method.
System
object does not support code generation — Default isInputDirectFeedthroughImpl
method returns false, indicating that direct feedthrough is not
enabled. To override the default behavior, implement the isInputDirectFeedthroughImpl
method in your class definition file.
Use the Nondirect
mixin to allow a System
object to
be used in a Simulink feedback loop. A delay object is an example
of a nondirect feedthrough object.
To use this mixin, you must subclass from this class in addition to subclassing from the matlab.System
base class. Type the following syntax as the first line of your class definition file, where
ObjectName
is the name of your
object:
classdef ObjectName < matlab.system & matlab.system.mixin.Nondirect
isInputDirectFeedthroughImpl | Direct feedthrough status of input |
outputImpl | Output calculation from input or internal state of System object |
updateImpl | Update object states based on inputs |