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 |
(* SI multipliers *) |
58 |
|
59 |
yocto = {10^-24}; |
60 |
zepto = {10^-21}; |
61 |
atto = {10^-18}; |
62 |
femto = {10^-15}; |
63 |
pico = {10^-12}; |
64 |
nano = {10^-9}; |
65 |
micro = {10^-6}; |
66 |
milli = {10^-3}; |
67 |
centi = {10^-2}; |
68 |
deci = {10^-1}; |
69 |
deka = {10.0}; |
70 |
hecta = {100.0}; |
71 |
kilo = {10^3}; |
72 |
mega = {10^6}; |
73 |
giga = {10^9}; |
74 |
tera = {10^12}; |
75 |
peta = {10^15}; |
76 |
exa = {10^18}; |
77 |
zetta = {10^21}; |
78 |
yotta = {10^24}; |
79 |
|
80 |
(* distance *) |
81 |
|
82 |
meter = {m}; |
83 |
pc = {3.08374e+16*m}; |
84 |
parsec = {pc}; |
85 |
kpc = {kilo*pc}; |
86 |
Mpc = {mega*pc}; |
87 |
km = {kilo*m}; |
88 |
dm = {m/10}; |
89 |
cm = {m/100}; |
90 |
mm = {milli*m}; |
91 |
um = {micro*m}; |
92 |
nm = {nano*m}; |
93 |
kilometer = {km}; |
94 |
centimeter = {cm}; |
95 |
millimeter = {mm}; |
96 |
micron = {um}; |
97 |
nanometer = {nm}; |
98 |
angstrom = {m/1e10}; |
99 |
fermi = {m/1e15}; |
100 |
|
101 |
mi = {1609.344*m}; |
102 |
yd = {0.914412*m}; |
103 |
ft = {0.304804*m}; |
104 |
inch = {0.0254*m}; |
105 |
mile = {mi}; |
106 |
yard = {yd}; |
107 |
feet = {ft}; |
108 |
foot = {ft}; |
109 |
in = {inch}; |
110 |
|
111 |
(* mass *) |
112 |
|
113 |
kilogram = {kg}; |
114 |
g = {kg/1000}; |
115 |
gram = {g}; |
116 |
mg = {g/1000}; |
117 |
milligram = {mg}; |
118 |
ug= {kilogram*1e-9}; |
119 |
microgram= {ug}; |
120 |
ng= {kilogram*1e-12}; |
121 |
nanogram= {ng}; |
122 |
pg= {kilogram*1e-15}; |
123 |
picogram= {pg}; |
124 |
|
125 |
tonne = {1000*kilogram}; (* reference on tonne: http://physics.nist.gov/Pubs/SP811/appenB8.html *) |
126 |
t = {tonne}; |
127 |
kilotonne = {kilo*tonne}; |
128 |
kt = {kilotonne}; |
129 |
megatonne = {mega*tonne}; |
130 |
Mt = {megatonne}; |
131 |
gigatonne = {giga*tonne}; |
132 |
Gt = {gigatonne}; |
133 |
|
134 |
amu = {1.661e-27*kilogram}; |
135 |
lbm = {4.535924e-1*kilogram}; |
136 |
ton = {lbm*2000}; |
137 |
oz = {0.028349525*kilogram}; |
138 |
slug = {14.5939*kilogram}; |
139 |
|
140 |
(* time *) |
141 |
|
142 |
second = {s}; |
143 |
yr = {31557600*s}; |
144 |
wk = {604800*s}; |
145 |
d = {86400*s}; |
146 |
h = {3600*s}; |
147 |
min = {60*s}; |
148 |
sec = {s}; |
149 |
ms = {s/1000}; |
150 |
us = {s/1e6}; |
151 |
ns = {s/1e9}; |
152 |
ps = {s/1e12}; |
153 |
year = {yr}; |
154 |
week = {wk}; |
155 |
day = {d}; |
156 |
hour = {h}; |
157 |
hr={h}; |
158 |
minute = {min}; |
159 |
millisecond = {ms}; |
160 |
microsecond = {us}; |
161 |
nanosecond = {ns}; |
162 |
picosecond = {ps}; |
163 |
|
164 |
(* molecular quantities *) |
165 |
|
166 |
mole = {mol}; |
167 |
kg_mole= {1000*mol}; |
168 |
g_mole = {mol}; |
169 |
gm_mole = {mol}; |
170 |
kmol = {kilo*mol}; |
171 |
mol = {mol}; |
172 |
mmol = {milli*mol}; |
173 |
millimole= {mmol}; |
174 |
umol = {micro*mol}; |
175 |
micromole= {umol}; |
176 |
lb_mole = {4.535924e+2*mol}; |
177 |
|
178 |
(* temperature *) |
179 |
|
180 |
Kelvin = {K}; |
181 |
R = {5*K/9}; |
182 |
Rankine = {R}; |
183 |
|
184 |
(* money *) |
185 |
|
186 |
(* PLEASE USE ISO 4127 CURRENCY CODES FOR ALL MONEY UNITS *) |
187 |
currency = {USD}; |
188 |
CR = {USD}; |
189 |
credits= {USD}; |
190 |
(* the following two are historic and should not be used in future *) |
191 |
USdollar = {USD}; |
192 |
US = {USD}; |
193 |
|
194 |
(* currencies according to yahoo.com, as at 11 Sep 2006 *) |
195 |
AUD = {0.752400*USD}; |
196 |
GBP = {1.865000*USD}; |
197 |
EUR = {1.266499*USD}; |
198 |
JPY = {0.00856091*USD}; |
199 |
|
200 |
(* reciprocal time (frequency) *) |
201 |
|
202 |
rev = {1.0}; |
203 |
cycle = {rev}; |
204 |
rpm = {rev/minute}; |
205 |
rps = {rev/second}; |
206 |
hertz = {cycle/second}; |
207 |
Hz = {hertz}; |
208 |
|
209 |
(* area *) |
210 |
|
211 |
ha = {m^2*10000}; |
212 |
hectare= {ha}; |
213 |
acre= {m^2*4046.856}; |
214 |
|
215 |
(* volume *) |
216 |
|
217 |
L = {m^3/1000}; |
218 |
l = {L}; |
219 |
litre = {L}; |
220 |
liter = {L}; |
221 |
mL = {L/1000}; |
222 |
ml = {L/1000}; |
223 |
ul = {L/1e6}; |
224 |
uL = {L/1e6}; |
225 |
milliliter = {ml}; |
226 |
millilitre = {mL}; |
227 |
microliter = {ul}; |
228 |
microlitre = {uL}; |
229 |
|
230 |
hogshead= {2.384809e-1*m^3}; |
231 |
cuft = {0.02831698*m^3}; |
232 |
impgal = {4.52837e-3*m^3}; |
233 |
gal = {3.785412e-3*m^3}; |
234 |
barrel = {42.0*gal}; |
235 |
gallon = {gal}; |
236 |
quart = {gal/4}; |
237 |
pint = {gal/8}; |
238 |
cup = {gal/16}; |
239 |
floz = {gal/128}; |
240 |
|
241 |
(* force *) |
242 |
|
243 |
N = {kg*m/s^2}; |
244 |
newton = {N}; |
245 |
dyne = {N*1.0e-5}; |
246 |
EN = {1e18*N}; |
247 |
PN = {1e15*N}; |
248 |
TN = {1e12*N}; |
249 |
GN = {1e9*N}; |
250 |
MN = {1e6*N}; |
251 |
kN = {1000*N}; |
252 |
mN= {N*1e-3}; |
253 |
uN= {N*1e-6}; |
254 |
nN= {N*1e-9}; |
255 |
pN= {N*1e-12}; |
256 |
fN= {N*1e-15}; |
257 |
aN= {N*1e-18}; |
258 |
milliNewton= {mN}; |
259 |
microNewton= {uN}; |
260 |
nanoNewton= {nN}; |
261 |
picoNewton= {pN}; |
262 |
femtoNewton= {fN}; |
263 |
attoNewton= {aN}; |
264 |
|
265 |
lbf = {N*4.448221}; |
266 |
tonnef = {9.8* N/kg * 1 * t}; |
267 |
kgf = {9.8*N/kg * 1 * kg}; |
268 |
|
269 |
(* pressure *) |
270 |
|
271 |
Pa = {kg/m/s^2}; |
272 |
pascal = {Pa}; |
273 |
kPa = {1e3*Pa}; |
274 |
bar = {1e5*Pa}; |
275 |
mbar = {1e2*Pa}; |
276 |
MPa = {1e6*Pa}; |
277 |
GPa = {1e9*Pa}; |
278 |
|
279 |
atm = {Pa*101325.0}; |
280 |
mmHg = {133.322*Pa}; |
281 |
torr = {133.322*Pa}; |
282 |
psia = {6894.733*Pa}; |
283 |
psi = {psia}; |
284 |
ftH2O = {2989*Pa}; |
285 |
|
286 |
(* energy *) |
287 |
|
288 |
J = {kg*m^2/s^2}; |
289 |
joule = {J}; |
290 |
nJ= {J*1.0e-9}; |
291 |
uJ= {J*1.0e-6}; |
292 |
mJ= {J*1.0e-3}; |
293 |
kJ = {J * 1000}; |
294 |
MJ = {J * 1e6}; |
295 |
GJ = {J * 1e9}; |
296 |
TJ = {J * 1e12}; |
297 |
PJ = {J * 1e15}; |
298 |
milliJoule= {mJ}; |
299 |
microJoule= {uJ}; |
300 |
nanoJoule= {nJ}; |
301 |
erg = {J*1.0e-7}; |
302 |
|
303 |
BTU = {1055.056*J}; |
304 |
btu = {BTU}; (* this is the way it's written in most textbooks *) |
305 |
pCu = {BTU * 1.8}; |
306 |
cal = {J*4.18393}; |
307 |
calorie = {cal}; |
308 |
kcal= {1000*cal}; |
309 |
Cal= {1000*cal}; |
310 |
|
311 |
(* power *) |
312 |
|
313 |
W = {J/s}; |
314 |
EW = {exa*W}; |
315 |
PW = {peta*W}; |
316 |
TW = {tera*W}; |
317 |
GW = {giga*W}; |
318 |
MW = {mega*W}; |
319 |
kW = {kilo*W}; |
320 |
mW = {milli*W}; |
321 |
uW = {micro*W}; |
322 |
nW = {nano*W}; |
323 |
pW = {pico*W}; |
324 |
fW = {femto*W}; |
325 |
aW = {atto*W}; |
326 |
terawatt = {TW}; |
327 |
gigawatt = {GW}; |
328 |
megawatt = {MW}; |
329 |
kilowatt = {kW}; |
330 |
watt = {W}; |
331 |
milliwatt = {mW}; |
332 |
microwatt = {uW}; |
333 |
nanowatt = {nW}; |
334 |
picowatt = {pW}; |
335 |
femtowatt = {fW}; |
336 |
attowatt = {aW}; |
337 |
aWW= {1*EW}; (* <geekjoke>we could say Art has a lot of power</geekjoke> *) |
338 |
|
339 |
Wh = {W*h}; |
340 |
kWh = {kW*h}; |
341 |
|
342 |
hp= {7.456998e+2*W}; |
343 |
|
344 |
(* absolute viscosity *) |
345 |
|
346 |
poise = {Pa*s/10}; |
347 |
cP = {poise/100}; |
348 |
|
349 |
(* electric charge *) |
350 |
|
351 |
C = {A*s}; |
352 |
coulomb = {C}; |
353 |
coul = {C}; |
354 |
mC = {0.001*C}; |
355 |
uC = {1e-6*C}; |
356 |
nC = {1e-9*C}; |
357 |
pC = {1e-12*C}; |
358 |
|
359 |
(* misc electro-magnetic fun *) |
360 |
|
361 |
V = {kg*m^2/s^3/A}; |
362 |
F = {A^2*s^4/kg/m^2}; |
363 |
ohm = {kg*m^2/s^3/A^2}; |
364 |
mho = {A^2*s^3/kg/m^2}; |
365 |
S = {mho}; |
366 |
siemens = {S}; |
367 |
ampere = {A}; |
368 |
amp = {A}; |
369 |
volt = {V}; |
370 |
farad= {F}; |
371 |
mA= {A/1000}; |
372 |
uA= {A/1000000}; |
373 |
kV= {1000*V}; |
374 |
MV= {1e6*V}; |
375 |
mV= {V/1000}; |
376 |
mF = {0.001*F}; |
377 |
uF = {1e-6*F}; |
378 |
nF = {1e-9*F}; |
379 |
pF = {1e-12*F}; |
380 |
kohm = {1000*ohm}; |
381 |
Mohm = {1e6*ohm}; |
382 |
kS = {1000*S}; |
383 |
mS = {0.001*S}; |
384 |
uS = {1e-6*S}; |
385 |
Wb = {V*second}; |
386 |
weber = {Wb}; |
387 |
tesla = {Wb/m^2}; |
388 |
gauss = {1e-4*tesla}; |
389 |
H = {Wb/A}; |
390 |
henry = {H}; |
391 |
mH = {milli*H}; |
392 |
uH = {1e-6*H}; |
393 |
|
394 |
(* |
395 |
* numeric constants of some interest |
396 |
* to set a variable or constant to these, the code is (in the declarations) |
397 |
* ATOM constant REFINES real; END constant; |
398 |
* MODEL gizmo; |
399 |
* x IS_A constant; |
400 |
* x := 1 {PI}; |
401 |
* ... |
402 |
*) |
403 |
molecule = {1.0}; |
404 |
PI= {3.1415926535897932385}; (* Circumference/Diameter ratio *) |
405 |
EULER_C = {0.57721566490153286}; (* euler gamma *) |
406 |
GOLDEN_C = {1.618033988749894}; (* golden ratio *) |
407 |
HBAR = {1.055e-34*J*s}; (* Reduced planck's constant *) |
408 |
PLANCK_C = {2*PI*HBAR}; (* Planck's constant *) |
409 |
LIGHT_C = {2.99793e8 * m/s}; (* Speed of light in vacuum *) |
410 |
MU0 = {4e-7*PI*kg*m/C/C}; (* Permeability of free space *) |
411 |
EPSILON0 = {1/LIGHT_C/LIGHT_C/MU0}; (* Permittivity of free space *) |
412 |
BOLTZMAN_C = {1.3805e-23 * J/K}; (* Boltzman's constant *) |
413 |
SIGMA_C = {5.670e-8 * W/m^2/K^4 }; (* Stefan-Boltzmann constant |
414 |
- blackbody radiation *) |
415 |
AVOGADRO_C = {6.022045e23 *molecule/mol};(* Avogadro's number of molecules *) |
416 |
GRAVITY_C = {6.673e-11 * N*m*m/kg/kg}; (* Newtons gravitational constant *) |
417 |
GAS_C = {BOLTZMAN_C*AVOGADRO_C}; (* Gas constant *) |
418 |
INFINITY= {1.0e38}; (* damn big number *) |
419 |
LIM_EXP= {709.78}; (* ln ( maxdouble ) *) |
420 |
LIM_CUBE= {5.6438030941223618e101}; (* cbrt ( maxdouble ) *) |
421 |
LIM_SQR= {1.0e154}; (* sqrt(maxdouble) *) |
422 |
|
423 |
(* The following were swiped from C <math.h> *) |
424 |
M_E= {2.7182818284590452354E0}; (* base e *) |
425 |
M_LOG2E= {1.4426950408889634074E0}; (* log2(e) *) |
426 |
M_LOG10E= {4.3429448190325182765E-1}; (* log10(e) *) |
427 |
M_LN2= {6.9314718055994530942E-1}; (* ln(2) *) |
428 |
M_LN10= {2.3025850929940456840E0}; (* ln(10) *) |
429 |
M_PI= {3.1415926535897932385E0}; (* as PI, but for consistency *) |
430 |
M_PI_2= {1.5707963267948966192E0}; (* PI/2 *) |
431 |
M_PI_4= {7.8539816339744830962E-1}; (* PI/4 *) |
432 |
M_1_PI= {3.1830988618379067154E-1}; (* 1/PI *) |
433 |
M_2_PI= {6.3661977236758134308E-1}; (* 2/PI *) |
434 |
M_2_SQRTPI= {1.1283791670955125739E0}; (* 2/sqrt(PI) *) |
435 |
M_SQRT2= {1.4142135623730950488E0}; (* sqrt(2) *) |
436 |
M_SQRT1_2= {7.0710678118654752440E-1}; (* 1/sqrt(2) *) |
437 |
|
438 |
eCHARGE = {1.602e-19*C}; (* Charge of an electron *) |
439 |
EARTH_G = {9.80665 * m/s/s}; (* Earth's gravitational field, somewhere *) |
440 |
eMASS = {9.1095e-31*kg}; (* Electron rest mass, I suppose *) |
441 |
pMASS = {1.67265e-27*kg}; (* Proton mass *) |
442 |
|
443 |
(* constant based conversions *) |
444 |
|
445 |
eV = {eCHARGE * V}; |
446 |
keV = {1000*eV}; |
447 |
MeV = {1e6*eV}; |
448 |
GeV = {1e9*eV}; |
449 |
TeV = {1e12*eV}; |
450 |
PeV = {1e15*eV}; |
451 |
EeV = {1e18*eV}; |
452 |
|
453 |
lyr = {LIGHT_C * yr}; (* Light-year *) |
454 |
|
455 |
oersted = {gauss/MU0}; |
456 |
|
457 |
(* plane angle measures *) |
458 |
|
459 |
radian = {rad}; |
460 |
deg = {rad*1.74532925199433e-2}; |
461 |
degrees = {deg}; |
462 |
grad = {0.9*deg}; |
463 |
arcmin = {deg/60.0}; |
464 |
arcsec = {arcmin/60.0}; |
465 |
rot = {2 * PI * rad}; |
466 |
RPM = {rot/minute}; |
467 |
|
468 |
(* solid angle measures *) |
469 |
|
470 |
steradian = {sr}; |
471 |
srad = {sr}; |
472 |
|
473 |
(* light quantities *) |
474 |
|
475 |
candela = {cd}; |
476 |
lm = {cd*sr}; |
477 |
lumen = {lm}; |
478 |
lx = {lm/m^2}; |
479 |
lux= {lx}; |
480 |
|
481 |
(* misc rates *) |
482 |
|
483 |
gpm = {gallon/min}; |
484 |
|
485 |
(* conversion factor to US (Fisher-Rosemount) valve constants to SI unit |
486 |
equivalent. see Appendix 3 of P Thomas 'Simulation of Industrial Processes for |
487 |
Control Engineers, 1999, ISBN 0750641614 *) |
488 |
VALVE_COEFF_US = {2.3837e-5*m*m}; |
489 |
|
490 |
(* time variant conversions *) |
491 |
|
492 |
MINIMUMWAGE = {5.15*USD/h}; (* Dec 2005, see http://www.dol.gov/ *) |
493 |
(* |
494 |
* conversions we'd like to see , but probably won't |
495 |
* milliHelen = {beauty/ship}; |
496 |
* Helen = {documentation/project}; |
497 |
* who's helen? |
498 |
* AscendWorldDomination = {big/estimate}; |
499 |
*) |
500 |
END UNITS; |