Main Content

Underspecified data types

Description

Select the diagnostic action to take if Simulink® software could not infer the data type of a signal during data type propagation.

Category: Diagnostics

Identify and Resolve Underspecified Data Types

This example shows how to use the configuration parameter Underspecified data types to identify and resolve an underspecified data type.

  1. Open the example model UnderspecifiedDataTypes.

  2. Set the Underspecified data types configuration parameter to warning.

  3. Update the diagram. The signals in the model use the data type uint8, and the model generates a warning.

  4. Open the Diagnostic Viewer. The warning indicates that the output signal of the Constant block has an underspecified data type.

  5. Open the Constant block dialog box. On the Signal Attributes tab, Output data type is set to Inherit: Inherit via back propagation. The Constant block output inherits a data type from the destination block. In this case, the destination is the Sum block.

  6. Open the Sum block dialog box. On the Signal Attributes tab, Accumulator data type is set to Inherit: Inherit via internal rule. Sum blocks cast all of their input signals to the selected accumulator data type. In this case, the accumulator data type is specified as an inherited type.

  7. Open the Inport block dialog box. On the Signal Attributes tab, Data type is set to uint8.

The data type of the Constant block output signal is underspecified because the source and destination blocks each apply an inherited data type. The signal cannot identify an explicit data type to inherit. In cases like this, Simulink applies heuristic rules to select a data type to use.

To resolve the underspecified data type, you can use one of these techniques:

  • On the Signal Attributes tab of the Constant block dialog box, specify Output data type as a particular numeric type, such as uint8.

  • On the Signal Attributes tab of the Sum block dialog box, select the check box Require all inputs to have the same data type. With this setting, the Sum block applies the data type of the first input, uint8, to the underspecified data type of the second input.

Settings

Default: none

none

Simulink software takes no action.

warning

Simulink software displays a warning.

error

Simulink software terminates the simulation and displays an error message.

Command-Line Information

Parameter: UnderSpecifiedDataTypeMsg
Value: 'none' | 'warning' | 'error'
Default: 'none'

Recommended Settings

ApplicationSetting
DebuggingNo impact
TraceabilityNo impact
EfficiencyNo impact
Safety precautionerror

Related Topics