Inport

Create input port for subsystem or external input

  • Library:
  • Simulink / Commonly Used Blocks

    Simulink / Ports & Subsystems

    Simulink / Sources

    HDL Coder / Commonly Used Blocks

    HDL Coder / Ports & Subsystems

    HDL Coder / Sources

Description

Inport blocks link signals from outside a system into the system.

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

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

  • If you add an Inport block, the label is the next available number.

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

  • If you copy an Inport block into a system, its port number is not renumbered unless its current number conflicts with an inport already in the system. If the copied Inport block port number is not in sequence, renumber the block. Otherwise, you get an error message when you run the simulation or update the block diagram.

Inport Blocks in a Top-Level System

You can use an Inport block in a top-level system to:

  • Supply external inputs from the workspace using one of these approaches. If no external outputs are supplied, then the default output is the ground value.

  • Provide a means for perturbation of the model by the linmod and trim analysis functions.

  • To load logged signal data using root Inport blocks, use the createInputDataset function to create a Dataset object that contains elements corresponding to root-level Inport blocks.

Inport Blocks in a Subsystem

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

If you renumber the Port number of an Inport block, the block becomes connected to a different input port. The block continues to receive its signal from the same block outside the subsystem.

Inport blocks inside a subsystem support signal label propagation, but root-level Inport blocks do not.

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.

Creating Duplicate Inports

You can create any number of duplicates of an Inport block. The duplicates are graphical representations of the original intended to simplify block diagrams by eliminating unnecessary lines. The duplicate has the same port number, properties, and output as the original.

To create a duplicate of an Inport block:

  1. In the block diagram, select the block that you want to duplicate.

  2. In the Model Editor menu bar, select Edit > Copy.

  3. In the block diagram, place your cursor where you want to place the duplicate.

  4. Select Edit > Paste Duplicate Inport.

Connecting Buses to Root-Level Inports

If you want a root-level Inport of a model to produce a bus signal, set the Data type parameter to the name of a bus object that defines the bus that the Inport produces. For more information, see When to Use Bus Objects.

Ports

Output

expand all

Input signal that flows through the inport into the system.

You can use a subsystem inport to supply fixed-point data in a structure or any other format.

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

Parameters

expand all

Main

Specify the order in which the port that corresponds to the block appears on the parent Subsystem or Model block.

  • If you add a block that creates another port, the port number is the next available number.

  • Deleting all blocks associated with a port deletes the port. Other ports are renumbered so that they are sequential and do not skip any numbers.

  • Specifying a port number that exceeds the number of ports creates a port for that number and for any skipped sequential numbers.

Programmatic Use

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

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'

Select to specify the block outputs the value of the input signal at the previous time step.

Selecting this check box enables Simulink to resolve data dependencies among triggered subsystems that are part of a loop.

The Inport block indicates that this option is selected by displaying <Lo>.

Dependency

Enabled in a triggered subsystem.

Programmatic Use

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

Select to specify the block latches the value of the input to this subsystem and prevents this value from changing during the execution of the subsystem. For a single function call that is branched to invoke multiple function-call subsystems, this option breaks a loop formed by a signal fed back from one of these function-call subsystems into the other. This option prevents any change to the values of a feedback signal from a function-call subsystem that is invoked during the execution of this subsystem.

The Inport block indicates that this option is selected by displaying <Li>.

Dependency

Enabled when Inport block is in a function-call subsystem.

Programmatic Use

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

When loading data from the workspace to a root-level Inport block, specify whether the block linearly interpolates and extrapolates output at time steps for which no corresponding data exists.

To load discrete signal data from the workspace, in the Inport block dialog box:

  1. Set the Sample time parameter to a discrete value, such as 2.

  2. Clear the Interpolate data parameter.

Specifying the discrete sample time causes the simulation to have hit times exactly at those instances when the discrete data is sampled. You specify the data values, not time values.

Turning interpolation off avoids unexpected data values at other simulation time points as a result of double precision arithmetic processing. For more information, see Load Data to Test a Discrete Algorithm.

Simulink uses the following interpolation and extrapolation:

  • For time steps between the first specified data point and the last specified data point — zero-order hold

  • For time steps before the first specified data point and after the last specified data point — ground value

  • For variable-size signals for time steps before the first specified data point — a NaN is logged for single or double data types and ground for other data types. For time steps after the last specified data point, uses ground values.

Programmatic Use

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

To import, visualize, and map signal and bus data to root-level inports, click this button. The Root Inport Mapper tool displays.

Dependency

This button appears only if this block is a root inport block.

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.

Specify that the input signal outputs a function-call trigger signal.

Select this option if it is necessary for a current model to accept a function-call trigger signal when referenced in the top model.

Dependency

Enabled in an asynchronous function call.

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 Multirate Bus Input for 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

Boolean | bus | double | enumerated | fixed point | integer | single | 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