1 |
(* ASCEND modelling environment |
2 |
Copyright (C) 2007-2008 Carnegie Mellon University |
3 |
Copyright (C) 1994-1997 Carnegie Mellon University |
4 |
Copyright (C) 1990 Thomas Guthrie Epperly |
5 |
|
6 |
The ASCEND Modeling Library is free software; you can redistribute |
7 |
it and/or modify it under the terms of the GNU General Public |
8 |
License as published by the Free Software Foundation; either |
9 |
version 2 of the License, or (at your option) any later version. |
10 |
|
11 |
The ASCEND Modeling Library is distributed in hope that it |
12 |
will be useful, but WITHOUT ANY WARRANTY; without even the implied |
13 |
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
14 |
See the GNU General Public License for more details. |
15 |
|
16 |
You should have received a copy of the GNU General Public License |
17 |
along with the program; if not, write to the Free Software |
18 |
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139 USA. |
19 |
*) |
20 |
PROVIDE "measures.a4l"; |
21 |
(* |
22 |
This provides common unit definitions. The user may write additional |
23 |
files of unit definitions particular to their problem or site. |
24 |
|
25 |
This is a file defining the conversion factors ASCEND will recognize when |
26 |
it sees them as {units}. Note that the assignment "x := 0.5 {100}" yields |
27 |
x == 50, and that there are no 'offset conversions', e.g. "F=9/5C+32". |
28 |
|
29 |
Please keep unit names to 20 characters or less as this makes life pretty. |
30 |
This is not a hard limit however. |
31 |
|
32 |
All ASCEND units are built up from base units for each dimension of |
33 |
measurement. The base units are mostly the Systeme Internationale base |
34 |
units, with a few additional ones to aid with legibility/checkability. |
35 |
|
36 |
Unit Dim code Dimension Source |
37 |
kg M mass SI |
38 |
mol Q amount of substance SI |
39 |
s T time SI |
40 |
m L length SI |
41 |
K TMP temperature SI |
42 |
USD C currency non SI |
43 |
A E electric current SI |
44 |
cd LUM luminous intensity SI |
45 |
rad P plane angle SI suggested |
46 |
sr S solid angle SI suggested |
47 |
|
48 |
Units for currency are selected arbitrarily to be USD, for US dollars, |
49 |
being the dominant international currency at this time. |
50 |
|
51 |
Original author: Tom Epperly, 1990. |
52 |
Contributors: Ben Allan, John Pye. |
53 |
*) |
54 |
|
55 |
UNITS |
56 |
|
57 |
(* distance *) |
58 |
|
59 |
meter = {m}; |
60 |
pc = {3.08374e+16*m}; |
61 |
parsec = {pc}; |
62 |
kpc = {1000*pc}; |
63 |
Mpc = {1e6*pc}; |
64 |
km = {m*1000}; |
65 |
m = {m}; |
66 |
dm = {m/10}; |
67 |
cm = {m/100}; |
68 |
mm = {m/1000}; |
69 |
um = {m/1000000}; |
70 |
nm = {1.e-9*m}; |
71 |
kilometer = {km}; |
72 |
centimeter = {cm}; |
73 |
millimeter = {mm}; |
74 |
micron = {um}; |
75 |
nanometer = {nm}; |
76 |
angstrom = {m/1e10}; |
77 |
fermi = {m/1e15}; |
78 |
|
79 |
mi = {1609.344*m}; |
80 |
yd = {0.914412*m}; |
81 |
ft = {0.304804*m}; |
82 |
inch = {0.0254*m}; |
83 |
mile = {mi}; |
84 |
yard = {yd}; |
85 |
feet = {ft}; |
86 |
foot = {ft}; |
87 |
in = {inch}; |
88 |
|
89 |
(* mass *) |
90 |
|
91 |
kilogram = {kg}; |
92 |
g = {kg/1000}; |
93 |
gram = {g}; |
94 |
mg = {g/1000}; |
95 |
milligram = {mg}; |
96 |
ug= {kilogram*1e-9}; |
97 |
microgram= {ug}; |
98 |
ng= {kilogram*1e-12}; |
99 |
nanogram= {ng}; |
100 |
pg= {kilogram*1e-15}; |
101 |
picogram= {pg}; |
102 |
|
103 |
tonne = {kilogram *1000}; (* reference on tonne: http://physics.nist.gov/Pubs/SP811/appenB8.html *) |
104 |
t = {tonne}; |
105 |
kilotonne = {tonne*1000}; |
106 |
kt = {kilotonne}; |
107 |
megatonne = {tonne*1e6}; |
108 |
Mt = {megatonne}; |
109 |
gigatonne = {tonne*1e9}; |
110 |
Gt = {gigatonne}; |
111 |
|
112 |
amu = {1.661e-27*kilogram}; |
113 |
lbm = {4.535924e-1*kilogram}; |
114 |
ton = {lbm*2000}; |
115 |
oz = {0.028349525*kilogram}; |
116 |
slug = {14.5939*kilogram}; |
117 |
|
118 |
(* time *) |
119 |
|
120 |
second = {s}; |
121 |
yr = {31557600*s}; |
122 |
wk = {604800*s}; |
123 |
d = {86400*s}; |
124 |
h = {3600*s}; |
125 |
min = {60*s}; |
126 |
sec = {s}; |
127 |
ms = {s/1000}; |
128 |
us = {s/1e6}; |
129 |
ns = {s/1e9}; |
130 |
ps = {s/1e12}; |
131 |
year = {yr}; |
132 |
week = {wk}; |
133 |
day = {d}; |
134 |
hour = {h}; |
135 |
hr={h}; |
136 |
minute = {min}; |
137 |
millisecond = {ms}; |
138 |
microsecond = {us}; |
139 |
nanosecond = {ns}; |
140 |
picosecond = {ps}; |
141 |
|
142 |
(* molecular quantities *) |
143 |
|
144 |
mole = {mol}; |
145 |
kg_mole= {1000*mol}; |
146 |
g_mole = {mol}; |
147 |
gm_mole = {mol}; |
148 |
kmol = {1000*mol}; |
149 |
mol = {mol}; |
150 |
mmol = {mol/1000}; |
151 |
millimole= {mmol}; |
152 |
umol = {mol/1e6}; |
153 |
micromole= {umol}; |
154 |
lb_mole = {4.535924e+2*mol}; |
155 |
|
156 |
(* temperature *) |
157 |
|
158 |
Kelvin = {K}; |
159 |
R = {5*K/9}; |
160 |
Rankine = {R}; |
161 |
|
162 |
(* money *) |
163 |
|
164 |
(* PLEASE USE ISO 4127 CURRENCY CODES FOR ALL MONEY UNITS *) |
165 |
currency = {USD}; |
166 |
CR = {USD}; |
167 |
credits= {USD}; |
168 |
(* the following two are historic and should not be used in future *) |
169 |
USdollar = {USD}; |
170 |
US = {USD}; |
171 |
|
172 |
(* currencies according to yahoo.com, as at 11 Sep 2006 *) |
173 |
AUD = {0.752400*USD}; |
174 |
GBP = {1.865000*USD}; |
175 |
EUR = {1.266499*USD}; |
176 |
JPY = {0.00856091*USD}; |
177 |
|
178 |
(* reciprocal time (frequency) *) |
179 |
|
180 |
rev = {1.0}; |
181 |
cycle = {rev}; |
182 |
rpm = {rev/minute}; |
183 |
rps = {rev/second}; |
184 |
hertz = {cycle/second}; |
185 |
Hz = {hertz}; |
186 |
|
187 |
(* area *) |
188 |
|
189 |
ha = {m^2*10000}; |
190 |
hectare= {ha}; |
191 |
acre= {m^2*4046.856}; |
192 |
|
193 |
(* volume *) |
194 |
|
195 |
L = {m^3/1000}; |
196 |
l = {L}; |
197 |
litre = {L}; |
198 |
liter = {L}; |
199 |
mL = {L/1000}; |
200 |
ml = {L/1000}; |
201 |
ul = {L/1e6}; |
202 |
uL = {L/1e6}; |
203 |
milliliter = {ml}; |
204 |
millilitre = {mL}; |
205 |
microliter = {ul}; |
206 |
microlitre = {uL}; |
207 |
|
208 |
hogshead= {2.384809e-1*m^3}; |
209 |
cuft = {0.02831698*m^3}; |
210 |
impgal = {4.52837e-3*m^3}; |
211 |
gal = {3.785412e-3*m^3}; |
212 |
barrel = {42.0*gal}; |
213 |
gallon = {gal}; |
214 |
quart = {gal/4}; |
215 |
pint = {gal/8}; |
216 |
cup = {gal/16}; |
217 |
floz = {gal/128}; |
218 |
|
219 |
(* force *) |
220 |
|
221 |
N = {kg*m/s^2}; |
222 |
newton = {N}; |
223 |
dyne = {N*1.0e-5}; |
224 |
EN = {1e18*N}; |
225 |
PN = {1e15*N}; |
226 |
TN = {1e12*N}; |
227 |
GN = {1e9*N}; |
228 |
MN = {1e6*N}; |
229 |
kN = {1000*N}; |
230 |
mN= {N*1e-3}; |
231 |
uN= {N*1e-6}; |
232 |
nN= {N*1e-9}; |
233 |
pN= {N*1e-12}; |
234 |
fN= {N*1e-15}; |
235 |
aN= {N*1e-18}; |
236 |
milliNewton= {mN}; |
237 |
microNewton= {uN}; |
238 |
nanoNewton= {nN}; |
239 |
picoNewton= {pN}; |
240 |
femtoNewton= {fN}; |
241 |
attoNewton= {aN}; |
242 |
|
243 |
lbf = {N*4.448221}; |
244 |
tonnef = {9.8* N/kg * 1 * t}; |
245 |
kgf = {9.8*N/kg * 1 * kg}; |
246 |
|
247 |
(* pressure *) |
248 |
|
249 |
Pa = {kg/m/s^2}; |
250 |
pascal = {Pa}; |
251 |
kPa = {1e3*Pa}; |
252 |
bar = {1e5*Pa}; |
253 |
mbar = {1e2*Pa}; |
254 |
MPa = {1e6*Pa}; |
255 |
GPa = {1e9*Pa}; |
256 |
|
257 |
atm = {Pa*101325.0}; |
258 |
mmHg = {133.322*Pa}; |
259 |
torr = {133.322*Pa}; |
260 |
psia = {6894.733*Pa}; |
261 |
psi = {psia}; |
262 |
ftH2O = {2989*Pa}; |
263 |
|
264 |
(* energy *) |
265 |
|
266 |
J = {kg*m^2/s^2}; |
267 |
joule = {J}; |
268 |
nJ= {J*1.0e-9}; |
269 |
uJ= {J*1.0e-6}; |
270 |
mJ= {J*1.0e-3}; |
271 |
kJ = {J * 1000}; |
272 |
MJ = {J * 1e6}; |
273 |
GJ = {J * 1e9}; |
274 |
TJ = {J * 1e12}; |
275 |
PJ = {J * 1e15}; |
276 |
milliJoule= {mJ}; |
277 |
microJoule= {uJ}; |
278 |
nanoJoule= {nJ}; |
279 |
erg = {J*1.0e-7}; |
280 |
|
281 |
BTU = {1055.056*J}; |
282 |
btu = {BTU}; (* this is the way it's written in most textbooks *) |
283 |
pCu = {BTU * 1.8}; |
284 |
cal = {J*4.18393}; |
285 |
calorie = {cal}; |
286 |
kcal= {1000*cal}; |
287 |
Cal= {1000*cal}; |
288 |
|
289 |
(* power *) |
290 |
|
291 |
W = {J/s}; |
292 |
EW = {1.0e+18*W}; |
293 |
PW = {1.0e+15*W}; |
294 |
TW = {1.0e+12*W}; |
295 |
GW = {1.0e+9*W}; |
296 |
MW = {1.0e+6*W}; |
297 |
kW = {1000*W}; |
298 |
mW = {W/1e3}; |
299 |
uW = {W/1e6}; |
300 |
nW = {W/1e9}; |
301 |
pW = {W/1e12}; |
302 |
fW = {W/1e15}; |
303 |
aW = {W/1e18}; |
304 |
terawatt = {TW}; |
305 |
gigawatt = {GW}; |
306 |
megawatt = {MW}; |
307 |
kilowatt = {kW}; |
308 |
watt = {W}; |
309 |
milliwatt = {mW}; |
310 |
microwatt = {uW}; |
311 |
nanowatt = {nW}; |
312 |
picowatt = {pW}; |
313 |
femtowatt = {fW}; |
314 |
attowatt = {aW}; |
315 |
aWW= {1*EW}; (* <geekjok>we could say art has a lot of power</geekjoke> *) |
316 |
|
317 |
Wh = {W*h}; |
318 |
kWh = {kW*h}; |
319 |
|
320 |
hp= {7.456998e+2*W}; |
321 |
|
322 |
(* absolute viscosity *) |
323 |
|
324 |
poise = {Pa*s/10}; |
325 |
cP = {poise/100}; |
326 |
|
327 |
(* electric charge *) |
328 |
|
329 |
C = {A*s}; |
330 |
coulomb = {C}; |
331 |
coul = {C}; |
332 |
mC = {0.001*C}; |
333 |
uC = {1e-6*C}; |
334 |
nC = {1e-9*C}; |
335 |
pC = {1e-12*C}; |
336 |
|
337 |
(* misc electro-magnetic fun *) |
338 |
|
339 |
V = {kg*m^2/s^3/A}; |
340 |
F = {A^2*s^4/kg/m^2}; |
341 |
ohm = {kg*m^2/s^3/A^2}; |
342 |
mho = {A^2*s^3/kg/m^2}; |
343 |
S = {mho}; |
344 |
siemens = {S}; |
345 |
ampere = {A}; |
346 |
amp = {A}; |
347 |
volt = {V}; |
348 |
farad= {F}; |
349 |
mA= {A/1000}; |
350 |
uA= {A/1000000}; |
351 |
kV= {1000*V}; |
352 |
MV= {1e6*V}; |
353 |
mV= {V/1000}; |
354 |
mF = {0.001*F}; |
355 |
uF = {1e-6*F}; |
356 |
nF = {1e-9*F}; |
357 |
pF = {1e-12*F}; |
358 |
kohm = {1000*ohm}; |
359 |
Mohm = {1e6*ohm}; |
360 |
kS = {1000*S}; |
361 |
mS = {0.001*S}; |
362 |
uS = {1e-6*S}; |
363 |
Wb = {V*second}; |
364 |
weber = {Wb}; |
365 |
tesla = {Wb/m^2}; |
366 |
gauss = {1e-4*tesla}; |
367 |
H = {Wb/A}; |
368 |
henry = {H}; |
369 |
mH = {0.001*H}; |
370 |
uH = {1e-6*H}; |
371 |
|
372 |
(* |
373 |
* numeric constants of some interest |
374 |
* to set a variable or constant to these, the code is (in the declarations) |
375 |
* ATOM constant REFINES real; END constant; |
376 |
* MODEL gizmo; |
377 |
* x IS_A constant; |
378 |
* x := 1 {PI}; |
379 |
* ... |
380 |
*) |
381 |
molecule = {1.0}; |
382 |
PI= {3.1415926535897932385}; (* Circumference/Diameter ratio *) |
383 |
EULER_C = {0.57721566490153286}; (* euler gamma *) |
384 |
GOLDEN_C = {1.618033988749894}; (* golden ratio *) |
385 |
HBAR = {1.055e-34*J*s}; (* Reduced planck's constant *) |
386 |
PLANCK_C = {2*PI*HBAR}; (* Planck's constant *) |
387 |
LIGHT_C = {2.99793e8 * m/s}; (* Speed of light in vacuum *) |
388 |
MU0 = {4e-7*PI*kg*m/C/C}; (* Permeability of free space *) |
389 |
EPSILON0 = {1/LIGHT_C/LIGHT_C/MU0}; (* Permittivity of free space *) |
390 |
BOLTZMAN_C = {1.3805e-23 * J/K}; (* Boltzman's constant *) |
391 |
SIGMA_C = {5.670e-8 * W/m^2/K^4 }; (* Stefan-Boltzmann constant |
392 |
- blackbody radiation *) |
393 |
AVOGADRO_C = {6.022045e23 *molecule/mol};(* Avogadro's number of molecules *) |
394 |
GRAVITY_C = {6.673e-11 * N*m*m/kg/kg}; (* Newtons gravitational constant *) |
395 |
GAS_C = {BOLTZMAN_C*AVOGADRO_C}; (* Gas constant *) |
396 |
INFINITY= {1.0e38}; (* damn big number *) |
397 |
LIM_EXP= {709.78}; (* ln ( maxdouble ) *) |
398 |
LIM_CUBE= {5.6438030941223618e101}; (* cbrt ( maxdouble ) *) |
399 |
LIM_SQR= {1.0e154}; (* sqrt(maxdouble) *) |
400 |
|
401 |
(* The following were swiped from C <math.h> *) |
402 |
M_E= {2.7182818284590452354E0}; (* base e *) |
403 |
M_LOG2E= {1.4426950408889634074E0}; (* log2(e) *) |
404 |
M_LOG10E= {4.3429448190325182765E-1}; (* log10(e) *) |
405 |
M_LN2= {6.9314718055994530942E-1}; (* ln(2) *) |
406 |
M_LN10= {2.3025850929940456840E0}; (* ln(10) *) |
407 |
M_PI= {3.1415926535897932385E0}; (* as PI, but for consistency *) |
408 |
M_PI_2= {1.5707963267948966192E0}; (* PI/2 *) |
409 |
M_PI_4= {7.8539816339744830962E-1}; (* PI/4 *) |
410 |
M_1_PI= {3.1830988618379067154E-1}; (* 1/PI *) |
411 |
M_2_PI= {6.3661977236758134308E-1}; (* 2/PI *) |
412 |
M_2_SQRTPI= {1.1283791670955125739E0}; (* 2/sqrt(PI) *) |
413 |
M_SQRT2= {1.4142135623730950488E0}; (* sqrt(2) *) |
414 |
M_SQRT1_2= {7.0710678118654752440E-1}; (* 1/sqrt(2) *) |
415 |
|
416 |
eCHARGE = {1.602e-19*C}; (* Charge of an electron *) |
417 |
EARTH_G = {9.80665 * m/s/s}; (* Earth's gravitational field, somewhere *) |
418 |
eMASS = {9.1095e-31*kg}; (* Electron rest mass, I suppose *) |
419 |
pMASS = {1.67265e-27*kg}; (* Proton mass *) |
420 |
|
421 |
(* constant based conversions *) |
422 |
|
423 |
eV = {eCHARGE * V}; |
424 |
keV = {1000*eV}; |
425 |
MeV = {1e6*eV}; |
426 |
GeV = {1e9*eV}; |
427 |
TeV = {1e12*eV}; |
428 |
PeV = {1e15*eV}; |
429 |
EeV = {1e18*eV}; |
430 |
|
431 |
lyr = {LIGHT_C * yr}; (* Light-year *) |
432 |
|
433 |
oersted = {gauss/MU0}; |
434 |
|
435 |
(* subtly dimensionless measures *) |
436 |
|
437 |
radian = {rad}; |
438 |
|
439 |
steradian = {sr}; |
440 |
srad = {sr}; |
441 |
deg = {rad*1.74532925199433e-2}; |
442 |
degrees = {deg}; |
443 |
grad = {0.9*deg}; |
444 |
arcmin = {deg/60.0}; |
445 |
arcsec = {arcmin/60.0}; |
446 |
|
447 |
(* light quantities *) |
448 |
|
449 |
candela = {cd}; |
450 |
lm = {cd*sr}; |
451 |
lumen = {lm}; |
452 |
lx = {lm/m^2}; |
453 |
lux= {lx}; |
454 |
|
455 |
(* misc rates *) |
456 |
|
457 |
gpm = {gallon/min}; |
458 |
|
459 |
(* time variant conversions *) |
460 |
|
461 |
MINIMUMWAGE = {5.15*USD/h}; (* Dec 2005, see http://www.dol.gov/ *) |
462 |
(* |
463 |
* conversions we'd like to see , but probably won't |
464 |
* milliHelen = {beauty/ship}; |
465 |
* Helen = {documentation/project}; |
466 |
* who's helen? |
467 |
* AscendWorldDomination = {big/estimate}; |
468 |
*) |
469 |
END UNITS; |