Main Content
Choose a Componentization Technique for Code Reuse
Key componentization techniques that you can use with Simulink® and the code generator to produce reusable code include:
Referenced models
Subsystems
Library subsystems
Combinations of models, subsystems, and library subsystems
Choose componentization techniques based on your code reuse goals.
Goal | Referenced Model | Subsystem in Model | Subsystem in Library |
---|---|---|---|
Design for explicit code reuse. | √ | √ | √ |
Facilitate parallel team development. | √ | √ | √ |
Reuse function within a model or across models. | √ | ||
Reduce build time by generating reusable code incrementally. | √ | ||
Verify reusable code with SIL or PIL simulation. | √ | ||
Optimize generated code by configuring code generator to detect opportunities for code reuse. | √ | √ | √ |
Maximize reuse with context-dependent behavior. | √ | √ | |
Develop a frequently used, and infrequently changed, utility function. | √ |
Related Topics
- Compare Capabilities of Model Components
- Generate Reentrant Code from Top Models (Embedded Coder)
- Generate Reentrant Code from Subsystems (Embedded Coder)
- Generate Reentrant Code from Simulink Function Blocks (Embedded Coder)
- Generate Reusable Code from Library Subsystems Shared Across Models (Embedded Coder)
- Library-Based Code Generation for Reusable Library Subsystems (Embedded Coder)