How to protect a model with simscape interfaces?
4 views (last 30 days)
Show older comments
I need to provide an electrical plant model to a customer, with simscape interfaces so they can connect their battery model directly. The model's IP needs to be protected.
My electrical plant is made of a control model and the electrical model using simscape. These 2 models would ideally be referenced models. Then I would protect the whole electrical plant, with the simscape interfaces and share it. How do I do this?
I see that referenced subsystems can have simscape interfaces but can't be protected and referenced models can be protected but can't have simscape interfaces. Is there another better approach to do this?

2 Comments
Yifeng Tang
on 31 Mar 2025
You are right in that protected and referenced models do not support Simscape connections.
I also disagree with the answer from Prem Manoj Mule. Simscape Bus and physical signal connections requires the physical connection port to interface through the subsystem, and model reference won't allow that.
One possible but clumsy workaround is to use subsystem2ssc and ssc_protect to generate a .sscp file for your Simscape part of the model. It'll be encrypted. Your Simulink part can be converted to model reference by itself. Whether this works depends on how complicated your Simscape model. Maybe you can share more details and I can help advise further.
Answers (2)
Prem Manoj Mule
on 31 Mar 2025
Approach: Using Protected Models with Simscape Interfaces
1.Encapsulate Your Electrical Plant in a Model Reference
- Convert your electrical plant model (Simscape-based) into a referenced model using Model Reference.
- Ensure that your control model and electrical model are separate referenced models.
2.Enable Simscape External Interfaces for Referenced Models
- Simscape blocks inside a referenced model do not expose external interfaces by default.
- To enable this, use Simscape Bus and physical signal connections as input/output ports instead of direct Simscape physical connections.
3.Protect the Model
- Use Model Protection to safeguard your intellectual property:
- In MATLAB, go to Simulink Toolstrip → Model Reference → Protect Model.
- Configure settings like encryption, limitation on solver configuration, and licensing.
- Generate a protected version of the referenced model.
4.Export the Protected Model
- Provide the protected referenced model to your customer while ensuring Simscape physical interfaces are preserved.
Alternative Approach: Creating an S-Function Wrapper
If referenced models with Simscape interfaces do not work as expected, you can:
- Convert your model into an S-Function using Simulink Coder.
- Implement a wrapper function that exposes Simscape-compatible inputs/outputs.
0 Comments
Yifeng Tang
on 1 Apr 2025
As Model Reference and Model Protection won't allow physical connection through the subsystem/model boundary, it's not possible to directly achieve what you want. As I mentioned in the comment, one possible workaround is to separate the Simulink and the Simscape part. For the Simulink part, you may use the model protection as usual. For the Simscape part, you may refer to this MATLAB Answer post (How can I protect a Simscape model?). The key idea is to connect Simscape components using .ssc code, and then use ssc_protect to encrypt it. This works for "pure" Simscape models, including PS signal inputs and outputs, but not Simulink inputs/outputs.
This said, you still need to pass signals from the Simulink part, through a Simulink-PS Converter, into the Simscape part. And it sounds like you don't want this Simulink signal to be visible either. The picture below summarizes what you envison, if I understood it correctly.

I can't think of a straightforward way of doing this, but here is a crazy idea: can we "encrypt" the signal? Say have the Simulink part send out 5 signals muxed together, one being the actual one, or some kind of combination of the 5 being the actual control signal, and reverse such operation using PS domain in the Simscape part. Or it can be one signal with some bias and scaling built in, and use the PS domain to decrypt.
Hope this helps. You may also try to reach out to MathWorks account team to your organization (if you have the contact) or MathWorks Support and see if there are other resources on this.
0 Comments
See Also
Categories
Find more on Foundation and Custom Domains in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!