Documentation

Referenced Models

Generate and reuse code for referenced models

To learn about considerations when generating code for a referenced model, seeCode Generation of Referenced Models. For an example on how to generate code for a referenced model, seeGenerate Code for Referenced Models.

Blocks

Model Include multiple model implementations as block in another model

Functions

find_mdlrefs Find Model blocks and referenced models at all levels or at top level only
view_mdlrefs Display graph of model reference dependencies
Simulink.SubSystem.convertToModelReference Convert subsystem to model reference
slbuild Build standalone executable or model reference target for model; except where noted, this function requires a Simulink Coder license

Topics

Code Generation of Referenced Models

This section describes model referencing considerations that apply specifically to code generation by the金宝app®Coder™.

Simulink Coder Model Referencing Requirements

A model reference hierarchy must satisfy variousSimulink Coderrequirements, as described in this section.

Configure Referenced Models

Minimize occurrences of algebraic loops by selecting theMinimize algebraic loop occurrencesparameter on theModel Referencepane.

Generate Code for Referenced Models

Introduces generating code for models referenced with Model blocks, and usingModel Explorerto browse code files

Generate Reusable Code From Referenced Models

Create reusable code for subsystems that contain referenced models.

Combine Code Generated for Multiple Models

Generate a single executable program from multiple models or multiple copies of the same model.

Build Model Reference Targets

By default, the Simulink engine rebuilds simulation targets before theSimulink Codersoftware generates model reference targets.

Storage Classes for Signals Used with Model Blocks

Models containingModelblocks can use signals of storage classAutowithout restriction.

Inherited Sample Time for Referenced Models

For information aboutModelblock sample time inheritance, see Inherit Sample Times for Model Referencing (Simulink).

Simulink Coder Model Referencing Limitations

Be aware of limitations that apply to using a model reference hierarchy for code generation.

Customize Library File Suffix and File Type

You can control the library file suffix and file type extension that theSimulink Codercode generator uses to name generated model reference libraries.

Was this topic helpful?