How can I protect a Simscape model?
23 ビュー (過去 30 日間)
古いコメントを表示
MathWorks Support Team
2018 年 9 月 14 日
編集済み: MathWorks Support Team
2025 年 10 月 28 日 10:58
I have a simple Simscape model which has connection ports exposed out of it. I tried two ways to protect the Simscape model:
First, I tried to generate an S-function from it. I got the following error:
The selected system expresses connection ports. Subsystem based code generation is not supported for portions of physical models. In order to generate code, the physical model must exist entirely within a subsystem.
Two, if I instead try to generate a protected model, I get a model reference with missing connection ports.
How can I protect my Simscape model?
採用された回答
MathWorks Support Team
2025 年 10 月 28 日 0:00
編集済み: MathWorks Support Team
2025 年 10 月 28 日 10:58
There are two types of references, a Model Reference and a Subsystem Reference. Subsystem references can contain physical connection ports that are used in a Simscape model as its input and output ports. However, you cannot protect a subsystem reference block using the Model Protection workflow. Whereas, model references cannot contain physical connections as input and output ports. Additionally, conversion of models or subsystems containing Simscape blocks to S-functions is not supported as per the limitations.
There are a couple of workarounds we can use to protect Simscape models despite the above limitations:
1) You can automatically convert subsystems containing only Simscape components into an SSC file using the 'subsystem2ssc' function. After that, you can use 'sscprotect' to create a protected Simscape source code file of extension SSCP. Just like with unprotected source files, you can build custom block libraries from SSCP files using the 'sscbuild' command. Visit the documentation page on protecting simscape files to learn more.
2) If your physical network includes specific input and output parameters, such as actuation commands or sensor outputs, consider transforming the model to use only Simulink interfaces. You can achieve this by utilizing PS-Simulink and Simulink-PS converters along with Simulink-based Inport/Outport blocks. This approach creates a self-contained physical network, enabling you to utilize protected model references.
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Foundation and Custom Domains についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!