api11 class

The api11 performs the Calculation of Temperature and Pressure Volume Correction Factors for Generalized Crude Oils, Refined Products, and Lubricating Oils in accordance with:

 

Manual of Petroleum Standards,

Chapter 11: Physical Properties Data,

Section 1:    Temperature and Pressure Volume Correction Factors for Generalized Crude Oils, Refined Products, and Lubricating Oils, American Petroleum Institute.

 

Table 1: Description of the api11 class interface: properties (variables), methods (functions) and error flags.

 

PROPERTIES

DESCRIPTION

SET PROPERTY VALUE

GET PROPERTY VALUE

Alternate condition:

0: include alternate conditions

1: exclude alternate conditions

void SetAlternate0off1on(short newX)

short GetAlternate0off1on()

Rounding condition:

0: rounded and un-rounded

1: rounded only

2: un-rounded only

void SetRounding012(short newX)

short GetRounding012()

Commodity-input:

0: Specialized Liquid

1: Crude Oil

2: Lubricating Oil

3: Refined Product

void SetComodity0sl1co2lo3rp(short newX)

short GetComodity0sl1co2lo3rp()

Thermal expansion factor unit

0: 1/F

1: 1/C

void SetAlpha60Unit0degF1degC(short newX)

short GetAlpha60Unit0degF1degC()

Thermal expansion factor at 60 F

void SetAlpha60(double newX)

double GetAlpha60()

Temperature unit

0:  All temperatures in F

1:  All temperatures in C

2:  All temperatures in K

3:  All temperatures in R

void SetAlpha60Unit0degF1degC(short newX)

short GetAlpha60Unit0degF1degC()

Observed Temperature

void SetObservedTemperature(double newX)

double GetObservedTemperature()

Alternate Temperature

void SetAlternateTemperature(double newX)

double GetAlternateTemperature()

Base Temperature

void SetBaseTemperature(double newX)

double GetBaseTemperature()

Pressure unit

0:  All pressures in psig

1:  All pressures in kPa (gauge)

2:  All pressures in bar (gauge)

void SetPressureUnit0psig1kPa2bar(short newX)

short GetPressureUnit0psig1kPa2bar()

Observed pressure

void SetObservedPressure(double newX)

double GetObservedPressure()

Alternate pressure

void SetAlternatePressure(double newX)

double GetAlternatePressure()

Input density type

0: Observed density in kg/m3

1: Observed relative density

2: Observed API gravity

3: Base density in kg/m3

4: Base relative density

5: Base density in API

6: Density in kg/m3 at 60F

7: Relative density at 60F

8: Density in API at 60F

void SetPressureUnit0psig1kPa2bar(short newX)

short GetPressureUnit0psig1kPa2bar()

Density

void SetDensity(double newX)

double GetDensity()

Observed volume in any unit

void SetObservedVolume(double newX)

double GetObservedVolume()

Key code

void SetKeyCode(long newKC)

-

Error status

-

long int GetErrorStatus()

Commodity-output:

0: Specialized Liquid

1: Crude Oil

2: Lubricating Oil

3: Refined Product

4: Furl Oil

5: Jet Fuel

6: Transition Zone

7: Gasoline

-

short GetCommodityOut0to7()

Scaled compressibility factor for observed temperature per psi

-

double GetScaledFpForToPerPsi()

Scaled compressibility factor for alternate temperature per psi

-

double GetScaledFpForTaPerPsi()

Scaled compressibility factor for observed temperature per selected pressure unit

-

double GetScaledFpForToPerSPU()

Scaled compressibility factor for alternate temperature per selected pressure unit

-

double GetScaledFpForTaPerPsi()

Correction factor to correct density & volume at 60 F to base temperature

-

double api11::GetCorrectionFactor60FtoTb()

Combined correction factor to correct density & volume at 60 F to observed conditions

-

double GetCorrectionFactor60FtoPoTo()

Combined rounded correction factor to correct density & volume at 60 F to observed conditions

-

double GetRCorrectionFactor60FtoPoTo()

Combined correction factor to correct density & volume at 60 F to alternate conditions

-

double GetCorrectionFactor60FtoPaTa()

Combined rounded correction factor to correct density & volume at 60 F to alternate conditions

