Main Content

Control Fixed-Point Instrumentation and Data Type Override

The conversion of a model from floating point to fixed point requires configuring fixed-point instrumentation and data type overrides. However, leaving these settings on after the conversion can lead to unexpected results. If you do not have Fixed-Point Designer™, you can work with a model containing Simulink® blocks with fixed-point settings by turning off fixed-point instrumentation and setting data type override to scaled doubles.

Control Instrumentation Settings

The fixed-point instrumentation mode controls which objects log minimum, maximum, and overflow data during simulation. Instrumentation is required to collect simulation ranges using the Fixed-Point Tool. These ranges are used to propose data types for the model. When you are not actively converting your model to fixed point, disable the fixed-point instrumentation to restore the maximum simulation speed to your model.

To enable instrumentation outside of the Fixed-Point Tool, at the command line set the MinMaxOverflowLogging parameter to MinMaxAndOverflow or OverflowOnly.

set_param('MyModel', 'MinMaxOverflowLogging', 'MinMaxAndOverflow')

Instrumentation requires a Fixed-Point Designer license. To disable instrumentation on a model, set the parameter to ForceOff or UseLocalSettings.

set_param('MyModel', 'MinMaxOverflowLogging', 'UseLocalSettings')

Control Data Type Override

Use data type override to simulate your model using double, single, or scaled double data types. If you do not have Fixed-Point Designer software, you can still configure data type override settings to simulate a model that specifies fixed-point data types. Using this setting, the software temporarily overrides data types with floating-point data types during simulation.

set_param('MyModel', 'DataTypeOverride', 'Double')

To observe the true behavior of your model, set the data type override parameter to UseLocalSettings or Off.

set_param('MyModel', 'DataTypeOverride', 'Off')

Instrumentation Settings and Data Type Override for a Model Reference Hierarchy

When you simulate a model that contains referenced models, the data type override and fixed-point instrumentation settings for the top-level model do not control the settings for the referenced models. You must specify these settings separately for the referenced model. If the settings are inconsistent, for example, if you set the top-level model data type override setting to double and the referenced model to use local settings and the referenced model uses fixed-point data types, data type propagation issues might occur.

When you change the fixed-point instrumentation and data type override settings for any instance of a referenced model, the settings change on all instances of the model and on the referenced model itself.

Related Topics