Google Answers Logo
View Question
Q: Temperature compensation sample code for PLC blending application ( No Answer,   1 Comment )
Subject: Temperature compensation sample code for PLC blending application
Category: Computers > Algorithms
Asked by: welday007-ga
List Price: $50.00
Posted: 16 May 2003 09:46 PDT
Expires: 15 Jun 2003 09:46 PDT
Question ID: 204657
Is there any sample PLC code or code for sale that allows temperature
compensation through RTD 4-20mA analog inputs and uses table API 6b? 
The application is a four-loop PID blender that mixes four ingredients
that change in volume depending on temperature.  The temperature
compensation would multiply the gross recipe volume by a factor in the
table to give the net volume required at that temperature.  Allen
Bradley RSLogix 500 for MicroLogix 1500 code is preferred, but any
similar ladder logic will be acceptable.

Clarification of Question by welday007-ga on 16 May 2003 18:21 PDT
The following is from literature about a similar blend controller:

Automatic Temperature Compensation
The e-BLEND Controller includes automatic temperature compensation as
a standard feature to allow blending on a net volume basis. With this
feature the e-BLEND will accept temperature inputs from each blend
component loop and automatically convert the measured gross volume to
an equivalent net volume at a reference temperature, 600F or 150C.
This computation is based on the latest API tables or by linear slope.
Computation formulas for the API Standard 2540, Tables 6A, 6B and 6D
and temperature slope algorithm are included in the standard e-BLEND
software and selectable by a simple data entry item.

My controller is only concerned with the 6B and temperature slope

Another source describes the problem as this:

All such volumes will be corrected to standard conditions (60F and
equilibrium vapor pressure) by the application of correction factors
listed in “Petroleum Measurement Tables” API Standard 2540, latest
revision (Table 6A for JP-4; Table 6B for all other Petroleum

One more source describes the table as:

Table 6B - Generalized Products, Correction of Volume to 60 Degrees F
Against API Gravity at 60 Degrees F

The table is quite lengthy and I believe there is a formula that may
not be exact but that is used in electronic controllers for obtaining
the values in the table.  This formula is what I really need.  I can
probably figure the ladder logic out myself.

Request for Question Clarification by mathtalk-ga on 18 May 2003 07:39 PDT
Hi, welday007-ga:

Are these gases that are being blended?

regards, mathtalk-ga

Clarification of Question by welday007-ga on 19 May 2003 06:23 PDT
The four ingredients are liquid petroleum products used in concrete and blacktop.

Request for Question Clarification by mathtalk-ga on 25 May 2003 08:05 PDT
If the temperature-based volume correction is to be applied over a
moderately narrow range of temperatures, then the "slope"
approximation would be adequate.

Although your quoted text references temperatures 60F and 600F, I
assume from the intended application that a somewhat narrower range of
temperatures can be specified.  If you will give me a range to work
with and the corresponding list of volume correction factors, I could
determine a formula which fits the data well.  However the American
Petroleum Institute seems to have prepared both the Table 6B data and
a collection of formulas to fit this data, which they are willing to

If you wanted to develop a data set and formula approximation that is
independent of the API licensing agreement, you could identify a
particular petroleum liquid (e.g. fuel oil?) to which Table 6B
applies, and we could then work from non-proprietary data in the
scientific literature.

In between "reinventing the wheel" and finding a code vendor for this
specific application that works with your specific PLC, there are 1)
other pet-liquid flow control device vendors who have presumably
addressed the same problem (but who are likely perceived as
competitors), and 2) some sources for non-PLC code for volume
correction factors.  I've posted a comment below about one of these.

regards, mathtalk-ga
There is no answer at this time.

Subject: Re: Temperature compensation sample code for PLC blending application
From: mathtalk-ga on 25 May 2003 08:32 PDT
Hi, welday007-ga:

This company claims to be the primary distributor of documentation
from the American Petroleum Institute:

but their Web site did not provide pricing information on the API 6B
data or formulas (although such products are listed there).

This company seems to have developed some C code to compute the volume
correction factors:

They reference Volume 10 of this set:

The entire set is a little expensive ($655) but the individual volumes
seem to be priced at $66 each.

"For accuracy and convenience, 2 or 3 separate tables replace each
previous table. For example, Table 6 has been superseded by 6A.
Generalized Crude Oils; 6B,Generalized Products; and 6C, Volume
Correction Factors for Individual and Special Applications.

"Volume X contains computer subroutine listings, example problems,and
instructions necessary to use the computer subroutines. Use of this
volume with a computer subroutine is a major conceptual departure from
previous versions of the tables and recognizes the increasing use of
computers to calculate volume correction in the petroleum industry.
The actual standard is neither the printed tables nor the set of
equations used to represent the density data, but is an explicit
implementation procedure used to develop computer subroutines. Strict
adherence to the procedures will ensure that all computers and
computer codes of the future will produce identical results."

regards, mathtalk-ga

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  

Google Home - Answers FAQ - Terms of Service - Privacy Policy