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 compile the example model named sldemo_mdlref_bus
. To compile the model, on the Modeling tab of the Simulink Toolstrip, click Update Model or Run. Compiling the model updates the line styles, which you can use to visually identify buses.
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.
The Protected Model Creator opens and provides options for the protected model.
Under Supported functionality, select Read-only view, Simulation, and Code generation. Set Content type to Binaries
. To password-protect the supported functionality, 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_bus.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 .
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 Web view.
To open the protected model report, right-click the shield badge and select Display Report.
See Also
Simulink.ModelReference.protect
(Simulink Coder)
Related Topics
- Protect Models to Conceal Contents (Simulink Coder)
- Package and Share Protected Models (Simulink Coder)
- Reference Protected Models from Third Parties