Expression Evaluator with Unit Handler - Verio Server

MJVanVoorhis@gmail.com 4/29/2009 - 4/23/2014, 7/22/2014, 3/10/2016, 8/17/2016, 2/22/2017, 4/2/2017, 8/28/2018, 1/1/2019

AnalysisChamp.com Complex Unit Converter

#### Description

Calculate expressions with units properly handled. Enter the expression value as a formula and input units as a formula. Also enter the desired output units. The expression evaluator will calculate the value, define the conversion factors for the units and verify that the desired output units are proper.

This site can process all MS VBScript functions. See Microsoft MSDN VBScript Reference and Microsoft Derived Functions for specific information. The names for all units are provided in AnalysisChamp.com/EEx/AllUnitNames.htm and a shorter list of more common unit names is located in AnalysisChamp.com/EEx/FavUnitNames.htm.

Check our blog at: AnalysisChamp.com/Wordpress.

MikeVanVoorhis@msn.com
4/28/2009, 1/28/2012, 11/17/2013, 3/10/2016, 8/17/2016, 2/22/2017

Examples are given using short function callout versions
(turn word wrap off before copying strings and pasting into expression evaluator)
Each expression string can be copied from the web page by selecting the text and pressing ctrl^C then inserting into the evaluation field and pressing ctrl^V.
The precision of returned values is not more accurate than 6 significant digits.

Example 01 - Temperature Calculations
[Enter Example 01]
What is the absolute temperature, degrees Kelvin, at 32 degrees farenheight (F)?
------
cv(32,"DEGF","DEGK")
= 273.15

Example 02.01 - Length Conversions
[Enter Example 02.01]
What is the length, in feet, of 200 rods?
------
cv(200,"ROD","FT")
= 3300 ft

Example 02.02 - Circle Perimeter
[Enter Example 02.02]
What is the length, in feet, of the perimeter of a circle 12 inches in diameter?
------
cv(12,"PI*IN","FT")
= 3.1415863 ft

Example 02.03 - Circle Area
[Enter Example 02.03]
What is the area, in square feet, of a circle whose diameter is 24 inches?
------
cv(1/4*24^2,"PI*IN^2","FT^2")
= 3.1415863 ft^2

Example 03 - Speed, Torque and Power Calculations
[Enter Example 03]
What is the torque, in pound-feet, of a shaft driving a 10 horsepower load at 3600 revolutions per minute?
Power = torque * speed so torque = power / speed
------
cv(10/3600,"HP/RPM","FT*LBF")
= 14.6 ft*lbf

Example 04 - Gas Law Calculations
[Enter Example 04A] [Enter Example 04B]
[Enter Example 04C]
What is the volume per mole of an ideal gas (like air) at 0 degC (273.15 degK) and atmoshperic pressure?
p*V = n*R*T so V/n = R*T/p
------
Two methods may be used. Temperature is a biased measurement unit. In this case, if the temperature in degrees Centigrade was used directly it would give erroneous results. First, convert temperature into DEGK...
cv(0,"DEGC","DEGK") = 273.15, then:
cv(1*273.15/1,"(RGC)*(DEGK)/(ATM)","L/MOL")
= 22.4 L/Mole
A second approach involves inserting Base Unit conversion functions into the analysis string...
cv(bv(1,"RGC")*bv(0,"DEGC")/bv(1,"ATM"),"("&bu("RGC")&")*("&bu("DEGC")&")/("&bu("ATM")&")","L/MOL")
= 22.4 L/Mole
... The temperature is properly calculated with this approach in a single expression.

