Main Content

Subsystem

Group blocks to create model hierarchy

  • Subsystem block

Libraries:
Simulink / Commonly Used Blocks
Simulink / Ports & Subsystems
HDL Coder / Ports & Subsystems

Description

A Subsystem block contains a subset of blocks within a model or system. The Subsystem block can represent a virtual subsystem or a nonvirtual subsystem.

  • Virtual subsystems help visually organize a block diagram. They play no active role in the simulation and do not affect simulation results. Virtual subsystems are neither conditionally nor atomically executed. Virtual subsystems do not have checksums.

  • Nonvirtual subsystems play an active role in the simulation of a system. If you add or remove a nonvirtual subsystem, you change the model behavior. Nonvirtual subsystems are atomic subsystems that execute as a single block, or atomic unit, when the parent model executes.

For information on the types of nonvirtual subsystems, see Explore Types of Subsystems.

To determine whether a subsystem is virtual or nonvirtual, use either of these strategies:

  • Check the border of the block. A block that represents a virtual subsystem has a thin border. A block that represents a nonvirtual subsystem has a thick border.

    Virtual and nonvirtual subsystem blocks

  • Use the get_param function to query the Boolean block parameter IsSubsystemVirtual.

The ports on a Subsystem block correspond to blocks inside the subsystem. For more information, see Connect Subsystems.

The Subsystem block supports signal label propagation through subsystem Inport and Outport blocks. For more information, see Signal Label Propagation.

Examples

expand all

You can create a subsystem by adding a Subsystem block, then adding contents to the subsystem.

Insert a Subsystem block into your model.

For example:

  1. Open the quick-insert menu by double-clicking the Simulink® canvas.

  2. In the search box, start typing the name of the block. For example, type subsystem.

  3. In the list that appears, select the block for the type of subsystem that you want to implement in your model. Use the arrow keys and press Enter or click the block.

To view or edit the contents of a subsystem, double-click the Subsystem block. To exit the subsystem, below the left end of the Simulink Toolbar, click the Back button . For more information on how to navigate the hierarchy of a model with subsystems, see Navigate Model Hierarchy.

You can create a subsystem by converting part of an existing model into a subsystem.

In the Simulink canvas, drag a selection box over the model elements that you want to include in the subsystem. An ellipsis appears next to the selection box.

Model contains a Transfer Fcn block and a Gain block selected, and an ellipsis next to the selection box

Pause on the ellipsis. An action bar expands.

Ellipsis replaced by an action bar, with the Create Subsystem option selected

In the action bar, click Create Subsystem or another subsystem option.

In the block diagram, the Transfer Fcn block and a Gain block are replaced by a single Subsystem block. The signal line that connected to the input port of the Transfer Fcn block now connects to the input port of the Subsystem block, and the signal line that connected to the output port of the Gain block now connects to the output port of the Subsystem block.

To provide an interface for signals entering and leaving the subsystem, the Subsystem block contains blocks that correspond to input and output ports.

When the selection contains blocks that correspond to input and output ports, the new subsystem includes copies of those blocks. The new subsystem does not contain copies of blocks that correspond to control ports.

To replace a Subsystem block with its contents, you can expand the subsystem.

Select the Subsystem block. Then, in the Simulink Toolstrip, on the Subsystem Block tab, click Expand.

The contents of the subsystem appear in an area labeled with the name of the replaced block.

The top image show a Sine Wave block connected to a Subsystem block connected to a Scope block. The bottom image show the same block diagram with the Subsystem block replaced by its contents. The contents are in an area labeled Subsystem.

For more information, see Expand Subsystem Contents.

To determine whether a subsystem is virtual, use the get_param function with the Boolean block parameter IsSubsystemVirtual.

Open the example. Then, open the SubsystemExecution model.

open_system("SubsystemExecution");

Check whether the Subsystem block named discrete cruise controller is virtual.

get_param("SubsystemExecution/discrete cruise controller",...
    "IsSubsystemVirtual")
ans = 
'off'

This subsystem is nonvirtual. The thick border of the block icon indicates that the subsystem is nonvirtual.

Check whether the Subsystem block named car dynamics is virtual.

