QCalc.Units

Constants and units of physical measure

Information

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:

  1. The radian is defined as the cycle divided by two pi (rad = cyc/2π), which is not necessarily one because angle is derived from the independent base constants (as mentioned above).
  2. Solid angle has the dimensionality of squared angle. The streradian (sr) is defined as the squared radian (rad2), not one.
  3. Frequency and rotational velocity have the dimensionality of angle per time. The hertz (Hz) is defined as cyc/s (not s-1).
  4. The cross product (×) introduces a factor of rad-1. This means that:
    • Torque, defined as r×F, has the dimensionality of energy per angle. Where J or N m is traditionally used to express torque, J/rad (or N m/rad) should be used.
    • A factor of 2π appears in the the Maxwell-Faraday equation and Ampère's circuital law of Maxwell's equations:
      • ∇×E = -2π ∂B/∂t
      • ∇×B = 2π μ0(J + ε0 ∂E/∂t) (This formation is also based on other points below.)
      • Rotational momentum has a factor of angle in the denominator.
        • The Planck constant (h) can be expressed in J/Hz or J s/rad (but not J s):
          • h cyc ≈ 6.626×10-34 J s (the traditional expression of the Planck constant [NIST2010])
          • h rad ≈ 1.055×10-34 J s (the traditional expression of the reduced Planck constant [NIST2010])
        • The quantum of circulation (rotational momentum per mass) is expressed as:
          • kappa ≈ 3.637×10-4 m2/(cyc s)
    • Rotational inertia has a factor of squared angle in the denominator. It can be expressed in kg m2/rad2.
    • Wavenumber has the dimensionality of angle per length. Where m-1 (or cm-1, etc.) is traditionally used to express wavenumber, cyc/m (or cyc/cm, etc.) should be used instead. Reciprocally, wavelength has the dimensionality of length per angle and is expressed using m/cyc (or cm/cyc, etc.). This implies that:
      • R ≈ 10973732 cyc/m
      • c2 = 1.439×10-2 m K/cyc
      • c3 λ ≈ 2.898×10-3 m K/cyc
      • λe cyc ≈ 2.426×10-12 m (The right side is the traditional expression of the electron's Compton wavelength [NIST2010].)
      • λe rad ≈ 386.2×10-15 m (The right side is the traditional expression of the electron's Compton wavelength over 2 π [NIST2010].)
    • Magnetic flux and related quantities have a factor of angle in the denominator.
    • The magnetic constant has a factor of squared angle in the denominator:
      • μ0 = 4π×10-7 H/(m cyc2) = 2kA/(cyc rad), where 2kA is the factor in Ampère's force law.
      In the basic equation for the inductance of a solenoid in vacuum, N (the number of turns) is replaced by the angle of the wound coil (θ = N cyc):
      • L = μ0 θ2 A/ℓ.
  5. The auxiliary magnetic field (H), magnetic moment, and related quantities have a factor of angle in the numerator.
  6. It follows that magnetizability, the ratio between magnetic moment and magnetic flux density, has squared angle in the numerator. A factor of cyc2 must be added to the traditional symbolic expression of the atomic unit of magnetizability.
  7. The henry (H) is defined as V s/A (not Wb/A). Although it related to magnetics, the henry is applied to electrical circuits, so it does not include any factors of angle.
  8. Traditional trigonometric functions accept angles in radians. Angles should be divided by the radian (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).
  9. The first radiation constant has a factor of angle to the fourth power in the denominator:
    • c1 cyc4 ≈ 3.742×10-16 W m2 (The right side is the traditional expression [NIST2010].)

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/ε0q1q2/(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/r2
where 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)).

Package Contents

Name Description
QCalc.Units.setup setup Set up the units in Dymola
QCalc.Units.UnitSystem UnitSystem Base constants for the unit system
QCalc.Units.Examples Examples Examples
QCalc.Units.Bases Bases Sets of base constants and units
QCalc.Units.Prefixes 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 quantum0)
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 constant0)
mu_0=1/(epsilon_0*cyc^2*c^2) magnetic constant0)
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 wavelengthe)
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
QCalc.Units.Interfaces Interfaces Partial classes

Types and constants

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 quantum0)";
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 constant0)";
final constant Q.Permeability mu_0=1/(epsilon_0*cyc^2*c^2) 
  "magnetic constant0)";
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 wavelengthe)";
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";

