引用模型
为引用模型生成代码
您可以为模型引用层次结构生成代码,以实现:
增量代码生成 - 仅在模型自上次生成代码以来发生了更改的情况下才生成代码
增量加载 - 在需要时才加载引用模型,这样可以加快模型加载速度
模块化开发 - 独立开发和维护被引用模型,而不依赖于使用它的模型
代码重用 - 从引用模型中生成可重用代码
要从为引用模型生成代码的示例入门,请参阅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. - Combine Code Generated for Multiple Models
Generate a single executable program from multiple models or multiple copies of the same model.
代码重用
- 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.