tgmconv

NAME
SYNOPSIS
DESCRIPTION
OPTIONS
UNIT SYNTAX
PERMISSIBLE UNITS
TGM Units
Metric Units
Customary/Imperial Units
BUGS
WORK NEEDED
AUTHOR
SEE ALSO

NAME

tgmconv − converter for measurements in the TGM, metric, imperial, and customary systems. Inputs and outputs only in dozenal.

SYNOPSIS

tgmconv -e [-k precision ] [-i input unit ] [-o output unit ] quantity

DESCRIPTION

tgmconv Converts the given quantity from the input unit to the output unit. At present, both input and output units must be given manually at the command line. Works with simple units (like "Grafut" and "second") and compound units of arbitrary complexity (like "S*m/m2").

OPTIONS

-k precision

Print the resulting output with precision digits of precision. By default, the output is printed with four digits after the zenimal point. If there is no fractional part, no zenimal point or fractional digits will be printed, even if this option is specified. If the precision is too high, a message will be printed noting this, and the precision will be reduced to the system’s maximum. If you give it a negative number, you will confuse it mightily, and it will resolve the confusion by dropping into standard input and waiting for you to give it something sensible.

-i input unit

Specifies what unit tgmconv will be receiving the quantity in. This argument is optional if you provide the input unit with the quantity itself, for which see the section on the quantity argument below.

-o output unit

Specifies the unit that tgmconv should convert the entered quantity of the input unit into. Strictly necessary if the output unit is not TGM; not strictly necessary if it is TGM, unless you want the unit multiplied or divided by an exponent.

quantity

Must be the final argument on the command line. This is the number of input units that will be converted to output units. Must be a dozenal number; tgmconv will interpret it as such regardless of the user’s actual intent.

Optionally, the input unit may be specified with the input quantity, if the -i option is not being used. (If the -i option is used, then tgmconv will assume that your unit is supposed to be part of your number, and most probably throw an error unless your unit and separator consist entirely of dozenal characters.) To do this, simply enter the quantity as normal (a valid dozenal number); follow it with some character which is not a dozenal number character (the author has taken to using ’:’, but any character not a dozenal number character will do fine); and then enter the unit one wishes to convert.

For example, entering 3:km/hr will cause tgmconv to convert 3 kilometers per hour into the appropriate unit, either TGM’s Vlos (by default) or whatever unit is specified by the -o option.

It’s important to be cautious here, and make sure that the input unit is separated by a non-dozenal character from the input quantity that is entered. For example, if one enters 3km/hr , one has entered perfectly valid input, and tgmconv will obediently convert it. However, it will convert 3 meters per hour, not kilometers. When it encounters the k , tgmconv will quite reasonably assume that this ends the quantity portion of the argument, and will begin the unit portion on the m which is finds next. It is unlikely that this result is what the user desires. However, there’s little to be done for it. Otherwise, there would be no way to tell if, for example, an ’A’ in the input was the start of a unit (for example, the Ag) or simply the number ten. Some separating unit is necessary; the best tgmconv can do is allow the user to employ whatever separator he wants, provided it can’t be confused for a dozenal character.

UNIT SYNTAX

TGM units have a simple syntax. They are entered simply as is. To multiply by an exponent, begin it with the desired exponent and a ’^’: 3^Gf for trinaGrafuts. To divide it, use a ’_’ instead: 3_Gf for triniGrafuts.

Building metric units can be done in the usual way by combining the canonical metric unit abbreviations (e.g., "m" for "meter", "g" for "gram") with the prefixes as normal. However, some of the higher prefixes won’t work as written because they conflict with TGM units when combined with certain metric units (for example, "megagram," canonically "Mg," conflicts with the Mag, and "terameter," canonically "Tm", conflicts with the Tim). Consequently, some need to written out differently.