Example 05 - Air Density Calculations
What is the density of air, in pounds per cubic foot, at 15 degC (288 degK) and
atmospheric pressure of 30.10 inches-mercury?
[Enter Example 05]
p*V = n*R*T and mass = moles * grams per mole (gpm) so n/V = p/(R*T) and density = n*gpm/V = p * gpm / (R*T)
------
As in example 4, the temperature needs to be in an absolute measurement system for proper evaluation...
cv(30.1*28.8/(1*288),"IN[HG]*(GM/MOL)/(RGC*DEGK)" , "LBM/FT^3")
= .0763 lbm/ft^3
Alternatevly, the use of Base Value functions inserted into the expression string provides proper results...
cv(bv(30.1,"IN[HG]")*bv(28.8,"GM/MOL")/(bv(1,"RGC")*bv(15,"DEGC")),"("&bu("IN[HG]")&")*("&bu("GM/MOL")&")/(("&bu("RGC")&")*("&bu("DEGC")&"))" , "LBM/FT^3")
= .0763 lbm/ft^3

Example 06 - Propeller Tip Speed Calculations
What is the tip speed, mach at standard sea level atmosphere, of a 72 inch diameter propeller spinning at 2400 RPM?
[Enter Example 06]
V = diameter / 2 * rotational speed
------
cv(72/2*2400,"(IN)*(RPM)","MACH[S]")
= .675 mach

Example 07 - Hydraulic Power Calculations
What is the hydraulic pressure of a 200 horsepower system with 400 gallons per minute flow rate?
[Enter Example 07]
power = pressure * flow rate so pressure = power / flow rate
------
cv(200/400,"(HP)/(GAL/MIN)","PSI")
= 857 psi

Example 08 - Dynamic Pressure Calculation
What is the dynamic pressure, in pascals, of an air-stream at 150 knots? Air density is .0775 pounds per cubic foot.
[Enter Example 08]
q = 1/2 * rho * V^2
------
cv(1/2*.0775*150^2,"(LBM/FT^3)*(KNOT)^2","PA")
= 3696 Pa

Example 09 - Shaft Load with Sheave
What is the side load on a shaft, in Newtons, with a 200 cm diameter sheave if it carries 30 kW power at 55 Hz?
[Enter Example 09]
F = p/(n*r)
------
cv(30/(55*200/2),"(KW)/((HZ)*(CM))","N")
= 86.8 Newton

What is the ideal radiated power per unit area of a body at 3000 degrees R in watts?
[Enter Example 10]
q = sigma * T^4
------
The temperature is expressed in absolute units and can be used without a primary conversion (see Example 5):
cv(1*3000^4,"(SIGMA)*(DEGR)^4","W/M^2")
= 4.38E5 W/M^2

Example 11 - Chemical Equivalent - Pounds(mass) to Moles
How many pounds of caffeine does a 1.35 mole sample weigh? The chemical formula for caffeine is C8-H10-N4-O2.
[Enter Example 11]
The formula weight of caffeine is 8*12.01115 + 10*1.00797 + 4*14.0067 + 2*15.9994
------
Addition and subtraction of units must be done carefully because they cannont be mixed within a sum or difference calculation. Checks on the units for each term in such a calculation must be made.
cv(1.35*(8*12.01115+10*1.00797+4*14.0067+2*15.9994),"(MOL)*(GM/MOL)","LBM")
= .578 lbm

Example 12 - Area of a Circle
[Enter Example 12]
What is the area of a circle, in square feet, if it has a diameter of 2 meter?
Area = pi/4 * Diameter^2
cv(1/4*2^2,"PI*M^2","FT^2")
= 33.8157 ft^2

Example 13 - Temperature of One Billion Standard Cubic Feet of Ideal Gas at one Atmosphere Pressure
What is the temperature, in degrees Farenheight, of 1 billion standard cubic feet of an ideal gas at one atmosphere pressure?
[Enter Example 13A]
Ideal gas law:
p*V = m * RGC * T; solving for T:
T = (m * RGC)/(p * V)
where:
T = temperature, m = quantity (billion standard cubic feet), RGC = universal gas constant, p = pressure and V = volume.
------
The temperature can be returned in biased units (DEGC or DEGF) because the result is converted after evaluation.
cv((1E9*1)/(1*1),"((FT^3)*(ATM))/((BCF)*(RGC))","DEGF")
= 60 degF
The expression can be checked using the base units as follows:
[Enter Example 13B]
cv((bv(1E9,"FT^3")*bv(1,"ATM"))/(bv(1,"BCF")*bv(1,"RGC")),"(("&bu("FT^3")&")*("&bu("ATM")&"))/(("&bu("BCF")&")*("&bu("RGC")&"))","DEGF")
= 60 degF

