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

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 and click Protect on the Model Block tab in the toolstrip. A dialog box opens where you can select options for creating a protected model.

Under Allow user of protected model to, select Open read-only view of model, Simulate, and Use generated code. To password-protect these actions, you can enter a unique password for each action. Then, click Create.

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

Double-click the project archive in the Current Folder browser to open the corresponding project that 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 accelerate simulation and code generation.

Use the Protected Model

When a Model block references a protected model, the block displays a 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.

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

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

See Also

(Simulink Coder)

Related Topics