/[ascend]/trunk/models/measures.a4l
ViewVC logotype

Contents of /trunk/models/measures.a4l

Parent Directory Parent Directory | Revision Log Revision Log


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

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22