Map Bus Objects to Models

As models become complex, it is important to identify the bus objects that a model uses and the models that use a specific bus object.

Before you simulate a model, all the bus objects it uses must be loaded into the base workspace. For automation and consistency across models, it is important to map bus objects to models.

  • By identifying all of the bus objects a model needs, you can ensure that those objects are loaded before model execution.

  • By identifying all models that use a bus object, you can ensure that changes to a bus object do not cause unexpected changes in any of the models that use that bus object.

To map bus objects to models, consider:

  • Keeping the bus objects in a data dictionary, which you use to store variables and objects for one or more models. To share a bus object between models, you can link each model to a dictionary and create a common referenced dictionary to store the object. For an example, see Partition Dictionary Data Using Referenced Dictionaries.

  • Using Simulink® Projects:

    1. Serialize the files that contain the bus objects as part of a project.

    2. Loading that data upon project open.

    For details, see Project Management.

  • Capturing the mapping information in an external data source, such as a database.

To find where a bus object is used in an open model, see Finding Blocks That Use a Specific Variable.

Use a Rigorous Naming Convention

Using a rigorous and standard naming convention is very helpful for mapping bus object usage. For example, consider the model and data required for an actuator control function. Naming the model Actuator and the input and output ports Actuator_bus_in and Actuator_bus_out, respectively, makes the connection between the bus objects and the model clear.

Note that this approach can cause issues if the output from one model reference is fed directly to another model reference. In this case, the naming mismatch results in an error.

Related Topics