Main Content

Nonvirtual Buses at Model Interfaces

A model reference boundary is the boundary between a model that contains aModelblock and the referenced model. If bus data passes to aModelblock, then that data crosses the boundary to the referenced model. Bus data input for theModelblock must be consistent with the bus data that the referenced model requires.

For bus data that crosses model reference boundaries, decide whether to use a virtual or nonvirtual bus. Using a virtual bus can be simpler than using a nonvirtual bus. However, using a nonvirtual bus provides a well-defined data interface for code generation. To learn the differences between virtual and nonvirtual buses, seeTypes of Composite Signals.

Tip

For virtual buses at interfaces, useIn Bus ElementandOut Bus Elementblocks. These blocks support multirate virtual buses and do not requireSimulink.Busobjects.

For nonvirtual buses at interfaces, useInportandOutportblocks.

Model Reference Requirements for Nonvirtual Buses

If you use a bus as an input to or an output from a referenced model:

  • Only a nonvirtual bus can contain variable-size signal elements.

  • For code generation, you can only configure theI/O arguments step methodstyle of C++ class interface for the referenced model when using a nonvirtual bus or when using theDefaultstyle of C++ class interface.

  • For code generation, you can only configure function prototype control for the referenced model when using a nonvirtual bus.

Nonvirtual公交车与根级InportBlocks

To pass a bus from a root-levelInportblock into a referenced model, in the Block Parameters dialog box of theInportblock: