Main Content

Component-Based Modeling Guidelines

Componentization benefits organizations developing Simulink®由许多功能作品组成的模型。使用模型组件可以启用:

  • Team-based development — Reduce file contention and elaborate components independently through well-defined interfaces.

  • Reduced design complexity — Each component solves smaller problems.

  • Component reuse — Reuse algorithms and environment models within a project and across multiple projects.

  • Unit testing — Eliminate retesting for unchanged components and reduce the cost of verification.

  • Performance benefits that scale — Reduce memory usage and the time required to load and simulate models.

  • 组件变体 - 在组件的多个实现中选择。

  • Intellectual property protection — Limit functionality and content visibility for components that you share with third parties.

Should You Create Model Components?

Considering the work required to define and manage components, you should use component-based modeling only when the benefits outweigh the cost.

将现有的simulink模型分为组件类似于采用金宝app大量代码(C,Java或Matlab®code) and breaking it down into multiple functions. The conversion can require significant effort and extensive modifications if the design is not modular from the beginning.

Considering model scalability and potential requirements upfront makes separating a Simulink model into components easier. Identifying components upfront can help you avoid these difficulties:

  • 组件定义差 - 随着时间的推移而生长的子系统的范围可能无法满足组件要求。例如,它们可能包含过多或太少的功能,无法重复使用,以生成与旧功能集成的代码,或者支持硬件在循环测试中。金宝app

  • Merge conflicts — If additional engineers begin to work on a model that was originally designed for development by a single engineer, they can encounter time-consuming and error-prone merges.

  • Algebraic loops — If a single engineer develops a model from the bottom up, they are likely to group blocks into subsystems as model complexity increases. The subsystems within the model are likely visual groupings that do not affect model execution. When you make these subsystems atomic, or convert them to referenced models, you can introduce unwanted algebraic loops that are difficult to diagnose and fix.

Components are also useful when a design becomes too complicated for one person to manage all of the details. For example, a complicated model can be a model that has:

  • 数千个街区

  • 数以百计的逻辑决策

  • Multiple variant configurations of the same functionality

Projects and source control can help you manage components. For more information, seeWhat Are Projects?Configuration Management.

Define Model Components

1.Choose Among Types of Model Components

确定与您的高级建模金宝app要求保持一致的Simulink组件。

2.Compare Capabilities of Model Components Investigate which types of model components meet your low-level modeling requirements.
3.定义模型组件的接口 Configure design attributes at interfaces and manage data for model components.