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.
Open the example model
UnderspecifiedDataTypes
.Set the Underspecified data types configuration parameter to
warning
.Update the diagram. The signals in the model use the data type
uint8
, and the model generates a warning.Open the Diagnostic Viewer. The warning indicates that the output signal of the Constant block has an underspecified data type.
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.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.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
Application | Setting |
---|---|
Debugging | No impact |
Traceability | No impact |
Efficiency | No impact |
Safety precaution | error |