Main Content

Simulink.ProtectedModel.createHarness

Create harness model that provides isolated environment for testing protected model

Since R2020b

Description

example

h = Simulink.ProtectedModel.createHarness(pname) creates and opens a harness model for the specified protected model. The harness model provides an isolated environment for testing the protected model. The name of the harness model is the name of the protected model followed by _harness.

h = Simulink.ProtectedModel.createHarness(pname,hname) specifies the name or path of the harness model.

Examples

collapse all

To test a protected model in an isolated environment, use the provided harness model or create a harness model for the protected model.

Suppose you receive a protected model named sldemo_mdlref_counter.slxp and do not receive a harness model for it. Using the same platform that was used to create the protected model, create a harness model for the protected model.

h = Simulink.ProtectedModel.createHarness('sldemo_mdlref_counter.slxp');

The harness model has three input ports, an input conversion subsystem, the protected model, an output conversion subsystem, and one output port.

The harness model is set up for simulation of the protected model.

Input Arguments

collapse all

Name of protected model, specified as a character vector or string scalar.

You can specify the name with or without the .slxp extension, however, you cannot specify a full path or partial path. The file must be on the MATLAB® path.

Example: Simulink.ProtectedModel.createHarness('model.slxp')

Data Types: char | string

Name of harness model being created, specified as a character vector or string scalar.

You can specify the name with or without the .slx extension.

To save the model in a specific location, specify the full path or a partial path for the harness model, including the name and extension. Otherwise, the harness model is saved in the working directory.

Example: Simulink.ProtectedModel.createHarness('model.slxp','harness.slx')

Data Types: char | string

Output Arguments

collapse all

Harness model, returned as a handle.

Data Types: double

Alternative Functionality

If you have a Simulink® Coder™ or HDL Coder™ license, create a harness model as part of the model protection process by using one of these options:

  • In the Protected Model Creator, select Package protected model with dependencies in a project or Create harness model for protected model.

  • Using the Simulink.ModelReference.protect (Simulink Coder), set 'Project' or 'Harness' to true.

Version History

Introduced in R2020b