This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Outport

Create output port for subsystem or external output

  • Library:
  • Simulink / Commonly Used Blocks

    Simulink / Ports & Subsystems

    Simulink / Sinks

Description

Outport blocks link signals from a system to a destination outside of the system. They can connect signals flowing from a subsystem to other parts of the model. They can also supply external outputs at the top level of a model hierarchy.

Simulink® software assigns Outport block port numbers according to these rules:

  • It automatically numbers the Outport blocks within a root-level system or subsystem sequentially, starting with 1.

  • If you add an Outport block, it is assigned the next available number.

  • If you delete an Outport block, other port numbers are automatically renumbered to ensure that the Outport blocks are in sequence and that no numbers are omitted.

Outport Blocks in a Subsystem

Outport blocks in a subsystem represent outputs from the subsystem. A signal arriving at an Outport block in a subsystem flows out of the associated output port on that Subsystem block. The Outport block associated with an output port is the block whose Port number parameter matches the relative position of the output port on the Subsystem block. For example, the Outport block whose Port number parameter is 1 sends its signal to the block connected to the topmost output port on the Subsystem block.

If you renumber the Port number of an Outport block, the block becomes connected to a different output port. The block continues to send the signal to the same block outside the subsystem.

Tip

For models that include bus signals composed of many bus elements that feed subsystems, consider using the In Bus Element and Out Bus Element blocks. These bus element port blocks:

  • Reduce signal line complexity and clutter in a block diagram.

  • Make it easier to change the interface incrementally.

  • Allow access to a bus element closer to the point of usage, avoiding the use of a Bus Selector and Goto block configuration.

The Out Bus Element block is of block type Outport. However, there are no specifications allowed on bus element port blocks, which support inherited workflows. You cannot use the Block Parameters dialog box of an Out Bus Element block to specify bus element attributes, such as data type or dimensions.

Top-Level Outport Block in a Model Hierarchy

Outport blocks at the top level of a model hierarchy have two uses. They can supply external outputs to the base MATLAB® workspace, and they provide a means for the linmod and trim analysis functions to obtain output from the system.

To supply external outputs to the workspace, use the Configuration Parameters > Data Import/Export pane (see Exporting Output Data to the MATLAB Workspace) or the sim command. For example, if a system has more than one Outport block and the save format is array, the following command

[t,x,y] = sim(...);

writes y as a matrix, with each column containing data for a different Outport block. The column order matches the order of the port numbers for the Outport blocks.

If you specify more than one variable name after the second (state) argument, data from each Outport block is written to a different variable. For example, if the system has two Outport blocks, to save data from Outport block 1 to speed and the data from Outport block 2 to dist, specify this command:

[t,x,speed,dist] = sim(...);

Connecting Buses to Root-Level Outports

A root-level Outport of a model can accept a virtual bus only if all elements of the bus have the same data type. The Outport block automatically unifies the bus to a vector having the same number of elements as the bus, and outputs that vector.

If you want a root-level Outport of a model to accept a bus signal that contains mixed types, set Outport block Data type to Bus: <object name> . If the bus signal is virtual, it is converted to nonvirtual, as described in Bus Conversion.

Associate Root-Level Outport Block with Simulink.Signal Object

To associate a root-level Outport block with a Simulink.Signal object, use the Model Data Editor. See For Signals.

Ports

Input

expand all

Input signal that flows through the outport to an external subsystem or model.

An Outport block can accept fixed-point and enumerated data types when the block is not a root-level output port. The complexity and data type of the block output are the same as its input.

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

Parameters

expand all

Main

Specify the port number of the block. This parameter controls the order in which the port that corresponds to the block appears on the parent subsystem or model block.

Programmatic Use

Block Parameter: Port
Type: character vector
Values: real integer
Default: '1'

Specify the name of the corresponding signal data in the generated code. Use this parameter to specify a name for the signal data when you apply a storage class to a root-level Outport block.

Programmatic Use

Block Parameter: SignalName
Type: character vector
Values: character vector
Default: ' '

Specify the information to be displayed on the icon of this port.

Programmatic Use

Block Parameter: IconDisplay
Type: character vector
Values: 'Signal name' | 'Port number' | 'Port number and signal name'
Default: 'Port number'

Specify a constant output value to be displayed when source is not connected.

Dependency

Enabled when a non-driven Outport block is in a Variant Subsystem block.

Programmatic Use

Block Parameter: OutputWhenUnconnected
Type: character vector
Values: 'on' | 'off'
Default: 'off'

Specify a constant output value to be displayed when source is not connected.

Dependency

Enabled in a Variant Subsystem block on a non-driven Output block.

Programmatic Use

Block Parameter: OutputWhenUnconnectedValue
Type: character vector
Values: | real integer
Default: '1