get_param("SubsystemExecution/car dynamics","IsSubsystemVirtual")
ans = 
'on'

This subsystem is virtual.

Ports

Input

expand all

Placing a block such as an Inport or In Bus Element block in a subsystem adds an external input port to the Subsystem block.

Use Inport or In Bus Element blocks to get signals from the local environment.

For more information, see Connect Subsystems.

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

A reinitialize event port provides a function-call control signal that triggers a subsystem reinitialize event, which resets the states of the subsystem.

The subsystem must contain a Reinitialize Function block that corresponds to each subsystem reinitialize event. For more information, see Using Initialize, Reinitialize, Reset, and Terminate Functions.

To specify the port name, use the Event name parameter of the Event Listener block in the Reinitialize Function block.

Dependencies

To enable this type of port, select Show subsystem reinitialize ports.

Output

expand all

Placing a block such as an Outport or Out Bus Element block in a subsystem adds an output port from the Subsystem block.

Use Outport or Out Bus Element blocks to send signals to the local environment.

For more information, see Connect Subsystems.

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

Parameters

expand all

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

Main

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

  • none — Do not display port labels.

  • FromPortIcon — If the corresponding port icon displays a signal name, display the signal name on the Subsystem block. Otherwise, display the port block name or the port number if the block name is a default name.

  • FromPortBlockName — Display the name of the corresponding port block on the Subsystem block.

  • SignalName — If the signal connected to the port is named, display the name of the signal on the Subsystem block. Otherwise, display the name of the corresponding port block.

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'

Control user access to the contents of the subsystem.

  • ReadWrite — Enable opening and modification of subsystem contents.

  • ReadOnly — Enable opening but not modification of the subsystem. If the subsystem resides in a block library, you can create and open links to the subsystem and can make and modify local copies of the subsystem but cannot change the permissions or modify the contents of the original library instance.

  • NoReadOrWrite — Disable opening or modification of subsystem. If the subsystem resides in a library, you can create links to the subsystem in a model but cannot open, modify, change permissions, or create local copies 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.

  • All — Resolve all names of workspace variables used by this subsystem, including those used to specify block parameter values and Simulink data objects (for example, Simulink.Signal objects).

  • ExplicitOnly — Resolve only names of workspace variables used to specify block parameter values, data store memory (where no block exists), signals, and states marked as “must resolve”.

  • None — Do not resolve any workspace variable names.

Programmatic Use

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

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

Causes the software to treat the subsystem as a unit when determining the execution order of block methods.

  • off — Treat all blocks in the subsystem as being at the same level in the model hierarchy as the subsystem when determining block method execution order. This can cause execution of methods of blocks in the subsystem to be interleaved with execution of methods of blocks outside the subsystem.

  • on — Treat the subsystem as a unit when determining the execution order of block methods. For example, when it needs to compute the output of the subsystem, the software invokes the output methods of all the blocks in the subsystem before invoking the output methods of other blocks at the same level as the Subsystem block.

Programmatic Use

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

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

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'

Try to eliminate any artificial algebraic loops that include the atomic subsystem

  • off — Do not try to eliminate any artificial algebraic loops that include the atomic subsystem.

  • on — Try to eliminate any artificial algebraic loops that include the atomic subsystem.

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: MinAlgLoopOccurrences
Values: 'off' (default) | 'on'

Specify how to schedule the subsystem.

  • Sample time — Specify whether all blocks in this subsystem must run at the same rate or can run at different rates.

  • Periodic partition — Schedule the subsystem as a periodic partition. Specify a partition name and a sample time corresponding to the rate at which the partition runs.

  • Aperiodic partition — Schedule the subsystem as an aperiodic partition. Specify a partition name.

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: ScheduleAs
Values: 'Sample time' (default) | 'Periodic partition' | 'Aperiodic partition'

Specify the name of the partition for the subsystem.

Dependencies

To enable this parameter, select Treat as atomic unit and set Schedule as to Periodic partition or Aperiodic partition.

Programmatic Use

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

Parameter: PartitionName
Values: '' (default) | partition name in quotes
Data Types: char | string

Specify whether all blocks in this subsystem must run at the same rate or can run at different rates.

  • -1 — Inherited sample time.

  • [Ts 0] — Periodic sample time.

If the blocks in the subsystem can run at different rates, specify the subsystem sample time as inherited (-1).

If all blocks must run at the same rate, specify the sample time corresponding to this rate as the value of the Sample time parameter.

If any of the blocks in the subsystem specify a different sample time (other than -1 or inf), the software displays an error message when you update or simulate the model. For example, suppose all the blocks in the subsystem must run 5 times a second. To ensure this rate, specify the sample time of the subsystem as 0.2. In this example, if any of the blocks in the subsystem specify a sample time other than 0.2, -1, or inf, the software displays an error when you update or simulate the model.

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: SystemSampleTime
Values: '-1' (default) | '[Ts 0]'

Specify variant control (condition) expression that executes a variant Simulink Function block when the expression evaluates to true.

  • Variant — Default name for a logical (Boolean) expression.

  • Logical expression — A logical (Boolean) expression or a Simulink.VariantExpression object representing a logical expression. The function is activated when the expression evaluates to true. If you want to generate code for your model, define the variables in the expression as Simulink.Parameter objects.

Dependencies

To enable this parameter, add a Subsystem block inside a Variant Subsystem block.

Programmatic Use

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

Parameter: VariantControl
Values: 'Variant' (default) | logical expression in quotes
Data Types: char | string

Specify whether the software treats the subsystem as a unit when propagating variant conditions from Variant Source blocks or to Variant Sink blocks.

  • on — The software treats the subsystem as a unit when propagating variant conditions from Variant Source blocks or to Variant Sink blocks. For example, when the software computes the variant condition of the subsystem, the software propagates that condition to all the blocks in the subsystem.

  • off — The software treats all blocks in the subsystem as being at the same level in the model hierarchy as the subsystem itself when determining their variant condition.

Programmatic Use

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

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

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.

  • Auto — The software chooses the optimal format for you based on the type and number of instances of the subsystem that exist in the model.

  • Inline — The software inlines the subsystem unconditionally.

  • Nonreusable function — If Filename options is set to Auto, the software packages separate functions in the model file. If File name options is set to Use subsystem name, Use function name, or User specified using different filenames, the software packages separate functions in separate files.

    Subsystems with this setting generate functions that might have arguments depending on the Function interface parameter setting. You can name the generated function and file using parameters Function name and File name (no extension), respectively. These functions are not reentrant.

  • Reusable function — The software generates a function with arguments that allows reuse of subsystem code when a model includes multiple instances of the subsystem.

    This option also generates a function with arguments that allows subsystem code to be reused in the generated code of a model reference hierarchy that includes multiple instances of a subsystem across referenced models. In this case, the subsystem must be in a library.

For more information, see:

Tips

  • When you want multiple instances of a subsystem to be represented as one reusable function, you can designate each one of them as Auto or as Reusable function. Using one or the other is best, as using both creates two reusable functions, one for each designation. The outcomes of these choices differ only when reuse is not possible. Selecting Auto does not allow control of the function or filename for the subsystem code.

  • The Reusable function and Auto options both try to determine if multiple instances of a subsystem exist and if the code can be reused. The difference between the behavior of each option is that when reuse is not possible:

    • Auto yields inlined code, or if circumstances prohibit inlining, separate functions for each subsystem instance.

    • Reusable function yields a separate function with arguments for each subsystem instance in the model.

  • If you select Reusable function while your generated code is under source control, set File name options to Use subsystem name, Use function name, or User specified. Otherwise, the names of your code files change whenever you modify your model, which prevents source control on your files.

  • If you select an option other than Auto or Inline and the model configuration parameter States, the code generator produces separate output and update methods. The code generator does not take into account the Combine output and update methods for code generation and simulation specification.

Dependencies

  • This parameter requires a Simulink Coder license for code generation.

  • To enable this parameter, select Treat as atomic unit.

Programmatic Use

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

