Main Content

Troubleshooting Units

To help you troubleshoot issues with unit settings, Simulink® uses Model Advisor checks to generate a report useful for larger models.

By default, Simulink flags unit usage issues, such as mismatched units, with warnings. Warnings enable you to continue working despite mismatched units. You can reduce the number of warnings you see by setting the configuration parameter Units inconsistency messages to none.

Undefined Units

Simulink does not support custom unit specifications. For more information about supported unit systems and the units they contain, see Allowed Units.

The Model Advisor check Identify undefined units in the model identifies undefined units.

Overflow and Underflow Errors or Warning

You can get overflow and underflow errors or warnings when using the Unit Conversion block. If you get:

  • Overflow messages, change the data type at the output port to one with a better range

  • Underflow messages, change the data type at the output port to one with better precision

Mismatched Units Detected

At the boundary of a component, Simulink detects if the units of two ports do not match. To see the tooltip, hover over the warning badge. If the unit is convertible, Simulink displays advice on fixing the issue.

The Model Advisor check Identify unit mismatches in the model identifies mismatched units.

Mismatched Units Detected Between Model Argument Definition and Value

At a component boundary, Simulink detects and reports a warning when these units are mismatched.

To detect and report warnings for mismatched units, you must set the simulation mode of the Model blocks to normal mode.

The Model Advisor check Identify unit mismatches in the model identifies mismatched units.

Mismatched Units Detected While Loading

At the boundary of a component, Simulink detects if the units of two ports do not match. To see the tooltip, hover the warning badge. When possible, Simulink displays advice on fixing the issue.

The Model Advisor check Identify unit mismatches in the model identifies mismatched units.

Disallowed Unit Systems

Simulink supports only the unit systems listed in the tables of allowed units.

The Model Advisor check Identify disallowed unit systems in the model identifies unit systems that are not allowed in the configured units systems.

Automatic Unit Conversions

If the Allow automatic unit conversions configuration parameter is set, Simulink supports the automatic conversion of units. Simulink flags automatically converted units with the badge.

For a list of the automatic unit conversions, use the Model Advisor check Identify automatic unit conversions in the model.

Unsuccessful Automatic Unit Conversions

If the Allow automatic unit conversions configuration parameter is set, Simulink supports the automatic conversion of units. If Simulink cannot perform the automatic unit conversion, Simulink returns a warning (). In such cases, consider manually specifying the unit.

Tip

Automatic unit conversion is a convenience. For better control of units, you can manually set the units for two connecting ports.

Simscape Unit Specification Incompatible with Simulink

If these are true:

  • You define a new unit to your unit registry by using the pm_addunit function.

  • You use the new unit with the Simulink-PS Converter or PS-Simulink Converter block.

  • Your new unit conflicts with an existing one in the Simulink database.

Simulink returns a warning about a potential incorrect calculation ().

See Also

Blocks

Functions

Objects

Related Topics