Example 14 - Molecular weights with English and Metric Units
What is the weight, in pico*grains, of a 1/4 inch long string of carbon atoms if each averages 1.5E-08 centimeters in diameter?
[Enter Example 14]
Carbon has an atomic weight of 12.01115 grams per mole.
total weight = total length * Weight/Atom * number of Atoms/length
where the weight/atom = formula weight / Avogadro's number
------
cv(.25*(12.01115/1)*(1/1.50E-8),"IN*((GM/MOL)/NA)*(1/CM)","PICO*GRAIN")
= .013 pico*grain

Example 15 - Percent Chemical Composition of a Compound
What is the percent composition of chlorine in FeCl3? Iron (Fe) weighs 55.847 grams per mole and chlorine (Cl) weighs 35.453 grams per mole based on atomic weight.
[Enter Example 15]
Molecule Weight = Fe*1+Cl*3 = (1*(55.847)+3*(35.453)) MOL*(GM/MOL)
Chlorine weight per molecule = (35.453)*3
Cl Percentage = (chlorine weight per molecule)/(molecule weight)
------
cv(3*35.453/(1*55.847+3*35.453),"(GM/MOL)/(GM/MOL)","CENTI")
= 65.6 percent (centi)

Example 16 - Centrifugal Force
What is the centrifugal force of a mass of 3.31 lbm rotating at 3000 revolutions per minute (rpm) at a radius of 18 inches?
[Enter Example 16]
Centrifugal Force = mass * radius * rotation speed ^ 2
------
cv(3.31*18*3000^2,"(LBM)*(IN)*(RPM)^2","LBF")
= 15230 lbf

Example 17 - Linear Interpolator
What is the interpolated estimate for y where y=f(x) at x=.20 when y1=2.5 at x1=0.10 and y2=7.5 at x2=0.30?
[Enter Example 17]
The linear interpolation formula is: y = (x-x1)*(y2-y1)/(x2-x1)+y1
------
(.20-.10)*(7.5-2.5)/(.30-.10)+2.5
= 5.0
Example 18 - Heat Conduction thru Wall
How much energy (in watts) is transferred through a concrete wall 8 feet tall x 12 feet wide x 8 inches thick when the temperature difference is 25 degrees F? The coefficient of thermal conductivity for concrete is .5 BTU*ft/(hr*ft^2*degR)
[Enter Example 18]
Heat flow Rate = (Coefficient of Thermal Conductivity * Area * Temperature difference)/thickness
------
cv((.5*(8*12)*25)/8,"((BTU*ft/(hr*ft^2*degR))*(ft*ft)*degR)/in","W")
= 527.5 W

Example 19.01 - Future value given Present worth calculation (F/P)
[Enter Example 19.01]
What is the future value of \$200,000.00, if the annual interest rate is 6.5 % and the number of periods is 30 years?
FV = FVperPV(PV, Interest, Periods)
------
FVperPV(200000, 6.5/100, 30)
= 1,322,873.23

Example 19.02 - Present worth given Future value calculation (P/F)
[Enter Example 19.02]
What is the Present worth of \$200,000.00 at 30 years from now if the annual interest rate is 6.5 %?
PV = PVperFV(FV, Interest, Periods)
------
PVperFV(200000, 6.5/100, 30)
= 30,237.21

Example 19.03 - Uniform payment amount for given Future value calculation (A/F)
[Enter Example 19.03]
What is the periodic payment amount for a future value of \$200,000.00 at 30 years from now if the annual interest rate is 6.5 %?
Amount = AmtperFV(FV, Interest, Periods)
------
AmtperFV(200000, 6.5/100, 30)
= 2,315.49

Example 19.04 - Uniform payment amount for given Present worth calculation (A/P)
[Enter Example 19.04]
What is the periodic payment amount for a Present worth of \$200,000.00 for 30 years if the annual interest rate is 6.5 %?
Amount = AmtperPV(PV, Interest, Periods)
------
AmtperPV(200000, 6.5/100, 30)
= 15,315.49

Example 19.05 - Future value of given Uniform payment amount calculation (F/A)
[Enter Example 19.05]
What is the Future value of periodic payments of \$150.00 for 30 years if the annual interest rate is 6.5 %?
FV = FVperAmt(Amt, Interest, Periods)
------
FVperAmt(150, 6.5/100, 30)
= 12,956.23

Example 19.06 - Present worth of given Uniform payment amount calculation (P/A)
[Enter Example 19.06]
What is the Present worth of future periodic payments of \$150.00 for 30 years if the annual interest rate is 6.5 %?
PV = PVperAmt(Amt, Interest, Periods)
------
PVperAmt(150, 6.5/100, 30)
= 1,958.80

Example 19.07 - Present worth of given Gradient payment amount calculation (P/G)
[Enter Example 19.07]
What is the Present worth of future Gradient payments increasing \$25.00 per period for 30 years if the annual interest rate is 6.5 %? The initial (1st) payment is \$0.00, the 2nd payment is \$25.00, the 3rd payment is \$50.00 and so on.
------
= 3,278.11

Example 19.08 - Equivalent uniform payment amount for a given Gradient payment amount calculation (A/G)
[Enter Example 19.08]
What is the equivalent uniform periodic payment of a Gradient payment series that increases \$25.00 per period for 30 years if the annual interest rate is 6.5 %? The initial (1st) gradient payment is \$0.00, the 2nd payment is \$25.00, the 3rd payment is \$50.00 and so on.
------
= 251.03
Example 19.09 - Return on Investment (ROI) for given present and future value and time period calculation (ROI)
[Enter Example 19.09]
What is the return on investment (annual percent) for a property purchased 2009 at \$155000 and sold 2017 for \$253500? The sales cost is 10%.
ROI = GoalSeekVar(.90*253500,0.0,25.0,.01, _
"FVperPV(155000,var/100,(2017-2009))")
------
GoalSeekVar(.90*253500,0.0,25.0,.01, _
"FVperPV(155000,var/100,(2017-2009))")

= 4.96
Example 19.10 - Return on Investment (ROI) for given present and future value and time period calculation (ROI)
[Enter Example 19.10]

ROI = ROI(PV, FV, Periods, iMin, iMax, iStep)
-------
ROI(155000,.90*253500,(2017-2009),0.0,25.0,.01)
= 4.96
Example 20.01 - Convert the decimal number 255 to it's hexadecimal string using VBScript HEX() function
[Enter Example 20.01]
What is the hexadecimal value of 255?
The VBScript "HEX()" function converts a decimal number into it's hexadecimal string. For further info on the HEX() function see MSDN HEX function reference
------
HEX(255)
= FF

Example 20.02 - Convert hexadecimal string "AA" to it's decimal number using the VBScript CLNG() function
[Enter Example 20.02]
What is the decimal value of "AA" hex?
The VBScript "CLng()" function converts a hex string into it's decimal equivalent if preceeded by "&h". For further info on the CLng() function see MSDN CLNG function reference
------
CLng("&h" & "AA")
= 170

Example 20.03 - Convert the decimal number 125 to it's octal string using VBScript OCT() function
[Enter Example 20.03]
What is the octal value of 125?
The VBScript "OCT()" function converts a decimal number into it's octal value. For further info on the OCT() function see MSDN OCT function reference
------
OCT(125)
= 175

