Main Content

Explore Protected Model Capabilities

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 the Example Model

Open and simulate the example model named sldemo_mdlref_bus.

Block diagram with a Model block

Protect the Referenced Model

The example model contains one Model block named CounterA. To protect the model referenced by this block, 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.

Under Supported functionality, select Read-only view, Simulation, and Code generation. To password-protect these actions, you can enter a unique password for each action. Then, click Create.

A project archive named sldemo_mdlref_counter_bus_protected.mlproj is generated for the protected model in the specified destination folder.

Double-click the project archive in the Current Folder browser to open the corresponding project, which contains the protected model sldemo_mdlref_counter_bux.slxp. The project also 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.

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 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

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

Protected model report

See Also

(Simulink Coder)

Related Topics