This example shows how to specify custom data type override settings to use during the range collection step in the Fixed-Point Tool.
By default, the Fixed-Point Tool honors the data types and any data type override specified on the model. You can use the Fixed-Point Tool to override data types in your model with doubles, singles, or scaled doubles. To specify custom data type overrides for elements within your model, use theset_param
function.
Open thefxp_custom_dto
model. The model consists of three subsystems. Update the diagram (Ctrl+D) to display the data types currently set on the model.
open_system('fxp_custom_dto')
The original model uses the double-precision data type for each of the three subsystems within the model.
To override the data types inSubsystem A
andSubsystem C
with singles, use theset_param
function:
set_param('fxp_custom_dto/Subsystem A','DataTypeOverride','Single'); set_param('fxp_custom_dto/Subsystem C','DataTypeOverride','Single');
Update the diagram and inspect the model to confirm that the data type override has been applied.
In theAppstab of thefxp_custom_dto
model, selectFixed-Point Tool.
In the Fixed-Point Tool, selectNew > Range Collection. UnderSystem Under Design (SUD), selectfxp_custom_dto
. UnderRange Collection Mode, selectSimulation Ranges.
UnderCollect Ranges, selectUse current settings. ClickCollect Ranges.
The Fixed-Point Tool collects ranges via simulation using the current data type override applied to your model. In this example, the data types ofSubsystem A
andSubsystem C
are overrode with singles, andSubsystem B
remains in double precision.
To verify that the custom data type override settings specified using theset_param
function were applied to the model during the range collection run, inspect theResultsspreadsheet in the Fixed-Point Tool.
编译后的数据类型(CompiledDT) column forBaselineRun
shows thatSubsystem A
andSubsystem C
used thesingle
data type, while the rest of the model was simulation using thedouble
data type.
When you simulate a model that contains referenced models, the data type override settings for the top-level model do not control the settings for the referenced models. You must specify these settings separately for referenced models, and if the settings must be consistent. 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, then data type propagation issues might occur.
When you change the 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.
Fixed-Point Instrumentation and Data Type Override|将一个引用Fi模型xed Point