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

Contents of /trunk/models/measures.a4l

Parent Directory Parent Directory | Revision Log Revision Log


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

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