| 1 | within Modelica; |
|---|
| 2 | package Constants |
|---|
| 3 | "Library of mathematical constants and constants of nature (e.g., pi, eps, R, sigma)" |
|---|
| 4 | |
|---|
| 5 | import SI = Modelica.SIunits; |
|---|
| 6 | import NonSI = Modelica.SIunits.Conversions.NonSIunits; |
|---|
| 7 | |
|---|
| 8 | extends Modelica.Icons.Library2; |
|---|
| 9 | |
|---|
| 10 | // Mathematical constants |
|---|
| 11 | constant Real e=Modelica.Math.exp(1.0); |
|---|
| 12 | constant Real pi=2*Modelica.Math.asin(1.0); // 3.14159265358979; |
|---|
| 13 | constant Real D2R=pi/180 "Degree to Radian"; |
|---|
| 14 | constant Real R2D=180/pi "Radian to Degree"; |
|---|
| 15 | |
|---|
| 16 | // Machine dependent constants |
|---|
| 17 | // (the definition is a temporary fix since not adapted to the |
|---|
| 18 | // machine where the Modelica translator is running) |
|---|
| 19 | constant Real eps=1.e-15 "Biggest number such that 1.0 + eps = 1.0"; |
|---|
| 20 | constant Real small=1.e-60 |
|---|
| 21 | "Smallest number such that small and -small are representable on the machine"; |
|---|
| 22 | constant Real inf=1.e+60 |
|---|
| 23 | "Biggest Real number such that inf and -inf are representable on the machine"; |
|---|
| 24 | constant Integer Integer_inf=2147483647 |
|---|
| 25 | "Biggest Integer number such that Integer_inf and -Integer_inf are representable on the machine"; |
|---|
| 26 | |
|---|
| 27 | // Constants of nature |
|---|
| 28 | // (name, value, description from http://physics.nist.gov/cuu/Constants/) |
|---|
| 29 | constant SI.Velocity c=299792458 "Speed of light in vacuum"; |
|---|
| 30 | constant SI.Acceleration g_n=9.80665 |
|---|
| 31 | "Standard acceleration of gravity on earth"; |
|---|
| 32 | constant Real G(final unit="m3/(kg.s2)") = 6.6742e-11 |
|---|
| 33 | "Newtonian constant of gravitation"; |
|---|
| 34 | constant Real h(final unit="J.s") = 6.6260693e-34 "Planck constant"; |
|---|
| 35 | constant Real k(final unit="J/K") = 1.3806505e-23 "Boltzmann constant"; |
|---|
| 36 | constant Real R(final unit="J/(mol.K)") = 8.314472 "Molar gas constant"; |
|---|
| 37 | constant Real sigma(final unit="W/(m2.K4)") = 5.670400e-8 |
|---|
| 38 | "Stefan-Boltzmann constant"; |
|---|
| 39 | constant Real N_A(final unit="1/mol") = 6.0221415e23 "Avogadro constant"; |
|---|
| 40 | constant Real mue_0(final unit="N/A2") = 4*pi*1.e-7 "Magnetic constant"; |
|---|
| 41 | constant Real epsilon_0(final unit="F/m") = 1/(mue_0*c*c) "Electric constant"; |
|---|
| 42 | constant NonSI.Temperature_degC T_zero=-273.15 "Absolute zero temperature"; |
|---|
| 43 | |
|---|
| 44 | annotation ( |
|---|
| 45 | Documentation(info="<html> |
|---|
| 46 | <p> |
|---|
| 47 | This package provides often needed constants from mathematics, machine |
|---|
| 48 | dependent constants and constants from nature. The latter constants |
|---|
| 49 | (name, value, description) are from the following source: |
|---|
| 50 | </p> |
|---|
| 51 | |
|---|
| 52 | <dl> |
|---|
| 53 | <dt>Peter J. Mohr and Barry N. Taylor (1999):</dt> |
|---|
| 54 | <dd><b>CODATA Recommended Values of the Fundamental Physical Constants: 1998</b>. |
|---|
| 55 | Journal of Physical and Chemical Reference Data, Vol. 28, No. 6, 1999 and |
|---|
| 56 | Reviews of Modern Physics, Vol. 72, No. 2, 2000. See also <a href= |
|---|
| 57 | \"http://physics.nist.gov/cuu/Constants/\">http://physics.nist.gov/cuu/Constants/</a></dd> |
|---|
| 58 | </dl> |
|---|
| 59 | |
|---|
| 60 | <p>CODATA is the Committee on Data for Science and Technology.</p> |
|---|
| 61 | |
|---|
| 62 | <dl> |
|---|
| 63 | <dt><b>Main Author:</b></dt> |
|---|
| 64 | <dd><a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a><br> |
|---|
| 65 | Deutsches Zentrum für Luft und Raumfahrt e. V. (DLR)<br> |
|---|
| 66 | Oberpfaffenhofen<br> |
|---|
| 67 | Postfach 11 16<br> |
|---|
| 68 | D-82230 Weßling<br> |
|---|
| 69 | email: <a href=\"mailto:Martin.Otter@dlr.de\">Martin.Otter@dlr.de</a></dd> |
|---|
| 70 | </dl> |
|---|
| 71 | |
|---|
| 72 | |
|---|
| 73 | <p> |
|---|
| 74 | Copyright © 1998-2007, Modelica Association and DLR. |
|---|
| 75 | </p> |
|---|
| 76 | <p> |
|---|
| 77 | <i>This Modelica package is <b>free</b> software; it can be redistributed and/or modified |
|---|
| 78 | under the terms of the <b>Modelica license</b>, see the license conditions |
|---|
| 79 | and the accompanying <b>disclaimer</b> |
|---|
| 80 | <a href=\"Modelica://Modelica.UsersGuide.ModelicaLicense\">here</a>.</i> |
|---|
| 81 | </p><br> |
|---|
| 82 | </html> |
|---|
| 83 | ", revisions="<html> |
|---|
| 84 | <ul> |
|---|
| 85 | <li><i>Nov 8, 2004</i> |
|---|
| 86 | by <a href=\"http://www.robotic.dlr.de/Christian.Schweiger/\">Christian Schweiger</a>:<br> |
|---|
| 87 | Constants updated according to 2002 CODATA values.</li> |
|---|
| 88 | <li><i>Dec 9, 1999</i> |
|---|
| 89 | by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>:<br> |
|---|
| 90 | Constants updated according to 1998 CODATA values. Using names, values |
|---|
| 91 | and description text from this source. Included magnetic and |
|---|
| 92 | electric constant.</li> |
|---|
| 93 | <li><i>Sep 18, 1999</i> |
|---|
| 94 | by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>:<br> |
|---|
| 95 | Constants eps, inf, small introduced.</li> |
|---|
| 96 | <li><i>Nov 15, 1997</i> |
|---|
| 97 | by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>:<br> |
|---|
| 98 | Realized.</li> |
|---|
| 99 | </ul> |
|---|
| 100 | </html>"), |
|---|
| 101 | Window( |
|---|
| 102 | x=0.16, |
|---|
| 103 | y=0.01, |
|---|
| 104 | width=0.65, |
|---|
| 105 | height=0.81, |
|---|
| 106 | library=1, |
|---|
| 107 | autolayout=1), |
|---|
| 108 | Invisible=true, |
|---|
| 109 | Icon( |
|---|
| 110 | Line(points=[-34, -38; 12, -38], style(color=0, thickness=2)), |
|---|
| 111 | Line(points=[-20, -38; -24, -48; -28, -56; -34, -64], style(color=0, |
|---|
| 112 | thickness=2)), |
|---|
| 113 | Line(points=[-2, -38; 2, -46; 8, -56; 14, -64], style(color=0, thickness= |
|---|
| 114 | 2))), |
|---|
| 115 | Diagram( |
|---|
| 116 | Rectangle(extent=[200, 162; 380, 312], style(fillColor=30, fillPattern=1)), |
|---|
| 117 | Polygon(points=[200, 312; 220, 332; 400, 332; 380, 312; 200, 312], style( |
|---|
| 118 | fillColor=30, fillPattern=1)), |
|---|
| 119 | Polygon(points=[400, 332; 400, 182; 380, 162; 380, 312; 400, 332], style( |
|---|
| 120 | fillColor=30, fillPattern=1)), |
|---|
| 121 | Text( |
|---|
| 122 | extent=[210, 302; 370, 272], |
|---|
| 123 | string="Library", |
|---|
| 124 | style( |
|---|
| 125 | color=9, |
|---|
| 126 | fillColor=0, |
|---|
| 127 | fillPattern=1)), |
|---|
| 128 | Line(points=[266, 224; 312, 224], style(color=0, thickness=4)), |
|---|
| 129 | Line(points=[280, 224; 276, 214; 272, 206; 266, 198], style(color=0, |
|---|
| 130 | thickness=4)), |
|---|
| 131 | Line(points=[298, 224; 302, 216; 308, 206; 314, 198], style(color=0, |
|---|
| 132 | thickness=4)), |
|---|
| 133 | Text( |
|---|
| 134 | extent=[152, 412; 458, 334], |
|---|
| 135 | string="Modelica.Constants", |
|---|
| 136 | style(color=1)))); |
|---|
| 137 | end Constants; |
|---|