A function-call subsystem is a subsystem that another block can invoke directly during a simulation. It is analogous to a function in a procedural programming language. Invoking a function-call subsystem is equivalent to invoking the output methods (See Block Methods) of the blocks that the subsystem contains in sorted order (See How Simulink Determines the Sorted Order). The block that invokes a function-call subsystem is called the function-call initiator. Stateflow®, Function-Call Generator, and S-function blocks can all serve as function-call initiators.
To create a function-call subsystem, drag a Function-Call Subsystem block from the
Ports & Subsystems library into your model and connect a function-call
initiator to the function-call port displayed on top of the subsystem.
You can also create a function-call subsystem from scratch. First
create a Subsystem block in your
model and then create a Trigger block
in the subsystem. Next, on the Trigger block parameters pane, set
the Trigger type to
You can configure a function-call subsystem to be triggered
(the default) or periodic by setting the Sample time type of
its Trigger port to be
respectively. A function-call initiator can invoke a triggered function-call
subsystem zero, one, or multiple times per time step. The sample times
of all the blocks in a triggered function-call subsystem must be set
to inherited (
A function-call initiator can invoke a periodic function-call
subsystem only once per time step and must invoke the subsystem periodically.
If the initiator invokes a periodic function-call subsystem aperiodically,
the simulation is halted and an error message is displayed. The blocks
in a periodic function-call subsystem can specify a noninherited sample
time or inherited (
-1) sample time. All blocks
that specify a noninherited sample time must specify the same sample
time. For example, if one block specifies
the sample time, all other blocks must specify a sample time of
If a function-call initiator invokes a periodic function-call subsystem
at a rate that differs from the sample time specified by the blocks
in the subsystem, the simulation halts and an error message appears.
Note: During range checking, the design minimum and maximum are back-propagated to the actual source port of the function-call subsystem, even when the function-call subsystem is not enabled.
To prevent this back propagation, add a Signal Conversion block
and a Signal Specification block after the source port,
set the Output of the Signal Conversion block
For more information, see Function-Call Subsystems and S-Functions.