Quantcast

Documentation Center

  • Trial Software
  • Product Updates

Outport

Create output port for subsystem or external output

Library

Ports & Subsystems, Sinks

Description

Outport blocks are the links from a system to a destination outside the system.

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

  • It automatically numbers the Outport blocks within a top-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 on a Subsystem block 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, although the block continues to send the signal to the same block outside the subsystem.

When you create a subsystem by selecting existing blocks, if more than one Outport block is included in the grouped blocks, Simulink software automatically renumbers the ports on the blocks.

The Outport block name appears in the Subsystem icon as a port label. To suppress display of the label, click the Outport block and select Format > Hide Name.

Initializing Outport Blocks in Conditionally Executed Contexts

To set initial conditions for an Outport block in a conditionally executed subsystem, use one of these approaches.

  • Inherit initial values from input signals for the subsystem.

  • Explicitly specify initial values

For details, see Specify or Inherit Conditional Subsystem Initial Values.

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

Root-level Outport Block in a Model Hierarchy

Outport blocks at the root-level of a model hierarchy have two uses: to supply external outputs to the base MATLAB® workspace, which you can do by using either the Model Configuration Parameters dialog box or the sim command, and to provide a means for analysis functions to obtain output from the system.

  • To supply external outputs to the workspace, use the Configuration Parameters dialog box (see Exporting Output Data to the MATLAB Workspace) or the sim command (see sim). 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, you could specify this command:

    [t,x,speed,dist] = sim(...);
  • To provide a means for the linmod and trim analysis functions to obtain output from the system (see Linearizing Models)

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, you must set the Outport block Data type parameter to use a bus object name for the Bus: <object name> or <data type expression> option, to define the type of bus that the Outport produces. If the bus signal is virtual, it will be converted to nonvirtual, as described in Automatic Bus Conversion. See Bus Objects more information.

Data Type Support

The Outport block accepts real or complex signals of any data type that Simulink supports. An Outport block can also 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 those of its input. The Outport block also accepts a bus object as a data type.

    Note:   If you specify a bus object as the data type for this block, do not set the minimum and maximum values for bus data on the block. Simulink ignores these settings. Instead, set the minimum and maximum values for bus elements of the bus object specified as the data type. The values should be finite real double scalar.

    For information on the Minimum and Maximum properties of a bus element, see Simulink.BusElement.

For more information, see Data Types Supported by Simulink.

The elements of a signal array connected to an Outport block can be of differing complexity and data types except in the following circumstance: If the output port is in a conditionally executed subsystem and the initial output is specified, all elements of an input array must be of the same complexity and data types.

Typical Simulink data type conversion rules apply to an output port's Initial output parameter. If the initial output value is in the range of the block's output data type, Simulink software converts the initial output to the output data type. If the specified initial output is out of the range of the output data type, Simulink software halts the simulation and signals an error.

Parameters and Dialog Box

The Main pane of the Outport block dialog, when present in a conditionally executed subsystem, box appears as follows:

Port number

Specify the port number of the block.

Settings

Default: 1

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

Command-Line Information

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

Icon display

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

Settings

Default: Port number

Signal name

Display the name of the signal connected to this port (or signals if the input is a bus).

Port number

Display port number of this port.

Port number and signal name

Display both the port number and the names of the signals connected to this port.

Command-Line Information

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

Source of initial output value

Select the source of the initial output value of the block.

Settings

Default: Dialog

Dialog

The initial output value is specified by the Initial output parameter on the dialog.

Input signal

The initial output value is inherited from the input signal. See Setting Initial Conditions for an Enabled Subsystem.

Tips

  • If you are using classic initialization mode, selecting Input signal will cause 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 Specify or Inherit Conditional Subsystem Initial Values.

Dependencies

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

Selecting Dialog enables the following parameters:

  • Output when disabled

  • Initial output

Command-Line Information

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

Output when disabled

Specify what happens to the block output when the subsystem is disabled.

Settings

Default: held

held

Output is held when the subsystem is disabled.

reset

Output is reset to the value given by Initial output when the subsystem is disabled.

Tips

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

