Function-Call Subsystem - Subsystem whose execution is controlled by external function-call

        input - Simulink ([original](https://in.mathworks.com/help/simulink/slref/functioncallsubsystem.html)) ([raw](?raw))

Subsystem whose execution is controlled by external function-call input

Libraries:
Simulink / Ports & Subsystems

Description

The Function-Call Subsystem block is a Subsystem block preconfigured as a starting point for creating a subsystem that executes when a function-call input port receives a function-call event. A Stateflow® chart, Function-Call Generator block, S-Function block, or Hit Crossing block can provide function-call events. See Using Function-Call Subsystems.

Contents of an Function-Call Subsystem block.

Use Function-Call Subsystem blocks to:

Simulink® ignores any priority set on a Function-Call Subsystem block, but you can set the priority on a block connected to the function-call port of the subsystem. The function-call port can receive a function-call event from a Stateflow chart, MATLAB Function block, Function-Call Generator block, S-Function block, or Hit Crossing block.

Examples

Ports

Input

expand all

Signal input to a Subsystem block, specified as a scalar, vector, or matrix. Placing an Inport block in aSubsystem block adds an external input port to the block. The port label matches the name of the Inport block.

Use Inport blocks to receive signals from the local environment.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | Boolean | fixed point | enumerated | bus | image

A Trigger block in a Subsystem block adds an external input port to the block. A Trigger type of function-call makes the block a Function-Call port block that accepts function-call events.

Output

expand all

Signal output from a Subsystem block, returned as a scalar, vector, or matrix. Placing an Outport block in aSubsystem block adds an external output port to the block. The port label matches the name of the Outport block.

Use Outport blocks to send signals to the local environment.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | Boolean | fixed point | enumerated | bus | image

Parameters

expand all

To edit block parameters interactively, use theProperty Inspector. From the Simulink Toolstrip, on the Simulation tab, in thePrepare gallery, select Property Inspector.

Main

Select how to display port labels on the Subsystem block icon.

For port label editing on Subsystem blocks, see Edit Port Labels on Subsystem Blocks.

Programmatic Use

To set the block parameter value programmatically, use the set_param function.

Parameter: ShowPortLabels
Values: 'FromPortIcon' (default) | 'FromPortBlockName' 'SignalName' 'none'

Control user access to the contents of the subsystem.

You do not receive a response if you attempt to view the contents of a subsystem whose Read/Write permissions parameter is set to NoReadOrWrite. For example, when double-clicking such a subsystem, the software does not open the subsystem and does not display any messages.

Programmatic Use

To set the block parameter value programmatically, use the set_param function.

Parameter: Permissions
Values: 'ReadWrite' (default) | 'ReadOnly' 'NoReadOrWrite'

Enter the name of a function to be called if an error occurs while the software executes the subsystem.

The software passes two arguments to the function: the handle of the subsystem and a character vector that specifies the error type. If no function is specified, the software displays a generic error message if executing the subsystem causes an error.

Programmatic Use

To set the block parameter value programmatically, use the set_param function.

Parameter: ErrorFcn
Values: '' (default) | function name in quotes
Data Types: char | string

Select whether to resolve names of workspace variables referenced by this subsystem.

For more information, see Symbol Resolution and Symbol Resolution Process.

Programmatic Use

To set the block parameter value programmatically, use the set_param function.

Parameter: PermitHierarchicalResolution
Values: 'All' (default) | 'ExplicitOnly' 'None'

Select this parameter to display the reinitialize event ports. Clear this parameter to remove the ports.

Dependencies

To enable this parameter, select Treat as atomic unit.

Programmatic Use

To set the block parameter value programmatically, use the set_param function.

Parameter: ShowSubsystemReinitializePorts
Values: 'off' (default) | 'on'

Code Generation

Parameters on the Code Generation tab require a Simulink Coder™ or Embedded Coder® license.

Select the code format to be generated for an atomic (nonvirtual) subsystem.

For more information, see:

The default value depends on the block configuration. For example, the default value for the Subsystem block is Auto. The default value for the CodeReuseSubsystem block isReusable function.

Tips

Dependencies

Programmatic Use

To set the block parameter value programmatically, use the set_param function.

Parameter: RTWSystemCode
Values: 'Auto' | 'Inline' 'Nonreusable function' 'Reusable function'

Select how the software names the function it generates for the subsystem.

If you have an Embedded Coder license, you can control function names with options on the Configuration Parameter > pane.

For more information, see Generate Subsystem Code as Separate Function and Files (Simulink Coder).

The default value depends on the block configuration. For example, the default value for the Subsystem block is Auto. The default value for the CodeReuseSubsystem block isUse subsystem name.

Dependencies

Programmatic Use

To set the block parameter value programmatically, use the set_param function.

Parameter: RTWFcnNameOpts
Values: 'Auto' | 'Use subsystem name' 'User specified'

Specify a unique, valid C or C++ function name for subsystem code.

Use this parameter if you want to give the function a specific name instead of allowing the Simulink Coder code generator to assign its own autogenerated name or use the subsystem name. For more information, see Generate Subsystem Code as Separate Function and Files (Simulink Coder).

Dependencies

Programmatic Use

To set the block parameter value programmatically, use the set_param function.

Parameter: RTWFcnName
Values: '' (default) | function name in quotes
Data Types: char | string

Select how the software names the separate file for the function it generates for the subsystem.

The default value depends on the block configuration. For example, the default value for the Subsystem block is Auto. The default value for the CodeReuseSubsystem block isUse function name.

Dependencies

Programmatic Use

To set the block parameter value programmatically, use the set_param function.

Parameter: RTWFileNameOpts
Values: 'Auto' | 'Use subsystem name' 'Use function name' 'User specified'

The filename that you specify does not have to be unique. However, avoid giving non-unique names that result in cyclic dependencies. For example,sys_a.h includes sys_b.h,sys_b.h includes sys_c.h, andsys_c.h includes sys_a.h.

For more information, see Generate Subsystem Code as Separate Function and Files (Simulink Coder).

Dependencies

Programmatic Use

To set the block parameter value programmatically, use the set_param function.

Parameter: RTWFileName
Values: '' (default) | filename in quotes
Data Types: char | string

Select how to use arguments with the generated function.

In some cases, when generating optimized code, the code generator might not generate a function that has arguments.

For more information, see:

Dependencies

Programmatic Use

To set the block parameter value programmatically, use the set_param function.

Parameter: FunctionInterfaceSpec
Values: 'void_void' (default) | 'Allow arguments (Optimized)' 'Allow arguments (Match graphical interface)'

Generate subsystem function code in which the internal data for an atomic subsystem is separated from its parent model and is owned by the subsystem.

For details on how to generate modular function code for an atomic subsystem, seeGenerate Modular Function Code for Nonvirtual Subsystems (Embedded Coder).

For details on how to apply memory sections to atomic subsystems, see Override Default Memory Placement for Subsystem Functions and Data (Embedded Coder).

Dependencies

Programmatic Use

To set the block parameter value programmatically, use the set_param function.

Parameter: FunctionWithSeparateData
Values: 'off' (default) | 'on'

Select how the software applies memory sections to the subsystem initialization and termination functions.

Tips

Dependencies

Programmatic Use

To set the block parameter value programmatically, use the set_param function.

Parameter: RTWMemSecFuncInitTerm
Values: 'Inherit from model' (default) | 'Default' model memory section in quotes

Select how Embedded Coder applies memory sections to the subsystem execution functions.

Tips

Dependencies

Programmatic Use

To set the block parameter value programmatically, use the set_param function.

Parameter: RTWMemSecFuncExecute
Values: 'Inherit from model' (default) | 'Default' model memory section in quotes

Select how the software applies memory sections to the subsystem constants.

Tips

Dependencies

Programmatic Use

To set the block parameter value programmatically, use the set_param function.

Parameter: RTWMemSecDataConstants
Values: 'Inherit from model' (default) | 'Default' model memory section in quotes

Select how the software applies memory sections to the subsystem internal data.

Tips

Dependencies

Programmatic Use

To set the block parameter value programmatically, use the set_param function.

Parameter: RTWMemSecDataInternal
Values: 'Inherit from model' (default) | 'Default' model memory section in quotes

Select how the software applies memory sections to the subsystem parameters.

Tips

Dependencies

Programmatic Use

To set the block parameter value programmatically, use the set_param function.

Parameter: RTWMemSecDataParameters
Values: 'Inherit from model' (default) | 'Default' model memory section in quotes

Subsystem Reference

Specify the subsystem file you want to reference. For information about subsystem references, see Create and Use Referenced Subsystems in Models.

Dependencies

To access this parameter, in the Subsystem Reference section, click Convert.

For more information on how to convert a subsystem to a referenced subsystem, see Convert Subsystem to a Referenced Subsystem.

Programmatic Use

To set the block parameter value programmatically, use the set_param function.

Parameter: ReferencedSubsystem
Values: '' (default) | subsystem filename in quotes
Data Types: char | string

Block Characteristics

Data Types Booleana | busa doublea enumerateda fixed pointa halfa integera singlea stringa
Direct Feedthrough no
Multidimensional Signals yesa
Variable-Size Signals yesa
Zero-Crossing Detection no
a Actual data type or capability support depends on block implementation.

Extended Capabilities

expand all

Actual code generation support depends on block implementation.

Actual data type support depends on block implementation.

Version History

Introduced before R2006a