Generate code for referenced models
You can generate code for a model reference hierarchy to achieve:
Incremental code generation – generate code only if the model has changes since the code was previously generated
Incremental loading – load referenced model when it is required which speeds up model loading
Modular development – develop and maintain referenced model independently from the models that use it
Code reuse – generate reusable code from referenced model
To get started on an example on how to generate code for a referenced model, see Generate Code for Model Reference Hierarchy.
- Generate Code for Model Reference Hierarchy
Introduces generating code for models referenced with Model blocks.
- Generated Functions in a Model Reference Hierarchy
About generated functions in a model reference hierarchy.
- File Packaging for Models (Code and Data)
Partition data and functions of reference model into separate files.
- Set Configuration Parameters for Code Generation of Model Hierarchies
Satisfy model reference hierarchy requirements to enable code generation.
- Convert Subsystem to Referenced Model and Generate Code
Use Model Reference Conversion Advisor to convert a Subsystem block to a Model block and generate code for the model reference hierarchy.
- Storage Classes for Parameters and Signals Used in Model Blocks
Configure storage classes for parameters and signals to transfer data in model reference hierarchy.
- Code Generation Limitations for Model Reference
Model references have limitations including, but not limited to, data logging, state initialization, and S-functions.
- Simulink Cache Files for Incremental Code Generation
Share Simulink cache files in team-based development to reduce build time and avoid unnecessary code regeneration.
- Establish Data Ownership in a Model Hierarchy
In the generated code, place the definitions of global variables with the components that define them.
- Combine Code Generated for Multiple Models
Generate a single executable program from multiple models or multiple copies of the same model.
- Modeling Guidelines for Generated Code
Overview of guidelines to consider for your model and generated code, including coding guidelines, component deployment modeling guidelines, and MathWorks Advisory Board guidelines (MAB).
- Generate Reusable Code from Model Reference Hierarchy
Generate reusable subsystem code from a top model with Model blocks.
- Specify Instance-Specific Parameter Values for Reusable Referenced Model
When you create a reusable component as a referenced model, configure block parameters to use the same value for instances of the component or a different value for each instance.
- Shared Constant Parameters for Code Reuse
Share generated code for constant parameters across models.