What is the meaning of unit and quantity?
Well, quantity, also called dimension, is what you measure, i.e. any measurable extent or magnitude such as length, mass, time, etc. A unit is a "yardstick" by which you express your measurements. For example, a measurement of the length quantity can be expressed as a number of meter units.
The Modelica notions of quantity and unit with a concrete representation as string attributes to the Real predefined class, are seen below.
Below are examples of definitions and uses of types corresponding to some physical quantities. Remember that the final prefix on quantity and unit means that these attributes cannot be changed by further modification of the types Force and Angle.
Definintion of quantity types:
Use of the quantity types
The quantity attribute can be used as a grouping mechanism in interactive Modelica environments. The quantity name is needed because it is in general not possible to determine just from the unit whether two different units belong to the same physical quantity. For example, consider the following two types:
The Modelica standard library package Modelica.SIunits contains predefined quantity and connector types in the form shown in the above examples. This library contains approximately 450 predefined types comprising the complete set of ISO SI standard units, which is quite helpful when defining the interfaces of a model. Some additional examples from this library are shown below: