Guy on Simulink

Simulink & Model-Based Design

Projects Export Profile 2

Posted by Guy Rouleau,

After my last post on FMU import and export, someone asked me if exporting a Simulink model to an FMU was a good way to hide the model and protect intellectual property.

The answer is: No!

An FMU is simply a compressed archive. If you try changing the extension of an FMU to .zip and extracting it, you will find that it contains the original model. If you want to protect your IP, what I recommend is to protect the model. Once this is done, you can leverage the project export profile feature to automatically package only what should be shared.

Let's look at an example project I put together to highlight this workflow.

The Project

Here is what my example project looks like:

My example project

In this project, my top model "f14_top.slx" is simply a wrapper containing a Model block. With the shortcuts "Use Source" and "Use Protected", I can re-configure it in one click to either reference f14.slx in normal mode or reference its protected version f14.slxp.

Referencing the model

Let's look at the details...

Project Shortcuts

As mentioned above, I created two MATLAB scripts that I marked as shortcuts "Use Source" and "Use Protected". While I am developing the model, I need to work with the unprotected source model. For that, I click the "Use Source" shortcut, which executes:

Normal Mode

When I am ready to share the project, I can build the protected target and reconfigure the top model to reference it:

Protected Mode

Labels

To differentiate the files I want to share from the rest of the project, I use labels. Those will be used later to create an export profile.

When right-clicking on a file in the Project, I select Add Labels and can create new labels or select existing ones. In my case, I created the labels Source, Protected and Internal:

Creating labels

Export Profiles

The last thing to do is create an export profile, which can be done from the Share menu:

Export Profile

In my new profile, I can select which labels I do not want to be included when I will export the project.

Manage Export Profile

If I export the project using this profile, here is what the resulting project will look like:

Exported Project

Now it's your turn

Do you have different workflows to protect your IP and share projects? Let us know in the comments below.

2 CommentsOldest to Newest

Christian Bertsch replied on : 1 of 2
Dear Guy, your statement " ... if exporting a Simulink model to an FMU was a good way to hide the model and protect intellectual property. The answer is: No! An FMU is simply a compressed archive. If you try changing the extension of an FMU to .zip and extracting it, you will find that it contains the original model. " is misleading: This is just a problem of the current way of how Simulink exports an FMU, which is a so-called-tool wrapper FMU that contains the original model. There are be good alternatives e.g. based on code generation/compilation that can contain any kind of protection (compilation, license checks etc.). Currently one can generate binary FMUs (Model exchange, and Co-Simulation FMU with fixed step solvers) e.g. with https://github.com/CATIA-Systems/FMIKit-Simulink via Simuilink Coder. To enable the same for CoSimulation FMU with variable step Simulink Solvers is Mathworks turn (due to currenly missing support of Simulink Coder to export them). Users are waiting for this!
Georg Nestlinger replied on : 2 of 2
Hi Guy, to me it appears very cumbersome to specify the labels I do NOT want to be included in the exported project. I have a project with a lot of files. The files I need to share are only a small subset of the whole project. So in this case, it would be much simpler to label only those files that need to be included in the exported project.