Select this check box to output a vector of length N if the Constant value parameter evaluates to an N-element row or column vector.

Dependency

Enabled in a Variant Subsystem block on a non-driven Output block when you select the Specify output when source is unconnected parameter.

Programmatic Use

Block Parameter: VectorParams1DForOutWhenUnconnected
Type: character vector
Values: 'on' | 'off'
Default: 'off'

Clear this check box to specify that Simulinkuses a signal buffer on output port. This buffer ensures consistent initialization of the Outport block signal.

If you select this check box, Simulink tries to remove the signal buffer.

  • If the signal buffer is not needed, Simulink removes the buffer.

  • If the signal buffer is needed for data consistency and proper execution, Simulink displays an error indicating the buffer could not be removed.

Allow partial writes through Assignment blocks.

For examples with conditional writes and partial writes, see Ensure Outport is Virtual.

Dependencies

This parameter applies to these blocks:

  • Conditional subsystem

  • Assignment

  • Merge

  • Model with root Outport block

Select the source of the initial output value of the block. Select Dialog to specify that the initial output value is the value of the Initial output parameter. Select Input signal to specify that the initial output value is inherited from the input signal. See Conditional Subsystem Initial Output Values.

Tips

  • If you are using classic initialization mode, selecting Input signal causes an error. To inherit the initial output value from the input signal, set this parameter to Dialog and specify [] (empty matrix) for the Initial output value. For more information, see Conditional Subsystem Initial Output Values.

Dependencies

This parameter is enabled when the Outport resides in a Conditional Subsystem.

Selecting Dialog enables the following parameters:

  • Output when disabled

  • Initial output

Programmatic Use

Block Parameter: SourceOfInitialOutputValue
Type: character vector
Values: 'Dialog' | 'Input signal'
Default: 'Dialog'

Specify what happens to the block output when the subsystem is disabled. Select held to indicate that the output is held when the subsystem is disabled. Select reset to indicate that the output is reset to the value given by Initial output when the subsystem is disabled.

Dependencies

To enable this parameter, select Dialog in Source of initial output value when the outport resides in a conditional sybsystem with valid enabling and disabling semantics.For example, this parameter is disabled when the Outport is placed inside a Triggered Subsystem but is enabled when the Outport is placed inside an Enabled Subsystem.

If an Outport is placed inside a function-call subsystem, this parameter is meaningful only if the function-call subsystem is bound to a state in a Stateflow chart. For more information, see Bind a Function-Call Subsystem to a State (Stateflow).

When connecting the output of a conditional subsystem to a Merge block, set this parameter to held. Setting it to reset returns an error.

Programmatic Use

Block Parameter: OutputWhenDisabled
Type: character vector
Values: 'held' | 'reset'
Default: 'held'

For conditionally executed subsystems, specify the block output before the subsystem executes and while it is disabled. Specify [] (empty matrix) to inherit the initial output value from the input signal. For more information, see Conditional Subsystem Initial Output Values.

For information about specifying an initial condition structure, see Specify Initial Conditions for Bus Signals.

Tips

If the conditional subsystem is driving a Merge block, you do not need to specify an Initial Condition (IC) for the Outport block. For more information, see Underspecified initialization detection.

Dependencies

To enable this parameter, set Source of initial output value to Dialog when this block resides in a conditionally executed subsystem.

Limitations

  • This block does not allow an initial output of inf or NaN.

  • When the input is a virtual bus, an Initial output value [] is treated as double(0).

  • When the input contains a nonvirtual bus, Initial output does not support nonzero scalar values.

Programmatic Use

Block Parameter: InitialOutput
Type: character vector
Values: '[]' | scalar
Default: '[]'

Signal Attributes

Click the Show data type assistant button to display the Data Type Assistant, which helps you set the data type attributes. For more information, see Specify Data Types Using Data Type Assistant.

Lower value of the output range that Simulink checks.

This number must be a finite real double scalar value.

Note

If you specify a bus object as the data type for this block, do not set the minimum value for bus data on the block. Simulink ignores this setting. Instead, set the minimum values for bus elements of the bus object specified as the data type. For information on the Minimum property of a bus element, see Simulink.BusElement.

Simulink software uses this value to perform:

  • Simulation range checking (see Signal Ranges).

  • Automatic scaling of fixed-point data types.

  • Optimization of the code that you generate from the model. This optimization can remove algorithmic code and affect the results of some simulation modes such as SIL or external mode. For more information, see Optimize using the specified minimum and maximum values (Simulink Coder).

Programmatic Use

Block Parameter: OutMin
Type: character vector
Values: '[ ]'| scalar
Default: '[ ]'

Upper value of the output range that Simulink checks.

This number must be a finite real double scalar value.

Note

If you specify a bus object as the data type for this block, do not set the maximum value for bus data on the block. Simulink ignores this setting. Instead, set the maximum values for bus elements of the bus object specified as the data type. For information on the Maximum property of a bus element, see Simulink.BusElement.

Simulink software uses this value to perform:

  • Simulation range checking (see Signal Ranges).

  • Automatic scaling of fixed-point data types.

  • Optimization of the code that you generate from the model. This optimization can remove algorithmic code and affect the results of some simulation modes such as SIL or external mode. For more information, see Optimize using the specified minimum and maximum values (Simulink Coder).

Programmatic Use

Block Parameter: OutMax
Type: character vector
Values: '[ ]'| scalar
Default: '[ ]'

Specify the output data type of the external input. The type can be inherited, specified directly, or expressed as a data type object such as Simulink.NumericType. Do not specify a bus object as the expression.

Select to lock the output data type setting of this block against changes by the Fixed-Point Tool and the Fixed-Point Advisor. For more information, see Use Lock Output Data Type Setting (Fixed-Point Designer).

Programmatic Use

Block Parameter: LockScale
Type: character vector
Values: 'off' | 'on'
Default: 'off'

Specify the outport bus to be nonvirtual in the parent model. Select this parameter if you want the bus emerging in the parent model to be nonvirtual. The bus that is input to the port can be virtual or nonvirtual, regardless of the setting of Output as nonvirtual bus in parent model.

Clear this parameter if you want the bus emerging in the parent model to be virtual.

Tips

  • In a nonvirtual bus, all signals must have the same sample time, even if the elements of the associated bus object specify inherited sample times. Any bus operation that would result in a nonvirtual bus that violates this requirement generates an error. For details, see Connect Multirate Buses to Referenced Models.

  • For a virtual bus, to use a multirate signal, in the root-level Outport block, set the Sample time parameter to inherited (-1).

  • For the top model in a model reference hierarchy, code generation creates a C structure to represent the bus signal output by this block.

  • For referenced models, select this option to create a C structure. Otherwise, code generation creates an argument for each leaf element of the bus.

Dependency

To enable this parameter, select Data type > Bus: <object name>.

Programmatic Use

Block Parameter: BusOutputAsStruct
Type: character vector
Values: 'off' | 'on'
Default: 'off'

Specify the physical unit of the input signal to the block. To specify a unit, begin typing in the text box. As you type, the parameter displays potential matching units. For a list of supported units, see Allowed Unit Systems.

To constrain the unit system, click the link to the right of the parameter:

  • If a Unit System Configuration block exists in the component, its dialog box opens. Use that dialog box to specify allowed and disallowed unit systems for the component.

  • If a Unit System Configuration block does not exist in the component, the model Configuration Parameters dialog box displays. Use that dialog box to specify allowed and disallowed unit systems for the model.

Programmatic Use

Block Parameter: Unit
Type: character vector
Values: 'inherit' | '<Enter unit>'
Default: 'inherit'

Specify the dimensions that a signal must have to be connected to this Outport block.

-1

A signal of any dimensions can be connected to this port.

N

The signal connected to this port must be a vector of size N.

[R C]

The signal connected to this port must be a matrix having R rows and C columns.

Programmatic Use

Block Parameter: PortDimensions
Type: character vector
Values: '-1' | integer | [integer, integer]
Default: '-1'

Specify the type of signals allowed out of this port. To allow variable-size and fixed-size signals, select Inherit. To allow only variable-size signals, select Yes. Not to allow variable-size signals, select No.

Dependencies

When the signal at this port is a variable-size signal, the Port dimensions parameter specifies the maximum dimensions of the signal.

Command-Line Information

Parameter: VarSizeSig
Type: character vector
Value: 'Inherit '| 'No' | 'Yes'
Default: 'Inherit'

Specify the discrete interval between sample time hits or specify another appropriate sample time such as continuous or inherited.

By default, the block inherits its sample time based upon the context of the block within the model. To set a different sample time, enter a valid sample time based upon the table in Types of Sample Time.

Programmatic Use

Block Parameter: SampleTime
Type: character vector
Values: scalar
Default: '-1'

Specify the numeric type of the signal output. To choose the numeric type of the signal that is connected to its input, select auto. Otherwise, choose a real or complex signal type.

Programmatic Use

Block Parameter: SignalType
Type: character vector
Values: 'auto' | 'real' | 'complex'
Default: 'auto'

Block Characteristics

Data Types

double | single | Boolean | base integer | fixed point | enumerated | bus | string

Direct Feedthrough

No

Multidimensional Signals

Yes

Variable-Size Signals

Yes

Zero-Crossing Detection

No

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.

PLC Code Generation
Generate Structured Text code using Simulink® PLC Coder™.

Fixed-Point Conversion
Convert floating-point algorithms to fixed point using Fixed-Point Designer™.

Introduced before R2006a