"Exa" must be written out "Ex" (example: "Exm" for "exameter"); "peta" must be written out "Pe" (example: "PeV" for "petavolt"); "tera" must be written out "Te" (example: "TeV" for "teravolt"); and "mega" must be written out "Me" (example: "Meg" for "megagram"). All the other prefixes can be affixed as normal.

For metric and imperial units, compound units have a fairly tight but intuitive syntax. There is no need to specify exponents; any digit that’s encountered will be treated as a positive exponent. When units are being multiplied, a specific mention of this is necessary; a "*" character is probably easiest, though as a practical matter any character other than a dozenal character (0-9, A, B, T, X, E) or a ’-’ would work.

As an example, the TGM unit of conductivity is the Eldu. The metric unit of conductivity is the Siemen-meter per square meter. To enter the metric unit, use the appropriate abbreviations connected with ’*’ and ’/’:

S*m/m2

(Incidentally, "mho", the old term for the Siemen, will also work here.) Many metric units are compound where TGM provides a single unit, so learning this idiom is essential if tgmconv is to be used at all heavily. Fortunately, it’s not a complicated matter.

Another down side is that tgmconv is too stupid (or, really, too smart) to understand non-standard abbreviations. A common abbreviation in America for "miles per hour" is "mph", for example; tgmconv would have no idea what "mph" was supposed to mean. To get "miles per hour", one must enter "mi/hr", which tgmconv will understand exactly. Similarly, "psi", as the common abbreviation for "pounds per square inch", would be incomprehensible for tgmconv; but entering "lbf/in2" will yield the correct answer.

PERMISSIBLE UNITS

Unfortunately, at this point tgmconv’s syntax is relatively fascistic; it insists on receiving its units in a canonical abbreviated format, in addition to the syntax for composite units explained above. Below is a list of the acceptable units and their abbreviations for TGM, metric, and customary/imperial, plus a brief statement of each unit’s purpose.

TGM Units

Tim --- Tm

The unit of time.

Grafut --- Gf

The unit of length.

Astru --- Au

Another unit of length. Equivalent to the astronomical unit ("au" in SI metric); the approximate distance from Earth to the Sun.

Gee --- G

The unit of acceleration.

Vlos --- Vl

The unit of velocity.

Surf --- Sf

The unit of area.

Volm --- Vm

The unit of volume.

Maz --- Mz

The unit of mass.

Atomic Mass Unit --- mMz

The atomic mass unit, as expressed in TGM units.

Denz --- Dz

The unit of density.

Vlov --- Vv

The unit of velocity squared.

Mav --- Mv

The unit of momentum.

Mag --- Mg

The unit of force.

Tenz --- Tz

The unit of tension.

Prem --- Pm

The generic unit of pressure or stress.

Atmoz --- Atz

The TGM standard atmosphere, a unit of pressure.

Werg --- Wg

The unit of energy or work.

Pov --- Pv

The unit of power.

Viscod --- Vsd

The unit of viscosity, equivalent to Newton-seconds per meter squared (N*s/m2).

Viskin --- Vsn

The unit of viscosity, equivalent to meters squared per second (m2/s).

Radian --- rad

The typical and familiar measure of angles.

Steradian --- Sr

The familiar unit of solid angles.

radiVlos --- rVl

The unit of angular velocity.

radiGee --- rG

The unit of angular acceleration.

radaMav --- RMv

The unit of angular momentum.

radaMag --- RMg

The unit of angular force, or torque.

quaraMaz --- QMz

The unit of moment of inertia.

Freq --- Fq

The unit of frequency or revolution; equivalent to hertz or RPM.

Kur --- Kr

The unit of current.

Kurn --- Kn

The unit of magneto-motive force.

Pel --- Pl

The unit of electro-motive force.

Og --- Og

The unit of resistance, reactance, and impedance.

Go --- Go

The unit of conductance, susceptance, and admittance.

Quel --- Ql

The unit of quantity or charge.

Kap --- Kp

The unit of capacity.