Parameter: RTWSystemCode
Values: 'Auto' (default) | '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 Code Generation > Identifiers pane.

  • Auto — Assign a unique function name using the default naming convention, model_subsystem(), where model is the name of the model and subsystem is the name of the subsystem, or that of an identical one when code is being reused.

    If you select Reusable function for the Function packaging parameter and a model reference hierarchy contains multiple instances of the reusable subsystem, in order to generate reusable code for the subsystem, Function name options must be set to Auto.

  • Use subsystem name — Use the subsystem name as the function name. By default, the function name uses the naming convention model_subsystem.

    When a subsystem is in a library block and the subsystem parameter Function packaging is set to Reusable function, if you set the Use subsystem name option, the code generator uses the name of the library block for the subsystem function name and filename.

  • User specified — Enable the Function name field. Enter any legal C or C++ function name, which must be unique.

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

Dependencies

  • This parameter requires a Simulink Coder license.

  • To enable this parameter, set Function packaging to Nonreusable function or Reusable function.

Programmatic Use

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

Parameter: RTWFcnNameOpts
Values: 'Auto' (default) | '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

  • This parameter requires a Simulink Coder license.

  • To enable this parameter, set Function name options to User specified.

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.

  • Auto — Depending on the configuration of the subsystem and how many instances are in the model, Auto yields different results.

    • If the code generator does not generate a separate file for the subsystem, the subsystem code is generated within the code module generated from the subsystem parent system. If the subsystem parent is the model itself, the subsystem code is generated within model.c or model.cpp.

    • If you select Reusable function for the Function packaging parameter and your generated code is under source control, consider specifying a File name options value other than Auto. This prevents the generated filename from changing due to unrelated model modifications, which is problematic for using source control to manage configurations.

    • If you select Reusable function for the Function packaging parameter and a model reference hierarchy contains multiple instances of the reusable subsystem, in order to generate reusable code for the subsystem, File name options must be set to Auto.

  • Use subsystem name — The code generator generates a separate file, using the subsystem (or library block) name as the filename.

    When File name options is set to Use subsystem name, the subsystem filename is mangled if the model contains Model blocks, or if a model reference target is being generated for the model. In these situations, the filename for the subsystem consists of the subsystem name prefixed by the model name.

  • Use function name — The code generator uses the function name specified by Function name options as the filename.

  • User specified — This option enables the File name (no extension) text entry field. The code generator uses the name you enter as the filename. Enter any filename, but do not include the .c or .cpp (or any other) extension. This filename need not be unique.

    While a subsystem source filename need not be unique, you must avoid giving nonunique names that result in cyclic dependencies. For example, sys_a.h includes sys_b.h, sys_b.h includes sys_c.h, and sys_c.h includes sys_a.h.

Dependencies

  • This parameter requires a Simulink Coder license.

  • To enable this parameter, set Function packaging to Nonreusable function or Reusable function.

Programmatic Use

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

Parameter: RTWFileNameOpts
Values: 'Auto' (default) | '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, and sys_c.h includes sys_a.h.

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

Dependencies

  • This parameter requires a Simulink Coder license.

  • To enable this parameter, set File name options to User specified.

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.

  • void_void — Generate a function without arguments and pass data as global variables. For example:

    void subsystem_function(void)

  • Allow arguments (Optimized) — Generate a function that uses arguments instead of passing data as global variables. This specification reduces global RAM. This option might reduce code size and improve execution speed and enable the code generator to apply additional optimizations. For example:

    void subsystem_function(real_T rtu_In1, real_T rtu_In2, 
                            real_T *rty_Out1)

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

  • Allow arguments (Match graphical interface) — Generate a function interface that uses arguments that match the Subsystem graphical block interface. The generated function interface is predictable and does not change. A predictable interface can be useful for debugging and testing your code and integrating with external applications. For example, if a model has two Inport blocks and two Outport blocks, then the generated function interface is:

    void subsystem_function(real_T rtu_In1, real_T rtu_In2, 
                            real_T *rty_Out1, real_T *rty_Out2)

For more information, see:

