Skip to Main Content Skip to Search
Product Documentation

Creating a Model Reference

A model becomes a submodel when a Model block in some other model references it. Any model can function as a submodel, and such use does not preclude using it as a separate model also. To create a reference to a model (submodel) in another model (parent model):

  1. If the folder containing the submodel you want to reference is not on the MATLAB path, add the folder to the MATLAB path.

  2. In the submodel:

    • Enable Configuration Parameters > Optimization > Inline parameters. You must enable Inline parameters for all models in a model reference hierarchy except the top model in the hierarchy. See Inline Parameter Requirements for details.

    • Set Configuration Parameters > Model Referencing > Total number of instances allowed per top model to:

      • One, if the hierarchy uses the model at most once

      • Multiple, to use the model more than once per top model. To reduce overhead, specify Multiple only when necessary.

      • Zero, which precludes referencing the model

  3. Create an instance of the Model block in the parent model by dragging a Model block instance from the Ports & Subsystems library to the parent model. The new block is initially unresolved (specifies no submodel) and has the following appearance:

  4. Open the new Model block's parameter dialog box by double-clicking the Model block. See Navigating a Model Block for more about accessing Model block parameters.

  5. Enter the name of the submodel in the Model name field. This name must contain fewer than 60 characters. (See Name Length Requirement.)

  6. Click OK or Apply.

If the referenced model contains any root-level inputs or outputs, Simulink displays corresponding input and output ports on the Model block instance that you have created. Use these ports to connect the referenced model to other ports in the parent model.

A signal that connects to a Model block is functionally the same signal outside and inside the block. Therefore that signal is subject to the restriction that a given signal can have at most one associated signal object. See Simulink.Signal for more information. For information about connecting a bus signal to a referenced model, see Bus Usage Requirements.

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS