Documentation

Use Protected Model in Simulation

When you receive a protected model, it might be included in a protected model package. The package could include additional files, such as a harness model and a MAT-file. A protected model file has an .slxp extension. A typical workflow for using a protected model in a simulation is:

  1. If necessary, unpack the files according to any accompanying directions.

  2. If there is a MAT-file containing workspace definitions, load that MAT-file.

  3. If there is a harness model, copy the Model block referencing the protected model into your model.

  4. If the protected model is password protected, then right-click the protected-model badge icon and select Authorize. Enter the required passwords, and then click OK.

  5. If a protected model report was generated when the protected model was created, right-click the protected-model badge icon and select Display Report to open it. In the Summary of the report, check that your Simulink® version and platform match the software and platform used to create the protected model.

  6. Connect signals to the Model block that match its input and output port requirements.

  7. Provide any needed model argument values. See Assign Model Argument Values.

There are also other ways to include the protected model into your model:

  • Use your own Model block rather than the Model block in the harness model.

      Note:   When you change a Model block to reference a protected model, the Simulation mode of the block is set to Accelerator. You cannot change this mode. Furthermore, you cannot use the protected reference model block in External mode.

  • Start with the harness model, add more constructs to it, and use it in your model.

  • Use the protected model as a variant in a Model Variant block, as described in Set Up Model Variants.

  • Apply a mask to the Model block that references the protected model. See Masking.

  • Configure a callback function, such as LoadFcn, to load the MAT-file automatically. See Callbacks for Customized Model Behavior.

Now you can simulate the model that includes the protected model. Because the protected model is set to Accelerator mode, the simulation produces the same outputs that it did when used in Accelerator mode in the source model.

Protected Model Web View

The Web view is a read-only reference of the protected model. If the Web view functionality is enabled during creation, you can see this read-only view of a protected model. It is platform independent so you can view it on platforms other than the platform for which you created the protected model. To open the Web view of a protected model, use one of the following methods:

  • Right-click the protected-model badge icon and select Show Web view.

  • Use the Simulink.ProtectedModel.open function. For example, to display the Web view for protected model sldemo_mdlref_counter, you can call:

    Simulink.ProtectedModel.open(‘sldemo_mdlref_counter', ‘webview');

  • Double-click the .slxp protected model file in the Current Folder browser.

  • In the Block Parameter dialog box for the protected model, click Open Model.

Hover over a block in the model Web view to show the parameter values.

If the Web view is password protected, then right-click the protected-model badge icon and select Authorize. In the Model view box, enter the password, and then click OK.

Was this topic helpful?