Dependencies

  • This parameter requires an Embedded Coder license and an ERT-based system target file.

  • To enable this parameter, set Function packaging to Nonreusable function.

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.

  • off — Do not 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.

  • on — 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. The subsystem data structure is declared independently from the parent model data structures. A subsystem with separate data has its own block I/O and DWork data structure. As a result, the generated code for the subsystem is easier to trace and test. The data separation also tends to reduce the maximum size of global data structures throughout the model, because they are split into multiple data structures.

For details on how to generate modular function code for an atomic subsystem, see Generate 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

  • This parameter requires an Embedded Coder license and an ERT-based system target file.

  • To enable this parameter, set Function packaging to Nonreusable function.

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.

  • Inherit from model — Apply the root model memory sections to the subsystem function code.

  • Default — Do not apply memory sections to the subsystem system code, overriding any model-level specification.

  • The memory section of interest — Apply one of the model memory sections to the subsystem.

Tips

Dependencies

  • This parameter requires an Embedded Coder license and an ERT-based system target file.

  • To enable this parameter, set Function packaging to Nonreusable function or Reusable function.

Programmatic Use

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

Parameter: RTWMemSecFuncInitTerm
Values: 'Inherit from model' (default) | 'Default' | 'The memory section of interest'

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

  • Inherit from model — Apply the root model memory sections to the subsystem function code.

  • Default — Do not apply memory sections to the subsystem system code, overriding any model-level specification.

  • The memory section of interest — Apply one of the model memory sections to the subsystem.

Tips

Dependencies

  • This parameter requires an Embedded Coder license and an ERT-based system target file.

  • To enable this parameter, set Function packaging to Nonreusable function or Reusable function.

Programmatic Use

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

Parameter: RTWMemSecFuncExecute
Values: 'Inherit from model' (default) | 'Default' | 'The memory section of interest'

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

  • Inherit from model — Apply the root model memory sections to the subsystem data.

  • Default — Do not apply memory sections to the subsystem data, overriding any model-level specification.

  • The memory section of interest — Apply one of the model memory sections to the subsystem.

Tips

  • The memory section that you specify applies to the corresponding global data structures in the generated code. For basic information about the global data structures generated for atomic subsystems, see Standard Data Structures (Simulink Coder).

  • The possible values vary depending on what, if any, package of memory sections you have set for the model configuration. See Control Data and Function Placement in Memory by Inserting Pragmas (Embedded Coder).

  • If you have not configured the model with a package, Inherit from model is the only available value. Otherwise, the list includes Default and all memory sections the model package contains.

  • These options can be useful for overriding the model memory section settings for the given subsystem. For details on how to apply memory sections to atomic subsystems, see Override Default Memory Placement for Subsystem Functions and Data (Embedded Coder).

Dependencies

  • This parameter requires an Embedded Coder license and an ERT-based system target file.

  • To enable this parameter, set Function packaging to Nonreusable function and select the Function with separate data parameter.

Programmatic Use

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

Parameter: RTWMemSecDataConstants
Values: 'Inherit from model' (default) | 'Default' | 'The memory section of interest'

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

  • Inherit from model — Apply the root model memory sections to the subsystem data.

  • Default — Do not apply memory sections to the subsystem data, overriding any model-level specification.

  • The memory section of interest — Apply one of the model memory sections to the subsystem.

Tips

  • The memory section that you specify applies to the corresponding global data structures in the generated code. For basic information about the global data structures generated for atomic subsystems, see Standard Data Structures (Simulink Coder).

  • The possible values vary depending on what, if any, package of memory sections you have set for the model configuration. See Control Data and Function Placement in Memory by Inserting Pragmas (Embedded Coder).

  • If you have not configured the model with a package, Inherit from model is the only available value. Otherwise, the list includes Default and all memory sections the model package contains.

  • These options can be useful for overriding the model memory section settings for the given subsystem. For details on how to apply memory sections to atomic subsystems, see Override Default Memory Placement for Subsystem Functions and Data (Embedded Coder).

Dependencies

  • This parameter requires an Embedded Coder license and an ERT-based system target file.

  • To enable this parameter, set Function packaging to Nonreusable function and select the Function with separate data parameter.

Programmatic Use

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

