Mathcad computer methods

Published: Last Edited:

This essay has been submitted by a student. This is not an example of the work written by our professional essay writers.

Mathcad Computer Methods For Interconversion Of Petroleum Distillation Curves.


The main goal of the present paper is to offer a general, easy-to-use Mathcad version of the API (American Petroleum Institute) procedures for the ASTM D 86 and TBP distillation curves interconversion. Moreover, we shall provide in Part II Mathcad written procedures which may be applied as single variable functions.

Being given the natural syntax and layout of Mathcad worksheets, we consider that such Mathcad implementation of the API procedure could be useful for rapid determination of petroleum fractions properties, since numerous empirical correlations available in the literature are employing input data from the ASTM or TBP distillation curves. Moreover, due to features of Mathcad platform such as readability and ease of data input/output, Mathcad versions of API procedure may also help the refinery lab technician or analyst whenever a rapid and convenient check of distillations results obtained experimentally is needed.

The relations needed for distillation curves interconversion given in have been adapted by the author for temperatures in degrees centigrade, the most common European and SI tolerated temperature unit. These relations are explicitly given below in order to make them available to the reader wishing to use them in calculations made by hand or in other computation platforms.

Numerical checks against examples taken from literature and made to verify our Mathcad versions of the API procedure, are also shown.

Actually, there is no ASTM standard comprising a real TBP distillation, but experimental method described in ASTM D 2892 standard can be considered sufficiently close to real TBP distillation. Other experimental protocols for recording of so-called TBP temperatures may vary slightly depending on company or national standards. Petroleum fraction distillation according ASTM D 86 standard will be referred to as ASTM distillation in all subsequent text.

Once the procedure written or copied in a Mathcad worksheet, it can afterwards be used everywhere in the same worksheet or even in a different one, or may be called iteratively from programming modules. Such a Mathcad procedure can also be employed as a Mathcad module within the Mathconnex environment.

Presentation Of API Procedures

The Procedure For Conversion Of ASTM Distillation Curve Into The TBP Curve

The procedures recommended by API for the interconversion of ASTM and TBP distillation curves can be found in [1]. For the sake of readability of their Mathcad implementation presented in this work, these procedures will be briefly recalled next.

To begin with, the API method for the prediction of TBP curve from ASTM D86 distillation results comprises the following four steps :

1-. finding out the differences between temperatures of the 0 %, 10 %, 30 %, 50 %, 70%, 90% and 100 %(vol.) points on the initial ASTM distillation curve, i.e. the following DtidASTM:

DtidASTM=tid+1ASTM - tidASTM , (1)

with id used for indexing temperature differences and let to have the values id = 0, 1, 2, ..., 5 (to be like in the Mathcad application, see below text and figures). DtidASTM are thus :

Dt0ASTM = t10%ASTM - t0%ASTM

Dt1ASTM = t30%ASTM - t10%ASTM

Dt2ASTM = t50%ASTM - t30%ASTM

Dt3ASTM = t70%ASTM - t50%ASTM

Dt4ASTM = t90%ASTM - t70%ASTM

Dt5ASTM = t100%ASTM - t90%ASTM (1a-f)

2-. determination of the temperature, ºC, for the 50 % (vol.) TBP point from the 50 % (vol.) point temperature, ºC, of the ASTM distillation, using the equation :

3-. calculation of the temperature differences Dt on the TBP curve corresponding to the same cut points as in step 1 for ASTM curve. Differences DtidTBP on TBP curve are related to the above DtidASTM on the ASTM distillation curve through the empirical relations (3) :

Coefficients Aid and Bid , with different values for each interval (Tab. 1), have been taken from and adapted for temperatures in degrees centigrade (ºC).

4-. once temperature differences between the selected cut points and t50%TBP known, temperatures (ºC) of the TBP curve corresponding to the mentioned points are merely

determined by adding or subtracting from t50%TBP the appropriate temperature differences :

t0%TBP = t50%TBP - (Dt1TBP + Dt2TBP + Dt3TBP)

t10%TBP = t50%TBP - (Dt2TBP + Dt3TBP)

t30%TBP = t50%TBP - Dt3TBP

t70%TBP = t50%TBP + Dt4TBP

t90%TBP = t50%TBP + Dt4TBP + Dt5TBP

t100%TBP = t50%TBP + Dt4TBP + Dt5TBP + Dt6TBP (4 a-f)

