Test Protected Models
To test a protected model that you created, compare the output of the protected model
to the output of the original model. Because you supply the protected model from the
original model, both the original and the protected model might exist on the MATLAB® path. In the parent model, if the Model block
Model name parameter names the model without providing a
suffix, the protected model takes precedence over the unprotected model. To override
this default when testing the output, in the Model block Model
name parameter, specify the file name with the extension of the
unprotected model, .slx
.
To compare the unprotected and protected versions of a Model block, use
the Simulation Data Inspector. This example uses sldemo_mdlref_basic
and the protected model, sldemo_mdlref_counter.slxp
, which is created
in Protect Models to Conceal Contents.
If it is not already open, open
sldemo_mdlref_basic
.openExample('sldemo_mdlref_basic');
Enable logging for the output signal of the Model block,
CounterA
. In the Configuration Parameters dialog box, in the Data Import/Export pane, select the Signal logging parameter. Click Apply and OK.Right-click the output signal. From the context menu, select
Properties
. In the Signal Properties dialog box, select Log signal data. Click Apply and OK. For more information, see Save Signal Data Using Signal Logging.Right-click the
CounterA
block. From the context menu, selectBlock Parameters (ModelReference)
. In the Block Parameters dialog box, specify the Model name parameter with the name of the unprotected model and the extension,sldemo_mdlref_counter.slx
. Click Apply and OK. Repeat this step forCounterB
block andCounterC
block.Simulate the model. When the simulation is complete, click the Data Inspector button to open the Simulation Data Inspector.
In the Simulation Data Inspector, rename the run to indicate that it is for the unprotected model.
In the Simulink® Editor, right-click the
CounterA
block. From the context menu, selectBlock Parameters (ModelReference)
. In the Block Parameters dialog box, specify the Model name parameter with the name of the protected model,sldemo_mdlref_counter.slxp
. A badge icon appears on the Model block. Repeat this step forCounterB
block andCounterC
block.Simulate the model, which now refers to the protected model. When the simulation is complete, a new run appears in the Simulation Data Inspector.
In the Simulation Data Inspector, rename the new run to indicate that it is for the protected model.
In the Simulation Data Inspector, click the Compare tab. From the Baseline and Compare To lists, select the runs from the unprotected and protected model, respectively. To compare the runs, click Compare Runs. For more information about comparing runs, see Compare Simulation Data.