Bus Data Crossing Model Reference Boundaries

A model reference boundary is the boundary between a model that contains a Model block and the referenced model. If bus data passes to a Model block, then that data crosses the boundary to the referenced model. Bus data input for the Model block 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. Using a nonvirtual bus provides a well-defined data interface for code generation. To learn the differences between virtual and nonvirtual buses, see Virtual and Nonvirtual Buses. If you use a virtual bus, you can use In Bus Element blocks to avoid the need for a bus object. If you use a nonvirtual bus, you must define it with a bus object by following the instructions in Create Bus Objects with the Bus Editor.

Multirate Bus Input for Referenced Models

You can pass a virtual multirate bus into a referenced model by using In Bus Element blocks. To pass a nonvirtual multirate bus into a referenced model, use an Inport block and add blocks in the parent and referenced model as follows:

  1. In the parent model: To convert the multirate bus to a single-rate bus, insert a Rate Transition block. Inport blocks can only pass single-rate buses into referenced models. The Rate Transition block must specify a rate in its Block Parameters > Output port sample time field unless one of the following is true:

    • The Configuration Parameters > Solver pane specifies a rate with these settings:

      • The Periodic sample time constraint parameter is set to Specified.

      • The Sample time properties parameter contains the specified rate.

    • The Inport block that accepts the bus in the referenced model specifies a rate in its Block Properties > Signal Attributes > Sample time field.

  2. In the referenced model: Use a Bus Selector block to pick out signals of interest, and use Rate Transition blocks to convert the signals to the desired rates.

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 the I/O arguments step method style of C++ class interface for the referenced model when using a nonvirtual bus or when using the Default style of C++ class interface.

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

Use these Upgrade Advisor checks to fix models saved before R2016a that engage these limitations:

See Also

Blocks

Related Examples

More About