Bus Data Crossing Model Reference Boundaries

A model reference boundary refers to the boundary between a model that contains a Model block and the referenced model. If you have bus data in a model that is passed to a Model block, then that data crosses the boundary to the referenced model.

To have bus data cross model reference boundaries:

  1. Use a bus object (Simulink.Bus) to define the bus. For details, see Create a Nonvirtual Bus.

    You can use a nonvirtual or a virtual bus as an input to a referenced model. If you use a virtual bus, Simulink® automatically converts it to a nonvirtual bus (for details, see Automatic Bus Conversion). Simulink requires that each model reference inport use contiguous memory, which nonvirtual buses provide. Using a nonvirtual bus provides a well-defined data interface for code generation.

  2. Consider stripping out unneeded data from bus objects crossing model reference boundaries.

    In large models, bus objects can become quite large and have several levels of hierarchy. Often referenced models need some, but not all, of the data contained in large buses. Passing unneeded data across model reference boundaries impacts performance negatively. The interface definition for a model should specify exactly what data the model uses.

Connect Multi-Rate Buses to Referenced Models

In a model that uses a fixed-rate solver, referenced models can input only single-rate buses. However, you can input the signals in a multi-rate bus to a referenced model by inserting blocks into the parent and referenced model as follows:

  1. In the parent model: Insert a Rate Transition block to convert the multi-rate bus to a single-rate bus. 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:

      • Periodic sample time constraint is Specified

      • Sample time properties contains the specified rate.

    • The Inport 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.

Was this topic helpful?