Protected Model Capabilities - MATLAB & Simulink (original) (raw)

This example shows how to create a protected model and use it in normal mode simulation, accelerator mode simulation, and code generation.

To create protected models, you must have Simulink® Coder™ installed. To generate the read-only view of protected models, you must have Simulink® Report Generator™ installed.

Open Example Model

To open the IterativeCounter project, open the example. The project opens the CounterSystem model at startup.

To update the line styles, update the model. On the Modeling tab of the Simulink® Toolstrip, click Update Model. You can use the line styles to visually identify buses.

Model CounterSystem

Protect the Referenced Model

The Model block references a model named CounterAlgorithm. To protect the referenced model, select the Model block. Then, in the Simulink Toolstrip, on the Model Block tab, click Protect.

Model Block tab with pointer on Protect button

The Protected Model Creator opens and provides options for the protected model.

For this example, under Supported functionality, select Read-only view, Simulation, and Code generation. To password-protect the supported functionality, enter a password for each action. To include only compiled binaries and headers for the generated code, set Content type to Binaries.

Protected Model Creator

To generate the protected model according to the specified options, click Create.

By default, a project archive named CounterAlgorithm_protected.mlproj is generated for the protected model in the specified destination folder. The project archive packages the protected model CounterAlgorithm.slxp and its dependencies for easy sharing. For example, the project archive contains a harness model that provides an isolated environment for the protected model and a data dictionary that defines the variables used by the protected model.

To create a project from the project archive, double-click the project archive. To use the protected model, you can reference the protected model project from another project.

You can use the protected model in normal mode simulation, accelerator mode simulation, and code generation. You can also open a read-only view of the model. The original model file is not required.

The protected model is already compiled, which can speed up simulation and code generation.

Use the Protected Model

When a Model block references a protected model, the block displays a shield badge .

Model block with shield badge

To enable password-protected functionality, right-click the shield badge and select Authorize. Enter the passwords you set while creating the protected model.

Protected model password dialog box

After entering the passwords, you can simulate the model in either normal or accelerator mode. You can also generate code for the top model.

To open a read-only view of the protected model, double-click the Model block or right-click the shield badge and select Show Web view.

Protected model read-only view with Property Inspector collapsed

To open the protected model report, right-click the shield badge and select Display Report.

Protected model report

See Also

Tools

Functions

Topics