Main Content

Convert Data Types

After collecting ranges as described in Collect Ranges, propose and apply data types for objects in your model based on the collected ideal ranges stored in the baseline run. The Fixed-Point Tool proposes a data type for all objects in the system under design whose Lock output data type setting against changes by the fixed-point tools parameter is cleared.

Edit Proposal Settings

View of the Fixed-Point Tool after collecting ranges. The Settings menu is expanded and highlighted.

In the Convert section of the toolstrip, under the Settings menu, configure the settings that the Fixed-Point Tool uses to generate data type proposals for objects in your system under design.

SettingDescription
ProposePropose

Select whether to propose fraction lengths or word lengths for objects in the system under design.

  • When you select Word Length, the Fixed-Point Tool uses range information and the specified Default fraction length value to propose word lengths for the objects in your model.

  • When you select Fraction Length, the Fixed-Point Tool uses the range information and the specified Default word length value to propose best-precision fraction lengths for the objects in your model.

Propose signednessSelect whether to use the collected range information to propose signedness.
Safety margin for simulation min/max (%)Specify a safety margin to apply to collected simulation ranges. The Fixed-Point Tool will add the specified amount to the collected ranges and base proposals on this larger range. The default value for this setting is two percent.
Convert to Fixed PointConvert double/single typesSelect whether to generate proposals for results that currently specify a double or single data type.
Convert inherited typesSelect whether to generate data type proposals for results that currently specify an inherited data type.
Default word lengthSelect the default word length to use for proposals. This setting is enabled only when the Propose setting is set to Fraction Length. The default value for this setting is 16.
Default fraction lengthSelect the default fraction length to use for proposals. This setting is enabled only when the Propose setting is set to Word Length. The default value for this setting is 4.

Propose Data Types

View of the Fixed-Point Tool after collecting ranges. The Propose Data Types button is highlighted.

When proposing data types, the Fixed-Point Tool uses the following types of range data:

  • Design minimum or maximum values — You specify a design range for model objects using parameters such as Output minimum and Output maximum. For a list of blocks for which you can specify these values, see Blocks That Allow Signal Range Specification.

  • Simulation minimum or maximum values — When simulating a system with instrumentation enabled, the Fixed-Point Tool logs the minimum and maximum values generated by model objects. For more information about instrumentation settings, see Fixed-Point Instrumentation and Data Type Override.

    If you specified multiple simulation scenarios through a Simulink.SimulationInput object, the Fixed-Point Tool proposes data types based on the merged ranges of all simulations.

  • Derived minimum or maximum values — When deriving minimum and maximum values for a selected system, the Fixed-Point Tool uses the design minimum and maximum values that you specify on the blocks to derive range information for signals in your model. For more information, see How Range Analysis Works.

The Fixed-Point Tool uses all available range data to calculate data type proposals.

To generate proposals, click the Propose data types button .

Apply Proposed Data Types

After reviewing the data type proposals, apply the proposed data types to your model.

View of the Fixed-Point Tool after proposing data types. The Apply Data Types button is highlighted.

The Fixed-Point Tool allows you to apply data type proposals selectively to objects in your model. In the spreadsheet, use the Accept check box to specify the proposals that you want to assign to model objects.

The Fixed-Point Tool applies the proposed data type to this object. By default, the tool selects the Accept check box when a proposal differs from the current data type of the object.

The Fixed-Point Tool ignores the proposed data type and leaves the current data type intact for this object.

 

No proposal exists for this object, for example, the object is locked against automatic data typing.

  1. Examine each result. For more information about a particular result, select the result and examine the Result Details pane.

    This pane also describes potential issues or errors and suggests methods for resolving them. Results for which the data type proposal may cause issues, are marked with a warning () or an error () icon. For more detail on the information contained in the Result Details pane, see Examine Results to Resolve Conflicts.

  2. If you do not want to accept the proposal for a result, on the spreadsheet, clear the Accept check box for that result.

    Before applying proposals to your model, you can customize them. In the spreadsheet, click a ProposedDT cell and edit the data type expression. Some results belong to a data type group in which they must all share the same data type. In these cases, the Fixed-Point Tool will report an error unless all results in the data type group share the same data type.

  3. To write the proposed data types to the model, click the Apply Data Types button .

To complete the next step in the conversion process, see Verify New Settings.

Related Topics