How can I protect a Simscape model?

32 visualizaciones (últimos 30 días)
MathWorks Support Team
MathWorks Support Team el 14 de Sept. de 2018
Editada: MathWorks Support Team el 28 de Oct. de 2025 a las 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? 

Respuesta aceptada

MathWorks Support Team
MathWorks Support Team el 28 de Oct. de 2025 a las 0:00
Editada: MathWorks Support Team el 28 de Oct. de 2025 a las 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. 

Más respuestas (0)

Categorías

Más información sobre Foundation and Custom Domains en Help Center y File Exchange.

Productos


Versión

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by