Reference Protected Models from Third Parties - MATLAB & Simulink (original) (raw)

To deliver a model without revealing its intellectual property, third parties can protect the model before delivery. A protected model is a referenced model that does not support editing. The protected model author chooses whether to enable read-only view, simulation, code generation, and password protection. When an operation is password-protected, the AES-256 encryption technology protects the supporting file contents.

Note

Creating a protected model requires a Simulink® Coder™ license.

To identify protected models, look for:

If available, a protected model report describes the supported functionality. To open the report, use one of these options:

Alternatively, use the slxpinfo function. This function provides high-level information about the protected model even when the report is unavailable.

Load Supporting Files for Protected Model

You may receive the protected model on its own, in a project archive, or in a package.

If you receive a project archive (.mlproj), double-click the project archive in the Files panel and specify the destination folder. Alternatively, right-click the project archive and click Extract Here. The project opens, and the extracted files are in a new folder named after the project archive. Optionally, reference the protected model project from another project. For more information, see Componentize Large Projects.

If you receive a protected model or supporting files by another method, follow the provided instructions. For example, you might need to load a MAT file that contains workspace definitions. You can configure a callback function, such as LoadFcn, to load the MAT file automatically. See Customize Model Behavior with Callbacks.

Verify Digital Signature of Protected Model

If the author signed the protected model, verify the digital signature. In the Files panel, double-click the protected model. In the Details pane, theSigned by field indicates the publisher that signed the model and whether the signature is verified by a trusted certificate authority. Verification fails in these cases:

To verify the signature on protected models by default, in the Simulink Preferences dialog box, select Verify digital signature of protected model before opening.

View Protected Model Contents

Web view allows you to view this protected model information:

To open the read-only view, you can double-click the Model block referencing the protected model or the .slxp file in the Files panel. If the read-only view is password protected, right-click the protected-model badge icon and select . In the Model view box, enter the password, then click OK.

You can navigate the model hierarchy by double-clicking Model orSubsystem blocks. Alternatively, you can navigate to theView All tab and select the system that you want to view. You cannot view the content of protected referenced models in the protected model.

To view block parameters and signal properties, select a block or a signal line, respectively.

To search in Web view, click the search button, then enter the name or value that you want to search in the box that appears. The elements of the model that the search returns appear highlighted. The search results include the name and parent of each returned element.

Test Protected Model in Isolated Environment

With the protected model, you may receive a harness model, which typically has the suffix _harness. A harness model provides an isolated environment for you to test the protected model. If supporting files are missing, simulating or generating code for the harness model can help identify them.

To create a harness model, right-click the protected model file in the Files panel, then click Create Harness Model. The created harness model is set up for simulation of the protected model.

Reference Protected Model

To reference a protected model:

  1. Ensure that the protected model is on the MATLAB path.
  2. If you have a harness model, copy the Model block from the harness model into your model. Otherwise, reference the protected model in a new Model block. Open the Block Parameters dialog box and enter the name of the protected model in the Model name field.
    When a Model block references a protected model, theSimulation mode of the block becomesAccelerator. You cannot change this mode.
  3. If the protected model is password protected, right-click the protected-model badge icon on the Model block and click . In the Model view box, enter the password, then click OK.
  4. Connect signal lines to the Model block that match its input and output port requirements. See Define Model Reference Interfaces.
    Note that the protected model cannot use noninlined S-functions directly or indirectly.
  5. Provide the needed model argument values. See Configure Referenced Model to Use Model Arguments.

If you plan to simulate the protected model, use the same platform and compiler used to create the protected model. The software stores the protected model as a compiled MEX binary.

Use Models Protected in Previous Releases

Check that your current Simulink release supports the protected model.

If available, the protected model report shows the release versions used to create the protected model. Use the same Simulink release that was used to create the protected model unless the protected model also supports later releases, as described by this table.

Modeling Requirement Backward Compatibility for Protected Models
Read-only view Supported with limitations — R2019a and later releasesThe protected model must have been created in R2018b or a later release.The protected model must have been created within 10 releases of your current release.
Simulation in normal mode Supported with limitations — R2019a and later releasesThe protected model must have been created in R2018b or a later release.The protected model must have been created within 10 releases of your current release.
Simulation in accelerator mode Supported with limitations — R2020a and later releasesThe protected model must have been created in R2018b or a later release.You must directly simulate the parent of the protected model. Simulating a model hierarchy that contains the parent model as a referenced model is not supported. To interactively simulate the parent model, you must open it as the top model in its own window. For more information, see Navigate Model Hierarchy.The protected model must use Just-in-Time acceleration and must not require C code generation. For more information on acceleration modes, see How Acceleration Modes Work.The protected model must have been created within 10 releases of your current release.
Simulation in SIL or PIL mode Supported with limitations — R2020b and later releasesThe protected model contains ERT, ERT-based, AUTOSAR, GRT, or GRT-based code generated in R2018b or a later release. You can run Model block SIL and PIL simulations that reference the protected model. For more information, see Use Protected Models from Previous Releases to Perform SIL Testing and Generate Code (Embedded Coder).If ERT or AUTOSAR code in the protected model requires shared utility code, use sharedCodeUpdate (Embedded Coder) to copy the required code to an existing shared utility code folder. For more information, see Cross-Release Shared Utility Code Reuse (Embedded Coder). You cannot useSimulink.ModelReference.ProtectedModel.addTarget orSimulink.ModelReference.ProtectedModel.removeTarget to add or remove generated code from a protected model created in a different release.The protected model must have been created within 10 releases of your current release.
Simulation in rapid accelerator mode Not supported
Code generation Supported with limitations — R2020b and later releasesThe protected model contains ERT, ERT-based, AUTOSAR, GRT, or GRT-based code generated in R2018b or a later release, with aModel reference code interface. For more information, see Use Protected Models from Previous Releases to Perform SIL Testing and Generate Code (Embedded Coder).If ERT or AUTOSAR code in the protected model requires shared utility code, use sharedCodeUpdate (Embedded Coder) to copy the required code to an existing shared utility code folder. For more information, see Cross-Release Shared Utility Code Reuse (Embedded Coder).You cannot useSimulink.ModelReference.ProtectedModel.addTarget orSimulink.ModelReference.ProtectedModel.removeTarget to add or remove generated code from a protected model created in a different release.The protected model must have been created within 10 releases of your current release.

You cannot use a protected model from a newer release than your current release. For example, you cannot use a protected model from R2025a in R2024b.

See Also

Simulink.ProtectedModel.getPublisher | Simulink.ProtectedModel.verifySignature

Topics