Constants and units of physical measure
Below are details about the premise and the implementation of physical units in QCalc. For an overview of how to use QCalc, please see the top-level documentation and the getting started page. This text has been updated and adapted from [Davies2012]. That paper also suggests how the approach might be better integrated in the Modelica language. Please also see the documentation of the Quantities package.
Introduction:
In mathematical models, one uses variables to represent physical quantities. As stated by the Bureau International des Poids et Mesures (BIPM) [BIPM2006, p. 103]:
"The value of a quantity is generally expressed as the product of a number and a unit. The unit is simply a particular example of the quantity concerned which is used as a reference, and the number is the ratio of the value of the quantity to the unit."
In general, a unit may be the product of other units raised to various powers.
In Modelica, a physical
quantity is represented by a Real
variable.
Its value
attribute is a number
associated with the value of the quantity (not the value of the quantity
itself, as will be shown). Usually the value
attribute is
not explicitly referenced because it is automatically returned when the
variable itself is referenced. The unit
attribute is a string that
describes the unit by which the value of the quantity has been divided to
arrive at the number. The displayUnit
attribute (also a
string) describes the unit by which the value of the quantity should be
divided to arrive at the number as it is entered by or presented to the
user. The Real
type contains other attributes as well,
including the quantity
string.
The SIunits package of the
Modelica Standard Library contains
types that extend the Real
type. The type definitions
modify the unit
, displayUnit
, and
quantity
attributes (among others) to represent various
physical quantities. The unit
and displayUnit
attributes are based on the
International System of Units (Système
international d'unités, SI). The quantity
string is
the name of the physical quantity. For example, the
Velocity type has a
unit
of "m/s" and a quantity
of "Velocity".
If an instance of Velocity
has a value
of one (v = 1), then it is
meant that "the value of velocity is one metre per second." Again, the
value
attribute represents the number, or the value of the
quantity divided by the unit, not the value of the quantity itself.
This conflict is solved in QCalc
by establishing units as mathematical entities and writing
v = 1 m/s (in code, v = 1*U.m/U.s
or simply
v = U.m/U.s
, where U
is an abbreviation for this
package). Here, the variable v directly represents the quantity.
Its value
attribute is truly the value of the quantity in the
context of the statement by BIPM (above). One advantage is that unit
conversion is built in. The essence of unit conversion is that the
phrase "value of quantity in unit" typically means "value of
quantity divided by unit." Continuing with the previous example,
v is divided by m/s in order to display v in metres per
second (as a number). If another unit of length like the foot is
established by the appropriate relation (ft ≈ 0.3048 m) and
v is divided by ft/s, the result is velocity in feet per second
(∼3.2894). Some units such as °C, Pag, and dB involve offsets or
nonaffine transformations between the value of the quantity and the
number; these are described by functions besides simple division.
Method:
In QCalc, each scalar unit is a constant quantity. The value of a unit, like other quantities, is the product of a number and a unit. Therefore, units may be derived from other units (e.g., Pa = N/m2). This recursive definition leaves several units (in SI, 7) that are locally independent and must be established universally. These base units are established by the "particular example of the quantity concerned which is used as a reference" quoted previously [BIPM2006]. The choice of the base units is somewhat arbitrary [Fritzson2004, p. 375], but regardless, there are a number of units that must be defined by example.
If only SI will be used, then it is easiest to set each of the base units of SI equal to one—the metre (m), kilogram (kg), second (s), ampere (A), kelvin (K), mole (mol), and candela (cd). This is implicitly the case in the SIunits package, but again, it hardly captures the idea that the value of a quantity is the product of a number and a unit.
Instead, in QCalc, the values of the base units are established from physical constants. This approach reflects the way that standards organizations (e.g., NIST) define modern units. The "particular example of the quantity" [BIPM2006] is an experiment that yields precise and universally repeatable results rather than a prototype (e.g., the international prototype kilogram) which is carefully controlled and distributed via replicas. This approach also makes it easy to normalize certain constants as in natural unit systems.
In addition, the values of the constants can be chosen to scale the values of variables. There are physical systems where typical quantities are many orders of magnitude larger or smaller than the related product of powers of base SI units (e.g., the domains of astrophysics and atomic physics). In modeling those systems, it may help to choose appropriately small or large values (respectively) for the corresponding base units so that the product of the number (large or small in magnitude) and the unit (small or large, respectively) is well-scaled. This scaling is usually unnecessary due to the wide range and appropriate distribution of the real numbers that are representable in floating point.1 However, in some cases it may improve computational performance to scale the units and use lower precision. There are fields of research where, even today, simulations are sometimes performed in single precision [Brown2011, Hess2008] and where scaling is a concern [Rapaport2004, p. 29]. The number and the unit are usually multiplied before the dynamic simulation or even during translation because the product is often involved in initial conditions or parameter expressions. During the simulation, only the value is important, so there is no computational overhead. The value is divided by the display unit after the simulation.
The method is neutral with regards to not only the values of the base units, but also the choice of the base units and even the number of base units. This is an advantage because many systems of units besides SI are used in science and engineering. As mentioned previously, the choice of base units is somewhat arbitrary, and different systems of units are based on different choices. Some systems of units have fewer base units (lower rank) than SI, since additional constraints are added that exchange base units for derived units. For example, the Planck, Stoney, Hartree, and Rydberg systems of units set the Boltzmann constant equal to one (kB = 1) [http://en.wikipedia.org/wiki/Natural_units]. The kelvin is eliminated [Greiner1995, p. 386] or, more precisely, considered a derived unit instead of a base unit. In SI, the kelvin would be derived from the kilogram, metre, and second, (K ≈ 1.381×10-23 kg m2/s2). In this case, temperature is not an independent dimension.
There are seven base constants in the Units package (R∞, c, kJ, RK, kF, R, and kA'; see Units.Bases) and seven SI base units (m, s, kg, A, K, mol, and cd). The candela (cd) is decoupled from these constants by the luminosity function, but the radian (rad) is derived from them.
Implementation:
The units and constants are defined as variables in this
Units package. Each is a
constant
of the appropriate type from the
Quantities package. The first
section of this package establishes mathematical constants. The next section
establishes the independent base constants, which are grouped in a
replaceable
record. The third section derives
other physical constants from the base constants.
The fourth section establishes units from the base constants
using transcendental and empirical relations. The rest of the
code derives additional units and constants from those units.
All of the units from [BIPM2006] are
defined, which includes the
SI units and
some non-SI units. Other units are included for convenience.
Some prefixed units are defined as well, but most
must be expressed using separate factors (e.g.,
U.Prefixes.k*U.m
).
Some units such as Celsius and
decibel involve functions other than multiplication.
These units are called lambda units and are defined via
operator records. The *
and /
operators are overloaded
to call the unit's transformation and its inverse, respectively.
This package (QCalc.Units) is
abbreviated as U
for convenience throughout the rest of
QCalc, and
QCalc.Quantities is
abbreviated as Q
.
The Units.setup function establishes unit conversions using the values of the units, constants, and prefixes. These conversions may include offsets. The function also sets the default display units. It is automatically called when QCalc is loaded from the load.mos script. It can also be called manually from the "Re-initialize the units" command available in the Modelica development environment from the Units package and its subpackages. A spreadsheet (Resources/quantities.xlsx) is available to help maintain the quantities, default units, and the setup function.
The values of the units, constants, and prefixes can be evaluated by translating the Units.Examples.Evaluate model. This defines the values in the workspace of the development environment. For convenience, the load.mos script automatically translates that model and saves the result as "units.mos" in the working directory.
In order to interpret the simulation results stored in a file, it is necessary to know the values of the base constants. Since these may be changed, it is a good idea to drop QCalc.Units.UnitSystem into your model to record the values of the base constants in the results.
Although it is not necessary since Modelica is acausal, the declarations in this package are sorted so that they can be easily ported to imperative/causal languages (e.g., Python and C).
Some notes on angle:
As mentioned on the getting started page and in the Quantities package, angle is a dimension. This is different from SI, where angle is considered dimensionless (rad = 1) [2 Units of angle such as the cycle (cyc), radian (rad), and degree (deg) must be explicitly included in the expression of quantities, but they often cancel in equations relating quantities. The following differences are noted from the traditional SI representation:
U.rad
) before passing to these functions
(e.g., sin(theta/U.rad)
) and the result of their inverses should be multiplied by
the radian (e.g., asin(x)*U.rad
).The explicit inclusion of angle has several advantages. First, it avoids a conflict in the definition of SI units. BIPM defines the hertz as the reciprocal second (Hz = s-1), but states that "The SI unit of frequency is given as the hertz, implying the unit cycles per second" [BIPM2006]. Due to trigonometry (cyc = 2π rad), BIPM's definition of the radian as one (rad = 1) implies that the cycle is two pi (cyc = 2π) and the hertz is not cycles per second but rather cycles per second divided by two pi (Hz = cyc/(2π s)).
The second advantage is that the use of explicit angles avoids the potential confusion between energy and torque in SI [BIPM2006]. Torque is expressed as the cross product of force and radius. The cross product introduces a factor of rad-1, so the result is energy per angle, which is clearly distinct from energy. The angle cancels in the expression of rotational power—the product of torque and rotational velocity (angle per time).
Also, the inclusion of angle avoids the need to use different variables depending on the chosen unit of angle. For example, frequency is sometimes represented by a variable in hertz (e.g., ν) and other times by a variable in radians per second (e.g., ω). If angle is explicit, then one variable will suffice (f = ν cyc/s = ω rad/s). As alluded to earlier, there is no need for the reduced Planck constant (i.e., h ≈ 6.6261×10-34 J/Hz ≈ 1.0546×10-34 J s/rad).
Fourth, if angle is counted as a dimension, the fine-structure constant is not dimensionless. This addresses the conundrum of a dimensionless constant that cannot be mathematically derived.
Another possible advantage appears if we define the size of a circle (S) as length per angle—radius per radian (r/rad) or, equivalently, circumference per cycle. This simplifies the representation of some common equations because explicit factors of 2π are eliminated. The circumference of one circle is S cyc. The surface area of one sphere is S2 sp, where sp = 4π sr is the spat, a unit of solid angle.3 Coulomb's force law can be expressed using the electric constant (ε0) without a explicit factor of 1/4π:
F = (1/ε0) q1q2/(S2 sp)where S2 sp is the surface area of the sphere centered at one charge and touching the other. Since S = r/rad, sp = 4π sr, and sr = rad2, this is
F = kC q1q2/r2where kC is the electric constant, which is 1/(4π ε0) as expected. Thus, there may not be a need to maintain the electric force constant as a separate variable from the electric constant.
1. The Modelica specification recommends that floating point numbers be represented in at least IEEE double precision, which covers magnitudes from ∼2.225×10-308 to ∼1.798×10308 [Modelica2010, p. 13].
2. The common argument that angle is dimensionless ("angle is a ratio of lengths") is flawed. Angle is the not the ratio of arclength to radius. Rather, angle in radians is the ratio of arclength to radius (θ/rad = L/r). It is not necessary that angle (θ) is dimensionless, only that angle and radian (rad) have the same dimension. In QCalc, that dimension is called angle. The common (and correct) understanding is that the radian (rad) is a unit of angle, just as the metre (m) is a unit of length. The dimensionality of the radian is angle, just as the dimensionality of the metre is length.
3. The spat (sp) is the solid angle of one sphere, just as the cycle (cyc) is the angle of one circle. For mnemonic purposes, sp can be considered as the abbreviation for sphere as well as spat.
Extends from Icons.Package (Icon for standard packages (from MSL 3.2.1)).
Name | Description |
---|---|
setup | Set up the units in Dymola |
UnitSystem | Base constants for the unit system |
Examples | Examples |
Bases | Sets of base constants and units |
Prefixes | SI prefixes |
pi=2*acos(0) | pi (π) |
base | Scalable base constants |
R_inf=base.R_inf | Rydberg constant (R∞) |
c=base.c | speed of light |
k_J=base.k_J | Josephson constant (kJ) |
R_K=base.R_K | von Klitzing constant (RK) |
k_F=base.k_F | Faraday constant (kF) |
R=base.R | gas constant |
k_Aprime=base.k_Aprime | modified Ampere constant (kA cyc/α) |
Phi_0=1/k_J | magnetic flux quantum (Φ0) |
G_0=2/R_K | conductance quantum (G0) |
e=G_0*Phi_0 | elementary charge |
h=2*e*Phi_0 | Planck constant |
N_A=k_F/e | Avogadro constant (NA) |
k_B=R/N_A | Boltzmann constant (kB) |
cyc=k_Aprime*c/R_K | cycle |
c_1=2*pi*h*c^2/cyc^3 | first radiation constant (c1) |
c_2=h*c/k_B | second radiation constant (c2) |
c_3_f=2.821439372122079*c/c_2 | Wien frequency displacement constant (c3 f) |
c_3_lambda=c_2/4.965114231744276 | Wien wavelength displacement constant (c3 λ) |
sigma=c_1/15*(pi/c_2)^4 | Stefan-Boltzmann constant (σ) |
Ry=h*c*R_inf | Rydberg energy |
Ha=2*Ry | Hartree energy |
T_H=Ha/k_B | Hartree temperature (TH) |
rad=cyc/(2*pi) | radian |
m=10973731.568539*cyc/R_inf | metre |
s=299792458*m/c | second |
Wb=483597.870e9/k_J | weber |
S=25812.8074434/(R_K*cyc) | siemens |
mol=96485.3365*Wb*cyc*S/k_F | mole |
K=8.3144621*(Wb*cyc)^2*S/(s*mol*R) | kelvin |
cd=1 | candela |
Hz=cyc/s | hertz |
V=Wb*Hz | volt |
A=V*S | ampere |
C=A*s | coulomb |
J=V*C | joule |
Gy=(m/s)^2 | gray |
kg=J/Gy | kilogram |
g=kg/Prefixes.k | gram |
sr=rad^2 | steradian |
lm=cd*sr | lumen |
W=J/s | watt |
N=J/m | newton |
Pa=N/m^2 | pascal |
T=Wb/m^2 | tesla |
lx=lm/m^2 | lux |
F=s*S | farad |
ohm=1/S | ohm (Ω) |
H=s/S | henry |
kat=mol/s | katal |
Sv=Gy | sievert |
Bq=1/s | becquerel |
degC | degree Celsius (°C) |
min=60*s | minute |
hr=60*min | hour |
d=24*hr | day |
deg=cyc/360 | degree (°) |
arcmin=deg/60 | arcminute (′) |
arcsec=arcmin/60 | arcsecond (′′) |
ha=(Prefixes.h*m)^2 | hectare |
L=(Prefixes.d*m)^3 | litre (L or l) |
t=Prefixes.M*g | tonne |
g_0=9.80665*m/s^2 | standard gravity |
cm=Prefixes.c*m | centimetre |
cc=cm^3 | cubic centimetre |
Hg=13.5951*g*g_0/cc | force per volume of mercury under standard gravity |
mm=Prefixes.m*m | millimetre |
mmHg=mm*Hg | millimetre of mercury |
kPa=Prefixes.k*Pa | kilopascal |
bar=100*kPa | bar |
b=100*(Prefixes.f*m)^2 | barn |
angstrom=1e-10*m | angstrom (Å) |
nmi=1852*m | nautical mile |
kn=nmi/hr | knot |
Np | neper (in terms of amplitude ratio, not power ratio) |
B | bel (in terms of power ratio, not amplitude ratio) |
dB | decibel (in terms of power ratio, not amplitude ratio) |
Gal=cm/s^2 | gal |
dyn=g*Gal | dyne |
erg=dyn*cm | erg |
Ba=dyn/cm^2 | barye |
P=Ba*s | poise |
St=cm^2/s | stokes |
sb=cd/cm^2 | stilb |
ph=sb*sr | phot |
abA=Prefixes.da*A | abampere |
abC=abA*s | abcoloumb |
abV=erg/abC | abvolt |
Mx=erg/(abA*cyc) | maxwell |
Gs=Mx/cm^2 | gauss |
pole=4*pi*Mx | unit magnetic pole |
Oe=dyn/pole | oersted |
abF=abC/abV | abfarad |
abohm=s/abF | abohm |
abH=abohm*s | abhenry |
k_A=dyn/abA^2 | Ampere constant (kA) |
k_C=k_A*c^2 | Coulomb constant (kC) |
epsilon_0=1/(k_C*(if base.rational then 4*pi else 1)) | electric constant (ε0) |
mu_0=1/(epsilon_0*cyc^2*c^2) | magnetic constant (μ0) |
Z_0=2*k_A*c/rad | characteristic impedance of vacuum (Z0) |
alpha=k_A*c/R_K | fine-structure constant (α) |
a_0=alpha/(2*R_inf) | Bohr radius (a0) |
lambda_e=alpha*a_0/sr | electron Compton wavelength (λe) |
kappa=lambda_e*c/2 | quantum of circulation (κ) |
m_e=Phi_0/kappa | specific electron rest mass (me) |
r_e=k_A/m_e | specific classical electron radius (re) |
mu_B=kappa*e*sp/2 | Bohr magneton |
M_e=m_e*e | mass of an electron (Me) |
t_H=a_0*sqrt(M_e/Ha) | Hartree time (tH) |
l_n=h*rad/(M_e*c) | natural unit of length (ln) |
t_n=l_n/c | natural unit of time (tn) |
y=365.25*d | Julian year |
ly=c*y | light year |
au=149597870700*m | astronomical unit |
pc=au*648e3/pi | parsec |
atm=101325*Pa | atmosphere |
Torr=atm/760 | torr |
Wh=W*h | watt hour |
eV=e*V | electron volt |
sp=4*pi*sr | spat |
rpm=cyc/min | revolution per minute |
'%'=Prefixes.c | percent (%) |
AT=A*cyc | ampere-turn |
D=Prefixes.c*dyn/atm | darcy |
u=g/(N_A*mol) | unified atomic mass unit |
M=mol/L | molar |
kPag | kilopascal, gauge |
Interfaces | Partial classes |
final constant Q.Number pi=2*acos(0) "pi (π)";
replaceable constant Bases.SIKmol base constrainedby Bases.Base "Scalable base constants";
final constant Q.Wavenumber R_inf=base.R_inf "Rydberg constant (R∞)";
final constant Q.Velocity c=base.c "speed of light";
final constant Q.MagneticFluxReciprocal k_J=base.k_J "Josephson constant (kJ)";
final constant Q.MagneticFluxSpecific R_K=base.R_K "von Klitzing constant (RK)";
final constant Q.Number k_F=base.k_F "Faraday constant (kF)";
final constant Q.Number R=base.R "gas constant";
final constant Q.LengthSpecificMassSpecific k_Aprime=base.k_Aprime "modified Ampere constant (kA cyc/α)";
final constant Q.MagneticFlux Phi_0=1/k_J "magnetic flux quantum (Φ0)";
final constant Q.Conductance G_0=2/R_K "conductance quantum (G0)";
final constant Q.Amount e=G_0*Phi_0 "elementary charge";
final constant Q.MomentumRotational h=2*e*Phi_0 "Planck constant";
final constant Q.AmountReciprocal N_A=k_F/e "Avogadro constant (NA)";
final constant Q.Amount k_B=R/N_A "Boltzmann constant (kB)";
final constant Q.Angle cyc=k_Aprime*c/R_K "cycle";
final constant Q.PowerArea c_1=2*pi*h*c^2/cyc^3 "first radiation constant (c1)";
final constant Q.PotentialPerWavenumber c_2=h*c/k_B "second radiation constant (c2)";
final constant Q.MagneticFluxReciprocal c_3_f=2.821439372122079*c/c_2 "Wien frequency displacement constant (c3 f)";
final constant Q.PotentialPerWavenumber c_3_lambda=c_2/4.965114231744276 "Wien wavelength displacement constant (c3 λ)";
final constant Q.PowerAreicPerPotential4 sigma=c_1/15*(pi/c_2)^4 "Stefan-Boltzmann constant (σ)";
final constant Q.Energy Ry=h*c*R_inf "Rydberg energy";
final constant Q.Energy Ha=2*Ry "Hartree energy";
final constant Q.Temperature T_H=Ha/k_B "Hartree temperature (TH)";
final constant Q.Angle rad=cyc/(2*pi) "radian";
constant Q.Length m=10973731.568539*cyc/R_inf "metre";
constant Q.Time s=299792458*m/c "second";
constant Q.MagneticFlux Wb=483597.870e9/k_J "weber";
constant Q.Conductance S=25812.8074434/(R_K*cyc) "siemens";
constant Q.Amount mol=96485.3365*Wb*cyc*S/k_F "mole";
constant Q.Temperature K=8.3144621*(Wb*cyc)^2*S/(s*mol*R) "kelvin";
final constant Q.LuminousIntensity cd=1 "candela";
final constant Q.Frequency Hz=cyc/s "hertz";
final constant Q.Potential V=Wb*Hz "volt";
final constant Q.Current A=V*S "ampere";
final constant Q.Amount C=A*s "coulomb";
final constant Q.Energy J=V*C "joule";
final constant Q.Velocity2 Gy=(m/s)^2 "gray";
final constant Q.Mass kg=J/Gy "kilogram";
final constant Q.Mass g=kg/Prefixes.k "gram";
final constant Q.Angle2 sr=rad^2 "steradian";
final constant Q.Illuminance lm=cd*sr "lumen";
final constant Q.Power W=J/s "watt";
final constant Q.Force N=J/m "newton";
final constant Q.Pressure Pa=N/m^2 "pascal";
final constant Q.MagneticFluxAreic T=Wb/m^2 "tesla";
final constant Q.LuminousEmittance lx=lm/m^2 "lux";
final constant Q.Capacitance F=s*S "farad";
final constant Q.Resistance ohm=1/S "ohm (Ω)";
final constant Q.Inductance H=s/S "henry";
final constant Q.Current kat=mol/s "katal";
final constant Q.Velocity2 Sv=Gy "sievert";
final constant Q.TimeReciprocal Bq=1/s "becquerel";
final constant Interfaces.degC degC "degree Celsius (°C)";
final constant Q.Time min=60*s "minute";
final constant Q.Time hr=60*min "hour";
final constant Q.Time d=24*hr "day";
final constant Q.Angle deg=cyc/360 "degree (°)";
final constant Q.Angle arcmin=deg/60 "arcminute (′)";
final constant Q.Angle arcsec=arcmin/60 "arcsecond (′′)";
final constant Q.Area ha=(Prefixes.h*m)^2 "hectare";
final constant Q.Volume L=(Prefixes.d*m)^3 "litre (L or l)";
final constant Q.Mass t=Prefixes.M*g "tonne";
final constant Q.Acceleration g_0=9.80665*m/s^2 "standard gravity";
final constant Q.Length cm=Prefixes.c*m "centimetre";
final constant Q.Volume cc=cm^3 "cubic centimetre";
final constant Q.PressureLineic Hg=13.5951*g*g_0/cc "force per volume of mercury under standard gravity";
final constant Q.Length mm=Prefixes.m*m "millimetre";
final constant Q.Pressure mmHg=mm*Hg "millimetre of mercury";
final constant Q.Pressure kPa=Prefixes.k*Pa "kilopascal";
final constant Q.Pressure bar=100*kPa "bar";
final constant Q.Area b=100*(Prefixes.f*m)^2 "barn";
final constant Q.Length angstrom=1e-10*m "angstrom (Å)";
final constant Q.Length nmi=1852*m "nautical mile";
final constant Q.Velocity kn=nmi/hr "knot";
final constant Interfaces.Np Np "neper (in terms of amplitude ratio, not power ratio)";
final constant Interfaces.B B "bel (in terms of power ratio, not amplitude ratio)";
final constant Interfaces.dB dB "decibel (in terms of power ratio, not amplitude ratio)";
final constant Q.Acceleration Gal=cm/s^2 "gal";
final constant Q.Force dyn=g*Gal "dyne";
final constant Q.Energy erg=dyn*cm "erg";
final constant Q.Pressure Ba=dyn/cm^2 "barye";
final constant Q.Viscosity P=Ba*s "poise";
final constant Q.Diffusivity St=cm^2/s "stokes";
final constant Q.Luminance sb=cd/cm^2 "stilb";
final constant Q.Illuminance ph=sb*sr "phot";
final constant Q.Current abA=Prefixes.da*A "abampere";
final constant Q.Amount abC=abA*s "abcoloumb";
final constant Q.Potential abV=erg/abC "abvolt";
final constant Q.MagneticFlux Mx=erg/(abA*cyc) "maxwell";
final constant Q.MagneticFluxAreic Gs=Mx/cm^2 "gauss";
final constant Q.MagneticFlux pole=4*pi*Mx "unit magnetic pole";
final constant Q.MagneticFieldAux Oe=dyn/pole "oersted";
final constant Q.Capacitance abF=abC/abV "abfarad";
final constant Q.Resistance abohm=s/abF "abohm";
final constant Q.Inductance abH=abohm*s "abhenry";
constant Q.LengthSpecificMassSpecific k_A=dyn/abA^2 "Ampere constant (kA)";
constant Q.PermittivityReciprocal k_C=k_A*c^2 "Coulomb constant (kC)";
final constant Q.Permittivity epsilon_0=1/(k_C*(if base.rational then 4*pi else 1)) "electric constant (ε0)";
final constant Q.Permeability mu_0=1/(epsilon_0*cyc^2*c^2) "magnetic constant (μ0)";
final constant Q.Resistance Z_0=2*k_A*c/rad "characteristic impedance of vacuum (Z0)";
final constant Q.Angle alpha=k_A*c/R_K "fine-structure constant (α)";
final constant Q.Length a_0=alpha/(2*R_inf) "Bohr radius (a0)";
final constant Q.Wavelength lambda_e=alpha*a_0/sr "electron Compton wavelength (λe)";
final constant Q.WavelengthVelocity kappa=lambda_e*c/2 "quantum of circulation (κ)";
final constant Q.MassSpecific m_e=Phi_0/kappa "specific electron rest mass (me)";
final constant Q.LengthSpecific r_e=k_A/m_e "specific classical electron radius (re)";
final constant Q.MagneticDipoleMoment mu_B=kappa*e*sp/2 "Bohr magneton";
final constant Q.Mass M_e=m_e*e "mass of an electron (Me)";
final constant Q.Time t_H=a_0*sqrt(M_e/Ha) "Hartree time (tH)";
final constant Q.Length l_n=h*rad/(M_e*c) "natural unit of length (ln)";
final constant Q.Time t_n=l_n/c "natural unit of time (tn)";
final constant Q.Time y=365.25*d "Julian year";
final constant Q.Length ly=c*y "light year";
final constant Q.Length au=149597870700*m "astronomical unit";
final constant Q.Length pc=au*648e3/pi "parsec";
final constant Q.Pressure atm=101325*Pa "atmosphere";
final constant Q.Pressure Torr=atm/760 "torr";
final constant Q.Energy Wh=W*h "watt hour";
final constant Q.Energy eV=e*V "electron volt";
final constant Q.Angle2 sp=4*pi*sr "spat";
final constant Q.Frequency rpm=cyc/min "revolution per minute";
final constant Q.Number '%'=Prefixes.c "percent (%)";
final constant Q.MagnetomotiveForce AT=A*cyc "ampere-turn";
final constant Q.Area D=Prefixes.c*dyn/atm "darcy";
final constant Q.Mass u=g/(N_A*mol) "unified atomic mass unit";
final constant Q.Concentration M=mol/L "molar";
final constant Interfaces.kPag kPag "kilopascal, gauge";
Set up the units in Dymola
This function has no inputs or outputs. It is essentially a script.
The defineDefaultDisplayUnit
and defineUnitConversion
functions
used here are not defined in the Modelica language (as of version 3.3) but are
recognized by Dymola.
For more information, please see the documentation for the Units package.
Extends from Icons.Function (Icon for functions (from MSL 3.2.1)).
Base constants for the unit system
Drop this record into your top-level model to record the values of the base constants with the simulation results. It is necessary to know the values of the base constants in order to interpret the results.
Extends from Bases.Base (Base constants).