Mit --- Mt

The unit of permittivity.

Flum --- Fm

The unit of magnetic flux.

Flenz --- Fz

The unit of magnetic flux density.

Gen --- Gn

The unit of inductance.

Lukt --- Lk

The unit of reluctance.

Meab --- Mb

The unit of permeability.

Penz --- Pz

The unit of power density, or intensity.

QuaraPenz --- QPz

The unit of radiant poewr.

Lypov --- Lp

The unit of light power, or luminous flux.

Lyde --- Ld

The unit of illumination, luminance, or brightness.

Senz --- Sz

The unit of light sensitivity.

QuaraLyde --- QLd

The unit of luminous intensity.

Calg --- Cg

The unit of heat, comparable to kelvins. tgmconv will match these up with Kelvins, as they have the same base (absolute zero).

Decigree --- Do

Another unit of heat, this one comparable to degrees Celsius. Based on the freezing point of water, like degrees Celsius.

Calkap --- Ck

The unit of heat capacity.

Calsp --- Csp

The unit of specific heat capacity.

Caldu --- Cdu

The unit of thermal conductivity.

Temgra --- Tgr

The unit of temperature gradiant.

Wesp --- Wsp

The unit of specific energy and specific latent heat.

Flo --- Fl

The unit of flow.

Zond --- Zd

The unit of loudness.

Vosp --- Vsp

The unit of specific volume.

Ag --- Ag

The unit of activity.

radaQuel --- RQl

The unit of electric dipole moment.

Rezy --- Ry

The unit of resistivity.

Eldu --- Edu

The unit of conductivity.

Imo --- Im

The unit of ionic mobility.

Quenz --- Qz

The unit of electric flux density.

Depoz --- Dp

The unit of electrochemical equivalence.

Elgra --- Egr

The unit of potential gradient.

radaFlum --- RFm

The unit of magnetic moment.

Magra --- Mgr

The unit of magnetic field strength or gradient.

Lyqua --- Lq

The unit of light quantity.

Perfut --- PGf

The unit of wave number and lens power.

Lytef --- Lf

The unit of light efficiency.

Orosp --- Osp

The unit of specific optical rotation.

Molz --- Mlz

The unit of amount of substance, equivalent to moles.

Surfolz --- Slz

The unit of molzar extinction or absorption.

Volmolz --- Vlz

The unit of molzar volume and refraction.

Molv --- Mlv

The unit of molvity (molarity).

Molm --- Mlm

The unit of molmity (molality).

Wergolz --- Wlz

The unit of molzar enthalpy.

Eldulz --- Eul

The unit of molzar conductivity.

Calgolz --- Clz

The unit of molzar entropy.

Orolz --- Olz

The unit of molzar optical rotation.

DubZond --- DZd

The unit of loudness; a subjective unit. Equivalent to SI metric bels (usually measured in the tenths, or decibels).

Tumblol --- Tmb

A unit of volume intended for convenient use; the "TGM pint". Equal to 3 2_Vm.

Quartol --- Qrt

A unit of volume intended for convenient use; the "TGM quart". Equal to 6 2_Vm, or two Tmb.

Galvol --- Glv

A unit of volume intended for convenient use; the "TGM quart". Equal to 2 1_Vm, or 4 Qrt.

Avolz --- Avz

The TGM version of Avogadro’s mass; the volume of one Molz of a perfect gas at ice point (0 decigrees) and one Atmoz pressure. Equal to roughly 1;0E41X 4^Vm.

Oum --- Oumz

The TGM "ounce". It’s equal to 2 3_Mz.

Me --- Emelectron

The charge of one Molz of electrons; equal to about 5;7 9^Ql, or about 25,850 (decimal) faraday.

Metric Units

second --- s

The metric unit of time.

meter --- m

The metric unit of length.

angstrom --- ang

