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. 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

In the Convert Data Types 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.

Edit Signal Tolerances

You can specify absolute, relative, and time tolerances for signals in your model that have signal logging enabled. After converting your system, when you simulate the embedded run, the Run Browser displays whether the embedded run meets the specified signal tolerances compared to the range collection run. You can view the comparison plots in the Simulation Data Inspector.

To specify a signal tolerance, click the Signal Tolerances button. The drop-down has a table containing all signals in the model with signal logging enabled. In the boxes to the right of the signal for which you want to register a tolerance, enter the tolerances for the signal. You can specify any of the following types of tolerances.

  • Abs Tol – Absolute value of the maximum acceptable difference between the original signal, and the signal in the converted design.

  • Rel Tol (%) – Maximum relative difference, specified as a percentage, between the original output, and the output of the new design. For example, a value of 1e-2 indicates a maximum difference of one percent between the original signal values, and the signal values of the converted design.

  • Time Tol (seconds) – Time interval, in which the maximum and minimum values define the upper and lower values to compare against.

Propose Data Types

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 (Simulink).

  • 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 the Fixed-point instrumentation mode parameter, see Fixed-point instrumentation mode.

  • 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.

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 ask if you want to update all results in the group.

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

    If you have not fixed all the warnings in the model, the Fixed-Point Tool displays a warning dialog box.

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

Related Topics