You can use the fxpopt
function 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.
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.
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.
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.
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.
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 — No Constraints Specified 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.