Documentation

Use Buses for Inports and Outports

For information about using buses as inputs to, or outputs from, a referenced model, see Bus Data Crossing Model Reference Boundaries.

Use Buses with Root-Level Inports

To have a root-level Inport block in a model that does not specify a bus object produce a bus signal, in the Inport block:

  • Set the Data type parameter to Bus: <object name>

  • Replace <object name> with the name of the bus object name that defines the bus that the Inport produces.

For more information, see Import Bus Data to Top-Level Input Ports.

Use Buses with 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.

To have a root-level Outport of a model accept a bus signal that contains mixed data types, use the Block Parameters dialog box of the Outport block.

  • Set Data type to Bus: <object name>.

  • Replace <object name> with the name of the bus object name that defines the bus that the Outport produces.

If the bus signal in a top-level model in a model reference hierarchy is virtual, the signal is converted to nonvirtual (see Bus Conversion).

Buses for Atomic Subsystem Nonvirtual Inports

By default, an Inport block is a virtual block and accepts a bus as input. However, an Inport block is nonvirtual if:

  • The Inport block is in an atomic subsystem.

  • The signal or any of its elements (if the signal is a bus) are directly connected to the output of the subsystem.

The Inport block can accept a bus when either of these conditions is true:

  • All elements of the bus can be converted to a vector (for example, all the elements must have the same data type).

  • The bus is a nonvirtual bus.

If the bus elements have different data types, attempting to simulate the model halts the simulation and produces an error message. To avoid this problem without changing the semantics of your model, insert a Signal Conversion block between the Inport block and the Outport block to which it was originally connected.

For example, the following model, which includes an atomic subsystem, does not simulate.

Starting the simulation generates the following error messages:

In the subsystem, the Inport block labeled nonvirtual is nonvirtual because it resides in an atomic subsystem and one of its bus elements (labeled a) is directly connected to one of the subsystem outputs. Further, the bus (bus1) connected to the subsystem inputs has elements of differing data types. As a result, you cannot simulate this model.

To break the direct connection to the subsystem output, insert a Signal Conversion block. Set the Signal Conversion block Output parameter to Signal copy. Inserting the Signal Conversion block enables you to simulate the model.

Buses with Model Referencing

For information about using buses as inputs to, or outputs from, a referenced model, see Bus Data Crossing Model Reference Boundaries.

See Also

Blocks

Classes

Related Examples

Was this topic helpful?