The Fixed-Point Tool uses range analysis to derive minimum and maximum values for objects in your model.
Requires a Fixed-Point Designer™ license.
Works only for compatible models. For more information, see Model Compatibility with Range Analysis.
Verify that your model is compatible with range analysis.
To use the Fixed-Point Tool to generate data type proposals for your model based on derived minimum and maximum values only, you must first set up your model in Simulink®.
Back up your model in case of error and as a baseline for testing and validation.
Open your model in Simulink.
Select Simulation > Normal in the Simulink menu so that the model runs in Normal mode. The Fixed-Point Tool supports only Normal mode.
To autoscale using derived data, you must specify design minimum and maximum values on at least the model inputs. The range analysis tries to narrow the derived range by using all the specified design ranges in the model. The more design range information you specify, the more likely the range analysis is to succeed. As the analysis is performed, it derives new range information for the model and then attempts to use this new information together with the specified ranges to derive ranges for the remaining objects in the model. For this reason, the analysis results might depend on block priorities because these priorities determine the order in which the software analyzes the blocks.
You specify a design range for model objects using parameters typically titled Output minimum and Output maximum. For a list of blocks that permit you to specify these values, see Blocks That Allow Signal Range Specification.
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 Specify Fixed-Point Data Types with the Data Type Assistant.
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 you select the Lock output data type setting against changes by the fixed-point tools parameter, the tool does not propose data types for that object.
From the Simulink Simulation 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 back-up model.
If the model changed, back up the model in case of error and as 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 Capture Model Settings Using the Shortcut Editor.
First use the Fixed-Point Advisor to prepare the model for conversion to fixed point. You do this preparation only once. The Fixed-Point Advisor gives advice about model and block configuration settings to prepare for automatic conversion to fixed point using the Fixed-Point Tool. The Fixed-Point Advisor:
Checks the model against fixed-point guidelines.
Identifies unsupported blocks.
Removes output data type inheritance from blocks.
Allows you to promote simulation minimum and maximum values to design minimum and maximum values. This capability is useful if you have not specified design ranges and you have simulated the model with inputs that cover the full intended operating range. For more information, see Specify block minimum and maximum values.
Runs simulation range detection diagnostics. When preparing the model for automatic data typing using derived data, you can complete the preparation without setting up signal logging and creating a simulation reference run. However, creating at least one simulation run is useful for early error detection. Simulating the model helps to verify that the design minimum and maximum values specified on the model are correct and that the model conforms to modeling guidelines.
To open the Fixed-Point Advisor:
From the Simulink Analysis menu, select Fixed-Point Tool.
On the Fixed-Point Tool Model Hierarchy pane, select the system or subsystem of interest.
On the Fixed-point preparation for selected system pane, click Fixed-Point Advisor.
Use the Fixed-Point Advisor to prepare the model for conversion. For more information, see Preparation for Fixed-Point Conversion.
On the Fixed-Point Tool Model Hierarchy pane, select the system or subsystem of interest.
On the Settings for selected system pane,
set Data type override to
Optionally, in the Data collection pane Run name field, specify a run name. Specifying a unique run name avoids overwriting results from previous runs.
In the Fixed-Point Tool, click Derive ranges for selected system.
The analysis runs and tries to derive range information for objects in the selected system.
If the analysis successfully derives range data for the model, the Fixed-Point Tool displays the derived minimum and maximum values for the blocks in the selected system. (See View Derived Ranges in the Fixed-Point Tool.) Before proposing data types, review the results.
If the analysis fails, examine the error messages and resolve the issues. See Resolve Range Analysis Issues.
The following table shows the different types of range analysis issues and the steps to resolve them.
|Analysis Results||Next Steps||For More Information|
The analysis fails because the model contains blocks that it does not support. The Fixed-Point Tool generates an error.
Review the error message information and replace the unsupported blocks.
The analysis cannot derive range data because the model contains conflicting design range information. The Fixed-Point Tool generates an error.
Examine the design ranges specified in the model to identify inconsistent design specifications and modify them to make them consistent.
|Fixing Design Range Conflicts|
The analysis cannot derive range data for an object because there is insufficient design range information specified on the model. The Fixed-Point Tool highlights the results for the object.
Examine the model to determine which design range information is missing.
|Providing More Design Range Information|
Unless you select an object's Lock output data type setting against changes by the fixed-point tools parameter or the data types are using inheritance rules, the Fixed-Point Tool proposes data types for model objects that specify fixed-point data types. You set up the tool to either propose fraction lengths for specified word lengths or to propose word lengths for specified fraction lengths. For more information, see Propose Fraction Lengths and .
When generating data type proposals, 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. For a list of blocks that permit you to specify these values, see Blocks That Allow Signal Range Specification.
Simulation minimum or maximum values — When
simulating a system whose Fixed-point instrumentation mode parameter
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
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 Derive Ranges.
For models that contain floating-point operations, range analysis might report a range that is slightly larger than expected due to rounding errors in the analysis. Automatic data typing bases its proposal on this slightly larger derived range. To avoid this issue, use the safety margin for design and derived min/max.
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.
For more information, see Safety margin for design and derived min/max (%) in
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 more information, see Percent
safety margin for design and derived min/max in the
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 more information, see Safety margin for simulation min/max (%) in the
On 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, as applicable.
If these options are not visible, use the Configure link to display them.
If you have a safety margin to apply, set Safety
margin for design and derived min/max (%). For example,
10 for a 10% safety margin.
Click the Propose fraction lengths or Propose word lengths button to generate a proposal, .
Note: When the Fixed-Point Tool proposes data types, it does not alter your model.
You can examine each data type proposal using the Result Details tab, which displays the rationale underlying the proposal. Also, this tab describes potential issues or errors, and provides methods for resolving them. To view the details, on the Contents pane, select an object that has proposed data types and click the Result Details tab in the upper right corner of the Fixed-Point Tool.
The Result Details tab provides the following information about the proposed data type, as appropriate.
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 a rationale. For example, the data type might be locked against changes by the fixed-point tools.
This section of the Result Details tab also informs you if 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. Similarly, blocks that are connected by the same element of a virtual bus must share the same data type.
The tab 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.
Some Simulink blocks accept only certain data types on some ports. This section of the Result Details tab also informs 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 tab lists the blocks that have data type constraints, provides details of the constrained data types, and links to the blocks in the model.
The Proposed Data Type Summary section of the Result Details tab provides a table with the proposed data type information.
Data type that the Fixed-Point Tool proposes for this object and the minimum and maximum values that the proposed data type can represent.
Data type that an object specifies.
Lists potential issues and errors associated with data type proposals. Describes the issues and suggests methods for resolving them. The tab uses the following icons to differentiate warnings from errors.
Indicates a warning message.
Indicates an error message.
Provides a table that lists a model object attributes that influence its data type proposal.
Design maximum and minimum values that an object specifies, e.g., its Output maximum and Output minimum parameters.
Maximum and minimum values that occur during simulation.
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 data type proposal for the selected object. In such cases, the table displays the following types of shared 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.
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.
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 on 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 from the context menu, select Highlight Block In Model to identify which block has a conflict.
Click the Result Details tab.
Use the information provided in the Needs Attention section of the Result Details tab 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 data type proposal, .
On the Fixed-Point Tool toolbar, use the Show option to filter the results to show All results.
After reviewing the data type proposals, 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. On the Contents pane, use the Accept check box 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, 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 Result Details tab.
If you do not want to accept the proposal for a result, on the Fixed-Point Tool Contents pane, clear the Accept check box for that result.
Before applying proposals to your model, the Fixed-Point Tool
enables you to customize them. On the Contents pane,
click a ProposedDT cell and edit the data type
expression. 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.
If you have not fixed all the warnings in the model, the Fixed-Point Tool displays a warning dialog box.
From the model's Simulation menu, select Update Diagram.
After applying the data types to the model, update diagram to check for data type propagation issues.
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.