Main Content

Include custom code for referenced models

Option to use custom code in model reference simulation target

Model Configuration Pane: Model Referencing

Description

The Include custom code for referenced models configuration parameter lets you use custom code for model reference simulation target builds for accelerator mode simulation.

Use the Model Configuration Parameters: Simulation Target pane to specify the custom code file.

Caution

Using custom code for referenced models in accelerator mode can produce different results than if you simulate the model without using the custom code. If the custom code includes declarations of structures for buses or enumerations, the model reference simulation target generation fails if the build results in duplicate declarations of those structures. Also, if the custom code uses a structure that represents a bus or enumeration, you might get unexpected simulation results.

Set Configuration Parameter for Referenced Model

In a model reference hierarchy, how you open the Configuration Parameters dialog box determines whether you edit the configuration parameter for the top model in the current model hierarchy or the current referenced model.

  • Top model in the current model hierarchy — In the Simulink® Toolstrip, on the Modeling tab, click Model Settings.

  • Current referenced model — In the Simulink Toolstrip, on the Modeling tab, click the Model Settings button arrow. Then, in the Referenced Model section, select Model Settings.

Alternatively, open the referenced model as a top model. Then, in the Simulink Toolstrip, on the Modeling tab, click Model Settings.

Settings

off (default) | on
off

Ignore custom code during model reference accelerator mode simulation.

on

Use custom code with blocks such as Stateflow®, MATLAB Function, or C Caller blocks during model reference accelerator mode simulation.

Recommended Settings

ApplicationSetting
DebuggingNo impact
TraceabilityNo impact
EfficiencyNo impact
Safety precautionoff

Programmatic Use

Parameter: SupportModelReferenceSimTargetCustomCode
Values: 'on' | 'off'
Default: 'off'

Version History

Introduced in R2018a