Main Content

Component Interface View

Display component interfaces to trace port connections and author ports

Renamed from Interface Display in R2024b

Description

The Component Interface View displays the input ports, output ports, and boundary of the current subsystem or model.

When you build large model hierarchies, the Component Interface View can help you:

  • Identify input and output ports.

  • Trace input ports to their destinations.

  • Trace output ports to their sources.

  • Author input and output ports.

  • Edit types assigned to ports.

The Component Interface View also supports the same interactions as the Simulink® Editor. For example, you can edit block diagrams and display information overlays such as sample time.

Component Interface View

Open the Component Interface View

  • Simulink Toolstrip: On the Modeling tab, in the Design gallery, click Interface View.

  • Simulink Editor: Press Ctrl+Shift+V.

  • MATLAB® Command Window: Open a model or subsystem. Then, enter interfaceView.

Examples

expand all

You can use the Component Interface View to easily identify ports of a model or subsystem, regardless of where the corresponding blocks are in the block diagram.

For example, open the model named slexAircraftExample.

slexAircraftExample model

To inspect the interfaces of the model components, open the Component Interface View. On the Modeling tab, in the Design gallery, click Interface View. Alternatively, press Ctrl+Shift+V.

slexAircraftExample model with Interface View open

The Component Interface View displays the input and output ports on the component boundary. Where the Component Interface View displays the ports depends on the type of component.

  • Models — By default, the Component Interface View displays the input ports on the left and the output ports on the right. To move a port in the Component Interface View, select the port and use the arrow keys. To save the modified the Component Interface View port locations, save the model.

  • Subsystems — The Component Interface View displays each port in the same location as the subsystem block displays the port. When you move a port in the Component Interface View, you also move the port on the subsystem block.

In this example, the top level of the model has an input port named u and an output port named alpha, rad.

The Subsystem block named Controller has three input ports on the left and one output port on the right. To open the subsystem, double-click the block.

Controller subsystem with Interface View open

Matching the Subsystem block, the Component Interface View displays three input ports on the left and one output port on the right.

To find the blocks that correspond with the input port named Stick Input, click the corresponding port icon on the component boundary.

Interface View with the Stick Input port selected

The Component Interface View selects the Inport block named Stick Input and draws a line between the port and the block.

To find the blocks that correspond with the input port named q (rad/sec), click the corresponding port icon on the component boundary.

Interface View with the q (rad/sec) port selected

The Component Interface View selects the Inport block named q (rad/sec) and draws a line between the port and the block.

To open the project and top model named ValueTypesTirePressure, open the example. To update the line styles and load the referenced models, compile the model. In the Simulink Toolstrip, on the Modeling tab, click Update Model or Run.

ValueTypesTirePressure model

Navigate into a referenced model. For example, double-click the Model block named Sensor1.

To inspect the interfaces of the model components, open the Component Interface View. On the Modeling tab, in the Design gallery, click Interface View. Alternatively, press Ctrl+Shift+V.

ValueTypesTirePressureSensor model with Interface View open

To trace a signal, bus, or message at a port, select the port. Then, click Show usage. For example, show usage for the output port named SensorTransmission.

Show usage button displayed for SensorTransmission port

The Property Inspector opens. The Component Interface View traces the usage of the top-level bus, signal, or message that the port receives. In this example, the output port receives a bus.

Usage of SensorTransmission port

To trace the usage of a bus element, in the Property Inspector, select the element. For example, select TirePressure.

Usage of TirePressure element

The Component Interface View traces the usage of TirePressure from the output port to the input port.

The Component Interface View also traces usage through subsystem boundaries. Open the referenced model named ValueTypesTirePressureController by double-clicking the Model block named Controller at the top level of the model hierarchy. Then, select the input port named SensorData and click Show usage.

Usage of SensorData port

To see how the subsystem named RangeChecker uses the input from SensorData, double-click the Subsystem block.

Usage of SensorData port in RangeChecker subsystem

The Component Interface View traces the bus usage through the subsystem.

The Component Interface View helps you add, remove, and modify ports at a model or subsystem interface.

For this example, open a new model.

To author the model interface, open the Component Interface View. On the Modeling tab, in the Design gallery, click Interface View. Alternatively, press Ctrl+Shift+V.

Component Interface View for untitled model

To view port authoring options, click the component boundary.

Input button in action bar

While input ports are typically on the left and output ports are typically on the right, you can create the ports on any side.

To create an input port, select Input.

Port and corresponding block selected with a faint line connecting the two

The Component Interface View adds a port and a block that represents the port. Optionally, enter a new name for the port. For example, enter In.

To create an output port, select Output.

Port and corresponding block selected with a faint line connecting the two

The Component Interface View adds a port and a block that represents the port. Optionally, enter a new name for the port. For example, enter Out.

Optionally, add blocks to the block diagram. For example, add a Gain block.

To connect a port, perform one of these actions:

  • Drag a port on a block that represents a component port to a supported block port.

    The pointer drags a line from the block that represents the input port.

  • Drag a port on the component boundary to a supported block port.

    The pointer drags a line from the input port on the component boundary to the input port of the Gain block.

  • Drag a block port to a supported port on the component boundary.

    The pointer drags a line from the output port of the Gain block to the output port on the component boundary.

  • Drag a port on the component boundary to a supported port on the component boundary.

    The pointer drags a line from the input port on the component boundary to the output port on the component boundary.

  • Drag a block port or component port to a location on the component boundary. The Component Interface View creates the supported type of component port. For example, when you drag an input port to the component boundary, the Component Interface View creates an output port.

    The pointer drags a line from the input port on the component boundary to

To delete a port, select the port. Then, press Delete.

You can use the Component Interface View in combination with the Type Editor to create, modify, and apply types to ports at a component interface.

For example, open the ComponentBasedModeling project. The project opens the top model in a model hierarchy. To update the line styles, in the Simulink Toolstrip, on the Modeling tab, click Update Model or Run. Updating the line styles can help you visually identify buses.

Top model

To inspect the interfaces of the model components, open the Component Interface View. On the Modeling tab, in the Design gallery, click Interface View. Alternatively, press Ctrl+Shift+V.

Top model with Interface View open

Suppose you want to define the interface of the Plant subsystem with Simulink.Bus objects.

Open the Plant subsystem.

Plant subsystem with Interface View open

To begin editing port data types, select a port. For example, select the new control port. Then, click Edit types.

Edit types button for control port

The docked Type Editor opens. Expand the ComponentControllerData dictionary, which contains Simulink.Bus objects named Controls, Goals, and Sensors.

Docked Type Editor with three bus objects in a data dictionary

Right-click the Controls bus object. Then, click Apply type to selected blocks and ports.

Docked Type Editor with the Controls bus object selected and the corresponding ports and blocks highlighted in the subsystem

The port now uses the Controls bus object.

Optionally, create a bus object to represent the port named disturbance. The Sensors bus object can represent the port named sensor.

To apply bus objects to the remaining ports, in the Component Interface View, select a port. Then, in the Type Editor, right-click the corresponding bus object and click Apply type to selected blocks and ports.

Related Examples

Programmatic Use

expand all

interfaceView opens the Component Interface View for the current system. For more information, see gcs.

interfaceView(sys) opens the Component Interface View for the system specified by sys. In quotes, specify a model name or a Subsystem block path in a loaded model.

Version History

Introduced in R2014b

expand all