Simulink® enables you to specify physical units as attributes on signals at the boundaries of model components. Such components can be:
Referenced Simulink models
Stateflow® charts, state transition tables, or truth tables
MATLAB Function blocks
Data Store Memory, Data Store Read, and Data Store Write blocks
By specifying, controlling, and visualizing signal units, you can ensure the consistency of calculations across the various components of your model. For example, this added degree of consistency checking is useful if you are integrating many separately developed components into a large, overall system model.
In Simulink models, you specify units from a unit database. The unit database comprises units from the following unit systems:
SI — International System of Units
SI (extended) — International System of Units
English — English System of Units
CGS — Centimetre-gram-second System of Units
Based on the type of system you are modeling, you can use any combination of units from these supported unit systems. For more information about supported unit systems and the units they contain, see Allowed Units.
You can assign units to signals through these blocks:
and these objects:
When you add a supported block to your model, the Unit parameter
on the block is set to
inherit by default. This
setting means that the block inherits the unit from a connecting signal
that has an explicitly specified unit.
You can explicitly specify units for signals using the Unit parameter of a supported block. For this parameter, the dialog box provides matching suggestions to help you:
If you do not provide a correctly formed unit expression, you
get an error. Correctly formed unit expressions are a combination
of unit names or symbols with properly balanced parentheses and
^ characters. Special characters such as
and so forth are not supported.
By default, a block port has an empty (that
is, unspecified) unit and the Unit parameter
is set to
inherit. When you specify a unit for
one port, Simulink checks the unit setting of any port connected
to it. If a port has an empty unit, you can connect it to another
port that has any supported unit. If a port unit parameter is set
inherit, it inherits the unit from a connected
port that has a specified unit.
When dealing with unitless, dimensionless, or no unit quantities, consider these guidelines:
Pure numbers with no units
1, the SI standard dimensionless
unit. Simulink checks the unit to make sure other dimensionless quantities
are propagated in. You can add, multiply, and otherwise manipulate these
types of numbers.
Consider using an empty unit, where the Unit parameter is blank. When this parameter is blank, Simulink accepts any unit that propagates to the port without returning a warning.
Integer counting number unit
count to denote an integer
counting number unit. Use this unit for quantities that are difficult to
describe, but that are considered unitless or dimensionless, such as
thermally accessible states or PWM count. For more information, see
count in Allowed Units.
Dimensionless physical quantities
Dimensionless physical quantities represent a specific physical quantity.
Consider using the physical quantities
of these physical quantities,
Reynolds_number, have corresponding units. To specify units
for the other physical quantities, use a format such as
1@physical quantity, for
1@refractive_index. Simulink performs a physical quantity check at propagation. For
example, if a model tries to add dimensional physical quantities, Simulink
returns a warning.
Pure scaled numbers
When you model a physical system, it is possible to use the
same unit expression for two or more signals that represent different
physical quantities. For example, a unit expression of
represent either torque or energy. To prevent mistaken connection
of two ports with the same unit but representing different physical
quantities, you can add a physical quantity to the unit expression.
For example, for the same unit of
N*m, you can
specify different physical quantities of
Similar to units, the dialog box provides suggestions as you type
the names of physical quantities.
Physical quantities help you to enforce an extra degree of unit consistency checking between connected ports. When you attempt to connect ports with different physical quantities, the model displays a warning.
have empty units. In the case of a:
Simulink.Signal object, the empty unit means that the corresponding signal
can inherit a unit from an upstream or downstream port.
Simulink.BusElement object, the empty
unit means that the corresponding bus element signal also has an empty
unit. You can connect the signal to a port with any unit, but the
signal does not inherit a unit from the port.
Simulink.Parameter object, the object does not attach a unit to the
corresponding parameter value.
If you specify a unit in a
Simulink.BusElement object, Simulink applies the attribute to the corresponding signal line when:
Simulink.Signal object resolves to a signal in the model
You use a bus element signal that is associated with
Simulink.Bus object with a Bus Creator, Bus
Selector, or Bus Assignment block.
Simulink.Parameter object, Simulink does not apply any attribute. For all objects, if the
Unit parameter has a value that is not formed correctly,
you see an error. If the unit is formed correctly but is undefined, you see a
warning when you compile the model. If the unit expression contains special
characters such as
&, and so
forth, Simulink replaces them with underscores (
Notes on the
starting in R2016a:
DocUnits property is now
Simulink.Signal objects. If, in a previous release,
you used the
DocUnits parameter of a
Simulink.Signal object to contain text that does
not now comply with units specifications, simulation returns a warning
when the model simulates.
To suppress these warnings, set the configuration parameter Units inconsistency messages to
This setting suppresses all units inconsistency check warnings.
If you have a class that derives from
Simulink.BusElement with a previously defined
Unit property, Simulink returns an error like the following:
Cannot define property 'Unit' in class 'classname' because the property has already been defined in the superclass 'superclass'.
If you use this property to represent the physical unit of the
signal, delete the
Unit property from the derived
class in the R2016a or later release. Existing scripts continue to
work, unless you are assigning incorrectly formed unit expressions
Unit field. In this case, replace the use
DocUnits to continue
to be able to assign the unit expression.
If you store existing data in a MAT- or
in a release prior to R2016a, copy the contents of the
DocUnits first. Then, save the file in the
earlier release before loading the model in R2016a or later release.
When modeling absolute temperature quantities, use units such
degR. When modeling temperature difference quantities,
use units such as
deltadegR. If you connect a signal that has
a temperature difference unit to a block that specifies an absolute temperature
unit, Simulink detects the mismatch.
You can specify units for input and output data of MATLAB Function blocks by using the Unit parameter on the Ports and Data Manager.
During model update, Simulink checks for inconsistencies in units between input or output data ports and the corresponding signals.
You can specify units for output data of Constant blocks by using
the Unit property in the
You can include units in signal data that you log or load.
You specify units for logging and loading using
When you log using
Timeseries format, Simulink stores
the unit information using
If you create MATLAB® timeseries data to load, you can specify
Units property of the
By default, you can specify units from any of the supported unit systems. However,
in large modeling projects, to enforce consistency, you might want
to restrict the unit systems that certain components of your model
can use. To specify available unit systems for a model, in the configuration
parameter Allowed unit systems, enter
a comma-separated list containing one or more of
Do not use quotation marks. If your model contains referenced models,
you can use the Allowed unit systems to restrict
units in each of those referenced models. If your model contains subsystems,
you can use the Unit System Configuration block
to restrict units in the subsystems. You can also optionally use a Unit
System Configuration block in a model. In this case, the settings
in the Unit System Configuration block override whatever
you specify in Allowed unit systems.
To restrict unit systems in a model:
In the Unit parameter of the Inport, Outport, or Signal Specification block, click the link.
If a Unit System Configuration block exists in your model, this link opens the block dialog box. Otherwise, the link opens the Allowed unit systems configuration parameter.
Specify one or more the desired unit systems,
in a comma-delimited list, or
all, without quotation
In a parent-child relationship (for example, a top model with a referenced model or subsystem), you can specify different unit systems for each component. However, if a child propagates a unit into a parent that is not in the unit systems specified for the parent, you get a warning.
To check whether there are unit mismatches caused by restricted unit systems in your model hierarchy:
Press Ctrl+D and visually inspect the model for warning badges.
Use the Model Advisor check Identify disallowed unit systems.