The normal abbreviation for this is a Scandinavian letter ’A’ with a circle over it; for obvious reasons, tgmconv expects it abbreviated with "ang". Equal to X^-X.

fermi --- fm

This is equal to the femtometer, an unimaginably tiny length. Actually, tgmconv knows of no such unit; but since the abbreviation for "femtometer" and "fermi" are both "fm", you can think of this as a fermi if you wish, and tgmconv will still give you the correct answer.

hectare --- ha

The metric unit of area, comparable to hectares. (The "official" unit of area is generally considered the square meter, comparable to the square yard or square foot.)

gram --- g

The metric unit of mass. This was a bit of a tough decision. The SI standard specifies the kilogram as the basic unit of mass; however, it comes ready-made with a prefix meaning "ten to the third", and a gram is one thousandth of a kilgram. So tgmconv assumes that the gram is the basic unit, rather than the kilogram, so that the algorithms won’t get messed up. The abbreviation "kg" still works fine, anyway.

metric ton --- t

Spelled "tonne" by non-American English speakers, this is equal to one thousand kilograms. In other words, it’s really a megagram (Meg), and entering either "t" or "Meg" will yield the same result.

atomic mass unit --- u
Dalton --- Da

These are equivalent; they both equal the approximate mass of a proton (or a neutron). In grams, about 1.660538782e-24. (Yes, protons and neutrons are crazy small.)

liter --- L

The metric unit of volume. Sort of. This used to be the metric unit of volume, but SI makes the cubic meter that unit, which is something substantially larger. The liter is, at least conceptually, the volume of one square decimeter ; technically, it was defined as the volume of one kilogram of pure water at four degrees celsius and 760 mm of mercury pressure. However, that definition yielded a liter equal to about 1.000028 dm3. Because for quite a long time that was what a liter was, tgmconv converts liters according to this old definition. If you want cubic decimeters, ask for them: dm3.

Newton --- N

The metric unit of force. The force required to accelerate one kg at a rate of one m/s2.

Dyne --- dyn

An old unit of force, the centimeter-gram-second; equal to one ten-thousandth of a Newton.

gram-force --- gf

Another metric unit of force; the force exerted on one gram by an acceleration of one metric standard gravity (about 9.806 m/s2). Usually expressed in kgf. The kgf, then, is equal to 9.806 N.

Pascal --- Pa

The metric unit of pressure and stress.

Metric Standard Atmosphere --- atm

The metric standard atmosphere.

bar --- bar

A metric unit of pressure; typically cited in millibars (mbar).

mHg --- meters of mercury

A metric unit of pressure; similar to inches of mercury. Usually cited in millimeters of mercury (mmHg), which is not quite equal to the Torr, but pretty close.

Torr --- Torr

Another metric unit of pressure, equal to 1/760 of a standard atmosphere. Named for Evangelista Torricelli, who discovered the principle of the barometer.

Ampere-turn --- At

The metric unit of magnetomotive force.

Joule --- J

The metric unit of energy or work.

Calorie --- cal

Another unit of energy or work. There were many types of calorie; tgmconv only knows one, the 15 degree calorie.

erg --- erg

An older metric unit of energy or work; it’s equal to 10.0e-7 Joules.

electron volt --- eV

Another unit of energy or work, quite common in physics. It’s got a complex technical definition; the bottom line is that it’s very tiny, equal to 1.60217653e-19 Joules.

Watt --- W

The metric unit of power.

Watt-hour --- Wh

Another metric unit of energy or work. Equals 3.6 megajoules. Usually listed in kilowatt-hours, kWh.

Hertz --- Hz

The metric unit of frequency.

Ampere --- A

The metric unit of electrical current.

Volt --- V

The metric unit of electromotive force, or "voltage".

Ohm --- ohm

The metric unit of resistance.

Mho --- mho
Siemens --- S

The metric units of conductance, the reciprocal of resistance in ohms. "Mho" is the old term, "Siemens" is the new term; tgmconv accepts both.

