Choosing a Range Collection Method
The Fixed-Point Tool automates the task of specifying fixed-point data types in a
Simulink® model. You can choose to use an iterative fixed-point conversion process, also
known as autoscaling, or you can optimize data types in your model
using fxpopt
. The Fixed-Point Tool also lets you explore the numerical
behavior of floating-point vs fixed-point data types in your model.
The tool collects range data for model objects from design minimum and maximum values that objects explicitly specify, from logged minimum and maximum values that occur during simulation, or from the minimum and maximum values derived using static range analysis.
Method | Advantages | Disadvantages |
---|---|---|
Using simulation minimum and maximum values |
|
|
Using design minimum and maximum values | You can use this method if the model contains blocks that range analysis does not support. However, if possible, use simulation data to propose data types. |
|
Using derived minimum and maximum values | You do not have to simulate multiple times to ensure that simulation data covers the full intended operating range. |
|
In the Fixed-Point Tool, you can choose between three range collection modes:
Simulation ranges – Collect ranges through simulation. To collect and merge the ranges of multiple simulation runs, you can specify simulation inputs.
Derived ranges – Collect ranges through a static analysis that derives the ranges, also known as range analysis.
Simulation with Range Analysis – Collect ranges through simulation and derived range analysis and combine the results.
Feature | Simulation Ranges | Derived Ranges | Simulation with Range Analysis |
---|---|---|---|
Range coverage | Proposed data types are based on simulation ranges. The proposals provided by the Fixed-Point Tool are as good as the test bench provided. Data type proposals are based on collected minimum and maximum values. | Static range analysis typically delivers a more conservative data type proposal. Data type proposals are based on collected minimum and maximum values. | Proposed data types are based on the union of simulation ranges and derived ranges. Data type proposals are based on collected minimum and maximum values. This option provides the most comprehensive range information. |
Simulation inputs | Comprehensive set of input signals that exercise the full range of your design. This allows you to collect and merge ranges from multiple simulation input cases. | Ranges reported from derivation are based only on design ranges specified in the model. Simulation inputs are not used to derive ranges. | Ranges are based on the combination of merged simulation ranges and ranges derived from design ranges specified in the model. |
Design ranges | Simulation ranges are verified against design range specification and violations are reported in the Diagnostic Viewer. | Design ranges must be specified on the model. Data type proposals are based on collected minimum and maximum values. | Simulation ranges are verified against design range specification. To derive ranges, design ranges must be specified on the model. |
Supported Features | All model objects are supported for instrumentation and range collection. | Range analysis supports a subset of model objects. For more information, see Unsupported Simulink Software Features. | Range analysis supports a subset of model objects. For more information, see Unsupported Simulink Software Features. |
Modeling constructs | Ranges always converge during simulation. | Some modeling constructs, such as feedback loops, may require more design range information before converging. | Simulation ranges always converge. Some modeling constructs, such as feedback loops, may require more design range information before derived ranges converge. |
Tunable parameters with known ranges | You must exercise the full tunable range using simulation inputs. | Design ranges of tunable parameters are reported. | Design ranges of tunable parameters are reported. You can additionally exercise the tunable range using simulation inputs. |
Simulation mode | Instrumentation data is only collected during Normal mode. No instrumentation data is collected while a model is running in accelerator or rapid accelerator mode. If you know that simulation will take a long time, you may want to derive ranges for your model. | Simulation mode has no affect on range analysis. | Instrumentation data is only collected during Normal mode. No instrumentation data is collected while a model is running in accelerator or rapid accelerator mode. If you know that simulation will take a long time, you may want to derive ranges for your model. |
Based on collected range information, the tool proposes fixed-point data types that maximize precision and cover the range. The Fixed-Point Tool allows you to review the data type proposals and then apply them selectively to objects in your model.