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. | √ |