The above relations of the API method were derived from experimental data on petroleum fractions with t50%ASTM less than 250ºC, but they may be extrapolated up to t50%ASTM around 315ºC with a good reliability. As indicated in the same reference [1], errors for the predicted TBP temperatures are below 4ºC, excepting initial and 10% temperatures, where they may be higher, up to 12ºC or 5ºC, respectively. The method applies for distillation curves at atmospheric pressure.

The method of API just presented is based on correlation equations found by Daubert [2] and by Zhou [6], by regression of experimental data. The principle of all these recent procedures is originating in data and graphical correlations of Edmister and Okamoto [5], while being improved continuously by considering the newer experimental data. Relations according method of Daubert [2] for the ASTM - TBP curves interconversion are also given in [3a, b], but in a rather confusing and incomplete manner (particularly in [3b]).

Procedure for the prediction of ASTM distillation curve from TBP curve

Carrying out the above steps with some of the operations reversed, the procedure may be applied to predict ASTM D86 distillation curve from a known TBP curve. The method for ASTM D 86 curve prediction is thus comprising the following steps :

1-. finding out temperature differences between consecutive temperatures corresponding to the selected cut points on the TBP curve, similarly to (1a-f),

DtidTBP = tid+1TBP - tidTBP , ºC (5)

where id is used for indexing temperature differences as in (1a-f). Points selected on the TBP curve correspond to same %vol. as in direct procedure, i.e. to 0 %, 10 %, 30 %, 50 %, 70 %, 90%, 100 % (vol. distilled).

2-. from correlation (2), rewritten with t50%ASTM explicitly, and now with t50%TBP known, t50%ASTM , ºC, can be readily computed as :

3-. from relations (3) written as in (7),

temperature differences between the selected cut points on the ASTM curve are then estimated.

4-. finally, the temperatures corresponding to the selected % vol. are established adding or subtracting from t50%ASTM the appropriate temperature differences just computed, similarly with the above (4a-f) in the direct procedure.

Besides their good accuracy for current applications, another advantage of the API procedure for the interconversion is their simplicity. As it can be noticed from their above description, the API methods present no particular computational difficulty.

As otherwise mentioned in [1], both direct and reversed procedure can be easily transposed for calculation on computer . For each of direct and reversed procedures we shall present two versions of their transcription into Mathcad platform, the first one, simpler, in the present paper and the second version in Part II.

Mathcad Implementation Of API Procedures For ASTM - TBP Distillation Curves Interconversion

Simpler Way

One simple way to carry out the calculation for the prediction of TBP curve from ASTM distillation curve according API method described above is shown in Fig. 1a‑b.

Considering the description of the procedure made in the previous paragraph and the self explanatory notations used in Fig. 1a-b, the computations shown in Mathcad worksheet in Fig. 1a-b are straightforward.

Values of coefficients Aid and Bid (Tab. 1) needed for the conversion of temperature differences are „stored” in vectors AAPIC and BAPI, each of them with a single column and Np‑1=6 rows, with Np = 7 being the number of points on the distillation curve required by the procedures.

Range variable „ip” is used in the worksheet in Figures 1a-b for numbering the selected temperatures or %vol. and has the values ip = 0, 1, 2, ..., rows(AAPIC), where rows(AAPIC)=6 (thus Np = 7 values for ip), while range variable „id” is used for indexing the temperature differences and takes Np - 1 = 6 values, id = 0, 1, 2, ..., 5. Function „rows” finds out the number of rows in a matrix (or vector ; a similar function in Mathcad is „length”, but whose argument may be only a vector). Both range variables may be also employed where needed for vector-type variables in the subsequent parts of the worksheet. Even if it can be changed as desired, the origin for indexing vector elements is left set equal to 0, the default value in Mathcad and generally the natural value too. Therefore starting value is 0 for both indexes, ip and id. Once the setting of indexes origin to the selected value made, e.g. to 0 in our case, it applies to all vectors and matrices in the Mathcad worksheet.

Mathcad worksheet with example of ASTM D82 distillation curve conversion to TBP distillation curve (continued in Fig. 1b)

We have chosen to represent distillation curves by a two-column matrix, the first column with % vol. imposed by the procedure, and the second column with corresponding temperatures. The ASTM distillation curve is accordingly given in the Np × 2 (7 rows × 2 columns) matrix with the same name, „ASTM”. In this simpler Mathcad version, definition of the ASTM matrix containing the data of ASTM curve is needed in the beginning of the Mathcad worksheet. ASTM data are taken same as in [1], in order to be able to verify our Mathcad implementation of the API procedure.

