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 modelsldemo_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 clickProtecton theModel Blocktab in the toolstrip. A dialog box opens where you can select options for creating a protected model.

UnderAllow user of protected model to, selectOpen read-only view of model,Simulate, andUse generated code. To password-protect these actions, you can enter a unique password for each action. Then, clickCreate.

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 theCurrent Folderbrowser 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.

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

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

See Also

(Simulink Coder)

Related Topics