| Contents | Index |
| Workflow for Automatic Data Typing Using Simulation Data | ||
|---|---|---|
| 1. Prerequisites | ||
| 1.1 | Open your model in Simulink and set it up for use with the Fixed-Point Tool. | |
| 1.2 | From the Simulink Tools menu, select Fixed-Point Tool to open the Fixed-Point Tool. | |
| 2. Prepare the model for conversion | ||
| 2.1 | In the Fixed-Point Tool Model Hierarchy pane, select the system or subsystem of interest. | |
| 2.2 | In the Fixed-point preparation for selected system pane, click Fixed-Point Advisor. | |
| 2.3 | Use the Fixed-Point Advisor to prepare the model for conversion. See Fixed-Point Advisor Reference. | |
| 3. Run the model to gather floating-point benchmark | ||
| 3.1 | Enable signal logging for system or subsystem of interest:
For more information, see Signal Logging Options in the fxptdlg reference. | |
| 3.2 | In the Fixed-Point Tool Model Hierarchy pane, select the system or subsystem for which you want a data type proposal. | |
| 3.3 | In the Shortcuts to set up runs pane, click the Model-wide double override and full instrumentation button to set:
Using these settings, the Fixed-Point Tool performs a global override of the fixed-point data types and scaling using double-precision numbers, thus avoiding quantization effects. During simulation, the tool logs minimum value, maximum value, and overflow data for all blocks in the current system or subsystem in the run DoubleOverride. | |
| 3.4 | Click the Fixed-Point
Tool Start simulation button
The Fixed-Point Tool highlights any simulation results that have issues, such as overflows or saturations. | |
| 4 Propose data types | ||
| 4.1 | In the Automatic data typing for selected system Settings pane, select either Propose fraction lengths for specified word lengths or Propose word lengths for specified fraction lengths. | |
| 4.2 | If you have safety margins to apply, set Percent safety margin for design and derived min/max and Percent safety margin for simulation min/max as necessary. For more information, see Safety margin for simulation min/max (%) and Safety margin for design and derived min/max (%) in the fxptdlg reference. | |
| 4.3 | Click the Propose
fraction lengths or Propose word lengths button
If there are conflicts in your model, the Fixed-Point Tool displays the Result Details dialog box. If you do not see this warning, there are no conflicts in your model, skip the next step. | |
| 4.4 | Click OK on the Result Details dialog box to close it. | |
| 5. Examine results to resolve conflicts | ||
| 5.1 | Use the Show option on the Fixed-Point Tool toolbar to filter the results to show Conflicts with proposed data types. The Fixed-Point Tool alerts you to potential issues with the proposed data types by displaying a block icon annotated with red, yellow, and green symbols. | |
| 5.2 |
To review the error and correct the problem:
| |
| 5.3 |
Review
the Result Details for the
| |
| 5.4 | You have changed
the Simulink model, so the benchmark data is not up to date.
Click the Fixed-Point Tool Start button
The Fixed-Point Tool warns you that you have not applied proposals. Click the Ignore and Simulate button to continue. | |
| 5.5 | Click the Propose
fraction lengths or Propose word lengths button
to generate a data type proposal,
| |
| 5.6 | Use the Show option on the Fixed-Point Tool toolbar to filter the results to show All results. | |
| 6. Apply proposed data types | ||
| 6.1 | Examine each
result. For more information about a particular result, select the
result then click the Show details for selected result button
| |
| 6.2 | If you do not want to accept the proposal for a result, in the Fixed-Point Tool Contents pane, clear the Accept checkbox for that result. | |
| 6.3 | Click the Apply
accepted fraction lengths or Apply accepted
word lengths button
| |
| 7. Verify new settings | ||
| 7.1 | In the Shortcuts to set up runs pane, click the Model-wide no override and full instrumentation button to use the locally specified data type settings. This sets:
Using these settings, the Fixed-Point Tool simulates the model using the new fixed-point settings and logs minimum value, maximum value, and overflow data for all blocks in the current system or subsystem in the run NoOverride. | |
| 7.2 | Click the Fixed-Point
Tool Start button
| |
| 7.3 | Compare the ideal results stored in the DoubleOverride run with the fixed-point results in the NoOverride run.:
| |
To use the Fixed-Point Tool to generate data type proposals for your model based on simulation minimum and maximum values only, you must first set up your model in Simulink.
Open your model in Simulink.
Select Simulation > Normal in the Simulink menu to ensure the model runs in Normal mode.
If you are using design minimum and maximum range information, add this information to blocks.
You specify a design range for model objects using parameters typically titled Output minimum and Output maximum. See Blocks That Allow Signal Range Specification for a list of blocks that permit you to specify these values.
Specify fixed-point data types for blocks and signals in your model. For blocks with the Data Type Assistant, use the Calculate Best-Precision Scaling button to calculate best-precision scaling automatically. For more information, see Specifying Fixed-Point Data Types with the Data Type Assistant.
Note If you have a floating-point model, use the Fixed-Point Advisor to prepare your model for conversion to an equivalent fixed-point representation. To learn more about the Fixed-Point Advisor, see Fixed-Point Advisor. |
You can choose to lock some blocks against automatic data typing by selecting the Lock output data type setting against changes by the fixed-point tools parameter. If an object's Lock output data type setting against changes by the fixed-point tools parameter is selected, the tool does not propose data types for that object.
From the Simulink Edit menu, select Update Diagram to perform parameter range checking for all blocks in the model.
If update diagram fails, use the failure information to fix the errors in your model. After fixing the errors, test update diagram again. If you are unable to fix the errors, restore your backed up model.
Back up the model as a fallback in case of error and a baseline for testing and validation.
Create a shortcut to capture the initial fixed-point instrumentation and data type override settings. For more information, see How to Capture Current Model Settings Using the Shortcut Editor.
If you have a floating-point model or subsystem, first use the Fixed-Point Advisor to prepare the model or subsystem for conversion to fixed point. The Fixed-Point Advisor checks the model against fixed-point guidelines and provides advice about unsupported blocks. You need only do this preparation once.
From the Simulink Tools menu, select Fixed-Point Tool.
In the Fixed-Point Tool Model Hierarchy pane, select the system or subsystem of interest.
In the Fixed-point preparation for selected system pane, click Fixed-Point Advisor.
Use the Fixed-Point Advisor to prepare the model for conversion. See Fixed-Point Advisor Reference.
You first run the model with a global override of the fixed-point data types using double-precision numbers to avoid quantization effects. This provides a floating-point benchmark that represents the ideal output. The Simulink software logs the signal logging results to the MATLAB workspace. The Fixed-Point Tool displays the simulation results including minimum and maximum values that occur during the run.
Launch Fixed-Point Tool.
From the Simulink Tools menu, select Fixed-Point Tool.
Enable signal logging for the system or subsystem of interest. Using the Fixed-Point Tool you can enable signal logging for multiple signals simultaneously. For more information, see Signal Logging Options in the fxptdlg Reference.
To enable signal logging:
Select the system or subsystem in the Fixed-Point Tool Model Hierarchy pane.
Right-click to open the context menu.
Use the Enable Signal Logging option to enable signal logging, as necessary.
The Contents pane of the Fixed-Point Tool
displays an antenna icon
next to items that have
signal logging enabled.
In the Fixed-Point Tool Model Hierarchy pane, select the system or subsystem for which you want a proposal.
In the Shortcuts to set up runs pane, click the Model-wide double override and full instrumentation button to set:
Data type override to Double
Data type override applies to to All numeric types
Fixed-point instrumentation mode to Minimums, maximums and overflows
The run name (in the Data collection pane Store results in run field) to DoubleOverride
Using these settings, the Fixed-Point Tool performs a global override of the fixed-point data types with double-precision data types, thus avoiding quantization effects. During simulation, the tool logs minimum value, maximum value, and overflow data for all blocks in the current system or subsystem in the run DoubleOverride.
Click the Fixed-Point Tool Simulate button
to run the simulation.
The Fixed-Point Tool highlights any simulation results that have issues, such as overflows or saturations.
The Fixed-Point Tool proposes data types for model objects that specify fixed-point data types unless an object's Lock output data type setting against changes by the fixed-point tools parameter is selected or the data types are using inheritance rules.
When proposing data types, the Fixed-Point Tool collects the following types of range data for model objects:
Design minimum or maximum values — You specify a design range for model objects using parameters typically titled Output minimum and Output maximum. See Blocks That Allow Signal Range Specification for a list of blocks that permit you to specify these values.
Simulation minimum or maximum values — When simulating a system whose Fixed-point instrumentation mode parameter specifies Minimums, maximums and overflows, the Fixed-Point Tool logs the minimum and maximum values generated by model objects. For more information about the Fixed-point instrumentation mode parameter, see the documentation for the fxptdlg function.
Derived minimum or maximum values — When deriving minimum and maximum values for a selected system, the Fixed-Point Tool uses the design minimum and maximum values that you specify for the model to derive range information for signals in your model. For more information, see Range Analysis.
The Fixed-Point Tool uses available range data to calculate data type proposals according to the following rules:
Design minimum and maximum values take precedence over the simulation and derived range.
The Safety margin for design and derived min/max (%) parameter specifies a range that differs from that defined by the design range. For example, a value of 20 specifies that a range of at least 20 percent larger is desired. A value of -10 specifies that a range of up to 10 percent smaller is acceptable. If this parameter is not visible in the Automatic data typing for selected system pane, click the Configure link.
The tool observes the derived range only when the Derived min/max option is selected. Otherwise, the tool ignores the derived range.
The Safety margin for design and derived min/max (%) parameter specifies a range that differs from that defined by the derived range. For example, a value of 20 specifies that a range of at least 20 percent larger is desired. A value of -10 specifies that a range of up to 10 percent smaller is acceptable. If this parameter is not visible in the Automatic data typing for selected system pane, click the Configure link.
The tool observes the simulation range only when the Simulation min/max option is selected. Otherwise, the tool ignores the simulation range.
The Safety margin for simulation min/max (%) parameter specifies a range that differs from that defined by the simulation range. For example, a value of 20 specifies that a range of at least 20 percent larger is desired. A value of -10 specifies that a range of up to 10 percent smaller is acceptable. If this parameter is not visible in the Automatic data typing for selected system pane, click the Configure link.
On the Settings pane, select either Propose fraction lengths for specified word lengths or Propose word lengths for specified fraction lengths.
To use simulation min/max information only, clear Derived min/max.
If you have safety margins to apply:
Enter Safety margin for design and derived min/max (%), if applicable. For example, enter 10 for a 10% safety margin. If this parameter is not visible in the Automatic data typing for selected system pane, click the Configure link.
Enter Safety margin for simulation min/max (%), if applicable. If this parameter is not visible in the Automatic data typing for selected system pane, click the Configure link.
Click the Propose fraction lengths or Propose
word lengths button to generate a proposal,
.
If there are conflicts in your model, the Fixed-Point Tool displays the Result Details dialog box.
If you do not see this warning, there are no conflicts in your model, go to Applying Proposed Data Types.
You can examine each proposal using the Result Details dialog box, which displays the rationale underlying the proposed data types. Also, this dialog box describes potential issues or errors, and it suggests methods for resolving them. To open the dialog box:
In the Contents pane, select an object that has proposed data types.
Click the Show details for selected result button
.
The Result Details dialog box provides the following information about the proposed data types, as appropriate.
Details which run the result is in and the current data type specified for the selected object.
This section describes a proposal in terms of how it differs from the object's current data type. For cases when the Fixed-Point Tool does not propose data types, this section provides an explanation. For example, the data type might be locked against changes by the fixed-point tool.
This section lists potential issues and errors associated with data type proposals. It describes the issues and suggests methods for resolving them. The dialog box uses the following icons to differentiate warnings from errors.
|
| Indicates a warning message. |
|
| Indicates an error message. |
This section of the dialog box tells you that the selected object must share the same data type as other objects in the model because of data type propagation rules. For example, the inputs to a Merge block must have the same data type. Therefore, the outputs of blocks that connect to these inputs must share the same data type.
The dialog box provides a hyperlink that you can click to highlight the objects that share data types in the model. To clear this highlighting, from the model View menu, select Remove Highlighting.
The Fixed-Point Tool allocates an identification tag to objects that must share the same data type. The tool displays this identification tag in the DTGroup column for the object. To display only the objects that must share data types, from the Fixed-Point Tool main toolbar, select the Show option. For more information, see Main Toolbar in the fxptdlg reference documentation.
Some Simulink blocks are designed to accept only certain data types on some ports. This section of the dialog box tells you when a block that connects to the selected object has data type constraints that impact the proposed data type of the selected object. The dialog box lists the blocks that have data type constraints, provides details of the constrained data types, and links to the blocks in the model.
This section provides a table that lists model object attributes that influence its data type proposal.
| Item | Description |
|---|---|
Currently Specified Data Type | Data type that an object currently specifies. |
Proposed Data Type | Data type that the Fixed-Point Tool proposes for this object. |
Proposed Representable Maximum | Maximum value that the proposed data type can represent. |
Design Maximum | Design maximum value that an object specifies using, e.g., its Output maximum parameter. |
Simulation Maximum | Maximum value that occurs during simulation. |
Simulation Minimum | Minimum value that occurs during simulation. |
Design Minimum | Design minimum value that an object specifies using, e.g., its Output minimum parameter. |
Proposed Representable Minimum | Minimum value that the proposed data type can represent. |
The table also includes a column titled Percent Proposed Representable. This column indicates the percentage of the proposed representable range that each value covers. Overflows occur when values lie outside this range.
Shared Values. When proposing data types, the Fixed-Point Tool attempts to satisfy data type requirements that model objects impose on one another. For example, the Sum block provides an option that requires all of its inputs to have the same data type. Consequently, the table might also list attributes of other model objects that impact the proposal for the selected object. In such cases, the table displays the following types of shared values:
Initial Values
Some model objects provide parameters that allow you to specify the initial values of their signals. For example, the Constant block includes a Constant value parameter that initializes the block output signal. The Fixed-Point Tool uses initial values to propose data types for model objects whose design and simulation ranges are unavailable. When data type dependencies exist, the tool considers how initial values impact the proposals for neighboring objects.
Model-Required Parameters
Some model objects require the specification of numeric parameters to compute the value of their outputs. For example, the Table data parameter of an n-D Lookup Table block specifies values that the block requires to perform a lookup operation and generate output. When proposing data types, the Fixed-Point Tool considers how this "model-required" parameter value impacts the proposals for neighboring objects.
Click OK on the Result Details dialog box to close the dialog box.
On the Fixed-Point Tool toolbar, use the Show option to filter the results to show Conflicts with proposed data types.
The Fixed-Point Tool lists its data type proposals in the Contents pane under the ProposedDT column. The tool alerts you to potential issues for each object in the list by displaying a green, yellow, or red icon.
|
| The proposed data type poses no issues for this object. |
|
| The proposed data type poses potential issues for this object. |
|
| The proposed data type will introduce data type errors if applied to this object. |
Review and fix each
error.
Select the error, right-click and select Highlight Block In Model from the context menu to identify which block has a conflict.
Click the Show details for selected result button
to open the Result
Details dialog box.
Use the advice provided in the Needs Attention section of the Result Details dialog box to resolve the conflict by fixing the problem in the Simulink model.
Review the Result Details for
the
warnings and correct
the problem if necessary.
You have changed the Simulink model, so the benchmark
data is not up to date. Click the Fixed-Point Tool Start button
to rerun the simulation.
The Fixed-Point Tool warns you that you have not applied proposals. Click the Ignore and Simulate button to continue.
Click the Propose fraction lengths or Propose
word lengths button to generate a proposal,
.
Use the Show option on the Fixed-Point Tool toolbar to filter the results to show All results.
After reviewing the data type proposals, you are ready to apply the proposed data types to your model. The Fixed-Point Tool allows you to apply its data type proposals selectively to objects in your model. Use the Accept check box in the Contents pane to specify the proposals that you want to assign to model objects. The check box indicates the status of a proposal:
|
| The Fixed-Point Tool will apply the proposed data type to this object. By default, the tool selects the Accept check box when a proposal differs from the object's current data type. |
|
| The Fixed-Point Tool will ignore the proposed data type and leave the current data type intact for this object. |
|
| No proposal exists for this object. This occurs, for example, when the object specifies a data type inheritance rule or is locked against automatic data typing. |
Examine each result. For more information about a
particular result, select the result and then click the Show
details for selected result button
to display the Result
Details dialog box.
If you do not want to accept the proposal for a result, clear the Accept checkbox in the Fixed-Point Tool Contents pane for that result.
Tip The Fixed-Point Tool enables you to customize its proposals before applying them to your model. To do so, in the Contents pane, click a ProposedDT cell and edit the data type expression. See documentation for the fixdt function for information about specifying fixed-point data types. |
Click the Apply accepted fraction lengths or Apply
accepted word lengths button
to write the proposed
data types to the model.
After applying proposed data types to your model, you simulate the model using the fixed-point data types that you applied.
In the Fixed-Point Tool Model Hierarchy pane, select the system or subsystem for which you want a proposal.
In the Shortcuts to set up runs pane, click the Model-wide no override and full instrumentation button to use the locally specified data type settings. This shortcut also sets the run name to NoOverride
Click the Fixed-Point Tool Start button
to run the simulation.
Compare the ideal results stored in the DoubleOverride run with the fixed-point results in the NoOverride run:
In the Contents pane, select
a result that has logged signal data. These results are annotated
with the
icon.
Click the Difference Plot of Signal
to view the difference
between the fixed-point and double override runs for the selected
result.
Fixed-Point Tool can propose new data types for Simulink signal objects in the base or model workspace. If you accept the proposed data types, the Fixed-Point Tool will apply the new data types to the Simulink signal objects automatically.
Caution The Fixed-Point Tool does not save the changes to the signal object. You must save the changes before closing the model. If you delete or manipulate a signal object in the base workspace after automatic data typing, you must rerun the automatic data typing. |
![]() | Models That Might Cause Data Type Propagation Errors | Automatic Data Typing Using Derived Minimum and Maximum Values | ![]() |

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |