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.
