Package and Share Protected Models - MATLAB & Simulink (original) (raw)

Main Content

When you protect a model, you can automatically create and package the following contents in a project archive (.mlproj) for easy sharing:

In the Protected Model Creator, select Package protected model with dependencies in a project.

Note

Before sharing the project, check whether the project contains the required supporting files. If supporting files are missing, simulating or generating code for the related harness model can help identify the missing files. Add the missing dependencies to the project and update the harness model if required.

Alternatively, you can use one of these options to deliver the protected model package:

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. The harness model is set up for simulation of the 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.

For example, if the model uses the following base workspace variables, they must be saved to a MAT-file:

To determine the required base workspace definitions and save them to a MAT-file, seeProtected Model Capabilities. Before executing the protected model as a part of a third-party model, the receiver of the protected model must load the MAT-file.

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 select when you create the protected model. The derived files are unpacked when you or a third party use the protected model in simulation or code generation.

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

This table provides the files that are unpacked depending on the options that you specify. If you specify the Code generation or Code interface options when you create the protected model, additional files are unpacked in the derived folder. To learn about these files, see Protected Model File Contents.

Supported Functionality Derived Files
Simulation only and the referencing model simulates in normal mode The_model_.mexext file is placed in the build folder.
Simulation only and the referencing model simulates in accelerator or rapid accelerator mode These files are unpacked in the slprj/sim/ folder: slprj/sim/model/*.hslprj/sim/model/ _model_lib.a (or_model_lib.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
HDL code generation These 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 (model.v if you specifiedVerilog as the Target language.)hdlsrc/model/ Subsystem.vhd (Subsystem.v if you specifiedVerilog 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 file is a generated protected model. If you use cosimulation, HDL Coderâ„¢ software instantiates this generated protected model.)

See Also

Functions

Topics