How can I protect a Simscape model?

28 Ansichten (letzte 30 Tage)
MathWorks Support Team
MathWorks Support Team am 14 Sep. 2018
Bearbeitet: MathWorks Support Team am 28 Okt. 2025 um 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? 

Akzeptierte Antwort

MathWorks Support Team
MathWorks Support Team am 28 Okt. 2025 um 0:00
Bearbeitet: MathWorks Support Team am 28 Okt. 2025 um 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. 

Weitere Antworten (0)

Kategorien

Mehr zu Foundation and Custom Domains finden Sie in Help Center und File Exchange

Produkte


Version

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by