Dependencies

  • Selecting Dialog in Source of initial output value enables this parameter.

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

Command-Line Information

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

Initial output

For conditionally executed subsystems, specify the block output before the subsystem executes and while it is disabled.

Settings

Default: [ ]

Simulink software does not allow the initial output of this block to be inf or NaN.

Tips

Dependencies

  • Selecting Dialog in Source of initial output value enables this parameter.

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

Command-Line Information

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

Minimum

Specify the minimum value that the block should output.

Settings

Default: [] (unspecified)

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

Command-Line Information

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

Maximum

Specify the maximum value that the block should output.

Settings

Default: [] (unspecified)

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

Command-Line Information

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

Data type

Specify the output data type of the external input.

Settings

Default: Inherit: auto

Inherit: auto

A rule that inherits a data type

double

Data type is double.

single

Data type is single.

int8

Data type is int8.

uint8

Data type is uint8.

int16

Data type is int16.

uint16

Data type is uint16.

int32

Data type is int32.

uint32

Data type is uint32.

boolean

Data type is boolean.

fixdt(1,16,0)

Data type is fixed point fixdt(1,16,0).

fixdt(1,16,2^0,0)

Data type is fixed point fixdt(1,16,2^0,0).

Enum: <class name>

Data type is enumerated, for example, Enum: BasicColors.

Bus: <object name>

Data type is a bus object.

<data type expression>

The name of a data type object, for example Simulink.NumericType

Do not specify a bus object as the expression.

Command-Line Information

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

Show data type assistant

Display the Data Type Assistant.

Settings

The Data Type Assistant helps you set the Output data type parameter.

For more information, see Specify Block Output Data Types.

Mode

Select the category of data to specify.

Settings

Default: Inherit

Inherit

Inheritance rule for data types. Selecting Inherit enables a second menu/text box to the right.

Built in

Built-in data types. Selecting Built in enables a second menu/text box to the right. Select one of the following choices:

  • double (default)

  • single

  • int8

  • uint8

  • int16

  • uint16

  • int32

  • uint32

  • boolean

Fixed point

Fixed-point data types.

Enumerated

Enumerated data types. Selecting Enumerated enables a second menu/text box to the right, where you can enter the class name.

Bus

Bus object. Selecting Bus enables a Bus object parameter to the right, where you enter the name of a bus object that you want to use to define the structure of the bus. If you need to create or change a bus object, click Edit to the right of the Bus object field to open the Simulink Bus Editor. For details about the Bus Editor, see Manage Bus Objects with the Bus Editor.

Expression

Expressions that evaluate to data types. Selecting Expression enables a second menu/text box to the right, where you can enter the expression.

Do not specify a bus object as the expression.

Dependency

Clicking the Show data type assistant button enables this parameter.

Command-Line Information

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

See Also

See Specify Data Types Using Data Type Assistant.

Data type override

Specify data type override mode for this signal.

Settings

Default: Inherit

Inherit

Inherits the data type override setting from its context, that is, from the block, Simulink.Signal object or Stateflow® chart in Simulink that is using the signal.

Off

Ignores the data type override setting of its context and uses the fixed-point data type specified for the signal.

Tip

The ability to turn off data type override for an individual data type provides greater control over the data types in your model when you apply data type override. For example, you can use this option to ensure that data types meet the requirements of downstream blocks regardless of the data type override setting.

Dependency

This parameter appears only when the Mode is Built in or Fixed point.

Signedness

Specify whether you want the fixed-point data as signed or unsigned.

Settings

Default: Signed

Signed

Specify the fixed-point data as signed.

Unsigned

Specify the fixed-point data as unsigned.

Dependencies

Selecting Mode > Fixed point enables this parameter.

See Also

For more information, see Specifying a Fixed-Point Data Type.

Word length

Specify the bit size of the word that holds the quantized integer.

Settings

Default: 16

Minimum: 0

Maximum: 32

Dependencies

Selecting Mode > Fixed point enables this parameter.

See Also

For more information, see Specifying a Fixed-Point Data Type.

Scaling

Specify the method for scaling your fixed-point data to avoid overflow conditions and minimize quantization errors.