Operator <n> (written as superscript) applied to a matrix picks up the (n+1)th column (since their indexing starts with 0) from the given matrix. For example, in Fig. 1a, exponent <0> applied to ASTM matrix, ASTM<0>, generates a vector consisting of all elements of first column in ASTM matrix, that is a vector with the %vol. of the points on the ASTM distillation curve used by the API method. Similarly, ASTM<1> leads to the vector of corresponding temperatures. We recall that in Mathcad a vector is by definition a single column matrix, as expected, that is a column (vertical) array of elements and not a row.

Written as in Fig. 1a (step 1), relation (1) is able to compute in a single line all (Np‑1)=6 temperature differences, namely the temperature difference for every id Î {0, 1, 2, ..., Np - 2}.

(continued from Fig. 1a) Mathcad worksheet with example of ASTM D 82 distillation curve conversion into TBP distillation curve (computed TBP curve : line and circle symbols, lower before approx. 40% vol. and then upper curve)

All the six (Np - 1) values for DtTBP are computed with relations (3) written literally and gathered in the vector DtTBP in relation (3) of Fig. 1b (step 3). Relations (4) are similarly written within a single vector (tTBP, step 4, Fig. 1b), in order to get simultaneously all required Np (seven) temperatures of the TBP curve.

Using range variable id, relations (3) inside vector DtTBP (Fig. 1b, step 3) can also be written in a more concise form, such as :

which is able to calculate within a single line all the temperature differences for the TBP curve.

The use of such a shorter form will be illustrated below, within the other zone of the Mathcad worksheet which presents the API procedure for the opposite conversion, TBP to ASTM (see Fig. 2).

The operator „augment” in the forth and last step of Fig. 1b is joining (side by side) two vectors: the first with %(vol.) as elements, which indeed are same as for the initial ASTM matrix, the second with the previously calculated TBP temperatures. We are thus retrieving the computed TBP curve in the same format as the initial ASTM curve, which is actually the selected format for distillation data representation.

Both initial ASTM curve and computed TBP curve are sketched in lower right part of Fig. 1b (TBP : the lower curve up to about 40% vol., and then the upper curve, trace : line and circle symbol).

It is worth of mention that use of vectors in Mathcad is often advantageous for the subsequent calculations in the worksheet since Mathcad platform offers powerful capabilities in computing, graphics display or data manipulations with vectors. An example of such a tool for computing with vectors is offered by the operator „vectorize” (see below).

Superscript „T” accompanying different vectors (DtASTM in Fig. 1a or DtTBP, TBP in Fig. 1b) means vector transpose and it is used in the shown Mathcad worksheets just for a more convenient display of the vectors elements.

The TBP distillation curve thus determined (in Mathcad worksheet in figures 1a‑b) starting from ASTM data given in [1] is the same as that computed using the same procedure in the mentioned original reference.

Prediction of an ASTM distillation curve from a TBP curve using API procedure is illustrated in Fig. 2.

Instructions „(TBPb<1>)3” in the Mathcad worksheet shown in Fig. 2a picks up the second column of matrix TBPb (as explained above) and then the fourth element of the vector thus obtained, hence it provides explicitly the temperature t50%TBP needed in the procedure.

Relation (7) in Mathcad worksheet area shown in Fig. 2 may be also written using the operator „vectorize” (arrow above expression) :

This „vectorize” operator applies on a suite of operations (or/and functions) with vectors (with same number of elements), its result being a vector with the same length (same number of elements) and whose elements are obtained by applying operations (or/and functions) of the suite consecutively on vectors elements of same index. This calculation, element by element, may also be called in parallel. Thus computation of DtASTMb written as above with vectorize operator, produces same result as calculation in relation (7) (Fig. 2) which was written using the index id. (However, vectorize operator may lead to higher memory demand in case of very large vectors).

Zone of Mathcad worksheet with example of ASTM D82 distillation curve prediction from TBP distillation curve using API procedure

Considering the previous description of the procedure for TBP curve conversion into the ASTM distillation curve and the above example (Fig. 1a-b) with the direct procedure, other computations in Fig. 2 are straightforward.

Mathcad worksheet areas in Fig. 1a-b, as well as the area with the opposite procedure, for TBP‑to‑ASTM conversion, given in Fig. 2, have actually been written in a single Mathcad worksheet (file) and they are presented here separately just for editing reasons. Hence, there was no more necessary to include in the beginning of Fig. 2 the assignments with Aid , Bid parameters values needed in the procedures, i.e. in relations (3) or (7).

As it can be readily noticed, the ASTM curve determined in the worksheet of Fig. 2 using the reverse procedure is identical to the initial ASTM curve (Fig. 1a).

