Main Content

本页的翻译已过时。点击此处可查看最新英文版本。

代码重用

适当设计模型,使代码生成器能够从中生成可重用的函数代码。

通过设计可生成可重用代码的模型,简化软件分发并减少开发软件所需的时间和资源。使用关键的 Simulink® 组件化方法,将一个模型分为若干个可分别进行仿真、代码生成和验证的设计组件。代码生成器从引用模型、子系统和库子系统生成可重用的函数代码。

主题

快速入门

What Is Code Reuse?

Why you reuse code and associate code reuse and reentrancy.

Choose a Componentization Technique for Code Reuse

Comparison of techniques for generating reusable code.

Simulink Function Blocks and Code Generation

Generate reusable code from Simulink Function blocks.

可重用代码

Generate Reusable Code from Library Subsystems Shared Across Models

Create reusable library subsystems to generate code for subsystems that models share.

Determine Why Subsystem Code Is Not Reused

Determine why the code generator does not reuse subsystem code as you expect.

Generate Reusable Code from Model Reference Hierarchy

Generate reusable subsystem code from a top model with Model blocks.

Shared Constant Parameters for Code Reuse

Share generated code for constant parameters across models.

Generate Reusable Code from Stateflow Atomic Subcharts

Generate reusable code for linked and unlinked atomic subcharts.

可重用、可重入代码

What Is Reentrant Code?

Why generate reentrant code.

从顶层模型生成可重入代码

从顶层模型生成可重用的可重入代码。

Generate Reentrant Code from Subsystems

Generate reusable, reentrant code from subsystems.

Generate Reentrant Code from Simulink Function Blocks

Generate reusable, reentrant code from Simulink Function blocks that are scoped to a model.

Storage Classes and Reentrant, Multi-Instance Models and Components

共享实用工具代码

Generate Shared Utility Code

Modularize and share common Model block functionality as helper functions.

Generate Shared Utility Code for Fixed-Point Functions

Generate reusable code for fixed-point support functions.

Generate Shared Utility Code for Custom Data Types

Generate reusable code for custom data types.