Coulomb --- C

The metric unit of electric charge.

Faraday --- faraday

"Faraday’s constant," the amount of electrical charge in one mole of electrons. It’s equal to about 96485.339924 C.

Farad --- F

The metric unit of capacitance.

Weber --- Wb

The metric unit of magnetic flux.

Tesla --- T

The metric unit of magnetic flux density and magnetic induction.

Henry --- H

The metric unit of inductance.

Becquerel --- Bq

The metric unit of radioactivity.

Curie --- Ci

Another metric unit of radioactivity. Equals the number of decays per second in a gram of radium-226 (decimal), or 3.7e10 (decimal) decays per second.

lumen --- lm

The metric unit of luminous flux.

candela --- cd

The metric unit of luminous intensity.

Kelvin --- K

The metric unit of heat, based on absolute zero. Convert to Calg.

Degrees Celsius --- degC

Another unit of heat; based on the freezing point of water. Convert to decigrees.

mole --- mol

The metric unit of amount of substance.

bel --- B

The metric unit of loudness, a subjective measure. Usually used in tenths, the decibel (dB). Note that while decibels are used in many fields, this is only the loudness decibel.

Customary/Imperial Units

This section includes not only customary and imperial units, but also others that don’t fit into either above category, like "days". Where they differ, the imperial versions are suffixed with an "i", the customary with a "c". Imperial versions are used in England and former colonies who gained independence after the imperial reform (broadly, everyone but America); customary versions are used in the United States.
foot --- ft

The customary/imperial unit of length.

inch --- in

One zenth of a foot; a measurement of length.

mil --- mil

A traditional tiny unit, equal to one thousandth of an inch.

yard --- yd

Another traditional length measurement; it is equal to three feet, a bit shorter than a meter.

fathom --- fath

A traditional length measure, generally limited to water depths; as in, "she sank in twenty fathoms". Equal to six feet; not surprisingly, a half-dozen.

rod --- rod

A traditional unit of measure, rarely used these days, equal to five and a half yards.

furlong --- furl

A traditional unit of land measure; equal to six hundred and sixty feet. Originally, acres were one furlong long and one chain wide; nowadays, they can be any shape.

mile --- mi

A traditional unit of length, used in mostly the same circumstances that the kilometer is used in metric. Equal to 5,280 feet.

nautical mile --- nmi

One minute of arc of latitude along any meridian; made equal to exactly one thousand, eight hundred and fifty-two meters by international agreement.

knot --- kn

A primarily maritime unit, it equals one nautical mile per hour. Commonly used even by metric-using seafaring countries, probably because it has a definite relation to the meridian. Common abbreviations are also "kt" and "kts", but tgmconv will only accept "kn". This is the abbreviation specified by the International Hydrographic Organization, whichi ncludes all major seafaring nations. (Or so Wikipedia told me, anyway.)

astronomical unit --- au

The approximate mean distance of the earth to the sun; really large.

light year --- ly

The distance light travels in one year of time.

parsec --- pc

A fancy unit having to do with parallax; enormously huge, about 3.26 light years.

acre --- acre

A traditional unit of area measure. Originally equal to one furlong by one chain; now can equal 4,840.0 square yards of any shape.

pound --- lb

The customary/imperial unit of weight and mass. This refers to the avoirdupois pound; troy pounds are dealt with later, and defined (internally) in terms of avoirdupois pounds.

slug --- slug

Another customary/imperial unit of mass. It equals one pound-force square seconds per foot. One could also simply request "1:lbf*s2/ft" and get the same answer.

stone --- st

Still commonly used in Britain, never used in America; the stone equals fourteen pounds. (Avoirdupois pounds, that is.)

ounce --- oz

