Data Type Optimization Not Successful
Issue
You can use the fxpopt
function or the Optimized Fixed-Point
Conversion
workflow in the Fixed-Point Tool to optimize the data
types of a model or subsystem. Sometimes, the optimization is not successful. The
following sections describe how to troubleshoot these cases.
Possible Solutions
Unable to Model Problem — No Constraints Specified
To determine if the behavior of a new fixed-point implementation is
acceptable, the optimization requires well-defined behavioral constraints. Use
the addTolerance
method of the fxpOptimizationOptions
class to specify numerical constraints for
the optimized design. Alternatively, use blocks from the Model Verification
library. For more information, see Specify Behavioral Constraints.
Unable to Model Problem — Model Is Not Supported
The model containing the system you want to optimize must have the following characteristics:
All blocks in the model must support fixed-point data types.
The design ranges specified on blocks in the model must be consistent with the simulation ranges.
If the model contains a MATLAB Function block, it must use MATLAB® language features supported for fixed-point conversion. For more information, see MATLAB Language Features Supported for Automated Fixed-Point Conversion.
The data logging format of the model must be set to
Dataset
.To configure this setting, in the Configuration Parameters, in the Data Import/Export pane, set Format to
Dataset
.The model must have finite simulation stop time.
Data Type Conversion Blocks Were Ignored by Optimization
When the Input and output to have equal parameter of a
Data Type Conversion block is set to Stored
Integer (SI)
, the Data Type Conversion block
will be ignored by the optimization.
Unable to Find a Fixed-Point Implementation That Met the Tolerances
If the optimization cannot find a feasible solution, try these solutions:
Relax signal tolerances.
Allow larger word lengths to expand the search space.
Consider using time windows when specifying signal tolerances. For more information, see Tolerance Computation.
Instead of specifying low-level tolerances on individual signals, consider specifying high-level behavioral constraints using blocks from the Model Verification library. For more information, see Specify Behavioral Constraints.
Unable to Explore Results
When the optimization is not able to find a new valid result, the
fxpopt
function does not produce an OptimizationResult
output. Invalid results are most often the
result of using a model that is not supported for optimization. For more
information, see Unable to Model Problem — Model Is Not Supported.
When the optimization is successful, you can explore several different implementations of your design that were found during the optimization process. Do not save the model until you are satisfied with the new design. Saving the model disables you from continuing to explore the other implementations.
Resolve Error: The RowNames
property must be a string array or a cell array, with each name containing one or more characters
This error may occur if clear all
is used during
fixed-point conversion workflows in the Fixed-Point Tool. clear
all
is currently not supported by fixed-point conversion
workflows. Do not use clear all
in initialization functions
(InitFcn
), or at the MATLAB Command Window when using the Fixed-Point Tool.
Derived Range Analysis Does Not Work for Accumulator Data Type
Only block output signals participate in derived range analysis. If a block has additional data type controls, such as for the accumulator or intermediate results, ranges are not derived for these elements. As a result, when optimization considers both simulation ranges and derived ranges, only simulation range information is used to optimize accumulator data types. Therefore, the optimized accumulator data type and output data type for a given block may differ. For more information, see How Range Analysis Works.