Products & Services Industries Academia Support User Community Company

Learn more about Simulink   

Subsystem, Atomic Subsystem, Nonvirtual Subsystem, CodeReuse Subsystem - Represent system within another system

Library

Ports & Subsystems

Description

A Subsystem block represents a subsystem of the system that contains it. The Subsystem block can represent a virtual subsystem or a nonvirtual subsystem. The primary difference is that nonvirtual subsystems provide the ability to control when the contents of the subsystem are evaluated. Nonvirtual subsystems are executed as a single unit (atomic execution) by the Simulink engine. A subsystem is virtual unless the block is conditionally executed and/or you have selected the block Treat as atomic unit check box.

An Atomic Subsystem block is a Subsystem block that has its Treat as atomic unit parameter selected by default. You can create conditionally executed nonvirtual subsystems that are executed only when a transition occurs on a triggering, function-call, action, or enabling input (see Creating Conditional Subsystems).

You can create a subsystem in these ways:

The number of input ports drawn on the Subsystem block's icon corresponds to the number of Inport blocks in the subsystem. Similarly, the number of output ports drawn on the block corresponds to the number of Outport blocks in the subsystem.

See Creating Subsystems in the Simulink User's Guide for more information about subsystems.

Data Type Support

See Inport for information on the data types accepted by a subsystem's input ports. See Outport for information on the data types output by a subsystem's output ports.

Parameters and Dialog Box

Show port labels

Cause Simulink software to display labels for the subsystem's ports on the subsystem's icon.

Settings

Default: FromPortIcon

none

Does not display port labels on the subsystem block.

FromPortIcon

If the corresponding port icon displays a signal name, display the signal name on the subsystem block. Otherwise, display the port block's name.

FromPortBlockName

Display the name of the corresponding port block on the subsystem block.

SignalName

If a name exists, display the name of the signal connected to the port on the subsystem block; otherwise, the name of the corresponding port block.

Command-Line Information

See Block-Specific Parameters for the command-line information.

Read/Write permissions

Control user access to the contents of the subsystem.

Settings

Default: ReadWrite

ReadWrite

Enables opening and modification of subsystem contents.

ReadOnly

Enables 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

Disables 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.

Command-Line Information

See Block-Specific Parameters for the command-line information.

Name of error callback function

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

Settings

Default: ' '

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

Command-Line Information

See Block-Specific Parameters for the command-line information.

Permit hierarchical resolution

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

Settings

Default: All

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.

Command-Line Information

See Block-Specific Parameters for the command-line information.

Treat as atomic unit

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

Settings

Default: Off

On

Cause Simulink software to 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, Simulink 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.

Off

Cause Simulink software to 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.

Dependencies

This parameter enables:

Command-Line Information

See Block-Specific Parameters for the command-line information.

Minimize algebraic loop occurrences

Try to eliminate any algebraic loops that include the subsystem.

Settings

Default: Off

On

Try to eliminate any algebraic loops that include the subsystem.

Off

Does not try to eliminate any algebraic loops that include the subsystem.

Dependency

Treat as atomic unit enables this parameter.

Command-Line Information

See Block-Specific Parameters for the command-line information.

Propagate execution context across subsystem boundary

Enable execution context propagation across the boundary of this subsystem.

Settings

Default: Off

On

Enables execution context propagation across this subsystem's boundary.

Off

Does not enable execution context propagation across this subsystem's boundary.

Dependency

Conditional execution of the subsystem enables this parameter.

Command-Line Information

See Block-Specific Parameters for the command-line information.

Warn if function-call inputs are context-specific

Simulink software displays a warning if it has to compute any of this function-call subsystem's inputs directly or indirectly during execution of a function-call.

Settings

Default: Off

On

Simulink software displays a warning if it has to compute any of this function-call subsystem's inputs directly or indirectly during execution of a function-call.

Off

Simulink software does not display a warning if it has to compute any of this function-call subsystem's inputs directly or indirectly during execution of a function-call.

Dependency

Use of a function-call subsystem enables this parameter.

The option is effective only if the Context-dependent inputs diagnostic on the Configuration Parameters > Connectivity dialog box is set to Use local settings.

Command-Line Information

See Block-Specific Parameters for the command-line information.

Sample time (-1 for inherited)

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

Settings

Default: -1

Tips

Dependencies

Treat as atomic unit enables this parameter.

Command-Line Information

See Block-Specific Parameters for the command-line information.

Real-Time Workshop system code

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

Settings

Default: Auto

Auto

Real-Time Workshop software chooses the optimal format for you based on the type and number of instances of the subsystem that exist in the model.

Inline

Real-Time Workshop software inlines the subsystem unconditionally.

Function

Real-Time Workshop software generates a separate, non-reentrant function with no arguments, and optionally place the subsystem code in a separate file.

Reusable function

Real-Time Workshop software generates a function with arguments that allows the subsystem's code to be shared by other instances of it in the model.