Settings

Default: Best precision

Binary point

Specify binary point location.

Slope and bias

Enter slope and bias.

Best precision

Specify best-precision values.

Dependencies

Selecting Mode > Fixed point enables this parameter.

Selecting Binary point enables:

  • Fraction length

  • Calculate Best-Precision Scaling

Selecting Slope and bias enables:

  • Slope

  • Bias

  • Calculate Best-Precision Scaling

See Also

For more information, see Specifying a Fixed-Point Data Type.

Fraction length

Specify fraction length for fixed-point data type.

Settings

Default: 0

Binary points can be positive or negative integers.

Dependencies

Selecting Scaling > Binary point enables this parameter.

See Also

For more information, see Specifying a Fixed-Point Data Type.

Slope

Specify slope for the fixed-point data type.

Settings

Default: 2^0

Specify any positive real number.

Dependencies

Selecting Scaling > Slope and bias enables this parameter.

See Also

For more information, see Specifying a Fixed-Point Data Type.

Bias

Specify bias for the fixed-point data type.

Settings

Default: 0

Specify any real number.

Dependencies

Selecting Scaling > Slope and bias enables this parameter.

See Also

For more information, see Specifying a Fixed-Point Data Type.

Lock output data type setting against changes by the fixed-point tools

Select to lock the output data type setting of this block against changes by the Fixed-Point Tool and the Fixed-Point Advisor.

Settings

Default: Off

On

Locks the output data type setting for this block.

Off

Allows the Fixed-Point Tool and the Fixed-Point Advisor to change the output data type setting for this block.

Command-Line Information

Parameter: LockScale
Type: string
Value: 'off' | 'on'
Default: 'off'

See Also

For more information, see Use Lock Output Data Type Setting.

Output as nonvirtual bus in 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.

Settings

Default: Off

On

Select this parameter if you want the bus emerging in the parent model to be nonvirtual.

Off

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

Tips

All signals in a nonvirtual bus 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. Therefore, if you select this option all signals in the bus must have the same sample time. You can use a Rate Transition block to change the sample time of an individual signal, or of all signals in a bus, to allow the signal or bus to be included in a nonvirtual bus.

Dependency

via bus object enables this parameter.

Command-Line Information

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

Port dimensions (-1 for inherited)

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

Settings

Default: -1

Valid values are:

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

Dependency

Clearing via bus object enables this parameter.

Command-Line Information

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

Variable-size signal

Specify the type of signals allowed out of this port.

Settings

Default: Inherit

Inherit

Allow variable-size and fixed-size signals.

No

Do not allow variable-size signals.

Yes

Allow only variable-size signals.

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: string
Value: 'Inherit'| 'No' | 'Yes'
Default: 'Inherit'

Sample time (-1 for inherited)

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

Settings

Default: -1

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.

See also Specify Sample Time in the online documentation for more information.

Command-Line Information

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

Signal type

Specify the numeric type of the signal output by this block.

Settings

Default: auto

auto

Output the numeric type of the signal that is connected to its input.

real

Output a real-valued signal. The signal connected to this block must be real. If it is not, Simulink software displays an error if you try to update the diagram or simulate the model that contains this block.

complex

Output a complex signal. The signal connected to this block must be complex. If it is not, Simulink software displays an error if you try to update the diagram or simulate the model that contains this block.

Command-Line Information

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

Sampling mode

Specify the sampling mode (Sample based or Frame based) that the input signal must match.

Settings

Default: auto

auto

Accept any sampling mode.

Sample based

The output signal is sample-based.

Frame based

The output signal is frame-based.

Dependency

Frame-based processing requires a DSP System Toolbox™ license.

For more information, see Sample- and Frame-Based Concepts in the DSP System Toolbox documentation.

Command-Line Information

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

Characteristics

Sample Time

Inherited from the driving block

Dimensionalized

Yes

Multidimensionalized

Yes

Virtual

Yes, when the block resides in a subsystem block and not at the root level of a model

For more information, see Virtual Blocks in the Simulink documentation.

Zero-Crossing Detection

No

See Also

Inport

Was this topic helpful?