www.squinch.org
API MPMS 11.1, Table 53A
The calculation demonstrated in this page is from the American Petroleum Institutes's Manual of Petroleum Measurement Standards, chapter 11, section 1.
Table 53A is a lookup table generated and published by API used for correcting observed density of generalised crude oil from observed temperature to its density at 15 Deg C.
If the product is not crude oil, then Table 53B should be used instead.
Our interest in this equation is to correct crude oil's observed density at an observed temperature to density at 15 Deg C. In order to do this with Table 53A equations, we need flowing temperature and the flowing density.
The algorithm for the calculation works as follows:
Round input data to specifications.
Exit with error if the data is outside the correlation bounds.
Calculate temperature change from 15 Deg. C (Delta T)
If a hydrometer was used, apply the hydrometer correction to the observed density.
Initialise 15 Deg. C Density
Loop:
Calculate Alpha [= K0/Den15
2
+ K1/Den15]
Calculate VCF [=e(-alpha * Delta T - 0.8 * alpha
2
* Delta T
2
)]
Calculate new 15 Deg. C Density [= DenT / VCF]
Until density has converged or convergence has failed.
If Convergence has failed or the 15 Deg. C Density is outside the correlation limits, exit with an error.
Set extrapolation flag and exit.
The extrapolation flag is an integer flag that allows us to see whether the density we have calculated was part of the original observed area of the table, or is part of the extrapolated area. It will have a value of -1 if we exited with an error, 0 if we exited with an observed density and 1 if we exited with an extrapolated density.
The math used in the algorithm is defined in terms of integer-only math. Even the exponential function is approximated by using multiplication, addition, subtraction and division of the first seven terms of the power series that the exponential function represents. This is done so that the results obtained are rounded at each calculation point in a precise, defined way, and the decimal places carried are controlled throughout the process. In short, the algorithm uses integer mathematics for reasons of repeatability.
The source code provided in the specification is written in Fortran, which only allows "GOTO" type conditional looping. In the RTU, this can be faithfully implemented as instruction list, but Java makes no provision for a GOTO, and neither does structured text. Also, the Fortran does not neatly break up into loops that can be expressed in a structured way. Therefore some liberties had to be taken in interpreting the algorithm in a way that Java permits. No differences were encountered in running the test cases included in the specification against the results obtained with this applet.
For more information on the equations, look in the Javascript in this document, or refer to the API 11.1 document, from which this page is derived.
Inputs
Temp (Deg C) =
Density (kg/m
3
) =
Density from Hydrometer?
Results Table