Various possibilities of use of Mathcad versions of API methods will be detailed in the next part. However, for the Mathcad version herein presented we can mention the obvious use, which is turning into profit the live character of the Mathcad worksheet. Thus, once some initial („input”) data are changed, for example in our case temperatures of selected points on the distillation curve, all subsequent calculations in the worksheet will be automatically updated and the corresponding predicted distillation curve would be determined immediately. The procedures written in Mathcad may also be employed by a user by making a Mathcad copy of it and then pasting its content in the Mathcad worksheet with his/hers own Mathcad application. The copy of Mathcad procedure may be also stored „such as”, in a separate worksheet (file), and included in other user's worksheet with the „Reference” command available from the ‚Insert' menu of Mathcad.

In the simpler Mathcad versions of API procedures which are presented in this paper, the matrix with distillation data must be defined in the worksheet before the calculations. This is a drawback of the versions, since use of the procedures by other instructions or functions in the same or another Mathcad worksheet is limited or even impossible. Particularly, iterations over the procedure in the present form are not possible. (However, with minor modifications of the Mathcad procedure, iterations may be carried out within MathConnex environment). The Mathcad versions of API procedure which will be given in the next part of the work are written using functions. They have no more the mentioned drawback and consequently they allow more numerous possibilities for their use.


The API procedures for ASTM D 86 / TBP (True Boiling Point) distillation curves inter-conversion have been transposed to Mathcad computation platform. Thus, a Mathcad worksheet is provided for each of direct, ASTM curve to TBP curve, and opposite, TBP to ASTM, conversion procedures. The format selected for data from distillation curves is a 7 rows by 2 columns matrix, format which is also appropriate for API procedures. Directions for use of the Mathcad worksheets with the procedures are also indicated. Even if simpler, with straightforward calculations, the Mathcad version of the procedures which is presented in this part of the work offer a convenient tool for fast prediction of a distillation curve from the other one. However, the mentioned Mathcad procedures have fewer possibilities of use than Mathcad version written with functions which will be given in the next part.


1. Daubert, Th. E., in Tehnical Data Book, American Petroleum Institute, 6th ed., April 1997, p. 3‑6 (Chapter 3, „Petroleum Fraction Distillation Interconversions”, Procedure 3A1.1).

2. Daubert, Th. E., Hydroc. Processing, sept. 1994, p. 75.

3. Paradowski, H., in Petroleum Refining (Wauquier, J. P., Ed.), Technip - Institut Francais du Petrole, Paris, 1995, vol. 1, a) p. 100 ; b) p. 163.

4. Tunescu, R. C., in Ingineria Prelucrarii Hidrocarburilor, Petrol-Petrochimie, (G. C. Suciu, R. C. Tunescu, Eds.), vol. 1, Ed. Tehnica, Bucuresti, 1983, p. 124.

5. Edmister, W. C., Okamoto, K. K., Petroleum Refiner, 38 (1959)(No. 9), p. 271 (also in : Edmister, W. C., Okamoto, K. K., Applied Hydrocarbon Thermodynamics, Gulf, Houston, 1961).

6. Zhou, P., Int. Chem. Eng., 24 (1984)(No. 4), p. 731-741.

7. Arnold, V. E., P., Oil & Gas Journal, 83 (1985)(No. 6), p. 55-62.

O transpunere in Mathcad uşor de utilizat a procedurilor API de interconversie a curbelor de distilare ale fracţiunilor petroliere.

Partea 1. Interconversia curbelor ASTM (STAS) - PRF (puncte reale de fierbere)


Procedurile recomandate de către API (American Petroleum Institute) pentru interconversia curbelor de distilare ASTM D 86 şi PRF (Puncte Reale de Fierbere) au fost transpuse în platforma de calcul Mathcad. Sunt prezentate două versiuni Mathcad atât pentru procedura directă de conversie, de la curba ASTM la cea PRF, cât şi pentru procedura inversă, de la curba PRF la curba ASTM. Prima versiune, mai simplă, este scrisă cu calcule aplicate direct datelor curbei inţiale de distilare, iar în a doua versiune relaţiile sunt scrise în foaia de calcul Mathcad sub forma unei suite de funcţii, astfel încât în final aceasta să poată fi apelată precum o funcţie de o singură variabilă. Foile de calcul Mathcad cu procedurile API oferă un instrument convenabil pentru predicţia uneia din curbele de distilare pe baza celeilalte. Pe lângă o scurtă descriere a procedurilor API, această primă parte a lucrării prezintă versiunea mai simplă a implementării acestora in platforma Mathcad, în timp ce versiunea cu funcţii va fi descrisă în Partea a 2-a.