Dec 172017
 
Pop-Up unit conversion utility. Handy and powerful.
File CONVERTS.ZIP from The Programmer’s Corner in
Category Science and Education
Pop-Up unit conversion utility. Handy and powerful.
File Name File Size Zip Size Zip Type
CONVERT.COM 18595 12664 deflated
CONVERT.DAT 6998 1525 deflated
READ.ME 5632 2182 deflated
TSR_CONV.COM 19474 13237 deflated

Download File CONVERTS.ZIP Here

Contents of the READ.ME file


*******THE FOLLOWING FILES ARE INCLUDED*********

TSR_CONV.COM -- a popup version of convert. The hot key is Alt F9.

CONVERT.COM -- a foreground version of convert.

CONVERT.DAT -- data file for the program.

READ.ME -- this file.

**********BLAH BLAH BLAH***********

Adapted to Turbo Pascal 3 from a basic program written by David Kahn that
was published in the March 1985 issue of BYTE magazine. Several enhancements
have been made.
(1) Routines have been added to check the number of significant figures.
No more answers with 10 significant figures if there are only 4 significant
figures in the conversion factor.
(2) Answers are now pretty printed to be more readable. For example, there
were 0.25600000E+03 tablespoons in a gallon, now there are 256.
(3) New conversion factors have been added to the data table and CONVERT can
now do anything (well almost anything) in the CRC Handbook of Chemistry and
Physics.
(4) The program is memory resident now (thanks to Lane Ferris and his
shareware program Stayres)

I originally wrote the program for use by hydrologists so many of the
new conversion factors and abbreviations relate to water. The data file may
have to be modified for other sciences. For example, in the data file 'gal'
is considered an abbreviation for gallon and not a unit describing gravity.

Arrays are now dimensioned to handle 150 units in the data table. If you
want to have more than that the constant maxunits must be changed. Arrays are
dimensioned to handle 15 prefixes. I can't imagine needing more than that but
if you do change the constant maxpr.


***********INSTRUCTIONS************

This program converts numbers between unit systems. It understands a wide
range of units, prefixes and also many abbreviations. Enter the value and
units of what you want to convert from, then enter the units of what you
want it converted to. If only units are given a value of one is assumed.

Powers are entered using the caret, ''^''. For example, square feet is
entered as feet^2. Inverse units can be entered 3 ways. You can use the word
'per', for example, 'per mile'. You can use a slash mark, for example,
'/mile''. You can use a negative power also, for example, 'mile^-1'.

Your input is assumed accurate to 8 significant figures, thus, if you
enter 1.2 gallons the program assumes you mean 1.2000000 gallons. Answers
are given to the correct number of significant figures. The conversion
factor for league, for example, is only accurate to 4 significant figures
so answers only have 4 significant figures. Most conversion factors have 8
significant figures.

Answers given without decimal points are accurate to 8 significant
figures, for example, '12' is equivalent to '12.000000'.

Examples of how to use the program.

Convert from: 125 feet per second
Covert to: miles/hour
The answer is 85.22726

Convert from: feet^3 second^-1
No scalar given, a value of 1 is assumed.
Convert to: acre-feet/year
The answer is 724.46

Convert from: 15 miles
Convert to: leagues
The answer is 4.824

Convert from: 5 milliliters
Convert to: tsp
The answer is 1.01444

Convert from: 12 megasecs
Convert to: millicenturies
The answer is 3.8025


*********HOW TO MODIFY THE DATA FILE************

The first line of the data file is the number of prefixes
and units. The first number (14) tells the number of prefixes
and the second number (123) tells the number of the units.
If you add or delete a unit the first line must be changed.

14 123

The following line shows the format of the data for each
unit.

a b c d e f g h i j
INCH 39.370079 8 4 1 0 0 0 0 0

Field

a Unit name which must be in uppercase.
b Conversion factor. I will tell how to calculate it later.
c Number of significant figures in the conversion factor,
the maximum is 8.
d Number of letters in the unit name

e-f Exponents for the dimensions of the unit. They can
be positive or negative.

e Distance
f Mass (or weight)
g Time
h Angle
i SolidAngle
j Quantity

Assume you want to add a unit for discharge, lps (liters per second).
The value in field e would be 3 (distance cubed = volume). The value in
field g would be -1 (inverse time). All the other fields would be 0.

To calculate the conversion factor you must convert the unit to
basic units. Gallons must be converted to cubic meters, acres to
square meters, miles per hour to meters per second. The basic units are:

Meters -- Distance
Kilograms -- Mass
Seconds -- Time
Radians -- Angle
Steradians -- SolidAngle
Coulombs -- Quantity

The conversion factor is the number that, when multiplied by
the unit, converts it to basic units.

As an example, calculate the conversion factor for gallons per minute.

gallons meters^3
CF * ------- = --------
minute second


meters^3 minute 264.17205 gallons 60 seconds
CF = ------- * ------ * ----------------- * ---------- = 1.585032E4
second gallon meter^3 minute


 December 17, 2017  Add comments

Leave a Reply