Main Content

Compare Capabilities of Composite Interfaces

Before you implement a piece of your system using a specific type of composite interface, consider whether the type satisfies your requirements for composite interface elements, modeling, and code generation.

Tip

To identify which composite interfaces to consider based on high-level guidelines and ideal use cases, see Choose Among Composite Interfaces.

For physical conserving connections, see Simscape Bus (Simscape).

Based on best practices for composite interfaces, these comparison tables focus on buses.

Composite Interface Elements

Composite Interface Elements RequirementVirtual BusesNonvirtual BusesArrays of Buses
Hierarchical elements

Supported

Elements of virtual buses can have hierarchy.

Supported

Elements of nonvirtual buses can have hierarchy.

Supported

While the array of buses is flat, the nested buses can have hierarchy.

Elements with different sample times

Supported

Elements of virtual buses can have different sample times.

Not supported

All elements of a nonvirtual bus must use the same sample time.

Use a Rate Transition block to change the sample time of signals in a bus. For more information, see Modify Sample Times for Nonvirtual Buses.

Not supported

All elements of an array of buses must use the same sample time.

Elements with different data types

Supported

Elements of virtual buses can have different data types.

Supported

Elements of nonvirtual buses can have different data types.

Supported

Top-level elements of arrays of buses must specify the same Simulink.Bus object data type. Elements of the nested buses can have different data types.

Variable-size signals

Supported

Virtual buses can contain variable-size signals as long as they are not used as inputs to or outputs from a referenced model.

Supported

Nonvirtual buses can contain variable-size signals.

Supported

Arrays of buses can contain variable-size signals only for simulations in normal mode.

Arrays of buses with variable-size signals do not support signal logging.

Function-call signals

Supported

Virtual buses can contain function-call signals. The virtual bus must not be defined by a Simulink.Bus object.

Not supported

Nonvirtual buses cannot contain function-call signals.

Not supported

Arrays of buses cannot contain function-call signals.

Messages

Supported

Virtual buses can have message elements as long as they do not also have signal elements.

Not supported

Nonvirtual buses can contain only signal elements.

Messages can have nonvirtual bus payloads.

Not supported

The nested nonvirtual buses in arrays of buses cannot have message elements.

Composite Interface Modeling

Composite Interface Modeling RequirementVirtual BusesNonvirtual BusesArrays of Buses
Name-based element access

Supported

Access elements of virtual buses by name.

Supported

Access elements of nonvirtual buses by name.

Supported

Access top-level elements of arrays of buses by index. Then, access elements of the nested buses by name.

Element access at component input ports

Supported

To select elements of a virtual bus at an input port, use In Bus Element blocks.

Supported

To select elements of a nonvirtual bus at an input port, use In Bus Element blocks.

Not supported

In Bus Element blocks can pass arrays of buses through the interface, but they cannot select the index-based elements of arrays of buses.

Composite interface definition at component input ports

Supported

To define an input virtual bus for a model component, specify the virtual bus and its elements with one or more In Bus Element blocks.

Supported

To define an input nonvirtual bus for a model component, specify the nonvirtual bus with one or more In Bus Element blocks.

For the element that you want to be a nonvirtual bus:

  1. Set Data type to a Simulink.Bus object.

  2. Set Bus virtuality to nonvirtual.

Supported

To define an input array of buses for a model component, specify the array of buses with an In Bus Element block.

For the element that you want to be an array of buses:

  1. Set Data type to a Simulink.Bus object.

  2. Set Bus virtuality to nonvirtual.

  3. Set Dimensions to an integer greater than 1.

Composite interface creation at component output ports

Supported

To create a virtual bus at an output port, connect the desired elements of the virtual bus to Out Bus Element blocks that correspond to the same output port.

Supported

To create a nonvirtual bus at an output port, connect the desired elements of the nonvirtual bus to Out Bus Element blocks that correspond to the same output port. Then, edit the signal attributes of the bus.

  1. Set Data type to a Simulink.Bus object.

  2. Set Bus virtuality to nonvirtual.

Not supported

Out Bus Element blocks can pass arrays of buses through the interface, but they cannot create arrays of buses.

Incremental interface changes

Supported

Virtual buses support incremental interface changes. Use In Bus Element and Out Bus Element blocks to modify the bus at the interface.

Not supported

Nonvirtual buses are defined by Simulink.Bus objects. The object must be modified to modify the interface.

Not supported

You can change the dimensions of an array of buses at an interface.

The nested buses are defined by a Simulink.Bus object. The object must be modified to modify the nested buses.

Defined interfaces in simulation

Supported

To define the properties of a virtual bus, you can specify a Simulink.Bus object data type or specify element attributes with In Bus Element and Out Bus Element blocks.

Supported

Nonvirtual buses specify the properties of their elements with Simulink.Bus objects.

Supported

Arrays of buses specify the properties of their elements with Simulink.Bus objects.

Iterative processing of subsystems

Not supported

Virtual buses do not support iterative processing of subsystems.

Supported

Group nonvirtual buses in arrays of buses to iteratively process them in a subsystem such as a for-each, while-iterator, or for-iterator subsystem.

Supported

Arrays of buses let you iterate over a group of nonvirtual buses. Connect the array of buses to a subsystem such as a for-each, while-iterator, or for-iterator subsystem.

Composite Interface Code Generation

Composite Interface Code RequirementVirtual BusesNonvirtual BusesArrays of Buses
Data structures in generated code

Not supported

While you can specify a Simulink.Bus object data type for a virtual bus, the generated code does not apply it.

Supported

Nonvirtual buses specify the properties of their elements with Simulink.Bus objects as data structures in the generated code.

Supported

Arrays of buses specify the properties of their elements with Simulink.Bus objects as data structures in the generated code.

Partial data use

Supported

Model components use only the data of selected elements of a virtual bus that is not defined by a Simulink.Bus object.

When a Simulink.Bus object defines the virtual bus, model components use all the data of the virtual bus.

Not supported

Model components use all the data of a nonvirtual bus.

Not supported

Model components use all the data of an array of buses.

Partial signal copies

Supported

When model compilation requires signal copies for a virtual bus, Simulink® can copy elements of the bus instead of the entire bus.

If a Simulink.Bus object defines the virtual bus, copies are of the entire bus.

Not supported

When model compilation requires signal copies for a nonvirtual bus, Simulink copies the entire bus.

Not supported

When model compilation requires signal copies for an array of buses, Simulink copies the entire array of buses.

Note

For additional code generation considerations, see:

Related Topics