Another unit of weight and mass; equal to one-sixteenth of a pound. There were several different types of ounce, including the troy (one zenth of a troy pound), avoirdupois, and fluid. The fluid ounce is for volume (see below); the avoirdupois ounce is the only weight and mass ounce that tgmconv knows. It is typically referred to simply as "ounce"; if one needs to distinguish, use "fluid ounce" for the volume measure and simply "ounce" for the weight.

troy ounce --- ozt

Commonly used only for precious metals, gems, and the like. Twelve troy ounces make a troy pound.

troy pound --- lbt

Never used anymore; put in here because it’s so easy once the troy ounce has been added.

imperial ton --- toni

Another unit of weight and mass, equal to 2,240 lbs. An interesting number, to be sure, because it was based on the English (or "long") hundredweight rather than on the pound.

customary ton --- tonc

An odd name, considering that the imperial ton is actually the customary one in this case. The American ton is based on the American, or "short", hundredweight, and thus equals 2,000 pounds.

hundredweight --- cw

The English, or "long", hundredweight, equal to 112.0 pounds. tgmconv doesn’t know the American or "short" hundredweight of 100.0 pounds, because it’s too easy to figure it out without tgmconv’s help.

imperial gallon --- gali

The imperial unit of volume.

imperial quart --- qti

One-fourth of an imperial gallon; twice an imperial pint.

imperial pint --- pti

A bit too large to be convenient for beer, the imperial pint is equal to twenty fluid ounces. An imperial pint of water is one pound and a quarter mass. ("A pintful of water’s a pound and a quarter", which apparently almost rhymes in British English.) It differs from the customary pint since the imperial reforms of 1824, in which one of many different varieties of gallon was chosen as the standard gallon. The imperial pint is one-eighth of an imperial gallon. It contains twenty fluid ounces.

imperial cup --- cpi

An imperial cup.

imperial tablespoon --- tbsi

An imperial tablespoon.

imperial teaspoon --- tspi

An imperial teaspoon.

customary gallon --- galc

The customary unit of volume.

customary quart --- qtc

One-fourth of a customary gallon; twice a customary pint.

customary pint --- ptc

The perfect size for a beer (no, I’m not biased; this is an obvious objective fact with which no reasonable man could possibly disagree), this is one-eighth of the customary gallon. It masses one pound. "A pint’s a pound the world around"---except, of course, that it isn’t, at least since 1824. It contains sixteen fluid ounces.

customary cup --- cpc

The customary cup.

customary tablespoon --- tbsc

The customary tablespoon.

customary teaspoon --- tspc

The customary teaspoon.

imperial fluid ounce --- flozi

You know the drill. One one hundred and sixtieth of an imperial gallon.

customary fluid ounce --- flozc

One one hundred and twenty-eighty of a customary gallon.

pounds-force --- lbf

The imperial/customary unit of force.

inches of mercury --- inHg

The imperial/customary unit of pressure.

British Thermal Unit --- btu

The imperial/customary unit of energy.

horsepower --- hp

The imperial/customary unit of power.

Revolutions Per Minute --- RPM

A traditional unit of frequency.

degrees --- deg

Degrees of angle; three hundred and sixty of them equals a circle, or 2*pi radians.

hour --- hr

1,0000 Tims; 3,600 seconds.

day --- day

20,0000 Tims; 86,400 seconds.

week --- wk

Seven days; a familiar unit from around the world.

minute --- min

About 249;7249 Tims; 60.0 seconds.

year --- yr

265;0 days; 365.0 days.

leap year --- yrlp

266;0 days; 366.0 days.

BUGS

None known at this time.

WORK NEEDED

The output unit should be deducible rationally from the input unit. That is, if the user is inputting Tims, it should be clear that he wants output in seconds unless he states otherwise. At the present time, tgmconv can only guess the output unit if the output unit is in TGM; this ought to be remedied.

AUTHOR

Donald P. Goodman III <dgoodmaniii at gmail dot com>

SEE ALSO

dec(1), dozdc(1), tgmconv(1), dozdate(1), dozcal(1), dozword(1), dozpret(1)