-

double GetRCorrectionFactor60FtoPaTa()

Combined correction factor to correct density & volume at base to observed conditions

-

double GetCorrectionFactorTbtoPoTo()

Combined rounded correction factor to correct density & volume at base to observed conditions

-

double GetCorrectionFactorTbtoPoTo()

Combined correction factor to correct density & volume at base to alternate conditions

-

double GetCorrectionFactorTbtoPaTa()

Combined rounded correction factor to correct density & volume at base to alternate conditions

-

double GetRCorrectionFactorTbtoPaTa()          

 

Density in  kg/m3 at 60 F

-

double GetDensityAt60FinKgPerM3()

Density in API at 60 F

-

double GetDensityAt60FinAPI()

 

Relative density at 60 F

-

double GetRelativeDensityAt60F()

Density in  kg/m3 at base temperature

-

double GetDensityAtTbInKgPerM3()      

 

Density in API at base temperature Tb

-

double GetDensityAtTbInAPI()

Relative density at base temperature

-

double GetRelativeDensityAtTb()

Un-rounded density in  kg/m3 at observed conditions

-

double GetURDensityAtPoToInKgPerM3()

Rounded density in  kg/m3 at observed conditions

-

double GetRDensityAtPoToInKgPerM3()

Un-rounded density in API at observed conditions

-

double GetURDensityAtPoToInAPI()

Rounded density in API at observed conditions

-

double GetRDensityAtPoToInAPI()

Un-rounded relative density at observed conditions

-

double GetURRDensityAtPoTo()

Rounded relative density at observed conditions

-

double GetRRDensityAtPoTo()   

 

Un-rounded density in  kg/m3 at alternate conditions

-

double GetURDensityAtPaTaInKgPerM3()

Rounded density in  kg/m3 at alternate conditions

-

double GetRDensityAtPaTaInKgPerM3()

Un-rounded density in API at alternate conditions

-

double GetURDensityAtPaTaInAPI()       

 

Rounded density in API at alternate conditions

-

double GetRDensityAtPaTaInAPI()

Un-rounded relative density at alternate conditions

-

double GetURRDensityAtPaTa()              

 

Rounded relative density at alternate conditions

-

double GetRRDensityAtPaTa()

Volume at 60 F in the same units as observed volume

-

double GetVolumeAt60F()

Rounded volume at 60 F in the same units as observed volume

-

double GetRVolumeAt60F()

Volume at base temperature in the same units as observed volume

-

double GetVolumeAtTb()

Rounded volume at base temperature in the same units as observed volume

-

double GetRVolumeAtTb()

Un-rounded volume at alternate conditions obtained from volume at 60 F

-

double GetURVolumeAtPaTaFromVolAt60F()

Rounded volume at alternate conditions obtained from rounded volume at 60 F in the same units as observed volume

-

double GetRVolumeAtPaTaFromRVolAt60F()

Un-rounded volume at alternate conditions obtained from base volume in the same units as observed volume

-

double GetURVolumeAtPaTaFromVolAtTb()

Rounded volume at alternate conditions obtained from rounded volume at base conditions in the same units as observed volume

-

double GetRVolumeAtPaTaFromRVolAtTb()

FUNCTIONS

Calculation of API-Chapter 11 corrections

long int CalculateAPI11()

Calculates temperature and pressure correction factors ... and returns long int ErrorStatus

ERROR STATUS

Error status bits are cleared or set upon the completion of long int CalculateAPI11() function as follows

Bit 0 =1 (01H)

observed temperature out of range

Bit 1 =1 (02H)

alternate temperature out of range

Bit 2 =1 (04H)

base temperature out of range

Bit 3 =1 (08H)

observed pressure out of range

Bit 4 =1 (010H)

alternate pressure out of range

Bit 5 =1 (020H)

commodity index out of range

Bit 6 =1 (040H)

thermal expansion coefficient out of range

Bit 7 =1 (080H)

density at 60F out of range

Bit 8 =1 (0100H)

density out of maximum range

Bit 9 =1 (0200H)

the result did not converge but is valid (Refined Products)

Bit 10 =1 (0400H)

the result did not converge and is invalid

Bit 24 =1 (0100000H)

incorrect key code entered

All other bits are unused