When is subsystem reference a better choice than model reference?

363 次查看(过去 30 天)
I am trying to understand the difference between "model reference" and "subsystem reference". I came across this documentation page, but no matter how many use-cases I reviewed, I never seem to end up with a "subsystem reference". From the flow chart shown in that page, the only way conclude with "subsystem reference" is when the block does not have a defined interface, or is not re-used or does not change. These are the antithesis of arguments for any creating any type of subsystems. Can someone comment on practical situations when a "subsystem reference" will be useful over "model reference"? Are there computational costs associated with "model reference"? I am inclined to believe that in practical cases in the industry, "subsystem references" are rarely used.

采纳的回答

Jonas
Jonas 2021-2-22
编辑:Jonas 2021-2-22
Subsystem References is new functionality to Simulink, it is only supported since R2019b. So industry will only slowly evolve to using the functionality.
I will try to explain use-cases for using Subsystem Reference, and contrast it with Model Reference. Both are saved into their own .slx file, and are referenced by a parent model. The difference is that with Model Reference, the signal interfaces are fixed, such as data types and signal dimensions. With a Subsystem Reference, these interfaces do not need to be fixed. Look at this documentation page. You can use a Subsystem Reference in multiple instances where one instance receives a scalar while another instance receives a vector signal. This is similar to using a library block: the same library block can be used for different instances with different signal dimensions or data types. A Model Reference only accepts signals of a fixed data type and dimensions.
Besides this, a Model Reference can have its own Configuration Parameters and Model Workspace, while a Subsystem does not have it and inherits this from the parent model.
I would say that a Subsystem Reference is more closely related to a library subsystem, with the advantage that:
  • The subsystem is inside its own .slx file, which can be versioned through GIT. This means a different team member can develop this subsystem reference inside the .slx file without disturbing other systems. If you do this with a library, the whole library will be affected.
  • A subsystem reference can be tested and developed inside a harness.
In a model-based design project, I would say typically a Model Reference is used for:
  • A controller
  • A plant model
which are then referenced in harnesses for:
  • Code generation
  • Real-time prototyping
  • Simulation
while Subsystem References are used for:
  • Speed controller subsystem inside the controller
  • Position estimator subsystem inside the controller
  • ...
  • Induction motor model inside the plant model
  • Synchronous motor model inside the plant model
  • ...
This link also provides a comparison overview.
  7 个评论

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Subsystems 的更多信息

产品


版本

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by