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.
Here is what my example project looks like:
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.
Let's look at the details...
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:
When I am ready to share the project, I can build the protected target and reconfigure the top model to reference it:
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:
The last thing to do is create an export profile, which can be done from the Share menu:
In my new profile, I can select which labels I do not want to be included when I will export the project.
If I export the project using this profile, here is what the resulting project will look like:
Now it's your turn
Do you have different workflows to protect your IP and share projects? Let us know in the comments below.