Specify Units for Stateflow Data
Units for Input and Output Data
Stateflow® charts in Simulink® models support the specification of physical units as properties for data inputs and outputs. Specify units by using the Unit (e.g., m, m/s^2, N*m) parameter for input or output data on charts, state transition tables, or truth tables. When you start typing in the field, this parameter provides matching suggestions for units that Simulink supports. By default, the property is set to inherit the unit from the Simulink signal on the corresponding input or output port. If you select the Data must resolve to signal object property for output data, you cannot specify units. In this case, output data is assigned the same unit type as the Simulink signal connected to the output port.
To display the units on the Simulink lines in the model, in the Debug tab, select Information Overlays > Port Units.
Stateflow checks the consistency of the signal line unit from Simulink with the unit setting for the corresponding input or output data in the Stateflow block. If the units do not match, Stateflow displays a warning during model update.
Units for Stateflow Limitations
The unit property settings do not affect the execution of the Stateflow block. Stateflow checks only consistency with the corresponding Simulink signal line connected to the input or output. It does not check
consistency of assignments inside the Stateflow blocks. For example, Stateflow does not warn against an assignment of an input with unit set to
ft to an output with unit set to
Stateflow does not perform unit
- Unit Specification in Simulink Models (Simulink)