Protected Model Creator - Specify model protection options and protect model - MATLAB (original) (raw)

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:

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.

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.

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

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.

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.

When you select this parameter, the software automatically selectsSimulation.

Dependencies

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

Specify the interface for the generated code.

SIL and PIL simulations can verify the protected model code.

Dependencies

To enable this parameter:

Specify the appearance of the generated code.

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

Content type Value OutputFormat Value ObfuscateCode 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 theSimulink.ModelReference.protect function withOutputFormat set to'MinimalCode'.

Dependencies

To enable this parameter, select Code generation.

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

When you select this parameter, you also selectSimulation.

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, clickRefresh. (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.

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, selectSimulation.

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.

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:

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

Version History

Introduced in R2012b

expand all

The new Identifier tag parameter lets you specify custom text 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.

To focus on the high-level steps, the model protection process now displays limited build process information by default. The model protection process temporarily overrides the values of the Verbose accelerator builds and**Verbose build** configuration parameters.

To display verbose build process information during model protection, use theSimulink.ModelReference.protect function and set Verbose to true.

When you create a harness model for a protected model that has model arguments, the harness model uses the default instance parameter values for theModel block. Previously, the harness model inconsistently applied the instance parameter values.

The Create Protected Model dialog box is now called the Protected Model Creator. The available options rename the same.

Tabs now group the model protection options based on your goals:

Some options have new names.

The Contents menu is replaced by the Package protected model with dependencies in a project check box.

The Create Protected Model dialog box caches your settings for a model during a MATLAB session. If you close and reopen the dialog box, the cached settings persist. To restore the default settings, click Reset. Passwords and tunable parameter selections are not cached.

The Create Protected Model dialog box populates tunable parameters on demand. To compile the model and list tunable parameters, clickRefresh.

When you select Use generated code, the protected model supports external mode simulation.

When you create a protected model, you can specify which parameters recipients can tune during simulation. Select the tunable parameters individually, or clickSelect All.

For code generation, parameters with non-automatic storage classes are tunable.

When you create a protected model, you can now automatically package it with its dependencies and a harness model in a project archive. When the recipient extracts the contents of the project archive and opens the harness model, they should be able to simulate the protected model without needing to define missing variables or objects. Before sharing the project archive, check whether the project contains the required supporting files, and update the harness model as needed.

In the Create Protected Model dialog box, set Contents toProtected model (.slxp) and dependencies in a project. For Name of project archive (.mlproj), use the default name or specify a name. The project inside the project archive uses the same name.

For more information, see Package and Share Protected Models.