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.
Introduces generating code for models referenced with Model blocks.
Satisfy model reference hierarchy requirements to enable code generation.
Use Model Reference Conversion Advisor to convert a Subsystem block to a Model block and generate code for the model reference hierarchy.
Generate reusable subsystem code from a top model with Model blocks.
Configure storage classes for parameters and signals to transfer data in model reference hierarchy.
Model references have limitations including, but not limited to, data logging, state initialization, and S-functions.
Share Simulink cache files in team-based development to reduce build time and avoid unnecessary code regeneration.
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.
In the generated code, place the definitions of global variables with the components that define them.
Generate a single executable program from multiple models or multiple copies of the same model.