Tip

If you select Reusable function while your generated code is under source control, set Real-Time Workshop 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.

Dependencies

Command-Line Information

See Block-Specific Parameters for the command-line information.

Real-Time Workshop function name options

Specify how Real-Time Workshop software is to name the function it generates for the subsystem.

Settings

Default: Auto

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).

Use subsystem name

Use the subsystem name as the function name.

User specified

Assign a unique, valid C or C++ function name that you specify.

Tip

If you specify Use subsystem name and the subsystem is a library block, Real-Time Workshop software names the function (and filename) with the name of the library block, regardless of the names used for that subsystem in the model.

Dependencies

Command-Line Information

See Block-Specific Parameters for the command-line information.

Real-Time Workshop function name

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

Settings

Default: ' '

Use this parameter if you want to give the function a specific name instead of allowing the Real-Time Workshop code generator to assign its own autogenerated name or use the subsystem name.

Dependencies

Setting Real-Time Workshop function name options to User specified enables this parameter.

Command-Line Information

See Block-Specific Parameters for the command-line information.

Real-Time Workshop file name options

Specify how Real-Time Workshop software is to name the separate file for the function it generates for the subsystem.

Settings

Default: Auto

Auto

Generate the function code within the module generated from the subsystem's parent system, or, if the subsystem's parent is the model itself, within the file model.c or model.cpp

Use subsystem name

Generate a separate file and name it with the name of the subsystem or library block

Use function name

Generate a separate file and name it with the function name you specify for Real-Time Workshop function name options

User specified

Assign a unique, valid C or C++ function name that you specify

Tip

If you specify 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.

Dependencies

Command-Line Information

See Block-Specific Parameters for the command-line information.

Real-Time Workshop file name (no extension)

Specify how Real-Time Workshop software is to name the file for the function it generates for the subsystem.

Settings

Default: ' '

Dependencies

Command-Line Information

See Block-Specific Parameters for the command-line information.

Function with separate data

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.

Settings

Default: Off

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. As a result, the generated code for the atomic subsystem is easier to trace and test. The data separation also tends to reduce the size of data structures throughout the model.

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.

Dependencies

Command-Line Information

See Block-Specific Parameters for the command-line information.

Memory section for initialize/terminate functions

Indicate how the Real-Time Workshop Embedded Coder software is to apply memory sections to the subsystem's initialization and termination functions.

Settings

Default: Inherit from model

Inherit from model

Apply the root model's memory sections to the subsystem's function code

Default

Not apply memory sections to the subsystem's system code, overriding any model-level specification

The memory section of interest

Apply one of the model's memory sections to the subsystem

Tips

Dependencies

Command-Line Information

See Block-Specific Parameters for the command-line information.

Memory section for execution functions

Indicate how the Real-Time Workshop Embedded Coder software is to apply memory sections to the subsystem's execution functions.

Settings

Default: Inherit from model

Inherit from model

Apply the root model's memory sections to the subsystem's function code

Default

Not apply memory sections to the subsystem's system code, overriding any model-level specification

The memory section of interest

Apply one of the model's memory sections to the subsystem

Tips

Dependencies

Command-Line Information

See Block-Specific Parameters for the command-line information.

Memory section for constants

Indicate how the Real-Time Workshop Embedded Coder software is to apply memory sections to the subsystem's data.

Settings

Default: Inherit from model

Inherit from model

Apply the root model's memory sections to the subsystem's data

Default

Not apply memory sections to the subsystem's data, overriding any model-level specification

The memory section of interest

Apply one of the model's memory sections to the subsystem

Tips

Dependencies

Command-Line Information

See Block-Specific Parameters for the command-line information.

Memory section for internal data

Indicate how the Real-Time Workshop Embedded Coder software is to apply memory sections to the subsystem's data.

Settings

Default: Inherit from model

Inherit from model

Apply the root model's memory sections to the subsystem's data

Default

Not apply memory sections to the subsystem's data, overriding any model-level specification

The memory section of interest

Apply one of the model's memory sections to the subsystem

Tips

Dependencies

Command-Line Information

See Block-Specific Parameters for the command-line information.

Memory section for parameters

Indicate how the Real-Time Workshop Embedded Coder software is to apply memory sections to the subsystem's data.

Settings

Default: Inherit from model

Inherit from model

Apply the root model's memory sections to the subsystem's function code

Default

Not apply memory sections to the subsystem's system code, overriding any model-level specification

The memory section of interest

Apply one of the model's memory sections to the subsystem

Tips

Dependencies

Command-Line Information

See Block-Specific Parameters for the command-line information.

Characteristics

Sample Time

Depends on the blocks in the subsystem

Dimensionalized

Depends on the blocks in the subsystem

Multidimensionalized

Depends on the blocks in the subsystem

Virtual

Yes, if the read-only property IsSubsystemVirtual is on

Zero Crossing

Yes, for enable and trigger ports if present

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS