1 9 package org.jscience.physics.units; 10 11 import org.jscience.physics.quantities.*; 12 import static org.jscience.physics.units.SI.*; 13 import static javolution.lang.MathLib.*; 14 15 23 public final class NonSI { 24 25 28 private static double STANDARD_GRAVITY = 9.80665; 30 33 private static double INTERNATIONAL_FOOT = 0.3048; 35 38 private static double AVOIRDUPOIS_POUND = 0.45359237; 40 43 private static double AVOGADRO_CONSTANT = 6.02214199e23; 45 48 private static double ELEMENTARY_CHARGE = 1.602176462e-19; 50 53 private NonSI() { 54 } 55 56 60 64 public static final Unit<Dimensionless> PERCENT = Unit.ONE.times(0.01) 65 .label("%"); 66 67 71 public static final Unit<Dimensionless> DECIBEL = Unit.ONE.transform( 72 new LogConverter(10).inverse().concatenate( 73 new MultiplyConverter(0.1))).label("dB"); 74 75 79 83 public static final Unit<Acceleration> GALILEO = METER_PER_SQUARE_SECOND 84 .times(1e-2); 85 86 90 public static final Unit<Acceleration> G = METER_PER_SQUARE_SECOND.times( 91 STANDARD_GRAVITY).label("grav"); 92 93 97 101 public static final Unit<AmountOfSubstance> ATOM = MOLE.times( 102 1.0 / AVOGADRO_CONSTANT).label("atom"); 103 104 108 112 public static final Unit<Angle> REVOLUTION = RADIAN.times(2.0 * PI).label( 113 "rev"); 114 115 119 public static final Unit<Angle> DEGREE_ANGLE = REVOLUTION 120 .times(1.0 / 360.0).label("°"); 121 122 126 public static final Unit<Angle> MINUTE_ANGLE = DEGREE_ANGLE.times( 127 1.0 / 60.0).label("′"); 128 129 133 public static final Unit<Angle> SECOND_ANGLE = MINUTE_ANGLE.times( 134 1.0 / 60.0).label("″"); 135 136 140 public static final Unit<Angle> CENTIRADIAN = RADIAN.times(0.01).label( 141 "centiradian"); 142 143 147 public static final Unit<Angle> GRADE = REVOLUTION.times(1.0 / 400.0) 148 .label("grade"); 149 150 154 158 public static final Unit<Area> ARE = SQUARE_METER.times(100).label("a"); 160 164 public static final Unit<Area> HECTARE = ARE.times(100).label("ha"); 166 170 public static final Unit<Area> BARN = SQUARE_METER.times(1e-28).label("b"); 172 176 180 public static final Unit<DataAmount> BYTE = BIT.times(8).label("byte"); 181 182 185 public static final Unit<DataAmount> OCTET = BYTE; 186 187 191 195 public static final Unit<Duration> MINUTE = SI.SECOND.times(60) 196 .label("min"); 197 198 202 public static final Unit<Duration> HOUR = MINUTE.times(60).label("h"); 203 204 208 public static final Unit<Duration> DAY = HOUR.times(24).label("day"); 209 210 214 public static final Unit<Duration> WEEK = DAY.times(7).label("week"); 215 216 220 public static final Unit<Duration> YEAR = SECOND.times(31556952).label( 221 "year"); 222 223 227 public static final Unit<Duration> MONTH = YEAR.times(1.0 / 12.0).label( 228 "month"); 229 230 236 public static final Unit<Duration> DAY_SIDEREAL = SECOND.times(86164.09) 237 .label("day_sidereal"); 238 239 244 public static final Unit<Duration> YEAR_SIDEREAL = SECOND 245 .times(31558149.54).label("year_sidereal"); 246 247 251 public static final Unit<Duration> YEAR_CALENDAR = DAY.times(365).label( 252 "year_calendar"); 253 254 257 public static final Unit<Duration> AEON = YEAR.times(1e9); 258 259 263 267 public static final Unit<ElectricCharge> E = COULOMB.times( 268 ELEMENTARY_CHARGE).label("e"); 269 270 275 public static final Unit<ElectricCharge> FARADAY = COULOMB.times( 276 ELEMENTARY_CHARGE * AVOGADRO_CONSTANT).label("Fd"); 278 283 public static final Unit<ElectricCharge> FRANKLIN = COULOMB.times( 284 3.3356e-10).label("Fr"); 285 286 290 295 public static final Unit<ElectricCurrent> GILBERT = SI.AMPERE.times( 296 10.0 / (4.0 * PI)).label("Gi"); 297 298 302 306 public static final Unit<Energy> BTU = JOULE.times(1055.056).label("Btu"); 307 308 312 public static final Unit<Energy> BTU_TH = JOULE.times(1054.350).label( 313 "Btu_th"); 314 315 319 public static final Unit<Energy> BTU_MEAN = JOULE.times(1055.87).label( 320 "Btu_mean"); 321 322 326 public static final Unit<Energy> CALORIE = JOULE.times(4.1868).label("cal"); 327 328 332 public static final Unit<Energy> KILOCALORIE = CALORIE.times(1e3).label( 333 "Cal"); 334 335 339 public static final Unit<Energy> ERG = JOULE.times(1e-7).label("erg"); 340 341 345 public static final Unit<Energy> ELECTRON_VOLT = JOULE.times( 346 ELEMENTARY_CHARGE).label("eV"); 347 static { 348 ELECTRON_VOLT.times(1e3).label("keV"); 349 ELECTRON_VOLT.times(1e6).label("MeV"); 350 ELECTRON_VOLT.times(1e9).label("GeV"); 351 } 352 353 357 public static final Unit<Energy> THERM = JOULE.times(105.4804e6).label( 358 "thm"); 360 364 368 public static final Unit<Illuminance> LAMBERT = LUX.times(1e4).label("La"); 369 370 374 378 public static final Unit<Length> FOOT = METER.times(INTERNATIONAL_FOOT) 379 .label("ft"); 380 381 386 public static final Unit<Length> FOOT_SURVEY_US = METER.times( 387 1200.0 / 3937.0).label("foot_survey_us"); 388 389 393 public static final Unit<Length> YARD = FOOT.times(3).label("yd"); 394 395 399 public static final Unit<Length> INCH = FOOT.times(1.0 / 12.0).label("in"); 400 401 405 public static final Unit<Length> MILE = METER.times(1609.344).label("mi"); 406 407 411 public static final Unit<Length> NAUTICAL_MILE = METER.times(1852.0).label( 412 "nmi"); 413 414 418 public static final Unit<Length> ANGSTROM = METER.times(1e-10).label("Å"); 419 420 424 public static final Unit<Length> ASTRONOMICAL_UNIT = METER.times( 425 149597870691.0).label("ua"); 426 427 431 public static final Unit<Length> LIGHT_YEAR = METER.times(9.460528405e15) 432 .label("ly"); 433 434 441 public static final Unit<Length> PARSEC = METER.times(30856770e9).label( 442 "pc"); 443 444 449 public static final Unit<Length> BOHR = METER.times(52.918e-12).label( 450 "Bohr"); 451 452 457 public static final Unit<Length> POINT = INCH.times(0.013837).label("pt"); 458 459 465 public static final Unit<Length> PIXEL = INCH.times(1.0 / 72.0).label( 466 "pixel"); 467 468 471 public static final Unit<Length> COMPUTER_POINT = PIXEL; 472 473 478 public static final Unit<Length> PICA = POINT.times(12).label("pi"); 479 480 484 public static final Unit<Length> DIDOT = METER.times(0.37592e-3).label( 485 "Didot"); 486 487 491 public static final Unit<Length> CICERO = DIDOT.times(12).label("cicero"); 492 493 497 501 public static final Unit<MagneticFlux> MAXWELL = WEBER.times(1e-8).label( 502 "Mx"); 503 504 508 512 public static final Unit<MagneticFluxDensity> GAUSS = TESLA.times(1e-4) 513 .label("G"); 514 515 519 523 public static final Unit<Mass> ATOMIC_MASS = KILOGRAM.times( 524 1e-3 / AVOGADRO_CONSTANT).label("u"); 525 526 530 public static final Unit<Mass> ELECTRON_MASS = KILOGRAM.times( 531 9.10938188e-31).label("me"); 532 533 537 public static final Unit<Mass> CARAT = KILOGRAM.times(200e-6) 538 .label("carat"); 539 540 544 public static final Unit<Mass> POUND = KILOGRAM.times(AVOIRDUPOIS_POUND) 545 .label("lb"); 546 547 551 public static final Unit<Mass> OUNCE = POUND.times(1.0 / 16.0).label("oz"); 552 553 557 public static final Unit<Mass> TON_US = POUND.times(2000).label("ton_us"); 558 559 563 public static final Unit<Mass> TON_UK = POUND.times(2240).label("ton_uk"); 564 565 569 public static final Unit<Mass> METRIC_TON = KILOGRAM.times(1000).label("t"); 570 571 575 579 public static final Unit<Force> DYNE = NEWTON.times(1e-5).label("dyn"); 580 581 585 public static final Unit<Force> KILOGRAM_FORCE = NEWTON.times( 586 STANDARD_GRAVITY).label("kgf"); 587 588 592 public static final Unit<Force> POUND_FORCE = NEWTON.times( 593 AVOIRDUPOIS_POUND * STANDARD_GRAVITY).label("lbf"); 594 595 599 604 public static final Unit<Power> HORSEPOWER = WATT.times(735.499) 605 .label("hp"); 606 607 611 615 public static final Unit<Pressure> ATMOSPHERE = PASCAL.times(101325).label( 616 "atm"); 617 618 622 public static final Unit<Pressure> BAR = PASCAL.times(100e3).label("bar"); 623 624 628 public static final Unit<Pressure> MILLIBAR = BAR.times(1.0 / 1000.0) 629 .label("mbar"); 630 631 636 public static final Unit<Pressure> MILLIMETER_OF_MERCURY = PASCAL.times( 637 133.322).label("mmHg"); 638 639 644 public static final Unit<Pressure> INCH_OF_MERCURY = PASCAL.times(3386.388) 645 .label("inHg"); 646 647 651 655 public static final Unit<RadiationDoseAbsorbed> RAD = GRAY.times(0.01) 656 .label("rd"); 657 658 662 public static final Unit<RadiationDoseEffective> REM = SIEVERT.times(0.01) 663 .label("rem"); 664 665 669 673 public static final Unit<RadioactiveActivity> CURIE = BECQUEREL.times( 674 3.7e10).label("Ci"); 675 676 680 public static final Unit<RadioactiveActivity> RUTHERFORD = SI.BECQUEREL 681 .times(1e6).label("Rd"); 682 683 687 691 public static final Unit<SolidAngle> SPHERE = STERADIAN.times(4.0 * PI) 692 .label("sphere"); 693 694 698 702 public static final Unit<Temperature> RANKINE = KELVIN.times(5.0 / 9.0) 703 .label("°R"); 704 705 710 public static final Unit<Temperature> FAHRENHEIT = RANKINE.plus(459.67) 711 .label("°F"); 712 713 717 720 public static final Unit<Velocity> KNOT = NAUTICAL_MILE.divide(HOUR); 721 722 726 public static final Unit<Velocity> MACH = METER_PER_SECOND.times(331.6) 727 .label("Mach"); 728 729 733 public static final Unit<Velocity> C = METER_PER_SECOND.times(299792458.0) 734 .label("c"); 735 736 740 744 public static final Unit<Volume> LITER = CUBIC_METER.times(0.001) 745 .label("L"); 746 static { 747 LITER.times(1e-6).label("µL"); 748 LITER.times(1e-3).label("mL"); 749 LITER.times(1e-2).label("cL"); 750 LITER.times(1e-1).label("dL"); 751 } 752 753 756 public static final Unit<Volume> CUBIC_INCH = INCH.pow(3); 757 758 763 public static final Unit<Volume> GALLON_LIQUID_US = CUBIC_INCH.times(231) 764 .label("gal"); 765 766 770 public static final Unit<Volume> PINT_LIQUID_US = GALLON_LIQUID_US.times( 771 1.0 / 8.0).label("pint"); 772 773 777 public static final Unit<Volume> FLUID_OUNCE_US = PINT_LIQUID_US.times( 778 1.0 / 16.0).label("oz_fl"); 779 780 784 public static final Unit<Volume> GALLON_DRY_US = CUBIC_INCH.times(268.8025) 785 .label("gallon_dry_us"); 786 787 791 public static final Unit<Volume> PINT_DRY_US = GALLON_DRY_US.times( 792 1.0 / 8.0).label("pint_dry_us"); 793 794 798 public static final Unit<Volume> GALLON_UK = LITER.times(4.54609).label( 799 "gallon_uk"); 800 801 805 public static final Unit<Volume> PINT_UK = GALLON_UK.times(1.0 / 8.0) 806 .label("pint_uk"); 807 808 812 public static final Unit<Volume> FLUID_OUNCE_UK = GALLON_UK.times( 813 1.0 / 160.0).label("oz_fl_uk"); 814 815 819 public static final Unit<Volume> CUP_US = FLUID_OUNCE_US.times(8).label( 820 "cup_us"); 821 822 826 public static final Unit<Volume> CUP_UK = FLUID_OUNCE_UK.times(10).label( 827 "cup_uk"); 828 829 833 public static final Unit<Volume> TABLESPOON_US = FLUID_OUNCE_US.times( 834 1.0 / 2.0).label("tablespoon_us"); 835 836 840 public static final Unit<Volume> TABLESPOON_UK = FLUID_OUNCE_UK.times( 841 5.0 / 8.0).label("tablespoon_uk"); 842 843 847 public static final Unit<Volume> TEASPOON_US = FLUID_OUNCE_US.times( 848 1.0 / 6.0).label("teaspoon_us"); 849 850 854 public static final Unit<Volume> TEASPOON_UK = FLUID_OUNCE_UK.times( 855 1.0 / 6.0).label("teaspoon_uk"); 856 857 861 public static final Unit<Volume> TABLESPOON_AU = CUBIC_METER.times(20.0e-6) 862 .label("tablespoon_au"); 863 864 868 872 public static final Unit ROENTGEN = COULOMB.divide(KILOGRAM).times(2.58e-4) 873 .label("Roentgen"); 874 875 878 static void initializeClass() { 879 } 880 881 } | Popular Tags |