After setting up your model as described in Set Up the Model, use
the Fixed-Point Tool to prepare the system for conversion. To open the Fixed-Point Tool, in
your model, in the Apps gallery, select Fixed-Point
Tool. Alternatively, use the
In the Fixed-Point Tool, click New and select
Select the system or subsystem you want to convert to fixed point. Convert individual subsystems in your model one at a time. This practice facilitates debugging by isolating the source of numerical issues.
In the main working area, under System Under Design (SUD), use the drop-down menu to select the system or subsystem you want to convert.
You can collect ranges through simulation, derived range analysis, or by using simulation combined with derived range analysis. Using simulation-based range collection, the Fixed-Point Tool performs a global override of the fixed-point data types with double-precision data types, avoiding quantization effects. This setting provides a floating-point benchmark that represents the ideal output.
Using derived range analysis, the Fixed-Point Tool uses design ranges specified on blocks to analyze and derive static ranges for other objects in your model. The tool uses all design range information specified on the model to derive ranges for objects in the system under design.
Using simulation with range analysis, the Fixed-Point Tool uses the union of the ranges collected through simulation and derived range analysis.
If you choose to collect ranges for objects in your model through derived range analysis, you do not need to simulate the model. However, to compare floating-point and fixed-point behavior using the Simulation Data Inspector, simulation is required.
Under Range Collection Mode, select the method that you want to use to collect ranges. The Fixed-Point Tool uses these collected ranges to later generate data type proposals.
For more information on deciding which method of range collection is right for your application, see Choosing a Range Collection Method.
If you choose to collect ranges through simulation, you must specify the simulation
input for your system. Under Simulation Inputs, select whether to use
the default model inputs to simulate the model for range collection, or select a
Simulink.SimulationInput object from the base workspace to specify one or more
SimulationInput object that you select contains more than one
simulation scenario, the Fixed-Point Tool proposes data types based on the merged ranges
from all simulation scenarios.
You can specify absolute, relative, and time tolerances for signals in your model that have signal logging enabled. After converting your system, when you simulate the embedded run, the Workflow Browser displays whether the embedded run meets the specified signal tolerances compared to the baseline run established during range collection. You can view the comparison plots in the Simulation Data Inspector.
Specify signal tolerances in the table under Signal Tolerances. The table contains all signals in the model with signal logging enabled. In the boxes to the right of the signal for which you want to register a tolerance, enter the tolerances for the signal. You can specify any of the following types of tolerances.
Abs Tol – Absolute value of the maximum acceptable difference between the original signal, and the signal in the converted design.
Rel Tol – Maximum relative difference, specified as a
percentage, between the original output, and the output of the new design. For
example, a value of
1e-2 indicates a maximum difference of one
percent between the original signal values, and the signal values of the converted
Time Tol (seconds) – Time interval, in which the maximum and minimum values define the upper and lower values to compare against.
Click the Prepare button. The Fixed-Point Tool creates a backup version of the model and checks the system under design and the model containing the system under design for compatibility with the conversion process.
When possible, the Fixed-Point Tool automatically changes settings that are not compatible. In cases where the tool is not able to automatically change the settings, it notifies you of the changes you must make manually to help the conversion process be successful.
To learn about the next step in the conversion process, see Collect Ranges.