| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Simulink Fixed Point |
| Contents | Index |
| On this page… |
|---|
Introduction to the Fixed-Point Advisor Best Practices for Using the Fixed-Point Advisor Models That Might Cause Data Type Propagation Errors |
The Fixed-Point Advisor provides a set of tasks to help you convert a floating-point model or subsystem to an equivalent fixed-point representation. You can use the Fixed-Point Advisor to prepare a model for conversion and obtain an initial scaling to use as the starting point for refinement and exploration inside the Fixed-Point Tool.
Check that update diagram succeeds for your model before using the Fixed-Point Advisor. (To update diagram, press Ctrl+D.) If update diagram fails, fix the failure in your model before you start converting your model.
Always back up your Simulink model before using the Fixed-Point Advisor.
This practice provides a fallback in case of error and a baseline for testing and validation.
The Fixed-Point Advisor is intended to assist in converting small models. Larger models can result in long processing times.
Convert subsystems within your model, rather than the entire model. This practice saves time and unnecessary conversions.
Specifying small simulation run times reduces task processing times. You can change the simulation run time in the Configuration Parameters dialog box. See Start time and Stop time in the Simulink Reference for more information.
Make small changes to your model so that you can identify where errors are introduced accidentally.
If you encounter data type propagation issues with a particular subsystem, isolate this subsystem by placing Data Type Conversion blocks on the inputs and outputs of the system. The Data Type Conversion block converts an input signal of any Simulink software data type to the data type and scaling you specify for its Output data type parameter. This practice enables you to continue converting the rest of your model.
The ultimate goal is to replace all blocks that do not support fixed-point data types. You must eventually replace blocks that you isolated with Data Type Conversion blocks with blocks that do support fixed-point data types.
You can prevent the Fixed-Point Advisor replacing the current data type. Use the Lock output data type setting against changes by the fixed-point tools parameter available on many blocks. The default setting allows replacement. Use this setting when:
You already know the fixed-point data types you want to use for a particular block.
For example, the block is modeling a real-world component. Set up the block to allow for known hardware limitations, such as restricting outputs to integer values.
Specify the output data type of the block explicitly and select Lock output data type setting against changes by the fixed-point tools.
You are debugging a model and know that a particular block accepts only certain data types.
Specify the output data type of upstream blocks explicitly and select Lock output data type setting against changes by the fixed-point tools.
The Fixed-Point Advisor proposes data types for Simulink signal objects in your model. However, it does not automatically save Simulink signal objects. To preserve changes, save the Simulink signal objects in your workspace and model before closing the model.
The Fixed-Point Advisor is not aware of all potential scaling issues and might propose data types that cause subsequent data propagation errors. To ensure that you can recover your original data type settings, back up your model before using the Fixed-Point Advisor. For more information about backing up your model and other best practices for using the Fixed-Point Advisor, see Best Practices for Using the Fixed-Point Advisor.
The following models are likely to cause data type propagation issues:
| Model Uses... | Fixed-Point Advisor Behavior | Data Type Propagation Issue |
|---|---|---|
| Buses | Not aware of the minimum, maximum, data type, and initial value information for bus objects and does not include them in autoscaling. | Fixed-Point Advisor might propose data types that are inconsistent with the data types for the bus object. |
| Simulink parameter objects | Does not consider any data type information for Simulink parameter objects. | Fixed-Point Advisor might propose data types that are inconsistent with the data types for the parameter object. |
| User-defined S-functions | Not aware of the operation of user-defined S-functions. |
|
| User-defined masked subsystems | Has no knowledge of the masked subsystem workspace and therefore cannot take this into account when autoscaling. | Fixed-Point Advisor might propose data types that are inconsistent with the requirements of the masked subsystem, particularly if the subsystem uses mask initialization. The proposed data types might cause data type mismatch errors or overflows. |
| Linked subsystems | Does not include linked subsystems when converting your model. | Data type mismatch errors might occur at the linked subsystem boundaries. |
| Embedded MATLAB Function blocks | Does not propose data types for Embedded MATLAB Function blocks. | Fixed-Point Advisor might propose data types that are inconsistent with the requirements of the Embedded MATLAB Function blocks. The proposed data types might cause data type mismatch errors or overflows. |
| Model reference | Does not propose data types for referenced models. | Data type propagation errors might occur at the referenced model's boundaries. |
| Blocks whose output is always floating-point for floating-point inputs regardless of their output data type setting. For example, Discrete Filter block and many Signal Processing Blockset blocks. | Might not propose data types for these blocks as they do not allow you to set the output data type to double or single. | Date type propagation errors might occur because the Fixed-Advisor Advisor is unable to lock down the output data type of these blocks. |
Open a model.
Start the Fixed-Point Advisor by:
Typing fpcadvisor('model_name/subsystem_name') at the MATLAB command line
Selecting a subsystem and then selecting Fixed-Point > Fixed-Point Advisor from the Tools menu
Right-clicking a subsystem block and then selecting Fixed-Point > Fixed-Point Advisor from the subsystem context menu
The Fixed-Point Advisor window opens.
Select the Fixed-Point Advisor folder in the Task Hierarchy pane.
Run the advisor by:
Selecting Run to Failure from the Run menu
Right-clicking the Fixed-Point Advisor folder and selecting Run to Failure from the folder context menu
The Fixed-Point Advisor runs the tasks in order until a task fails. A waitbar is displayed while each task runs.
Review the results. If a task fails because input parameters are not specified, select an Input Parameter. Then continue running to failure by right-clicking the task and selecting Continue from the context menu. If the task fails for a different reason, fix the task as described in Fixing a Task Failure.
Tasks fail when there is a step for you to take to convert your model from floating-point to fixed-point. For more information on why a specific task fails, see the Fixed-Point Advisor Reference.
You can fix a failure using three different methods:
Fix the failure by following the instructions in the Analysis Result box. Use this method to fix failures individually.
Fix the failure using the Action box. Use this method to automatically fix all failures. See Automatically Fixing Failures.
Fix the failure using the Model Advisor Results Explorer. Use this method to batch fix failures. See Batch Fixing Failures
Note A warning result is meant for your information. You can choose to fix the reported issue, or to move on to the next task. |
You can automatically fix failures using the Action box. The action box applies all of the recommended actions listed in the Analysis Result box.
Caution You should review the Analysis Result box prior to automatically fixing failures to ensure that you want to apply all of the recommended actions. |
Automatically fix all failures within a task using the following steps:
In the Action box, click Modify All.
The Action Result box displays a table of changes.
To verify that the task now passes, in the Analysis box, click Run This Task.
If a task fails and you want to explore the results and make batch changes, use the following steps.
In the Analysis box, click Explore Result.
The Model Advisor Result Explorer dialog box opens.
Use the Model Advisor Result Explorer to modify block parameters.
When you have finished making changes, in the Fixed-Point Advisor window, click Run This Task to see if the changes you made results in the task passing. Continue fixing failures and rerunning the task until the task passes.
![]() | Fixed-Point Advisor | Tutorial: Converting a Model from Floating- to Fixed-Point | ![]() |

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |