Home > Calculations > User Defined Functions > Units in Calculations

Units in Calculations                                            

The following units should be used as the unit of calculation in all user functions, regardless of the units in the data entry dialogue. The internal calculations are performed in these units and thus is what is expected to be returned from the user functions:

Money - Dollars (Capex, Opex, revenue)

Liquid Rates - m3/day

Gas Rates - E3m3/day

Liquid Volumes - m3 (Reserve Volumes in E3M3)

Gas Volumes - E3m3 (Reserve Volumes in E6M3)

Sulfur Volumes – Metric Tonnes (Reserve Volumes in E3Tonnes)

Prices - $/unit (m3, GJ, tonne)

Opcost - $/unit (m3, E3M3, tonne)

Diameter – millimetres

Length – Meters

Distance – Kilometers

For example, monthly opex is entered in WellSpring as thousands of dollars per month.  The calculation variables for opex are still in dollars, and any result coming back to a monthly opex should be returned in dollars.

For calculations on volumes, the function must convert any volumes to metric as above for the calculations to work.  The function @base can be used for conversion.

Example 1 

A forumla is to be used to create a capital amount.  The formula specifies that the capex is equal to fifteen times the daily oil rate (in millions of Bbls per day). Using this formula, an oil rate of 2,000 Bbls/day should produce a capital expense of $30,000.

The formula would look like:

=@Base(Imperial, FluidVolume, @oil())*15





The formula takes the oil rate - @oil() which will return a value in m3/day.  This is then multiplied by the conversion rate @Base() to work in Bbls/day.  The result is then left in dollars which is our base unit.


Example 2

The water production is entered in the Decline as a formula.  The water is equal to the gas production in millions of standard cubic feet per day (mmscf/day) times 5 bbls/mmscf/day.  So for 2,000 mcf/day, we expect water proudction of 10 bbls/day.

The formula is entered as:

=@Base(Imperial, FluidVolume,@DataRate(Gas ,Production ))*5/@Base(Imperial,GasVolume,1)/1,000

The function performs two conversions.  The first converts the gas production rate ,@dataRate(Gas,Production) from metric to imperial by dividing by the gas conversion factor @Base(Imperial,GasVolume,1) = 0.02831 to Imperial.

This entire results (now in bbls) is converted to base units (remember the calculation is in base) by converting the above result with the @Base function.


The complete WellSpring unit table and conversion factors are shown below

UnitType Imperial Medium Imperial Large Metric Medium Metric Large Imperial Medium String Imperial Large String Metric Medium String Metric Large String
API 1 1 1 1 Degree API Degree API Kg/M4 Kg/M5
Area 2.471 2.471 1 1 Acre Acre ha ha
Diameter 0.039370079 0.039370079 1 1 in in mm mm
Distance 0.621371192 0.621371192 1 1 mi mi km km
FluidFluidRatio 1 1 1 1 bbl/bbl bbl/bbl m3/m3 m3/m3
FluidGasRatio 178.112 178.112 1000 1000 bbl/mmcf bbl/mmcf m3/e6m3 m3/e6m3
FluidPerVolume 0.158984 0.158984 1 1 $/bbl $/bbl $/m3 $/m3
FluidPrice 0.158984 0.158984 1 1 $/bbl $/bbl $/m3 $/m3
FluidRate 6.28994 0.00628994 1 0.001 bbl/d mbbl/d m3/d e3m3/d
FluidReserveVolume 0.00628994 6.29E-06 0.001 1.00E-06 mbbl mmbbl e3m3 e6m3
FluidVolume 6.28994 0.00628994 1 0.001 bbl mbbl m3 e3m3
GasFluidRatio 5.61444 5.61444 1 1 mcf/bbl mcf/bbl e3m3/m3 e3m3/m3
GasGasRatio 1 1 1 1 mcf/mcf mcf/mcf e3m3/e3m3 e3m3/e3m3
GasPerVolume 0.0283169 0.0283169 1 1 $/mcf $/mcf $/e3m3 $/e3m3
GasPrice 1.05505585 1.05505585 1 1 $/mmBTU $/mmBTU $/GJ $/GJ
GasRate 35.3145 0.0353145 1 0.001 mcf/d mmcf/d e3m3/d e6m3/d
GasReserveVolume 0.0353145 3.53E-05 0.001 1.00E-06 mmcf bcf e6m3 e9m3
GasVolume 35.3145 0.0353145 1 0.001 mcf mmcf e3m3 e6m3
HeatingValue 26.839315 26.839315 1 1 BTU/cf BTU/cf GJ/e3m3 GJ/e3m3
Horsepower 1.341 1.341 1 1 HP HP kW kW
Length 3.280839895 3.280839895 1 1 ft ft m m
Money 0.001 1.00E-06 0.001 1.00E-06 m$ mm$ m$ mm$
None 1 1 1 1 NULL NULL NULL NULL
Percent 100 100 100 100 % % % %
PerHorsepower 0.745712 0.745712 1 1 $/HP/Mnth $/HP/Mnth $/Kw/Mnth $/Kw/Mnth
PerMonth 0.001 1.00E-06 0.001 1.00E-06 m$/Month mm$/Month m$/Month mm$/Month
PerWell 0.001 1.00E-06 0.001 1.00E-06 m$/Well/mo mm$/Well/mo m$/Well/mo mm$/Well/mo
Pressure 0.14458 0.14458 1 1 psi psi kpa kpa
PressurePerVolume 0.00409407 0.00409407 1 1 psi/mcf/d psi/mcf/d kpa/e3m3/d kpa/e3m3/d
SulfurFluidRatio 175.2498 175.2498 1000 1000 t/mbbl t/mbbl t/e3m3 t/e3m3
SulfurGasRatio 28.97138 28.97138 1000 1000 t/mmcf t/mmcf t/e6m3 t/e6m3
SulfurPerVolume 0.907185 0.907185 1 1 $/ton $/ton $/tonne $/tonne
SulfurPrice 0.907185 0.907185 1 1 $/ton $/ton $/tonne $/tonne
SulfurRate 1.102311 1.102311 1 1 ton(us)/d ton(us)/d tonne/d tonne/d
SulfurReserveVolume 0.001102311 0.001102311 0.001 0.001 Mton(us) Mton(us) e3tonne e3tonne
SulfurVolume 1.102311 1.102311 1 1 ton(us) ton(us) tonne tonne
Temperature 1 1 1 1 degF degF degC degC

See also

Example Functions
Using Functions for Capital
Using Lookup Tables in User Functions
Shared Functions - Function Library
Using Custom Variables - Time Series in Functions
Reporting On User Functions
Error Messages - User Functions
Function Reference Library