QCalc.Units.setup QCalc.Units.setup

Set up the units in Dymola

Information

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)).

Modelica definition

replaceable function setup "Set up the units in Dymola" // import Modelica.Utilities.Streams.print; extends Icons.Function; algorithm // print("Establishing display units…"); // ------------------------------------------------------------------------- // Default display units // ------------------------------------------------------------------------- // If units other than those in the displayUnit attribute of the quantities // in QCalc.Quantities should be used by default, then specify them here. // Be sure that the desired unit is included in a defineUnitConversion // command below. // Generated from QCalc/Resources/quantities.xlsx, 2014-8-14 defineDefaultDisplayUnit("L/T2", "m/s2") "Acceleration"; defineDefaultDisplayUnit("L/T2", "Gal") "Acceleration"; defineDefaultDisplayUnit("N", "C") "Amount"; defineDefaultDisplayUnit("1/N", "1/mol") "Reciprocal of amount"; defineDefaultDisplayUnit("1/N", "1/abC") "Reciprocal of amount"; defineDefaultDisplayUnit("1/N", "N_A/") "Reciprocal of amount"; defineDefaultDisplayUnit("A", "deg") "Angle"; defineDefaultDisplayUnit("A2", "sr") "Solid angle"; defineDefaultDisplayUnit("L2", "cm2") "Area"; defineDefaultDisplayUnit("N2.T2/(L2.M)", "uF") "Capacitance"; defineDefaultDisplayUnit("N/L3", "M") "Concentration"; defineDefaultDisplayUnit("N2.T/(L2.M)", "S") "Conductance"; defineDefaultDisplayUnit("N/T", "A") "Current"; defineDefaultDisplayUnit("L2/T", "St") "Diffusivity"; defineDefaultDisplayUnit("L2.M/T2", "J") "Energy"; defineDefaultDisplayUnit("L.M/T2", "N") "Force"; defineDefaultDisplayUnit("A/T", "Hz") "Frequency"; defineDefaultDisplayUnit("J.A2", "lm") "Illuminance"; defineDefaultDisplayUnit("L2.M/N2", "uH") "Inductance"; defineDefaultDisplayUnit("L2.M/N2", "abH") "Inductance"; defineDefaultDisplayUnit("L", "cm") "Length"; defineDefaultDisplayUnit("L/N", "m/mol") "Specific length"; defineDefaultDisplayUnit("L.M/N2", "H/m") "Specific length times specific mass"; defineDefaultDisplayUnit("J/L2", "sb") "Luminance"; defineDefaultDisplayUnit("J.A2/L2", "lx") "Luminous emittance"; defineDefaultDisplayUnit("J", "cd") "Luminous intensity"; defineDefaultDisplayUnit("A.L2.N/T", "J/T") "Magnetic dipole moment"; defineDefaultDisplayUnit("A.N/(L.T)", "AT/m") "Auxiliary magnetic field"; defineDefaultDisplayUnit("L2.M/(A.N.T)", "Wb") "Magnetic flux"; defineDefaultDisplayUnit("M/(A.N.T)", "T") "Areic magnetic flux"; defineDefaultDisplayUnit("A.N.T/(L2.M)", "1/Wb") "Reciprocal of magnetic flux"; defineDefaultDisplayUnit("L2.M/(A.N2.T)", "Wb/C") "Specific magnetic flux"; defineDefaultDisplayUnit("A.N/T", "AT") "Magnetomotive force"; defineDefaultDisplayUnit("M", "g") "Mass"; defineDefaultDisplayUnit("M/N", "g/mol") "Specific mass"; defineDefaultDisplayUnit("L2.M/(A.T)", "J/Hz") "Rotational momentum"; defineDefaultDisplayUnit("L.M/(A2.N2)", "Wb/(AT.m)") "Permeability"; defineDefaultDisplayUnit("N2.T2/(L3.M)", "F/m") "Permittivity"; defineDefaultDisplayUnit("L3.M/(N2.T2)", "m/F") "Reciprocal of permittivity"; defineDefaultDisplayUnit("L2.M/(N.T2)", "V") "Potential"; defineDefaultDisplayUnit("L3.M/(A.N.T2)", "V.m/rad") "Potential per wavenumber"; defineDefaultDisplayUnit("L2.M/T3", "W") "Power"; defineDefaultDisplayUnit("L4.M/T3", "W.m2") "Power times area"; defineDefaultDisplayUnit("M/T3", "W/m2") "Areic power"; defineDefaultDisplayUnit("N4.T5/(L8.M3)", "W/(m2.K4)") "Areic power per 4th power of potential"; defineDefaultDisplayUnit("M/(L.T2)", "kPa") "Pressure"; defineDefaultDisplayUnit("L2.M/(N2.T)", "ohm") "Resistance"; defineDefaultDisplayUnit("T", "s") "Time"; defineDefaultDisplayUnit("1/T", "Bq") "Reciprocal of time"; defineDefaultDisplayUnit("L/T", "cm/s") "Velocity"; defineDefaultDisplayUnit("L2/T2", "J/g") "Squared velocity"; defineDefaultDisplayUnit("M/(L.T)", "Pa.s") "Viscosity"; defineDefaultDisplayUnit("L3", "cc") "Volume"; defineDefaultDisplayUnit("L/A", "m/cyc") "Wavelength"; defineDefaultDisplayUnit("L2/(A.T)", "m2/(cyc.s)") "Wavelength times velocity"; defineDefaultDisplayUnit("A/L", "cyc/m") "Wavenumber"; // ------------------------------------------------------------------------- // Conversions to display quantities in units // ------------------------------------------------------------------------- defineUnitConversion( "L/T2", "cm/s2", s^2/cm) "Acceleration"; defineUnitConversion( "L/T2", "m/s2", s^2/m) "Acceleration"; defineUnitConversion( "L/T2", "Gal", 1/Gal) "Acceleration"; defineUnitConversion( "N", "C", 1/C) "Amount"; defineUnitConversion( "N", "J/K", K/J) "Amount"; defineUnitConversion( "N", "mol", 1/mol) "Amount"; defineUnitConversion( "N", "e", 1/e) "Amount"; defineUnitConversion( "N", "abC", 1/C) "Amount"; defineUnitConversion( "1/N", "1/C", C) "Reciprocal of amount"; defineUnitConversion( "1/N", "1/mol", mol) "Reciprocal of amount"; defineUnitConversion( "1/N", "1/abC", mol) "Reciprocal of amount"; defineUnitConversion( "1/N", "N_A", 1/N_A) "Reciprocal of amount"; defineUnitConversion( "A", "deg", 1/deg) "Angle"; defineUnitConversion( "A", "rad", 1/rad) "Angle"; defineUnitConversion( "A", "cyc", 1/cyc) "Angle"; defineUnitConversion( "A", "arcmin", 1/arcmin) "Angle"; defineUnitConversion( "A", "arcsec", 1/arcsec) "Angle"; defineUnitConversion( "A2", "sr", 1/sr) "Solid angle"; defineUnitConversion( "A2", "sp", 1/sp) "Solid angle"; defineUnitConversion( "L2", "cm2", 1/cm^2) "Area"; defineUnitConversion( "L2", "m2", 1/m^2) "Area"; defineUnitConversion( "L2", "b", 1/b) "Area"; defineUnitConversion( "N2.T2/(L2.M)", "F", 1/F) "Capacitance"; defineUnitConversion( "N2.T2/(L2.M)", "uF", 1/(Prefixes.u*F)) "Capacitance"; defineUnitConversion( "N2.T2/(L2.M)", "abF", 1/abF) "Capacitance"; defineUnitConversion( "N/L3", "C/cc", cc/C) "Concentration"; defineUnitConversion( "N/L3", "C/m3", m^3/C) "Concentration"; defineUnitConversion( "N/L3", "J/(m3.K)", m^3*K/J) "Concentration"; defineUnitConversion( "N/L3", "M", 1/M) "Concentration"; defineUnitConversion( "N2.T/(L2.M)", "S", 1/S) "Conductance"; defineUnitConversion( "N/T", "A", 1/A) "Current"; defineUnitConversion( "N/T", "kat", 1/kat) "Current"; defineUnitConversion( "N/T", "abA", 1/abA) "Current"; defineUnitConversion( "N/T", "W/K", K/W) "Current"; defineUnitConversion( "L2/T", "St", 1/St) "Diffusivity"; defineUnitConversion( "L2/T", "m2/s", s/m^2) "Diffusivity"; defineUnitConversion( "L2/T", "mm^2/s", s/mm^2) "Diffusivity"; defineUnitConversion( "L2.M/T2", "J", 1/J) "Energy"; defineUnitConversion( "L2.M/T2", "Ry", 1/Ry) "Energy"; defineUnitConversion( "L2.M/T2", "Ha", 1/Ha) "Energy"; defineUnitConversion( "L2.M/T2", "erg", 1/erg) "Energy"; defineUnitConversion( "L2.M/T2", "Wh", 1/Wh) "Energy"; defineUnitConversion( "L2.M/T2", "eV", 1/eV) "Energy"; defineUnitConversion( "L.M/T2", "N", 1/N) "Force"; defineUnitConversion( "L.M/T2", "dyn", 1/dyn) "Force"; defineUnitConversion( "A/T", "Hz", 1/Hz) "Frequency"; defineUnitConversion( "A/T", "rad/s", s/rad) "Frequency"; defineUnitConversion( "A/T", "rpm", 1/rpm) "Frequency"; defineUnitConversion( "J.A2", "lm", 1/lm) "Illuminance"; defineUnitConversion( "J.A2", "ph", 1/ph) "Illuminance"; defineUnitConversion( "L2.M/N2", "H", 1/H) "Inductance"; defineUnitConversion( "L2.M/N2", "uH", 1/(Prefixes.u*H)) "Inductance"; defineUnitConversion( "L2.M/N2", "abH", 1/abH) "Inductance"; defineUnitConversion( "L", "cm", 1/cm) "Length"; defineUnitConversion( "L", "m", 1/m) "Length"; defineUnitConversion( "L", "mm", 1/mm) "Length"; defineUnitConversion( "L", "angstrom", 1/angstrom) "Length"; defineUnitConversion( "L", "nmi", 1/nmi) "Length"; defineUnitConversion( "L", "a_0", 1/a_0) "Length"; defineUnitConversion( "L", "l_n", 1/l_n) "Length"; defineUnitConversion( "L", "ly", 1/ly) "Length"; defineUnitConversion( "L", "au", 1/au) "Length"; defineUnitConversion( "L", "pc", 1/pc) "Length"; defineUnitConversion( "L/N", "m/C", C/m) "Specific length"; defineUnitConversion( "L/N", "m/mol", mol/m) "Specific length"; defineUnitConversion( "L.M/N2", "H/m", m/H) "Specific length times specific mass"; defineUnitConversion( "L.M/N2", "N/A2", A^2/N) "Specific length times specific mass"; defineUnitConversion( "J/L2", "cd/m2", m^2/cd) "Luminance"; defineUnitConversion( "J/L2", "sb", 1/sb) "Luminance"; defineUnitConversion( "J.A2/L2", "lx", 1/lx) "Luminous emittance"; defineUnitConversion( "J", "cd", 1/cd) "Luminous intensity"; defineUnitConversion( "A.L2.N/T", "J/T", T/J) "Magnetic dipole moment"; defineUnitConversion( "A.L2.N/T", "mu_B", 1/mu_B) "Magnetic dipole moment"; defineUnitConversion( "A.N/(L.T)", "AT/m", m/AT) "Auxiliary magnetic field"; defineUnitConversion( "A.N/(L.T)", "Oe", 1/Oe) "Auxiliary magnetic field"; defineUnitConversion( "L2.M/(A.N.T)", "Wb", 1/Wb) "Magnetic flux"; defineUnitConversion( "L2.M/(A.N.T)", "Mx", 1/Mx) "Magnetic flux"; defineUnitConversion( "L2.M/(A.N.T)", "pole", 1/pole) "Magnetic flux"; defineUnitConversion( "M/(A.N.T)", "T", 1/T) "Areic magnetic flux"; defineUnitConversion( "M/(A.N.T)", "Gs", 1/Gs) "Areic magnetic flux"; defineUnitConversion( "A.N.T/(L2.M)", "1/Wb", Wb) "Reciprocal of magnetic flux"; defineUnitConversion( "L2.M/(A.N2.T)", "Wb/C", C/Wb) "Specific magnetic flux"; defineUnitConversion( "L2.M/(A.N2.T)", "Mx/abC", abC/Mx) "Specific magnetic flux"; defineUnitConversion( "A.N/T", "AT", 1/AT) "Magnetomotive force"; defineUnitConversion( "M", "g", 1/g) "Mass"; defineUnitConversion( "M", "kg", 1/kg) "Mass"; defineUnitConversion( "M", "u", 1/u) "Mass"; defineUnitConversion( "M", "t", 1/t) "Mass"; defineUnitConversion( "M", "M_e", 1/M_e) "Mass"; defineUnitConversion( "M/N", "g/mol", mol/g) "Specific mass"; defineUnitConversion( "L2.M/(A.T)", "J.s/rad", rad/(J*s)) "Rotational momentum"; defineUnitConversion( "L2.M/(A.T)", "J/Hz", Hz/J) "Rotational momentum"; defineUnitConversion( "L2.M/(A.T)", "h", 1/h) "Rotational momentum"; defineUnitConversion( "1", "'%'", 1/'%') "Number"; defineUnitConversion( "L.M/(A2.N2)", "H/(m.cyc2)", m*cyc^2/H) "Permeability"; defineUnitConversion( "L.M/(A2.N2)", "Wb/(AT.m)", AT*m/Wb) "Permeability"; defineUnitConversion( "L.M/(A2.N2)", "mu_0", 1/mu_0) "Permeability"; defineUnitConversion( "N2.T2/(L3.M)", "F/m", m/F) "Permittivity"; defineUnitConversion( "N2.T2/(L3.M)", "epsilon_0", 1/epsilon_0) "Permittivity"; defineUnitConversion( "N2.T2/(L3.M)", "k_C", 1/k_C) "Permittivity"; defineUnitConversion( "L3.M/(N2.T2)", "m/F", F/m) "Reciprocal of permittivity"; defineUnitConversion( "L3.M/(N2.T2)", "1/epsilon_0", epsilon_0) "Reciprocal of permittivity"; defineUnitConversion( "L3.M/(N2.T2)", "1/k_C", k_C) "Reciprocal of permittivity"; defineUnitConversion( "L2.M/(N.T2)", "J/mol", mol/J) "Potential"; defineUnitConversion( "L2.M/(N.T2)", "V", 1/V) "Potential"; defineUnitConversion( "L2.M/(N.T2)", "abV", 1/abV) "Potential"; defineUnitConversion( "L2.M/(N.T2)", "K", 1/K) "Potential"; defineUnitConversion( "L3.M/(A.N.T2)", "K.m/rad", rad/(K*m)) "Potential per wavenumber"; defineUnitConversion( "L3.M/(A.N.T2)", "V.m/rad", rad/(V*m)) "Potential per wavenumber"; defineUnitConversion( "L2.M/T3", "W", 1/W) "Power"; defineUnitConversion( "L4.M/T3", "W.m2", 1/(W*m^2)) "Power times area"; defineUnitConversion( "M/T3", "W/m2", m^2/W) "Areic power"; defineUnitConversion( "N4.T5/(L8.M3)", "W/(m2.K4)", m^2*K^4/W) "Areic power per 4th power of potential"; defineUnitConversion( "N4.T5/(L8.M3)", "sigma", 1/sigma) "Areic power per 4th power of potential"; defineUnitConversion( "M/(L.T2)", "atm", 1/atm) "Pressure"; defineUnitConversion( "M/(L.T2)", "bar", 1/bar) "Pressure"; defineUnitConversion( "M/(L.T2)", "kPa", 1/kPa) "Pressure"; defineUnitConversion( "M/(L.T2)", "Pa", 1/Pa) "Pressure"; defineUnitConversion( "M/(L.T2)", "mmHg", 1/mmHg) "Pressure"; defineUnitConversion( "M/(L.T2)", "bar", 1/bar) "Pressure"; defineUnitConversion( "M/(L.T2)", "Ba", 1/Ba) "Pressure"; defineUnitConversion( "M/(L.T2)", "atm", 1/atm) "Pressure"; defineUnitConversion( "M/(L.T2)", "Torr", 1/Torr) "Pressure"; defineUnitConversion( "M/(L2.T2)", "Pa/m", m/Pa) "Lineic pressure"; defineUnitConversion( "L2.M/(N2.T)", "ohm", 1/ohm) "Resistance"; defineUnitConversion( "L2.M/(N2.T)", "abohm", 1/abohm) "Resistance"; defineUnitConversion( "T", "d", 1/d) "Time"; defineUnitConversion( "T", "hr", 1/hr) "Time"; defineUnitConversion( "T", "us", 1/(Prefixes.u*s)) "Time"; defineUnitConversion( "T", "ms", 1/(Prefixes.m*s)) "Time"; defineUnitConversion( "T", "min", 1/min) "Time"; defineUnitConversion( "T", "s", 1/s) "Time"; defineUnitConversion( "T", "y", 1/y) "Time"; defineUnitConversion( "T", "t_n", 1/t_n) "Time"; defineUnitConversion( "T", "t_H", 1/t_H) "Time"; defineUnitConversion( "1/T", "1/s", s) "Reciprocal of time"; defineUnitConversion( "1/T", "Bq", 1/Bq) "Reciprocal of time"; defineUnitConversion( "L/T", "cm/s", s/cm) "Velocity"; defineUnitConversion( "L/T", "m/s", s/m) "Velocity"; defineUnitConversion( "L/T", "mm/s", s/mm) "Velocity"; defineUnitConversion( "L/T", "um/s", s/(Prefixes.u*m)) "Velocity"; defineUnitConversion( "L/T", "c", 1/c) "Velocity"; defineUnitConversion( "L/T", "kn", 1/kn) "Velocity"; defineUnitConversion( "L2/T2", "J/g", g/J) "Squared velocity"; defineUnitConversion( "L2/T2", "Sv", 1/Sv) "Squared velocity"; defineUnitConversion( "L2/T2", "Gy", 1/Gy) "Squared velocity"; defineUnitConversion( "M/(L.T)", "Pa.s", 1/(Pa*s)) "Viscosity"; defineUnitConversion( "M/(L.T)", "g/(cm.s)", cm*s/g) "Viscosity"; defineUnitConversion( "L3", "cc", 1/cc) "Volume"; defineUnitConversion( "L3", "L", 1/L) "Volume"; defineUnitConversion( "L3", "m3", 1/m^3) "Volume"; defineUnitConversion( "L/A", "cm/cyc", cyc/cm) "Wavelength"; defineUnitConversion( "L/A", "m/cyc", cyc/m) "Wavelength"; defineUnitConversion( "L/A", "m/rad", rad/m) "Wavelength"; defineUnitConversion( "L/A", "lambda_e", 1/lambda_e) "Wavelength"; defineUnitConversion( "L2/(A.T)", "m2/(cyc.s)", cyc*s/m^2) "Wavelength times velocity"; defineUnitConversion( "L2/(A.T)", "cm2/(cyc.s)", cyc*s/cm^2) "Wavelength times velocity"; defineUnitConversion( "L2/(A.T)", "kappa", 1/kappa) "Wavelength times velocity"; defineUnitConversion( "A/L", "cyc/m", m/cyc) "Wavenumber"; defineUnitConversion( "A/L", "rad/m", m/rad) "Wavenumber"; defineUnitConversion( "A/L", "cyc/(cm.s)", cm*s/cyc) "Wavenumber"; // -------- end from QCalc/Resources/quantities.xlsx // ------------------------------------------------------------------------- // Conversions with offsets // ------------------------------------------------------------------------- defineUnitConversion( "L2.M/(N.T2)", "degC", 1/K, -273.15) "Temperature in degC"; defineUnitConversion( "L2.M/(N.T2)", "degF", 9/(5*K), 32 - (9/5)*273.15) "Temperature in degF"; defineUnitConversion( "M/(L.T2)", "Pag", 1/Pa, -atm/Pa) "Pressure in Pag"; // print("Done."); end setup;

QCalc.Units.UnitSystem QCalc.Units.UnitSystem

Base constants for the unit system

Information

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).

Modelica definition

record UnitSystem "Base constants for the unit system" import QCalc; extends Bases.Base( final R_inf=QCalc.Units.R_inf, final c=QCalc.Units.c, final k_J=QCalc.Units.k_J, final R_K=QCalc.Units.R_K, final k_F=QCalc.Units.k_F, final R=QCalc.Units.R, final rational=QCalc.Units.base.rational); end UnitSystem;