Create single custom simscape component which contains multiple subsystems?

1 次查看(过去 30 天)
I have simscape subsystem, which contains physical signal inputs and simscape electrical outputs. I use the subsystem2ssc function to create a custom simscape component and then use ssc_protect to protect the subsystem. Currently there are no subsystems in the model and by using the two aforementioned function I am able to create a single file protected model.
I want to create a protected custom simscape component which contains nested subsystems. When I use the subsystem2ssc function it creates a .ssc file for each of the subsytems. Is there a way to create a single simscape component from a subsystem which contains other subsytems?

回答(1 个)

Sumukh
Sumukh 2024-8-21
Hi Daniel.
There are two possible ways to create a single protected component for Simscape subsystem with nested subsystems:
  • A single protected component for the subsystem can be created using the “Simscape Component” block available in Simulink “Utilities” library. The protected subsystem code (“.sscp”) file must be provided to the block parameters, and it works with subsystems with nested subsystems as well. You can run the following command in the command window of MATLAB R2018b to the learn more about the block:
web(fullfile(docroot, 'physmod/simscape/ref/simscapecomponent.html'))
  • Alternatively, a single component library file for the subsystem can be created using the command “ssc_build”. The protected files must be first placed inside a package folder, with the name “+package_name”. The command “ssc_build package_name” can then be used to create a single protected component library file for the Simscape subsystem. You can run the following command in the command window to know more about “ssc_build”:
web(fullfile(docroot, 'physmod/simscape/ref/ssc_build.html'))
However, slight modifications must be done in the subsystem code file before protecting the code files. In the code, the paths of the nested subsystems in the “components” section must be edited to match the package folder structure. You can run the following command in the command window to understand the workflow to create components from Simscape subsystems and editing the subsystem code (“.ssc”) file:
web(fullfile(docroot, 'physmod/simscape/lang/converting-subsystems-into-composite-components.html'))
I hope this helps with your query.

类别

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

产品


版本

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by