Parameter: RTWMemSecDataInternal
Values: 'Inherit from model' (default) | 'Default' | 'The memory section of interest'

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

  • Inherit from model — Apply the root model memory sections to the subsystem function code.

  • Default — Dot apply memory sections to the subsystem system code, overriding any model-level specification.

  • The memory section of interest — Apply one of the model memory sections to the subsystem.

Tips

  • The memory section that you specify applies to the corresponding global data structure in the generated code. For basic information about the global data structures generated for atomic subsystems, see Standard Data Structures (Simulink Coder).

  • The possible values vary depending on what, if any, package of memory sections you have set for the model configuration. See Control Data and Function Placement in Memory by Inserting Pragmas (Embedded Coder).

  • If you have not configured the model with a package, Inherit from model is the only available value. Otherwise, the list includes Default and all memory sections the model package contains.

  • These options can be useful for overriding the model memory section settings for the given subsystem. For details on how to apply memory sections to atomic subsystems, see Override Default Memory Placement for Subsystem Functions and Data (Embedded Coder).

Dependencies

  • This parameter requires an Embedded Coder license and an ERT-based system target file.

  • To enable this parameter, set Function packaging to Nonreusable function and select the Function with separate data parameter.

Programmatic Use

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

Parameter: RTWMemSecDataParameters
Values: 'Inherit from model' (default) | 'Default' | 'The memory section of interest'

Subsystem Reference

Specify the subsystem file you want to reference. For information about subsystem references, see Subsystem Reference.

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 an Existing 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.

Alternative Configurations

expand all

The Atomic Subsystem block selects the Treat as atomic unit parameter.

Libraries:
Simulink / Ports & Subsystems
HDL Coder / Ports & Subsystems

Since R2019b

The Subsystem Reference block references a subsystem stored in a subsystem file (.slx). For more information, see Subsystem Reference.

Libraries:
Simulink / Ports & Subsystems

The Enabled Subsystem is a template that contains an Enable block.

Libraries:
Simulink / Ports & Subsystems
HDL Coder / Ports & Subsystems

The Triggered Subsystem is a template that contains a Trigger block with Trigger type set to rising.

Libraries:
Simulink / Ports & Subsystems
HDL Coder / Ports & Subsystems

The Enabled and Triggered Subsystem is a template that contains an Enable block and a Trigger block with Trigger type set to rising.

Libraries:
Simulink / Ports & Subsystems

The Resettable Subsystem is a template that contains a Reset block.

Libraries:
Simulink / Ports & Subsystems

The If Action Subsystem is a template for creating a subsystem whose execution is controlled by an If block. The subsystem contains an Action Port block.

Libraries:
Simulink / Ports & Subsystems

The Switch Case Action Subsystem is a template for creating a subsystem whose execution is controlled by a Switch Case block. The subsystem contains an Action Port block.

Libraries:
Simulink / Ports & Subsystems

The Function-Call Subsystem is a template that contains a Trigger block with Trigger type set to function-call.

Libraries:
Simulink / Ports & Subsystems

The For Iterator Subsystem is a template that contains a For Iterator block.

Libraries:
Simulink / Ports & Subsystems

The While Iterator Subsystem is a template that contains a While Iterator block.

Libraries:
Simulink / Ports & Subsystems

The For Each Subsystem is a template that contains a For Each block.

Libraries:
Simulink / Ports & Subsystems
HDL Coder / Ports & Subsystems

Since R2022a

The Message Polling Subsystem is a template that contains a Trigger block with Trigger type set to message and Trigger time set to on sample time hit. The Trigger block replaces the Inport block.

Libraries:
Simulink / Messages & Events

Since R2022a

The Message Triggered Subsystem is a template that contains a Trigger block with Trigger type set to message and Trigger time set to on message available. The Trigger block replaces the Inport block.

Libraries:
Simulink / Messages & Events

The CodeReuseSubsystem block selects the Treat as atomic unit parameter and sets Function packaging to Reusable function.

Libraries:
Simulink / Ports & Subsystems

Since R2022b

The Neighborhood Processing Subsystem is a template that contains a Neighborhood block.

Libraries:
Simulink / Matrix Operations

Extended Capabilities

Version History

Introduced in R2007a