Main Content

Protected Model Creator

Specify model protection options and protect model

Renamed from Create Protected Model in R2024a

Description

The Protected Model Creator lets you create a protected model (.slxp).

When you protect a model, you can allow the recipient of the protected model to:

  • Simulate a model that includes the protected model in normal, accelerator, rapid accelerator, or external mode.

  • Open a read-only web view of the model, including model contents and block parameters. Creating a read-only web view of the model requires a Simulink® Report Generator™ license.

  • Generate C and C++ code for a model that includes the protected model, if you have a Simulink Coder™ license.

  • Generate HDL code for a model that includes the protected model, if you have an HDL Coder™ license.

  • Generate code for the protected model through the standalone interface, if you have an Embedded Coder® license and specify an ERT-based system target file for the model.

You can optionally password-protect each option. If you choose password protection for one of these options, the software protects the supporting files by using AES-256 encryption. Before you create a protected model, consider how the third party will use the model. For best practices, see Best Practices for Creating Protected Models.

Open the Protected Model Creator

How you open the tool depends on whether you want to protect a referenced model or the top model.

  • To protect a referenced model, select a Model block that references the model you want to protect. In the Simulink Toolstrip, on the Model Block tab, click Protect.

  • To protect the top model, in the Simulink Toolstrip, on the Simulation tab, click the Save button arrow. Then, select Protected Model.

Parameters

expand all

General

Specify whether to share an interactive rendition of a Simulink model that the recipient can view in a web browser with optional password protection. This read-only web view of the model includes the contents and block parameters of the model.

  • on — Share a web view of the model that you protect. For password protection, create and verify a password with a minimum of eight characters.

  • off — Do not share a web view of the model that you protect.

To open a web view of a protected model, perform one of these actions:

  • Simulink Editor: On the Model block, right-click the protected-model badge icon . Then, select Show Web view.

  • Current Folder Browser: Double-click the protected model file (.slxp).

Dependencies

Creating a read-only web view of the model requires a Simulink Report Generator license.

Specify whether the protected model supports simulation. Optionally, add password protection.

  • on — A model that references the protected model can run in normal, accelerator, or rapid accelerator mode. For password protection, create and verify a password with a minimum of eight characters.

  • off — The protected model does not support simulation.

For information about simulation modes in model hierarchies, see Choose Simulation Modes for Model Hierarchies.

Specify whether the protected model supports C and C++ code generation. Optionally, add password protection.

  • on — A model that references the protected model can run in normal, accelerator, rapid accelerator, or external mode and can support C and C++ code generation. For password protection, create and verify a password with a minimum of eight characters.

  • off — The protected model does not support C or C++ code generation.

When you select this parameter, the software automatically selects Simulation.

Dependencies

To generate C and C++ code, you must have a Simulink Coder license.

Specify the interface for the generated code.

  • Model reference — A Model block that references the protected model can support C and C++ code generation and simulation in accelerator, software-in-the-loop (SIL), or processor-in-the-loop (PIL) mode. For SIL and PIL simulations, the software deploys the generated code as part of a larger application that uses the referenced model. The generated artifacts match those generated by the slbuild function with the "ModelReferenceCoderTarget" build specification.

  • Top model — A Model block that references the protected model can support simulation in accelerator, software-in-the-loop (SIL), or processor-in-the-loop (PIL) mode. For SIL and PIL simulations, the software deploys the generated code as a standalone application. The generated artifacts match those generated by the slbuild function with the "StandaloneCoderTarget" build specification.

SIL and PIL simulations can verify the protected model code.

Dependencies

To enable this parameter:

  • Select Code generation.

  • Set the System target file configuration parameter to an ERT-based system target file, for example, ert.tlc. This option requires an Embedded Coder license.

Specify the appearance of the generated code.

  • Binaries — Include only compiled binaries and headers for the generated code. The binary files and headers are visible.

  • Obfuscated source code — Include header files found on the include path. The code in the build folder and the headers referenced by the code are visible, but obfuscated.

  • Readable source code — Include header files found on the include path. The code in the build folder, the headers referenced by the code, and the code comments are visible and readable.

This table compares the Content type parameter values to the corresponding Simulink.ModelReference.protect function argument values.

Content type ValueOutputFormat ValueObfuscateCode Value
Binaries'CompiledBinaries'true
Obfuscated source code'AllReferencedHeaders'true
Readable source code'AllReferencedHeaders'false

Tips

To include only the minimal header files required to build the code with the chosen build settings, use the Simulink.ModelReference.protect function with OutputFormat set to 'MinimalCode'.

Dependencies

To enable this parameter, select Code generation.

Specify whether the protected model supports HDL code generation. Optionally, add password protection.

  • on — A model that references the protected model can run in normal, accelerator, or rapid accelerator mode and can support HDL code generation. For password protection, create and verify a password with a minimum of eight characters.

  • off — The recipient cannot generate HDL code for the protected model.

When you select this parameter, you also select Simulation.

Dependencies

To generate HDL code, you must have an HDL Coder license.

Since R2024b

Specify a custom text tag with information that is relevant to the protected model.

Being able to trace a protected model to the corresponding version of the design file can be useful for debugging. To store file provenance information in a protected model, specify a custom text tag with information such as the job number, Git™ commit, or continuous integration system tag associated with creating the protected model.

The tag length must not exceed 256 characters.

Simulation Options

Since R2022a

Select the parameters from external data sources that you want the recipient to be able to tune during simulation.

The model protection process honors the tunability of parameters in the model workspace. Model arguments are inherently tunable. You do not need to specify the tunability of model arguments.

To compile the model and list the tunable parameters from external data sources, click Refresh. (since R2023b)

Select the tunable parameters individually, or click Select All.

For more information about tunable parameters for simulation, see Tune and Experiment with Block Parameter Values.

For code generation, parameters with non-automatic storage classes are tunable. For more information, see Storage Classes for Parameters and Signals Used in Model Blocks.

Save Options

Specify the path of the folder to contain the generated files.

Dependencies

The model being protected must be on the MATLAB® path. For more information, see What Is the MATLAB Search Path?

Since R2020b

Specify whether to package supporting files, including a harness model, with the protected model in a project archive. The type and number of supporting files depends on the model being protected. Examples of supporting files are a MAT file with base workspace definitions and a data dictionary pruned to relevant definitions. The supporting files are not protected.

  • on — Create a project archive (.mlproj) that contains the protected model, its dependencies, and its harness model. The supporting files are not protected. The project archive is a single file that allows for easy sharing. To create the interactive project, open the project archive.

    Before R2024a: Set Contents to Protected model (.slxp) and dependencies in a project.

  • off — Create only the protected model. If the protected model has dependencies, you must share them separately. Similarly, if you create a harness model for the protected model, you must share the harness model separately.

    Before R2024a: Set Contents to Protected model (.slxp) only.

Tips

Before sharing the project, check whether the project contains the required supporting files. If supporting files are missing, simulating or generating code for the related harness model can help identify the missing files. Add the missing dependencies to the project and update the harness model as needed. For more information, see Manage Project Files.

Dependencies

To enable this parameter, select Simulation.

Specify whether to create a harness model for the protected model. The harness model provides an isolated environment for the protected model, which is referenced by a Model block.

  • on — Create a harness model for the protected model.

  • off — Do not create a harness model for the protected model.

When you create a harness model for a protected model that relies on base workspace definitions, Simulink creates a MAT file that contains the required base workspace definitions.

The harness model must have access to supporting files, such as a MAT file with base workspace definitions or a data dictionary.

Dependencies

To clear this parameter, perform one of these actions:

  • Clear Package protected model with dependencies in a project.

  • Clear Simulation.

Since R2020b

Specify the name of the project archive that contains the generated files. The project inside the archive uses the same name.

If you do not specify a custom name, the default name for the project is the protected model name followed by _protected.

Dependencies

To enable this parameter, select Package protected model with dependencies in a project.

Tips

  • To create a protected model programmatically, use the Simulink.ModelReference.protect function.

    • This function provides options that the Protected Model Creator does not support. For example, you can create a modifiable protected model, add callbacks to the protected model, sign the protected model with a digital certificate, and add a postprocessing function for protected model files.

    • When you create a protected model with this function, you must specify whether to generate the protected model report. The function does not generate this report by default.

  • The Protected Model Creator caches your settings for a model during a MATLAB session. If you close and reopen the Protected Model Creator, the cached settings persist. To restore the default settings, click Reset. Passwords and tunable parameter selections are not cached. (since R2023b)

Version History

Introduced in R2012b

expand all