Example 20.04 - Convert octal value 175 to it's decimal number using the VBScript CLNG() function
[Enter Example 20.04]
What is the decimal value of 175 octal?
The VBScript "CLng()" function converts an octal value into it's decimal equivalent if preceeded by "&o". For further info on the CLng() function see MSDN CLNG function reference
------
CLng("&o" & "175")
= 125

Example 20.05 - Find the ANSI character for decimal number 65 using VBScript CHR() function
[Enter Example 20.05]
What is the ANSI character with value 65?
The VBScript "CHR()" function converts a string into it's value. For further info on the ASC() function see MSDN CHR function reference
------
CHR(65)
= A

Example 20.06 - Convert ANSI character "A" to it's decimal value using the VBScript ASC() function
[Enter Example 20.06]
What is the value of ANSI character "A"?
The VBScript "ASC()" function converts a character string into it's ANSI value. For further info on the ASC() function see MSDN ASC function reference
------
ASC("A")
= 65

Example 21 - Calculate the factorial of 6 using the FACTORIAL() function
[Enter Example 21]
What is the factorial of 6?
The "FACTORIAL()" function calculates this value. For further info on the FACTORIAL() function see Factorial function code reference
------
FACTORIAL(6)
= 720

Example 22 - Calculate the base 10 log of 5.25 using the LOG() function
[Enter Example 22]
What is the base-10 log of 5.25?
The "LOG()" function calculates this value for natural logs. Base-10 logs are found by using the ratio of the natural log of the value to the natural log of the base (in this case, 10). For further info on the LOG() function see LOG function reference
------
LOG(5.25)/LOG(10)
= 0.720159303405957

Example 23 - Identify value that evaluates to target by given function using GoalSeekVar()
[Enter Example 23]
What angle (in radians) allows the following function, "SIN(var)+1.5" to evaluate to 1.75?
The GoalSeekVar() function allows a user-defined function for the variable (="var") for given target, min, max and step values to be determined. GoalSeekVar(target, varMin, varMax, varStep, strFun) will substitute values from min to max by step until the function evaluates to the target value. It will return the variable value needed to evaluate the function to the target value. When var = 0.2527, SIN(var)+1.5 = target value = 1.75. The "EVAL(REPLACE(string,target,replacement))" function can be used to evaluate a user defined function.
------
GoalSeekVar(1.75,-3.1415,3.1415,.0001,"SIN(var)+1.5")
= 0.2527

Example Unit Search and Lookup
The database of unit names can be queried using the FS(start, search string, field) command. Typically, start = 1 and field = 2 to obtain the index number for a specified unit.
------
FS(1,"degree",2)
= 45 This is the index for the first unit that contains "degree" in its description. This function can be nested inside the FactorData function to retrieve the full description:
FD(FS(1,"degree",2),2)
= degrees

Function List: (The two character shortcut is listed and then the full named function is shown)
CV(): CVVal(input value, input unit string, output unit string)
Calculates the parameter value for the given value and units expressed as the output units.
CS(): CVSum(input1 value, input1 unit string, input2 value, input2 unit string, output unit string)
Calculates the sum value for the two given values with units expressed as the output unit.
BU(): CVBaseUnit(unit string)
Expresses the given units as SI units.
BV(): CVBaseVal(value,unit string)
Evaluates the given parameter into SI units.
BD(): UCBaseData(record,field)
Returns the specific field and record from the unit converter bases factors database. Field 1 is the name, field 2 is the check value and field 3 is the description.
BI(): UCBaseIndex(name)
Returns the specific record number from the unit converter base factors database for a given name.
KV(): UCChkval(Unit string)
Returns a unique check value for a unit text string based on its base units. Proper unit conversions yield equal check values.
FD(): UCFactorData(record,field)
Returns the specific field and record from the unit converter factors database.
FI(): UCFactorIndex(name)
Returns the specific record number from the unit converter factors database for a given name.
FS(): UCFactorDataSearch(start, search string, field)
Returns the next record number from the given start record of the unit converter factors database for a given text string within the given field.