Package and Share Protected Models

In addition to the protected model file (.slxp), you can include additional files in the protected model package. Some ways to deliver the protected model package are:

  • Provide the .slxp file and other supporting files as separate files.

  • Combine the files into a ZIP or other container file.

  • Combine the files by using a manifest. For more information, see Export Files in a Manifest (Simulink).

  • Provide the files in some other standard or proprietary format specified by the receiver.

Whichever approach you use to deliver a protected model, include information on how to retrieve the original files.

Harness Model

You can create a harness model when you create your protected model. The harness model contains a Model block that references the protected model. A third-party can use the Model block to reference your protected model.

MAT-File with Base Workspace Definitions

Referenced models can use object definitions or tunable parameters that are defined in the MATLAB® base workspace. These variables are not saved with the model. When you protect a model, you must obtain the definitions of required base workspace entities and ship them with the model.

The following base workspace variables must be saved to a MAT-file:

  • Global tunable parameter

  • Global data store

  • The following objects used by a signal that connects to a root-level model Inport or Outport:

    • Simulink.Signal

    • Simulink.Bus

    • Simulink.Alias

    • Simulink.NumericType that is an alias

To determine the required base workspace definitions and save them to a MAT-file, see Protected Models for Model Reference (Simulink). Before executing the protected model as a part of a third-party model, the receiver of the protected model must load the MAT-file.

Simulink Data Dictionary

Referenced models can use data definitions from a data dictionary, which are not saved with the model. When you protect a model that uses a data dictionary, package and ship the data dictionary with the protected model.

Protected Model File Contents

A protected model file (.slxp) consists of the derived files that support the options that you selected when you created the protected model. The derived files are unpacked when you or a third-party use the protected model in simulation. You do not need to package these derived files with the protected model.

The derived files that are unpacked depends on the support that you enabled when creating the protected model. The slprj/sim/model/* files are deleted after they are used.

This table illustrates the files that are unpacked depending on the options that you specified. If you specified the Use generated code or Code Interface options when creating the protected model, additional files are unpacked in the derived folder. To learn about these files, see Protected Model File Contents (Simulink Coder).

Protected Model Derived Files

Supported FunctionalityDerived Files
Created a protected model for simulation only and the referencing model is in Normal modeThe model.mexext file is placed in the build folder.
Created protected model for simulation only and referencing model is in Accelerator or Rapid Accelerator mode.

These files are unpacked in the slprj/sim/ folder:

  • slprj/sim/model/*.h

  • slprj/sim/model/modellib.a (or modellib.lib)

  • slprj/sim/model/tmwinternal/*

  • slprj/sim/_sharedutils/*

For the protected model report, these additional files are unpacked (but not in the build folder):

  • slprj/sim/model/html/*

  • slprj/sim/model/buildinfo.mat

Created protected model with HDL code generation support.

The files are unpacked in the hdlsrc folder: (Additional files depend on whether you enabled support for other options such as code generation).

  • hdlsrc/model/model.vhd (or model.v if you specified Verilog as the Target language).

  • hdlsrc/model/Subsystem.vhd (or Subsystem.v if you specified Verilog as the Target language of the model that you protected. The additional HDL files depend on how hierarchically the referenced model was designed).

  • hdlsrc/model/model_pkg.vhd (This file is not generated if you specified Verilog as the Target language of the model that you protected).

  • hdlsrc/model/model_report.html

  • hdlsrc/model/gm_model.slxp (This is a generated protected model. If you use cosimulation, HDL Coder™ instantiates this generated protected model).

See Also

Functions

Related Topics