# Documentation

## How Range Analysis Works

### Analyzing a Model with Range Analysis

The model that you want to analyze must be compatible with range analysis. If your model is not compatible, either replace unsupported blocks or divide the model so that you can analyze the parts of the model that are compatible. For more information, see Model Compatibility with Range Analysis.

The Fixed-Point Designer™ software performs a static range analysis of your model to derive minimum and maximum range values for signals in the model. The software analyzes the model behavior and computes the values that can occur during simulation for each block Outport. The range of these values is called a derived range.

The software statically analyzes the ranges of the individual computations in the model based on:

• Specified design ranges, known as design minimum and maximum values, for example, minimum and maximum values specified for:

• Inputs

• The semantics of each calculation in the blocks

If the model contains objects that the analysis cannot support, where possible, the software uses automatic stubbing.

The range analysis tries to narrow the derived range by using all the specified design ranges in the model. The more design range information you specify, the more likely the range analysis is to succeed. As the software performs the analysis, it derives new range information for the model. The software then attempts to use this new information, together with the specified ranges, to derive ranges for the remaining objects in the model.

For models that contain floating-point operations, range analysis might report a range that is slightly larger than expected. This difference is due to rounding errors because the software approximates floating-point numbers with infinite-precision rational numbers for analysis and then converts to floating point for reporting.

The following table summarizes how the analysis derives range information and provides links to examples.

When...How the Analysis WorksExamples

You specify design minimum and maximum data for a block output.

The derived range at the block output is based on these specified values and on the following values for blocks connected to its inputs and outputs:

• Specified minimum and maximum values

• Derived minimum and maximum values

Derive Ranges Using Design Ranges

A parameter on a block has initial conditions and a design range.

The analysis takes both factors into account by taking the union of the design range and the initial conditions.

Derive Ranges Using Block Initial Conditions

The model contains a parameter with a specified range and the parameter storage class is set to Auto.

The analysis does not take into account the range specified for the parameter. Instead, it uses the parameter value.

The model contains a parameter with a specified range and the parameter storage class is not set to Auto.

The analysis takes into account the range specified for the parameter and ignores the value.

The model contains insufficient design range information.

The analysis cannot determine derived ranges. Specify more design range information and rerun the analysis.

Troubleshoot Range Analysis of System Objects

The analysis results might depend on block sorting order which determines the order in which the software analyzes the blocks. For more information, see Control and Display the Sorted Order (Simulink).

The model contains conflicting design range information.

The analysis cannot determine the derived minimum or derived maximum value for an object. The Fixed-Point Tool generates an error. To fix this error, examine the design ranges specified in the model to identify inconsistent design specifications. Modify them to make them consistent.

Fixing Design Range Conflicts

### Automatic Stubbing

#### What is Automatic Stubbing?

Automatic stubbing is when the software considers only the interface of the unsupported objects in a model, not their actual behavior. Automatic stubbing lets you analyze a model that contains objects that the Fixed-Point Designer software does not support. However, if any unsupported model element affects the derivation results, the analysis might achieve only partial results.

#### How Automatic Stubbing Works

With automatic stubbing, when the range analysis comes to an unsupported block, the software ignores ("stubs") that block. The analysis ignores the behavior of the block. As a result, the block output can take any value.

The software cannot “stub” all Simulink blocks, such as the Integrator block. See the blocks marked “not stubbable” in Simulink Blocks Supported for Range Analysis.

### Model Compatibility with Range Analysis

To verify that your model is compatible with range analysis, see:

### How to Derive Ranges

1. Verify that your model is compatible with range analysis.

2. In Simulink, open your model and set it up for use with the Fixed-Point Tool. For more information, see Set Up the Model.

3. From the Simulink Analysis menu, select Data Type Design > Fixed-Point Tool.

4. In the Fixed-Point Tool, in the Prepare System for Conversion section of the toolstrip, under System under design, select the system or subsystem of interest.

5. Optionally, you can use the Fixed-Point Advisor to prepare the model for conversion. To start the Fixed-Point Advisor, click the Fixed-Point Advisor button.

• Checks the model against fixed-point guidelines.

• Identifies unsupported blocks.

• Allows you to promote simulation minimum and maximum values to design minimum and maximum values. This capability is useful if you have not specified design ranges and you have simulated the model with inputs that cover the full intended operating range. For more information, see Specify block minimum and maximum values.

6. In the Collect Ranges section of the toolstrip, select Derived Ranges as the method of range collection. This button configures the model to collect ranges using idealized floating-point data types.

Click the arrow button to select whether to have the analysis run using design information from the entire model, or using only design information specified within the selected system under design. By default, the tool collects ranges using design information from the system under design. For more information, see Derive Ranges at the Subsystem Level.

7. Click the button to run the analysis.

The analysis tries to derive range information for objects in the selected system. Your next steps depend on the analysis results.

Successfully derives range data for the model.

Displays the derived minimum and maximum values for the blocks in the selected system.

Review the derived ranges to determine if the results are suitable for proposing data types. If not, you must specify additional design information and rerun the analysis.

Derive Ranges Using Design Ranges

Fails because the model contains blocks that the software does not support.

Generates an error and provides information about the unsupported blocks.

To fix the error, review the error message information and replace the unsupported blocks.

Model Compatibility with Range Analysis

Cannot derive range data because the model contains conflicting design range information.

Generates an error.

To fix this error, examine the design ranges specified in the model to identify inconsistent design specifications. Modify them to make them consistent.

Fixing Design Range Conflicts

Cannot derive range data for an object because there is insufficient design range information specified on the model.

Highlights the results for the object.

Examine the model to determine which design range information is missing.

Troubleshoot Range Analysis of System Objects