Download as pdf or txt
Download as pdf or txt
You are on page 1of 125

AGA3+AGA8 (AGA38) Gas

Flow Calculations

ACE3600 System Tools


Suite0 (STS)
AB

6802987C05-A

MOTOROLA and the Stylized M Logo are registered in the U.S.


Patent and Trademark Office. All other product or service names
are the property of their respective owners.

Copyright © Motorola 2009 All Rights Reserved


COMPUTER SOFTWARE COPYRIGHTS

The Motorola products described in this instruction manual may include copyrighted Motorola computer programs stored in
semiconductor memories or other media. Laws in the United States and other countries preserve for Motorola certain
exclusive rights for copyrighted computer programs including the exclusive right to copy or reproduce in any form the
copyrighted computer program. Accordingly, any copyrighted Motorola computer programs contained in the Motorola
products described in this manual may not be copied or reproduced in any manner without the express written permission of
Motorola. Furthermore, the purchase of Motorola products shall not be deemed to grant either directly or by implication,
estoppel, or otherwise, any license under the copyrights, patents or patent applications of Motorola, except for the normal
non-exclusive, royalty free license to use that arises by operation of law in the sale of a product.

Motorola, Inc.
1301 E. Algonquin Road,
Schaumburg, IL 60196 U.S.A.
Contents

CONTENTS........................................................................................................................................................... I
SPECIFICATIONS ................................................................................................................................................ III
GENERAL ...........................................................................................................................................................1
SOFTWARE INSTALLATION .................................................................................................................................2
Before You Start Using the AGA38 Module .................................................................................................2
AGA38 Power Fail Safe Environment ..........................................................................................................3
Memory Allocation for AGA38 .....................................................................................................................4
SRAM (Static RAM) Memory Plug-in Requirements ....................................................................................5
Error Logger Messages ................................................................................................................................7
I/O Link.........................................................................................................................................................8
I/O Link for Live Inputs .............................................................................................................................................8
Module Failure I/O Link ............................................................................................................................................9
Live Input Failures ...................................................................................................................................................11
THE AGA38 APPLICATION ..............................................................................................................................13
The AGA38 Tables......................................................................................................................................13
Table Descriptions ...................................................................................................................................................16
How to Customize the Database ..............................................................................................................................85
The Ladder Application ..............................................................................................................................86
The Main Process Rungs..........................................................................................................................................86
The Rung List for AGA8P Process ..........................................................................................................................90
How to Customize the AGA38 Application.............................................................................................................90
AGA 8 Calculations .................................................................................................................................................91
STACKED DIFFERENTIAL PRESSURE TRANSDUCERS .........................................................................................92
AGA SOFTWARE FAILURE ...............................................................................................................................94
General .......................................................................................................................................................94
Flowing Density..........................................................................................................................................94
Gross Volumetric Heating Value................................................................................................................94
AGA3 ..........................................................................................................................................................95
METER RUN STATUS ........................................................................................................................................96
CHANGING THE RUNNING PARAMETERS ON LINE ............................................................................................98
UPDATING THE CONFIGURATION LOGGER .......................................................................................................99
Changing Parameters for a Specific Meter Run.......................................................................................100
ORIFICE PLATE REPLACEMENT ......................................................................................................................101
CALIBRATION.................................................................................................................................................103
Hourly Transaction Records.....................................................................................................................104
DAILY TRANSACTION RECORDS.....................................................................................................................106
EVENT LOGGER..............................................................................................................................................107
HISTORICAL DATA .........................................................................................................................................108
Historical Data Retrieval..........................................................................................................................108
Hourly and Daily Transaction Record Description ................................................................................................109
CONFIGURATION LOGGER PARAMETER LIST..................................................................................................110
EVENT EXCEPTIONS .......................................................................................................................................113
ERROR EXCEPTIONS .......................................................................................................................................113
WARNING EXCEPTIONS ..................................................................................................................................114
AGA HISTORY UPLOAD TOOL .......................................................................................................................115

i
Contents

UPGRADING THE MOSCAD AGA APPLICATION TO ACE3600 .....................................................................116


MERGING A USER-DEVELOPED ‘C’ APPLICATION WITH AGA38 ...................................................................118

ii
Specifications

Specifications

FEATURE ACE3600 RTU

American Gas Association As per equations 1-2, 1-3, 1-4, - part 1 , page 10 of AGA 3
Report No. 3 (AGA 3, 1992) publication

American Gas Association Uses the Detail Characterization Method Equation of State.
Report No. 8 (AGA 8, 1992)

API Chapter 21 The AGA 3 1992 and the AGA 8 1992 ACE3600
implementation conforms to Chapter 21 of the Manual of
Petroleum Measurement Standards, “Flow Measurements
Using Electronic Metering Systems”, Section 1 – Electronic
Gas Measurement.

Approvals Alberta ERCB


BC Energy, Mines and Resources

Calculation Precision Calculations are made using double precision floating point.

Multi-Run Support This feature is configurable:


One to twenty four meters runs.

Scan Time per one meter run ~ <30 msec.

Parameter Types Four types of parameters are included in the set up tables:
C - Global (configuration) parameters table for all meter
runs
I - Input parameters for AGA3 and AGA8 calculations
D - Tables for Display only
O - Calculated (Output) results

Liquid Flow Calculations AGA - 3 1992 supports single phase homogeneous liquid
flow calculations.

Contract Time The contract time is defined separately for each run.

Freeze Capability for Live Based on


Input Values (a) default value, or
(b) the last valid measurement, or
(c) the most recent average value

Live Input Values with Freeze Pressure meter, differential pressure meter, temperature
Capability meter and the optional densitometer

Input Module Failure Input Module Failure Detection is supported for all input
Detection modules.

iii
Specifications

FEATURE ACE3600 RTU

Engineering Units Supported Eight types of units are supported: US1, US2, US3, IP,
METRIC1, METRIC2, METRIC3, SI

Averaging Techniques · Flow-dependent time weighted linear average


· Flow-dependent time weighted formulaic average
· Flow-weighted linear average
· Flow-weighted formulaic average

BTU Units Supported · BTU IT (1055.056 joules)


· BTU 58.5/59.5 (1054.804 joules)
· BTU 60 (1054.678 joules)
· BTU 60/61 (1054.615 joules)
· BTU UK (1054.760 joules)

Passwords · System administrator password


· Operator password
· Maintenance mode password
· View mode password

Orifice Plate Materials and Stainless Steel, Monel, Carbon Steel, Other.
Tube Materials Supported
If Other, the Plate/Tube thermal expansion coefficient must
be specified.

Stacked Differential Pressure Two supported.


Transmitters

Static Pressure Tap Location Selectable; Upstream or Downstream.

Error Handling and Validation 29 Errors, including:


Checking Flowing temperature too low/ too high
Flowing pressure too low/ too high
Base temperature too low/ high
Base pressure too low/ high
Gas composition error

Pressure Meter, Differential Run, failed, manually frozen.


Pressure and Temperature
Meter Modes of Operation

Static Pressure , Differential Default pressure/temperature,


Pressure and Temperature Last valid flowing pressure/temperature,
Freeze Options Last calculated average pressure/temperature

Gas Chromatograph Interface A table for the input of the gas composition, volumetric
gross heating value and specific gravity from the
Chromatograph to ACE3600 database tables is supported.

iv
Specifications

FEATURE ACE3600 RTU

Calibration / Maintenance Mode

MDLC Protocol MDLC supports the direct transfer of 32-bit floating point
values from the gas field RTUs to the TCP/IP Gateway.

TCP/IP Gateway The TCP/IP Gateway provides the direct transfer of 32 bit
floating point values from the gas field RTUs to the SCADA
host software.

The TCP/IP Gateway to SCADA host connection is a high


speed 10/100 Mbit Ethernet link which allows the seamless
transfer of floating point values.

Specifications are subject to change without notice.

v
General

The ACE3600 RTU supports two well-known standards for natural gas orifice metering:

1. American Gas Association Report No. 3 (AGA3, 1992)

The main purpose of AGA3 (1992) is to calculate the mass flow rate and the volumetric
flow rate at flowing and base (contract) conditions.

This standard has been implemented according to the "Orifice Metering Of Natural Gas
And Other Related Hydrocarbon Fluids" publication, third edition, part 1-4, issued from
October 1990 through November 1992.

The equations that have been implemented are: 1-2, 1-3 and 1-4, on the AGA3 publication.

In addition to the American Gas Association, this standard has been adopted and
recommended by the following institutes:

- ANSI: American National Standards ANSI/API 2530-92

- API: American Petroleum Institute API 14.3

- GPA: Gas Processors Association GPA 8185-90

2. American Gas Association Report No. 8 (AGA8, 1992)

The main purpose of AGA8 (1992) is to calculate the density at flowing and base
conditions, compressibility at flowing and base conditions, specific gravity, super
compressibility and the volumetric gross heating value. The densities calculated by AGA8
(1992) are being used by AGA3 (1992) in order to calculate the mass and volumetric flow
rates. This is the only link between AGA3 (1992) and AGA8 (1992). The heating value is
being used to calculate the energy or energy rate of the flowing gas.

This standard has been implemented according to the "Compressibility Factors of Natural
Gas and Other Related Hydrocarbon Gases" publication, Second Edition, November, 1992.

The DETAIL CHARACTERIZATION METHOD Equation of State, which provides high


accuracy, broad temperature-pressure-composition application range and derived thermo-
dynamic property capabilities, is used.

This standard has been adopted and recommended by the following institutes:

- AGA: Transmission Measurement Committee Report No. 8

- API: American Petroleum Institute MPMS Chapter 14.2

The AGA3 (1992) and the AGA8 (1992) ACE36000 implementation conforms to the
"Manual of Petroleum Measurement Standards, Chapter 21 -Flow Measurements Using
Electronic Metering Systems, Section 1 -Electronic Gas Measurement", issued by the
American Petroleum Institute. This standard is also referenced as the API-21 standard.

The AGA module is optional to the ACE3600 system and is supplied as a separate module.

1
Software Installation

Software Installation

Install the AGA38 software, after installing the ACE3600 System Tools Suite (STS).

Insert the CD into the CDROM drive and run the setup utility from the CD.

The AGA38 project template is installed in the


[C|D]:\STS<xxxx>\Demo\AGA38\aga38_ace3600_v<version> directory.

The AGA38 drivers are installed in


[C|D]:\STS<xxxx>\Drivers\AGA38\v<version>\aga38_c_drv.plz and
[C|D]:\STS<xxxx>\Drivers\AGA38\v<version>\aga38.adb.

The AGA38 documentation files are installed in the [C|D]:\STS<xxxx>\Doc directory.

Before You Start Using the AGA38 Module


In order to use the AGA38 module (after the STS and AGA38 have been installed), you
must modify the ACE3600 site configuration in the following manner:

Step 1. Define inputs in the STS site configuration (e.g. in an 8 AI module) for the
following live inputs per each meter run:

- Temperature meter

- Pressure meter

- One or two differential meters

- Optional densitometer

An example of defining the live inputs for an 8 Analog Input module is


detailed in I/O Link for Live Inputs below.

Step 2. Specify the RAM size to be allocated to the AGA38 software in the site
configuration. To get to the “RAM size” parameter, use the following route
within the ACE3600 STS site view:

Advanced tab → ‘C’ Application → RAM size for dynamic allocation

IMPORTANT:
Before indicating the allocated memory size, carefully read the Memory
Allocation section, which includes specific directions on how to economically
utilize the memory.

Step 3. Set the AGA38 table parameters in the STS Application Programmer.

2
Software Installation

IMPORTANT:
The following four parameters must be specified in table #1:

- Nruns - Number of meter runs.

- HistrH - Number of history hourly transaction records.

- HistrD - Number of history daily transaction records.

- HistrE - Number of history event/exception records.

Before setting the above parameters, carefully read the Table #1, AGA Config
section of this document, which includes specific directions on how to set them.

Step 4. Perform I/O link for all of the live inputs mentioned above.

Step 5. Compile the AGA38 application.

Step 6. Download the AGA38 configuration.

Step 7. Download the AGA38 ladder application and set the site Time & Date.

Step 8. Download the aga38_c_drv.PLZ file using the STS Downloader utility.

Step 9. If you intend to upload the historical database created by the AGA history
logger, install the AGA History Upload Tool. For details, see the AGA
History Upload Tool User Guide.

The AGA History Upload Tool is a standalone product which can be


installed at any time.

AGA38 Power Fail Safe Environment


The ACE3600 AGA38 application can protect its historical database against data loss due
to power failure. To do so, the AGA38 backs up and automatically restores its database on
the non-volatile SRAM plug-in (on the CPU module which is equipped with backup
battery.) It is optional, but highly recommended, to activate the AGA38 backup facility.

To activate the AGA38’s database backup facility:

 The SRAM card must be installed on the CPU module. See the SRAM (Static
RAM) Memory Plug-in Requirements section for more information.

 The ‘SramBack’ variable in the AGA config table must be non-zero.

If the backup facility is not required, the AGA38 can be activated with no backup. In this
case, after power fail the system will reboot with an empty database. The AGA38
database backup facility will be inactive if one of the following conditions exists:

 AGA config flag (AGA config table #1, SramBack) is 0.

3
Software Installation

 There is no SRAM card installed on the CPU module.

Memory Allocation for AGA38


The memory size, measured in bytes, required by the AGA38 software is defined by the
following formula:

AGA38 memory requirement size = {25000 + {Nruns [Ts(Nh + Nd) + 28Ne + 23000]} } *Bf

where:

Nruns - Number of meter runs (defined by Nruns in table #1)

Ts - Length of one hourly or daily transaction record. If no average gas


composition is being saved (defined by SvCmps in table #1), the memory size
of one hourly or daily transaction record is 60 bytes. If the average gas
composition is being saved (defined by SvCmps in table #1), the memory size
of one hourly or daily transaction record is 144 bytes.

Nh - Number of hourly transaction records per meter run (defined by HistrH in


table #1)

Nd - Number of daily transaction records per meter run (defined by HistrD in


table #1)

Ne - Number of event records per meter run (defined by HistrE in table #1).

Bf - Backup facility factor. This factor is equal to 2 when the database backup
facility is active; otherwise it is equal to 1.

The total memory size required for the AGA38 is allocated out of the amount of default
memory reserved for dynamic allocation at runtime for all ‘C’ applications. This amount
appears as the RAM size for dynamic allocation in the STS Site Configuration. The “RAM
size” parameter can be accessed using:

Advanced tab → ‘C’ Application → RAM size for dynamic allocation

IMPORTANT:

When setting the Nruns, HistrH, HistrD and HistrE parameters, bear in mind that
the total AGA38 memory amount must be smaller than the amount of memory
reserved for dynamic allocation at runtime (RAM size for dynamic allocation).
Therefore, the parameters must be set so as to fulfill the memory allocation
requirement.

If the database backup facility is also enabled, see the SRAM (Static RAM)
Memory Plug-in Requirements section below for more information.

4
Software Installation

RECOMMENDATION:

Increase the default ‘RAM size for dynamic allocation” by the value calculated
for AGA38 memory allocation formula.

EXAMPLE 1:
According to the memory allocation formula above, ~2260 Kbytes of memory is
required by AGA38 to support:

- 6 meter runs

- 100 daily transaction records per each meter run

- 1000 hourly transaction records per each meter run

- 100 event records per each meter run

- Hourly/daily transaction records include gas composition

- Use backup (backup flag=1, 4Mb SRAM installed)

The “Ram size for dynamic allocation” default (256K) is increased by 2260 and
set to 2516 Kbytes:
‘C’ Application -> RAM size for dynamic allocation <256-16384> Kbytes = 2516

EXAMPLE 2:
According to the memory allocation formula above, ~418 Kbytes of memory is
required by AGA38 to support:

- 1 meter run

- 100 daily transaction records per each meter run

- 1000 hourly transaction records per each meter run

- 100 event records per each meter run

- Hourly/daily transaction records include gas composition

- Use backup (backup flag=1, 4Mb SRAM installed)

The “Ram size for dynamic allocation” default (256K) is increased by 418 and set
to 674 Kbytes:
‘C’ Application -> RAM size for dynamic allocation <256-16384> Kbytes = 674

SRAM (Static RAM) Memory Plug-in Requirements


When the AGA38 database backup facility is activated (an SRAM card is installed on the
CPU module, and the SramBack parameter in the AGA config table is not 0), the database
is backed up to the SRAM.

The amount of static memory required by the backup facility is also equal to "AGA38
memory requirement size". (Note: When the backup facility is enabled, Bf=2.)

5
Software Installation

IMPORTANT:

When setting the Nruns, HistrH, HistrD and HistrE parameters, bear in mind that
the size of the Static Memory RAM (SRAM) plug-in should be greater than or
equal to the "AGA38 memory requirement size" (described above.)

For example, if using a 4 Mbyte SRAM Plug-in (optionV447AB), keep in mind


that "AGA38 memory requirement size" (which depends on Nruns, HistrH, HistrD
and HistrE) should be less than 4 Mbytes. Therefore, the Nruns, HistrH, HistrD
and HistrE parameters must be set so as to fulfill this requirement.

6
Software Installation

Error Logger Messages


The ACE3600 RTU firmware and the AGA38 application log error/warning messages to
the Error Logger. This is in addition to the events posted to the AGA historical database
event logger. The AGA38 application issues errors on conditions related to the AGA38
application. For example:

 Pressure too high/low

 Temperature too high/low

The default AGA38 application provided to the customer issues the following error
message for demonstration purposes:

User Application Error: AGA38: Warning: Bore Too Small < 0.45 inches, 0.0375 feet,
11.4 mm, 0.0114 m!
This error/warning message warns the user that the bore diameter is too small. To
eliminate the error/warning message, change the bore diameter (table #2, index #0, column
'Plat_d') in the application to a value greater than 0.45 inches.

Another error may appear in multiple meter run configuration:

29/09/09 15:10 ERROR #: 161 Severity: Warning


# of time units passed without activating timer service is 6 device: 100_MS.
To avoid the above error from appearing, change the following in the STS site
configuration:

Advanced tab -> Timer Service -> Number of '100 msec' ticks passed before declaring
error <3-10> [4]: as follows:

Up to six meter runs – change to 12

Each additional meter run (above 6), increase by 2.

This change is recommended but not critical. In case the above change is not implemented,
an error is issued to the Error Logger (when AGA38 restores its database).

7
Software Installation

I/O Link

I/O Link for Live Inputs


Following is an example of defining the live inputs for an 8 Analog Input module:

Within the AGA application, the live inputs and their logical names must be logically
connected, or in other words, you must perform the I/O link. The live inputs are:

 T_Flow - specifies the temperature meter input

 P_Flow - specifies the pressure meter input.

 dP1 - specifies the differential pressure meter input

 dP2 - specifies the optional differential pressure meter input 2

 DnFlow - specifies an optional densitometer

Refer to the Scaled Analog Input data type for more information on how to define the
scaling between the analog inputs and the engineering units.

Refer to the ACE3600 STS User Guide for more information on how to perform I/O Link
for the module.

EXAMPLE:
For the first meter run (Ind=0) the pressure (P_Flow,0) is linked to Rack 0,
Module 3, AN_IN_1 analog input.

8
Software Installation

Module Failure I/O Link


Each Analog Input module contains an internal digital input bit, MOD_FAIL. If
MOD_FAIL=1, the module has failed.

The MOD_FAIL bit can be referred to as an additional digital input of the module, similar
to AN_IN_1, AN_IN_2 and so on. In order to link the MOD_FAIL bit to a logical name,
the following digital input columns were defined:

 P_Fail

 T_Fail

 dP1Fal

 dP2Fal

 DnFail

P_Fail,i specifies the MOD_FAIL bit value of the module to which the pressure
transmitter of the (i+1) meter run is connected.

9
Software Installation

T_Fail,i specifies the MOD_FAIL bit value of the module to which the temperature
transmitter of the (i+1) meter run is connected.

dP1Fal,i specifies the MOD_FAIL bit value of the module to which the first differential
pressure transmitter of the (i+1) meter run is connected.

dP2Fal,i specifies the MOD_FAIL bit value of the module to which the second differential
pressure transmitter of the (i+1) meter run is connected.

DnFail,i specifies the MOD_FAIL bit value of the module to which the optional
densitometer transmitter of the (i+1) meter run is connected.

It is strongly recommended to link each of the columns described above to its


corresponding MOD_FAIL bit.

EXAMPLE:
For the first meter run (Ind=0) the pressure (P_Flow,0) is linked to Rack 0,
Module 3, AN_IN_1 analog input. Therefore (P_Fail,0) is connected to
MOD_FAIL digital input of Rack 0, Module 3.

After scanning the P_Fail column, if P_Fail,0 is ON, the module which includes the
pressure analog input for the first meter run fails. Therefore, the method used by the AGA
software to detect pressure metering for the first run is no longer correct.

10
Software Installation

Live Input Failures


The live input reading is not correct if one of the following events occur:

1. The module to which the transmitter is connected fails, i.e. when (P_Fail,i) is ON,
the module to which the pressure transmitter of the (I+1) meter run is connected fails. The
same holds for the following list of <d-i> module fail columns:

P_Fail (pressure modules)

T_Fail (temperature modules)

dP1Fal (first source of differential pressure modules)

dP2Fal (second source of differential pressure modules)

DnFail (densitometer modules)

2. The scanned live value is out of the valid engineering unit range.

Each live input minimum and maximum value is checked to verify that it is not zero. If
they pass, then the live input value is checked to be greater than the minimum and smaller
than the maximum value. For example, the pressure is checked in the following manner:
if (P_Min,i) <> 0 or (P_Max,i) <> 0
begin
if P_Min,i > (P_Flow,i) or P_Max,i < (P_Flow,i)
begin
Pressure input for meter run #(i+1) is out of range
else
Pressure input for meter run #(i+1) is in range
end
else
No pressure range checks are performed for meter
run #(i+1)
end

If a live input reading is not correct, the AGA software proceeds with the calculation
according to the chosen freeze option.

The live inputs and their freeze option identifiers are:

Freeze option identifier Default Last valid Last average

Pressure PfrzOp 0 1 2

Temperature TfrzOp 0 1 2

Differential pressure DPFrzO 0 1 2

Densitometer DnFrzO 0 1 2

The live inputs and their status identifiers are:

Live input status Running and OK Reading Manually


identifier failure frozen

Pressure P_Mode 0 1 2

11
Software Installation

Live input status Running and OK Reading Manually


identifier failure frozen

Temperature T_Mode 0 1 2

Differential pressure DPMode 0 1 2

Densitometer DnMode 0 1 2

12
The AGA38 Application

The AGA38 Application

The AGA38 implementation includes parameter definitions and the ladder application. The
parameter definition is performed using the AGA38 application tables. Using the ladder
diagram language you activate several functions which were downloaded and programmed
into the flash memory.

The AGA38 Tables


The AGA38 tables are listed below:

NOTE:
Do not delete any of the AGA38 tables or their columns. The tables must remain
in consecutive order.

You may insert new tables before Table #1 or after Table #53.

Table # Table Name Table Type

0 Qualifiers

1 AGA Config (C)

2 Contract Time (I)

3 AGA statics 1 (I)

4 AGA statics 2 (I)

5 Pressure meter 1 (I)

6 Pressure meter 2 (I)

7 Temperature meter (I)

8 Diff. P. meter 1 (I)

9 Diff. P. meter 2 (I)

10 Flow. Density (I)

11 Base density (I)

12 Heating Value (I)

13 Gas Components 1 (I)

14 Gas Components 2 (I)

15 Gas Components 3 (I)

16 Chromotograph (I)

17 Parms for Calc (D)

18 AGA 8 92 output (O)

13
The AGA38 Application

Table # Table Name Table Type

19 Flow Control (I)

20 Config Change (I)

21 Current Flow Rate (O)

22 Meter Run Status (O)

23 Last Hour Qty (O)

24 Current Hour Qty (O)

25 Current Day Qty (O)

26 Last Day Qty (O)

27 Day Before Qty (O)

28 Pressure Avrg (O)

29 Diff. Pres. Avrg (O)

30 Temperature Avrg (O)

31 Flow Density Avrg (O)

32 Current Hour Avrg (O)

33 Current Day Avrg (O)

34 Last Valid Val 1 (O)

35 Last Valid Val 2 (O)

36 Last Averages (O)

37 MinMax Before Yest (O)

38 Last Day Min Max (O)

39 Current Day MinMax (O)

40 Last Hour MinMax (O)

41 Current Hour MinMax (O)

42 Flow Rate Maxima (O)

43 Flow Rate Minima (O)

44 History info (I)

45 RecordsIndexFind (I)

46 Time Range Qty (O)

47 History Fetch (I)

48 Hourly Daily Rec (O)

49 Event Record (O)

50 Version Revision (D)

14
The AGA38 Application

Table # Table Name Table Type

51 Second Counters (O)

52 Accumulators (O)

53 Accumulators 2 (I)
Update

The Table Type column lists the following abbreviations:

(C) - Configuration parameters table for all meter runs.


Table #1, ‘AGA config’ is the only configuration table. The parameters in this
table are global and valid for all meter runs. They must be set before
downloading; no changes are allowed at runtime.

(I) - Input parameters tables for AGA3 and AGA8 calculations.


The parameters in these tables may be set prior to downloading and may be
modified at any time.

(D) - Display parameters table.


Table #17 ‘Parms for Calc’ and table #50 ‘Version Revision’ are display or
read-only tables. No changes are allowed.

(O) - Output results tables.


These tables include the calculation results such as flow rates, averages,
minimum and maximum values, etc. No changes are allowed.

Table #1, ‘AGA config’ is a global AGA configuration table. The parameters in this table
are valid for all meter runs and the table refers to their number (Nruns).

Tables #2 to #44 and Tables #52 and #53 include the meter specific parameters. The
number of rows in each of these tables should be equal to or larger than the number of
meter runs (Nruns). Each row corresponds to a specific meter run.

Tables #45 to #49 are retrieve tables. Hourly, daily and event records can be retrieved
from the database by specifying record parameters such as the meter run number.

Table #50, ‘Version Revision’ includes the version and revision of the AGA software.

Table #51 ‘Second counters’ comprises the counters used by the ladder application.

Table #52 ‘Accumulators 1-2’ includes the non-resettable and resettable accumulators for
Uncorrected Volume, Corrected Volume, Mass and Energy per each meter run.

Table #53 ‘Accumulators 2 Update’ is used to update the resettable accumulators for
Uncorrected Volume, Corrected Volume, Mass and Energy per each meter run.

15
The AGA38 Application

Table Descriptions

Table #0, Qualifiers


This table is not in use by the Motorola AGA application. The user may use this table to
define special qualifiers which relate to user add-on files. For more on the Qualifiers table,
see Appendix C: Database Tables and Data Types of the ACE3600 STS User Guide.

Table #1, AGA Config


The parameters in this table are global parameters for all meter runs. The AGA config
table includes the following parameters:

For further details on the parameters listed below, refer to the Manual of Petroleum
Measurement Standards, Chapter 21, ‘Flow Measurement Using Electronic Metering
Systems’, Appendix B and sections 1.4.2.4, 1.4.2.5, 1.4.2.6.

 Nruns - the number of meter runs. The default is six runs.

16
The AGA38 Application

 Units - US or Metric types of units. The eight types of supported units are: US1=0,
US2=1, US3=2, IP=3, METRIC1=4, METRIC2=5, METRIC3=6, SI=7). The
default is 1 (US2 units).

US1 US2 US3 IP


P Pressure psi psi psi psf

T Temperature °F °F °F °F

dP Differential psi inches of H20 inches of H20 psf


Pressure @60 °F @68 °F

Density lbm lbm lbm lbm


3 3 3 3
ft ft ft ft

Viscosity cp cp cp lbm
ft·sec

Coefficient of in in in in
, ft
Thermal Expansion     
in· F in· F in· F in· F ft· F

d, D inches inches inches ft

Elevation ft ft ft ft

Volume 3 3 3 3
ft ft ft ft

Mass lbm lbm lbm lbm

Volumetric Flow Rate 3 3 3 3 3 3 3


ft ft ft ft ft ft ft
, , , ,
1hour 24hours 1hour 1hour 24hours 1hour 24hours
3
ft
24hours

Mass Flow Rate lbm


,
lbm lbm
,
lbm
,
lbm lbm
,
lbm
1hour 24hours 1hour 1hour 24hours 1hour 24hours
lbm
24hours

Heating Value BTU BTU BTU BTU


3 3 3 3
ft ft ft ft

Energy BTU BTU BTU BTU

Metric1 Metric2 Metric3 SI


P Pressure MPa bar Mpa Pa

T Temp. °C °C °C °K

dP Differential kPa millibar millibar Pa


Pressure

Density kg kg kg kg
m3 m3 m3 m3

17
The AGA38 Application

Viscosity cp cp cp kg
m  sec
Coefficient of mm mm mm/mm*d.C m/m*
Thermal Expansion mm·C mm·C d.Kmm/mm*d.C

d, D mm mm mm m

Elevation m m m m

Volume m**3 m**3 m**3 m**3

Mass kg kg kg kg

Volumetric Flow Rate m**3 /1 * hr, m**3 /1 * hr, m**3 /1 * m**3 /1 * hr, m
m**3/ 24 * hr m**3/24 * hr hr,m**3/24 * hr **3/24 * hr

Mass Flow Rate kg/1*hr kg/1*hr kg/1*hr kg/1*hr


kg/24*hr kg/24*hr kg/24*hr kg/24*hr

Heating Value Mj/ m**3 Mj/ m**3 Mj/ m**3 Mj/ m**3

Energy Mj Mj Mj Mj

 IMP - (Integral multiplier period) a period for which most of the coefficients of the
mass flow rate are considered as constant.

The IMP is measured in seconds and conforming to API-21 it should be defined as


an integer number that divides 3600. The default is 120 seconds.

NOTE:
It is recommended that the IMP parameter be greater than the AGA8TP parameter.

For more information about IMP, refer to API-21.

 Avgtch - the averaging technique. The available values are:

0 - flow dependent time weighted linear average

1 - flow dependent time weighted formulaic average

2 - flow weighted linear average

3 - flow weighted formulaic average (default)

For more information about Avgtch, refer to API-21.

 BTU - defines one BTU of energy. It is used when one of the units US1, US2, US3
or IP is selected. When one of the metric units, METRIC1, METRIC2, METRIC3
or IP is selected, the energy unit is one megajoule (106 joules). The available
values are:

0 - BTU IT = 1055.056 joules (default)

1 - BTU 58.5/59.5 = 1054.804 joules

2 - BTU 60 = 1054.678 joules

18
The AGA38 Application

3 - BTU 60/61 = 1054.615 joules

4 - BTU UK = 1054.76 joules

 HistrD - the number of daily history records per one run. The default is 100
records.

 HistrH - the number of history records, per hour, per one run. The default is 1000
records.

 HistrE - the number of Event Logger records per one run. The default is 100
records.

 TimeD - the period of time, measured in days, for a daily transaction record to be
saved in a historical file. The default is 35 days.

 TimeH - the period of time, measured in days, for a transaction record per hour, to
be saved in an historical file. The default is 35 days.

 TimeE - the period of time, measured in days, to save the event records in the
Event Logger. The default is 35 days.

 PasswS - system administrator password.

 PasswO - operator password.

 PasswM - maintenance password.

 PasswV - view password.

 AGA8WT - the period of time between two successive runs, measured in seconds,,
during which the AGA8 calculations are suspended. AGA8 runs under the TskprD
process. The default is 0 seconds.

 AGA8TP - the period of time, measured in seconds, when each meter run
recalculates its AGA8 calculation. The default is 10 seconds.

 SvCmps – a flag to save the average gas composition in the historical hourly or
daily transaction records. The default is 1.

1 - The average gas composition is being saved in historical records.

0 – The gas composition is not being saved in historical records.

NOTE:
This parameter has an impact on the memory consumption. Refer to the Memory
Allocation for AGA38 section.

 SramBack – Backup facility flag. When the value is not 0, the AGA flags its
backup facility to be activated. When the AGA backup facility is activated, the
AGA backups its database to protect the database against power failure. To enable
the backup facility, an SRAM memory card must be installed and the amount of
memory size for historical records (calculated according to the Memory Allocation
for AGA38 section above) must be less than the installed SRAM memory size. If

19
The AGA38 Application

‘SramBack’ is 0, no backup is performed even if an SRAM card is installed.

Table #2, Contract Time


The Contract time table is defined separately, per each run and includes the following
parameters:

 CtrctH - hour part of contract time. The default is 00. The range is 0 to 23.

 CtrctM - minutes part of contract time. The default is 00. The range is 0 to 59.

 CtrctS - seconds part of contract time. The default is 01. The range is 0 to 59.

The default contract time is 00:00:01 (midnight).

20
The AGA38 Application

Table #3, AGA Statics 1


The AGA Statics 1 table includes the following parameters:

 M_ID1 & M_ID2 - the meter ID (two integers for four characters)

 P_Base - the base pressure

 T_Base – the base temperature

 FluidT - the type of fluid flow. 0 = vapor, 1 = liquid.

 Isentr - isentropic exponent. This parameter is not relevant for liquid flow
calculation.

 Vscsty - viscosity

21
The AGA38 Application

Table #4, AGA Statics 2


The AGA Statics 2 table includes the following parameters:

 Plat_M - orifice plate material. The available values are:

0 - Stainless Steel
1 - Monel
2 - Carbon Steel
3 - other. If Plat_M=3, then Plat_C (plate thermal expansion coefficient) should
be specified.

 Plat_C - the plate thermal expansion coefficient

 Plat_d - the plate measured diameter (d)

 Plat_T - the orifice bore diameter measurement temperature

 Tube_M - the tube material. The available values are:

0 - Stainless Steel

22
The AGA38 Application

1 - Monel
2 - Carbon Steel
3 - other. If Tube_M=3, then Tube_C (tube thermal expansion coefficient) should
be specified.

 Tube_C - the tube thermal expansion coefficient

 Tube_D - the tube diameter measured (D)

 Tube_T - the tube internal diameter measurement temperature

Table #5, Pressure meter 1


The Pressure meter 1 table includes the following parameters:

P_Flow is a scaled analog input (sAI) with the following configuration table.

Ind P_Flow EGU Zero (%) EGU Zero EGU High 100%
Full Scale
0 0% 0.0 1.0

1 0% 0.0 1.0

 P_Flow - the flowing pressure (variable input).

23
The AGA38 Application

P_Flow is considered as gauge pressure if the pressure type (P_Type) is defined as


gauge type (1). In this case, the atmospheric pressure is added to the default
pressure, to calculate the absolute flowing pressure of the gas.
P_Flow is considered as absolute pressure if the pressure type (P_Type) is defined
as absolute type (0).

 P_Fail - fail bit for module including the analog input of the flowing pressure.

 TapLoc - static pressure tap location. This parameter is relevant for gas only.

0 - upstream

1 - downstream

 P_Mode - pressure meter mode of work. The available values are:

0 - run

1 - failed

2 - manually frozen

If P_mode is not equal to run, then the pressure is frozen according to the freeze
option.

 PFrzOp - static pressure freeze option. This option is active if P_mode is not equal
to run. The available values are:

0 - default pressure

1 - last valid flowing pressure

2 - last calculated average pressure

 P_Dflt - the default pressure. This option is relevant if the pressure freeze option
(PFrzOp) is active and is equal to 0.
P_Dflt is considered as gauge pressure if the pressure type (P_Type) is defined as
gauge type (1). In this case, the atmospheric pressure is added to the default
pressure to calculate the absolute flowing pressure of gas.
P_Dflt is considered as absolute pressure if the pressure type (P_Type) is defined
as absolute type (0).

 P_Min - minimum gauge/absolute allowed pressure.


If the pressure type (P_Type) is 0, P_Min is the minimum absolute pressure.
If the pressure type (P_Type) is 1, P_Min is the minimum gauge pressure.

 P_Max - maximum gauge/absolute allowed pressure.


If the pressure type (P_Type) is 0, P_max is the maximum absolute pressure.
If the pressure type (P_Type) is 1, P_max is the maximum gauge pressure.

24
The AGA38 Application

Table #6, Pressure meter 2


The Pressure meter 2 table includes the following parameters:

 P_Type - type of the pressure. The available values are:

0 - absolute pressure (default)

1 - gauge pressure

P_Flow and P_Dflt are considered as gauge pressure if the pressure type (P_Type)
is defined as gauge type (1). In this case, the atmospheric pressure is added to the
gauge pressure to calculate the absolute flowing pressure of gas.

P_Flow and P_Dflt are considered as absolute pressures if the pressure type
(P_Type) is defined as absolute pressure type (0).

 Elev_H - elevation above sea level meter location. This parameter is used to
calculate the average atmospheric pressure only if P_Type=0.

25
The AGA38 Application

Table #7, Temperature Meter


The Temperature meter table includes the following parameters:

T_Flow is a scaled analog input (sAI) with the following configuration table.

Ind T_Flow EGU Zero EGU Zero EGU High100% Full


(%) Scale

0 0% 0.0 1.0

1 0% 0.0 1.0

 T_Flow - flowing temperature (variable input)

 T_Fail - fail bit for module including the analog input of the flowing temperature

 T_Mode - temperature meter mode of work. The available values are:

0 - run

1 - failed

26
The AGA38 Application

2 - manually frozen

If T_mode is not equal to run, then the temperature is frozen according to the freeze
option.

 TFrzOp - temperature freeze option. This option is active if T_mode is not equal to
run. The available values are:

0 - default temperature

1 - last valid flowing temperature

2 - last calculated average flowing temperature

 T_Dflt - the default temperature. This option is relevant if the temperature freeze
option (TFrzOp) is active and is equal to 0.

 T_Min - minimum allowed temperature.

 T_Max - maximum allowed temperature.

27
The AGA38 Application

Table #8, Diff. P. meter 1


The Diff. P. meter 1 table includes the following parameters:

dP1 is a scaled analog input (sAI) with the following configuration table.

Ind dP1 EGU Zero (%) EGU Zero EGU High 100%
Full Scale
0 0% 0.0 1.0

1 0% 0.0 1.0

dP2 is a scaled analog input (sAI) with the following configuration table.

Ind dP2 EGU Zero (%) EGU Zero EGU High 100%
Full Scale
0 0% 0.0 1.0

1 0% 0.0 1.0

28
The AGA38 Application

 dP1 - diff. pressure 1 (variable input)

 dP1Fal - fail bit for module including the analog input of dP1

 dP2 - diff. pressure 2, if any (variable input).

 dP2Fal - fail bit for module including the analog input of dP2, if any.

 LoFlow - low cutoff. The default is 0.0.

 dP1dP2 - dP1dP2 switch value for stacked differential pressure support. If


dP1dP2 is 0, then the dP2 transmitter is not connected.

The following algorithm is used to determine the differential pressure:


if (dP1dP2 is zero) then /* only dP1 is used */
it is assumed that only the dP1 is used
if (dP1 is OK) then
dP1 is the differential pressure
else /* some failure with dP1 and only dP1 is used */
the differential pressure is determined according
to the freeze option
endif
else /* dP1dP2 <> 0 (dP1 and dP2 are used) */
if (dP1 and dP2 are both OK) then
if (dP1dP2 < dP2) then
/* high range, take dP2 */
dP2 is the differential pressure
else
/* low range, take dP1 */
dP1 is the differential pressure
endif
else /* some failure with dP1 or dP2 */
if (dP1 is OK) then
dP1 is the differential pressure
else
if (dP2 is OK) then
dP2 is the differential pressure
else /* some failure with both dP1 and dP2 */
the differential pressure is determined
according to the freeze option
endif
endif
endif
endif

29
The AGA38 Application

Table #9, Diff. P. meter 2


The Diff. P. meter 2 table includes the following parameters:

 dPMode - differential meter/meters mode of operation. The available values are:

0 -run

1 -failed

2 -manually frozen

 dPFrzO - if dPMode is not equal to run then the diff. pressure is frozen according
to the following freeze option. The available diff. pressure freeze options are:

0 - Default diff. pressure

1 - Last valid diff. pressure

2 - Last calculated average diff. pressure

 dPDflt - the default differential pressure. This option is relevant if the diff.
pressure freeze option (dPFrzO) is active and is equal to 0.

30
The AGA38 Application

 dP1Min - minimum allowed lowest dP1

 dP1Max - maximum allowed highest dP1

 dP2Min - minimum allowed lowest dP2

 dP2Max - maximum allowed highest dP2

Table #10, Flow density


The Flow density table includes the following parameters:

DnFlow is a scaled analog input (sAI) with the following configuration table.

Ind DnFlow EGU Zero (%) EGU Zero EGU High 100% Full Scale
0 0% 0.0 1.0

1 0% 0.0 1.0

 DnFlow - densitometer (optional variable input)

 DnFail - fail bit for module including the analog input of the optional
31
The AGA38 Application

densitometer.

 DnMode - density calculation mode. The available values are:

0 -run (if live input)

1 - failed (if live input)

2 - live but manually frozen (if live input)

3 - calc_by_AGA8_init (if not live input) (default)

4 - calc_by_AGA8 (if not live input)

5 - calc_by_AGA8_failed (if not live input)

6 - not live but manually frozen (if not live input)

If the input is not live, AGA3 uses the DnDflt density the first time. This is done until
DnMode changes from calc_by_AGA8_init to calc_by_AGA8 value (until AGA8
terminates its first calculation.)

 DnFrzO - freeze mode. The density freeze mode option is active if and only if
DnMode is not equal to run and is not equal to calc_by_AGA8. The available
values are:

0 - Default density (default)

1 - Last Valid density

2 - Last Average density

 DnDflt - the default density when the ‘density is frozen’ option is active and
DnFrzO is 0 or DnMode=3.

 Dn_Min - minimum allowed lowest density

 Dn_Max - maximum allowed highest density

32
The AGA38 Application

Table #11, Base density


The Base density table includes the following parameters:

 DBMod - base density mode:

0 - calc_by_AGA8_init (default)

1 - calc_by_AGA8

2 - calc_by_AGA8_failed

3 - manually frozen

Initially, AGA3 uses the DBDflt density, until DBMod switches from calc_by_AGA8_init
to calc_by_AGA8 value i.e., until AGA8 terminates its first calculation.

 DBFrzO - base density freeze option (when DBMod=2,3). The available values
are:

0 - default base density is used

1 - last valid base density

 DBDflt - default base density [if DBMod=2,3 AND DBFrzO=0] OR DBMod=0.

33
The AGA38 Application

Table #12, Heating Value


The Heating Value table includes the following parameters:

 HVMode - heating value mode. The available values are:

0 - calc_by_AGA8_init (default)

1 - calc_by_AGA8

2 - calc_by_AGA8_failed

3 - Freeze option

Initially, AGA3 uses the HVDflt heating value for energy calculations. This is done
until the HVMode changes from calc_by_AGA8_init to calc_by_AGA8 value (or until
the AGA8 terminates its first calculation.)

 HVFrzO - the volumetric gross heating value freeze option (when HVMode=2,3).
The available values are:

0 - default volumetric gross heating value

1 - last valid volumetric gross heating value

 HVDflt - the default heating value [when HVMode=2,3 AND HVFrzO=0] OR


34
The AGA38 Application

HVMode=0

 HVTemp - the heating value temperature reference (to calculate heating value and
energy)

 HVPres - the heating value pressure reference (to calculate heating value and
energy)

Table #13, Gas Components 1


The Gas Components 1 table includes the following parameters:

 Methan -specifies the percentage of methane.

 Nitrog -specifies the percentage of methane nitrogen.

 CrbnDi -specifies the percentage of carbon dioxide.

 Ethane -specifies the percentage of ethane.

 Propan -specifies the percentage of propane.

35
The AGA38 Application

 Water -specifies the percentage of water

 HydrSu -specifies the percentage of hydrogen sulfide.

 Hydrog -specifies the percentage of hydrogen.

Table #14, Gas Components 2


The Gas Components 2 table includes the following parameters:

 CrbnMo -specifies the percentage of carbon monoxide.

 Oxygen -specifies the percentage of oxygen.

 i_Buta -specifies the percentage of isobutane.

 n_Buta -specifies the percentage of N_butane.

 i_Pent -specifies the percentage of isopentane.

 n_Pent -specifies the percentage of N_pentane.

 n_Hexa -specifies the percentage of N_hexane.

36
The AGA38 Application

 n_Hept -specifies the percentage of N_heptane.

Table #15, Gas Components 3


The Gas Components 3 table includes the following parameters:

 n_Octa -specifies the percentage of N_octane.

 n_Nona -specifies the percentage of N_nonane.

 n_Deca -specifies the percentage of N_decane.

 Helium -specifies the percentage of Helium.

 Argono -specifies the percentage of Argon.

37
The AGA38 Application

Table #16, Chromotograph


The Chromotograph table includes the following parameters:

 ChrUsd -specifies a flag for Chromatograph use, for this meter. The available
values are:

0 - no Chromatograph is used for the metering (default). If density is not live, the
following parameters are configuration log parameters:

a) Density at base conditions

b) Specific gravity at base conditions

c) Compressibility at base conditions

d) Volumetric Gross Heating Value at heating value reference conditions.

e) Gas composition

1 - a Chromatograph is used for the metering. In this case, the parameters


described above a) to e) are not configuration log parameters, even when the
density is not live.

38
The AGA38 Application

Table #17, Parms for Calc


The Parms for Calc table includes the following parameters:

 P_Calc -specifies the pressure for AGA3 (live input, last valid, average or default)

 T_Calc -specifies the temperature for AGA3 (live input, last valid, average or
default)

 dPCalc -specifies the differential pressure for AGA3 (live input, last valid,
average or default)

 DnCalc -specifies the density for AGA3 (live input, last valid, average, default or
calculated)

 DBCalc -specifies the pressure for AGA3 (calculated by AGA8 or default)

 HVCalc -specifies the heating value for AGA3 (calculated by AGA8 or default)

39
The AGA38 Application

Table #18, AGA8 90 Output


The AGA8 90 Output table includes the following parameters:

 Z_Flow -specifies the compressibility at flowing temperature and pressure

 Z_Base -specifies the compressibility at base temperature and pressure

 Fpv -specifies the supercompressibility at flowing temperature and pressure

 Gr -defines the specific gravity (relative density)

 DnFlw8 -specifies the density at base conditions calculated by AGA8

 DnBas8 -specifies the density at flowing conditions calculated by AGA8

 HV8 -specifies the volumetric gross heating value at heating value reference
temperature.

40
The AGA38 Application

Table #19, Flow Control


The Flow Control table includes the following parameters:

 RunMod -specifies the global run_mode. The available values are:

0 -AGA3 is in calculation mode (default).

1 -AGA3 is in failed mode. The calculation is frozen according to the freeze


option.

2 -calculation is frozen according to the freeze option. This is for validation and
maintenance purposes.

 FrzOpt -specifies the freeze options. The available values are: 0 -The
volume/mass/energy are the defaults.

0 - The volume/mass/energy are the defaults.

1 -The volume/mass/energy are the last calculated (default).

2 -The volume/mass/energy are the last average calculated.

 QFDflt -specifies the default volumetric flow rate at flow T, P.

41
The AGA38 Application

 QBDflt -specifies the default volumetric flow rate at base T, P.

 M_Dflt -specifies the default mass flow rate.

 E_Dflt -specifies the default energy flow rate.

Table #20, Config Change


The Config Change table includes the following parameters:

 CfUpdt -specifies the configuration log update column.

If CfUpdt,I = 1 and CfPswd,I = legal password, then the configuration log for
meter run #(I+1) is updated.

After the update of the configuration log, CfUpdt,I and CfPswd,I are set to 0 by
the software.

If CfUpdt,I = 2 and CfPswd,I = legal password, then the configuration log of the
meter run #(I+1) is copied to the AGA tables.

The CfUpdt,I and CfPswd,I are set to 0 by the software when the operation is
performed.

The password should be:

42
The AGA38 Application

a) the system integrator’s

b) the operator’s

c) a maintenance person’s

 CfPswd -specifies the password. The updated parameters vary, according to the
type of password.

Table #21, Current flow rate


The Current flow rate table includes the following parameters:

 QFHour -specifies the hourly flow volume rate at flowing conditions.

 QBHour -specifies the hourly flow volume rate at base conditions.

 M_Hour -specifies the hourly flow mass rate.

 E_Hour -specifies the hourly energy rate.

 QF_Day -specifies the daily flow volume rate at flowing conditions.

 QB_Day -specifies the daily flow volume rate at base conditions.

43
The AGA38 Application

 M_Day -specifies the daily flow mass rate.

 E_Day -specifies the daily energy rate.

Table #22, Meter Run Status


The Meter Run Status table includes the following parameters:

 Status -specifies the run status. The following values are available:

0 -the meter run calculation is OK.

1 -AGA 3 calculation failure. In this case, the error is described in the next
column named Err_Sw.

2 -AGA 8 calculation failure. In this case, the error is described in the next
column named Err_Sw.

3 -The differential pressure meter is considered to be in failed state.

4 -The static pressure meter is considered to be in failed state.

5 -The temperature meter is considered to be in failed state.

44
The AGA38 Application

6 -The optional densitometer failure

7 -Warning

 Err_Sw -specifies an AGA3 or AGA8 calculation error (when Status=1 or


Status=2):

In addition to the appearance of the error in Err_Sw column, an event is posted to


the event file and an error message is posted to the system Error Logger. The error
number in the Err_Sw field is the number of the event posted to the event file.

Following is the list of the errors:


1000 -Flowing temperature too low
1001 -Flowing temperature too high
1002 -Flowing pressure too low
1003 -Flowing pressure too high
1004 -Base temperature too low
1005 -Base temperature high
1006 -Base pressure too low
1007 -Base pressure high
1008 -Gas composition error (some composition is negative or the sum is
not 100%)
1009 -Internal error (please report)
1010 -AGA 8 cannot be calculated for non vapor
1011 -AGA 8 calculation does not converge
1012 -Unit type definition error.
1013 -Orifice plate material definition error
1014 -Tube material definition error
1015 -Static tap location definition error
1016 -d<=0
1017 -D<=0
1018 -d>=D
1019 -State definition error
1020 -Negative viscosity
1021 -Negative plate thermal expansion factor
1022 -Negative tube thermal expansion factor
1023 -Negative flowing density
1024 -Negative base density (standard) conditions
1025 -Negative differential pressure
1026 -Aga3 calculations do not converge
1027 -Heating value reference temperature is too high
1028 -Heating value reference temperature is too low

The warnings are as follows (when Status=7):


2000 –Reynold number is too small
2001 –Reynold number is too large
2002 -Beta ratio is too large
2003 –Beta ratio large
2004 –Beta ratio is too small
2005 –Beta ratio small
2006 -Bore is too small

45
The AGA38 Application

Table #23, Last Hour Qty


The Last Hour Qty table includes the following parameters:

 QbLstH -specifies the volume at base conditions for the last (already terminated)
contract hour.

 M_LstH -specifies the mass for the last terminated contract hour.

 E_LstH -specifies the energy for the last terminated contract hour.

46
The AGA38 Application

Table #24, Current Hour Qty


The Current Hour Qty table includes the following parameters:

 QbCurH -specifies the volume at base conditions for the current (not yet
terminated) contract hour

 M_CurH -specifies the mass for the current contract hour

 E_CurH -specifies the energy for the current contract hour

47
The AGA38 Application

Table #25, Current Day Qty


The Current Day Qty table includes the following parameters:

 QbCurD -specifies the volume at base conditions for the current (not yet
terminated) contract day

 M_CurD -specifies the mass for the current (not yet terminated) contract day

 E_CurD -specifies the energy for the current (not yet terminated) contract day

48
The AGA38 Application

Table #26, Last Day Qty


The Last Day Qty table includes the following parameters:

 QbLstD -specifies the volume at base conditions, for the last concluded contract
day

 M_LstD -specifies the mass calculated for the last terminated contract day

 E_LstD -energy calculated for the last terminated contract day

49
The AGA38 Application

Table #27, Day Before Qty


The Day Before Qty table includes the following parameters:

 QbDBfr -specifies the volume at base conditions for the day before yesterday
contract day.

 M_DBfr -specifies the mass calculated for the day before yesterday contract day.

 E_DBfr -specifies the energy calculated for the day before yesterday contract day.

50
The AGA38 Application

Table #28, Pressure Avrg


The Pressure Avrg table includes the following parameters:

 PLstMF -specifies the average flowing pressure during the last minute, not
including ‘no flow’ periods.

 PLstHF -specifies the average flowing pressure during the last contract hour, not
including ‘no flow’ periods.

 PLstDF -specifies the average flowing pressure during the last contract day, not
including ‘no flow’ periods.

 PDBfrF -specifies the average flowing pressure during the day before yesterday,
not including ‘no flow’ periods.

 PLstMN -specifies the average flowing pressure during the last minute, including
‘no flow’ periods.

 PLstHN -specifies the average flowing pressure during the last contract hour,
including ‘no flow’ periods.

 PLstDN -specifies the average flowing pressure during the last contract day,
including ‘no flow’ periods.

 PDBfrN -specifies the average flowing pressure during the day before yesterday,

51
The AGA38 Application

including ‘no flow’ periods.

Table #29, Diff. Pres. Avrg


The Diff. Pres. Avrg table includes the following parameters:

 dPLsMF - specifies the average differential pressure during the last minute, not
including ‘no flow’ periods.

 dPLsHF - specifies the average differential pressure during the last contract hour,
not including ‘no flow’ periods.

 dPLsDF - specifies the average differential pressure during the last contract day,
not including ‘no flow’ periods.

 dPBfrF - specifies the average differential pressure during the day before
yesterday, not including ‘no flow’ periods.

 dPLsMN - specifies the average differential pressure during the last minute,
including ‘no flow’ periods.

 dPLsHN - specifies the average differential pressure during the last contract hour,
including ‘no flow’ periods.

 dPLsDN - specifies the average differential pressure during the last contract day,

52
The AGA38 Application

including ‘no flow’ periods.

 dPBfrN - specifies the average differential pressure during the day before
yesterday, including ‘no flow’ periods.

Table #30, Temperature Avrg


The Temperature Avrg table includes the following parameters:

 TLstMF -specifies the average temperature during the last minute, not including
‘no flow’ periods.

 TLstHF -specifies the average temperature during the last contract hour, not
including ‘no flow’ periods.

 TLstDF -specifies the average temperature during the last contract day, not
including ‘no flow’ periods.

 TDBfrF -specifies the average temperature during the day before yesterday, not
including ‘no flow’ periods.

 TLstMN -specifies the average temperature during the last minute, including ‘no
flow’ periods.

 TLstHN -specifies the average temperature during the last contract hour, including

53
The AGA38 Application

‘no flow’ periods.

 TLstDN -specifies the average temperature during the last contract day, including
‘no flow’ periods.

 TDBfrN -specifies the average temperature during the day before yesterday,
including ‘no flow’ periods.

Table #31, Flow Density Avrg


The Flow Density Avrg table includes the following parameters:

 dLstMF -specifies the average density during the last minute, not including ‘no
flow’ periods.

 dLstHF -specifies the average density during the last contract hour, not including
‘no flow’ periods.

 dLstDF -specifies the average density during the last contract day, not including
‘no flow’ periods.

 dDBfrF -specifies the average density during the day before yesterday, not
including ‘no flow’ periods.

 dLstMN -specifies the average density during the last minute, including ‘no flow’

54
The AGA38 Application

periods.

 dLstHN -specifies the average density during the last contract hour, including ‘no
flow’ periods.

 dLstDN -specifies the average density during the last contract day, including ‘no
flow’ periods.

 dDBfrN -specifies the average density during the day before yesterday, including
‘no flow’ periods.

Table #32, Current Hour Avrg


The Current Hour Avrg table includes the following parameters (calculated every minute):

 PCurHF -specifies the current hour pressure average, not including ‘no flow’
periods.

 dPCrHF -specifies the current hour differential pressure average, not including ‘no
flow’ periods.

 TCurHF -specifies the current hour temperature average, not including ‘no flow’
periods.

 dCurHF -specifies the current hour density average, not including ‘no flow’

55
The AGA38 Application

periods.

 PCurHN -specifies the current hour pressure average, including ‘no flow’ periods.

 dPCrHN -specifies the current hour differential pressure average, including ‘no
flow’ periods.

 TCurHN -specifies the current hour temperature average, including ‘no flow’
periods.

 dCurHN -specifies the current hour density average, including ‘no flow’ periods.

Table #33, Current Day Avrg


The Current Day Avrg table includes the following parameters (calculated every minute):

 PCurDF -specifies the current day pressure average, not including ‘no flow’
periods.

 dPCrDF -specifies the current day differential pressure average, not including ‘no
flow’ periods.

 TCurDF -specifies the current day temperature average, not including ‘no flow’
periods.

56
The AGA38 Application

 dCurDF -specifies the current day density average, not including ‘no flow’
periods.

 PCurDN -specifies the current day pressure average, including ‘no flow’ periods.

 dPCrDN -specifies the current day differential pressure average, including ‘no
flow’ periods.

 TCurDN -specifies the current day temperature average, including ‘no flow’
periods.

 dCurDN -specifies the current day density average, including ‘no flow’ periods.

Table #34, Last Valid Val 1


The Last Valid Val 1 table includes the following parameters:

 LastdP -specifies the last valid differential pressure value

 Last_P -specifies the last valid static pressure value.

 Last_T -specifies the last valid temperature value.

 Last_D -specifies the last valid flowing density value.

57
The AGA38 Application

 LastQf -specifies the last calculated volumetric flow rate at flowing conditions.

 LastQb -specifies the last calculated volumetric flow rate at base conditions.

 Last_M -specifies the last calculated mass flow rate.

 Last_E -specifies the last calculated energy flow rate.

Table #35, Last Valid Val 2


The Last Valid Val 2 table includes the following parameters:

 LastBD -specifies the last valid base density

 LastHV -specifies the last valid volumetric gross heating value

58
The AGA38 Application

Table #36, Last Averages


The Last Averages table includes the following parameters:

 LstAdP – specifies the last differential pressure calculated average.

 LstAvP -specifies the last static pressure calculated average.

 LstAvT -specifies the last temperature calculated average.

 LstAvD -specifies the last density calculated average.

 LstAQf -specifies the last calculated volumetric flow rate average at flowing
conditions.

 LstAQb -specifies the last calculated volumetric flow rate average at base
conditions.

 LstAvM -specifies the last calculated mass flow rate average.

 LstAvE -specifies the last calculated energy flow rate average.

59
The AGA38 Application

Table #37, MinMaxBefore Yest (Yesterday)


The MinMaxBefore Yest (Yesterday) table includes the following parameters:

 DBMxdP -specifies the day before yesterday maximum differential pressure.

 DBMaxT -specifies the day before yesterday maximum temperature.

 DBMaxP -specifies the day before yesterday maximum absolute static pressure.

 DBMxDn -specifies the day before yesterday maximum flowing density.

 DBMndP -specifies the day before yesterday minimum differential pressure.

 DBMinT -specifies the day before yesterday minimum temperature.

 DBMinP -specifies the day before yesterday minimum absolute static pressure.

 DBMnDn -specifies the day before yesterday minimum flowing density.

60
The AGA38 Application

Table #38, Last Day MinMax


The Last Day MinMax table includes the following parameters:

 LDMxdP -specifies the last contract day maximum differential pressure.

 LDMaxT -specifies the last contract day maximum temperature.

 LDMaxP -specifies the last contract day maximum absolute static pressure.

 LDMxDn -specifies the last contract day maximum flowing density.

 LDMndP -specifies the last contract day minimum differential pressure.

 LDMinT -specifies the last contract day minimum temperature.

 LDMinP -specifies the last contract day minimum absolute static pressure.

 LDMnDn -specifies the last contract day minimum flowing density.

61
The AGA38 Application

Table #39, Current Day MinMax


The Current Day MinMax table includes the following parameters:

 CDMxdP -specifies the current contract day maximum differential pressure.

 CDMaxT -specifies the current contract day maximum temperature.

 CDMaxP -specifies the current contract day maximum absolute static pressure.

 CDMxDn -specifies the current contract day maximum flowing density.

 CDMndP -specifies the current contract day minimum differential pressure.

 CDMinT -specifies the current contract day minimum temperature.

 CDMinP -specifies the current contract day minimum absolute static pressure.

 CDMnDn -specifies the current contract day minimum flowing density.

62
The AGA38 Application

Table #40, Last Hour MinMax


The Last Hour MinMax table includes the following parameters:

 LHMxdP -specifies the last contract hour maximum differential pressure.

 LHMaxT -specifies the last contract hour maximum temperature.

 LHMaxP -specifies the last contract hour maximum absolute static pressure.

 LHMxDn -specifies the last contract hour maximum flowing density.

 LHMndP -specifies the last contract hour minimum differential pressure.

 LHMinT -specifies the last contract hour minimum temperature.

 LHMinP -specifies the last contract hour minimum absolute static pressure.

 LHMnDn -specifies the last contract hour minimum flowing density.

63
The AGA38 Application

Table #41, Current Hour MinMax


The Current Hour MinMax table includes the following parameters:

 CHMxdP -specifies the current contract hour maximum differential pressure.

 CHMaxT -specifies the current contract hour maximum temperature.

 CHMaxP -specifies the current contract hour maximum absolute static pressure.

 CHMxDn -specifies the current contract hour maximum flowing density.

 CHMndP -specifies the current contract hour minimum differential pressure.

 CHMinT -specifies the current contract hour minimum temperature.

 CHMinP -specifies the current contract hour minimum absolute static pressure.

 CHMnDn -specifies the current contract hour minimum flowing density.

64
The AGA38 Application

Table #42, FlowRate Maxima


The FlowRate Maxima table includes the following parameters:

 DBQBMx -specifies the day before yesterday maximum flow rate (at base
conditions).

 LDQBMx -specifies the last contract day maximum flow rate (at base conditions).

 CDQBMx -specifies the current contract day maximum flow rate (at base
conditions).

 LHQBMx -specifies the last contract hour maximum flow rate (at base conditions).

 CHQBMx -specifies the current contract hour maximum flow rate (at base
conditions).

65
The AGA38 Application

Table #43, FlowRate Minima


The FlowRate Minima table includes the following parameters:

 DBQBMn -specifies the day before yesterday minimum flow rate (at base
conditions).

 LDQBMn -specifies the last contract day minimum flow rate (at base conditions).

 CDQBMn -specifies the current contract day minimum flow rate (at base
conditions).

 LHQBMn -specifies the last contract hour minimum flow rate (at base conditions).

 CHQBMn -specifies the current contract hour minimum flow rate (at base
conditions).

66
The AGA38 Application

Table #44, History Info


The History Info table includes the following parameters:

 ClrMod -specifies the history clear mode. The available values are:

1 -clearing all hourly and daily transaction, and event log records for the specific
run.

2 -clearing all hourly transaction records for the specific run.

3 -clearing all daily transaction records for the specific run.

4 -clearing all events log record for the specific run.

When ClrMod,I = (1 or 2 or 3 or 4) and ClrPwd,I = the maintenance or system


integrator person password, the operation is performed and ClrMod,I and
ClrPwd,I are set to zero.

 ClrPwd -specifies the password of the system integrator or of a maintenance


person.

 HourRN -specifies the current number of hourly transaction records in the event
logger.

 DayRN -specifies the current number of daily transaction records in the logger.

67
The AGA38 Application

 EvntRN -specifies the current number of event log records in the event logger.

Table #45, RecordsIndexFind


The purpose of this table is to retrieve the indices and the number of records which satisfy
a specific condition. In this table all the parameters must be entered, except for R_Indx
(the first index) and R_Num (the number of records) which are automatically set as a result
of search.

The RecordsIndexFind table includes the following parameters:

 RRun_N -specifies the run number which retrieves a record. The range is 1 to the
number of runs.

 RRec_T -specifies the record type. The available values are:

1 -Hourly transaction record

2 -Daily transaction record

3 -Event logger record

68
The AGA38 Application

 RCondT -specifies the condition type for which the records are being searched.
Thirteen different search conditions are defined:

1 -the record closing time is greater than the 'from range' time AND the record
closing time is less than or equal to the 'up to range' time.

2 -the record closing time is greater than the 'from range' time AND the record
closing time is less than the 'up to range' time.

3 -the record closing time is greater than or equal to the 'from range' time AND
the record closing time is less than or equal to the 'up to range' time.

4 -the record closing time is greater than or equal to the 'from range' time AND
the record closing time is less than the 'up to range' time.

5 -the record opening time is greater than the 'from range' time AND the record
opening time is less than or equal to the 'up to range' time.

6 -the record opening time is greater than the 'from range' time AND the record
opening time is less than the 'up to range' time.

7 -the record opening time is greater than or equal to the 'from range' time AND
the record opening time is less than or equal to the 'up to range' time.

8 -the record opening time is greater than or equal to the 'from range' time AND
the record opening time is less than the 'up to range' time.

9 -the record opening time is greater than the 'from range' time AND the record
closing time is less than or equal to the 'up to range' time.

10 -the record opening time is greater than the 'from range' time AND the record
closing time is less than the 'up to range' time.

11 -the record opening time is greater than or equal to the 'from range' time AND
the record closing time is less than or equal to the 'up to range' time.

12 -the record opening time is greater than or equal to the 'from range' time AND
the record closing time is less than the 'up to range' time.

13 -the record is located beyond the first non accessed record. In other words, the
record is in list of yet, unaccessed (retrieved) records.

Once the RCondT (Record Condition type) is set, only the records satisfying that
particular type are taken into consideration.

For event records, the opening and closing time are equal and defined as the time
of the event.

 RFYear -specifies the years from the beginning of the first record ('from range').

 RFMnth -specifies the months from the beginning of the first record ('from range').

69
The AGA38 Application

 RFDate -specifies the date from the beginning of the first record ('from range').

 RFHour -specifies the hours from the beginning of the first record ('from range').

 RFMint -specifies the minutes from the beginning of the first record ('from range').

 RFSec -specifies the seconds from the beginning of the first record ('from range').

 RTYear -specifies the years up to the end of the last record ('up to range').

 RTMnth -specifies the months up to the end of the last record ('up to range').

 RTDate -specifies the dates up to the end of the last record ('up to range').

 RTHour -specifies the hours up to the end of the last record ('up to range').

 RTMint -specifies the minutes up to the end of the last record ('up to range').

 RTSec -specifies the seconds up to the end of the last record ('up to range').

 R_Stat -The available values are:

1 -Start calculating the index of the first record and the number of records that
satisfy the time range condition only.

2 -Start calculating the index of the first record and the number of the records that
satisfy the time range condition.
Also, retrieve the first record from the hourly/daily or event table using the
History Fetch control table (HsFtch).

0 -The index and the number of records satisfying the range requirement have
been calculated and fetched to the R_Indx and R_Num next 2 fields.

If R_Stat was 2, the first record is fetched to table #48 ‘Hourly/Daily Rec or to
table #49 ‘Event Record’, according to the record type. The History Fetch control
table (HsFtch) parameters are as follows:

- FRun_N -The run number from which the first record was fetched.

- FRIndex -The index of the next record to the fetched.

- FRec_T -The record type: hourly, daily or event logger.

- F_Stat -0

If R_Stat was 1 (no record fetching requested), the index and the number of
records satisfying the range requirement are calculated and fetched to the R_Indx
and R_Num next two fields. The History Fetch control table (HsFtch) parameters
are as follows:

- FRun_N -The run number for which the first index (record number) and number
of records satisfying the time range condition were calculated.

70
The AGA38 Application

- FRIndex -The index of the first record

- FRec_T -The record type: hourly, daily or event logger.

- F_Stat -0

If R_Stat was 1 or 2 and FRec_T was 1 or 2, table #46 ‘Time range Qty’ is set.

 R_Indx -specifies the first record index number in the output searched range. The
range is 1 to the number of records.

 R_Num -specifies the number of records satisfying the output range requirement.
The range is 1 to the number of records.

NOTE:
If RFYear, RFMnth, RFDate, RFHour, RFMint, RFSec are all zero, this means
that the 'from range' includes the first record (the range starts from the first
record). If RTYear, RTMnth, RTDate, RTHour, RTMint, RTSec are all zero, this
means that the 'to range' includes the last record (the range ends by the last record)
If both 'from range' and 'to range' are equal to zero, this means that the range
includes all the records.

Table #46, Time Range Qty


This table is set by the AGA software each time a search for hourly/daily transaction
records is performed using table #45, RecordsIndexFind, and it comprises the summarized
data of the records satisfying the search condition. This table is an output table, therefore
no changes are allowed.

71
The AGA38 Application

The Time range Qty table includes the following parameters:

 QRunNu -specifies the run number that the quantities have been calculated for.
The range is 1 to the number of runs

 QRecTy -specifies the record type from which the time ranged quantities were
accumulated. The available values are:

1 -Hourly transaction record

2 -Daily transaction record

 QCondT -specifies the condition type according which the records are searched.
Thirteen different search conditions are defined:

1 -the record closing time is greater than the 'from range' time AND the record
closing time is less than or equal to the 'up to range' time.

2 -the record closing time is greater than the 'from range' time AND the record
closing time is less than the 'up to range' time.

72
The AGA38 Application

3 -the record closing time is greater than or equal to the 'from range' time AND
the record closing time is less than or equal to the 'up to range' time.

4 -the record closing time is greater than or equal to the 'from range' time AND
the record closing time is less than the 'up to range' time.

5 -the record opening time is greater than the 'from range' time AND the record
opening time is less than or equal to the 'up to range' time.

6 -the record opening time is greater than the 'from range' time AND the record
opening time is less than the 'up to range' time.

7 -the record opening time is greater than or equal to the 'from range' time AND
the record opening time is less than or equal to the 'up to range' time.

8 -the record opening time is greater than or equal to the 'from range' time AND
the record opening time is less than the 'up to range' time.

9 -the record opening time is greater than the 'from range' time AND the record
closing time is less than or equal to the 'up to range' time.

10 -the record opening time is greater than the 'from range' time AND the record
closing time is less than the 'up to range' time.

11 -the record opening time is greater than or equal to the 'from range' time AND
the record closing time is less than or equal to the 'up to range' time.

12 -the record opening time is greater than or equal to the 'from range' time AND
the record closing time is less than the 'up to range' time.

13 -the record is located beyond the first non accessed record. In other words, the
record is in list of yet, unaccessed (retrieved) records.

Once the QCondT (Record Condition type) is set, only the records satisfying that
particular type are taken into consideration.

 QFYear -specifies the years from the beginning of the first record ('from range').

 QFMnth -specifies the months from the beginning of the first record ('from range').

 QFDate -specifies the date from the beginning of the first record ('from range').

 QFHr -specifies the hours from the beginning of the first record ('from range').

 QFMint -specifies the minutes from the beginning of the first record ('from range').

 QFSec -specifies the seconds from the beginning of the first record ('from range').

 QTYear -specifies the years up to the end of the last record ('up to range').

 QTMnth -specifies the months up to the end of the last record ('up to range').

 QTDate -specifies the dates up to the end of the last record ('up to range').

73
The AGA38 Application

 QTHour -specifies the hours up to the end of the last record ('up to range').

 QTMint -specifies the minutes up to the end of the last record ('up to range').

 QTSec -specifies the seconds up to the end of the last record ('up to range').

 Qnsmpl -specifies the number of samples performed once per second.

 Qflotm -specifies the flow time, measured in seconds.

 Q_Mass -specifies the total mass for the time range.

 Qenrgy -specifies the total energy for the time range

 QVolBs -specifies the total volume at base reference conditions, provided the
reference base pressure and temperature have not been changed.

Table #47, History Fetch


The History Fetch table includes the following parameters:

 FRun_N -specifies the run number that a record is to be fetched. The range is 1 to
the number of runs.

 FRIndex -specifies the record index number. The range is 1 to the number of

74
The AGA38 Application

records.

 FRec_T -specifies the record type. The available values are:

1 -Hourly transaction record

2 -Daily transaction record

3 -Event logger record

 F_Stat -specifies the return status for ‘fetch’ and ‘start fetching’ flag. The
available values are:

1 -start fetching (set by user).

0 -successful record fetch. When F_Stat=0, FRIndex is increased by 1 to allow


fetching the next record.

When the record fetch failed, F_Stat has negative values, as described below:

-1 -F_Stat was not 1 when 'h_next' was called from ladder.

-2 -the run number is out of range.

-3 -the record type is not an hourly, daily or event record type.

-4 -the record index is out of the range of saved records of a specific type for a
specific meter run.

-5 -the condition is out of range. The condition range is 1 to 12.

-6 -time range error or time error

75
The AGA38 Application

Table #48, Hourly/Daily Rec


The Hourly/Daily Rec table includes the following parameters:

 TRunNu -specifies the transaction record run number. The range is 1 to the number
of meter runs.

 TRIndx -specifies the transaction record index number. The range is 1 to the
number of transaction records.

 TRecTy -specifies the transaction record type. The available values are:

1 -Hourly transaction record

2 -Daily transaction record

 TRMID1 -specifies the transaction record alphanumeric meter identifier. The


identifier comprises the two most significant characters of the four character meter
alphanumeric identifier.

 TRMID2 -specifies the transaction record alphanumeric meter identifier. The


identifier comprises the two least significant characters of the four character meter

76
The AGA38 Application

alphanumeric identifier.

 O_Year -specifies the opening year of the transaction record.

 O_Mnth -specifies the opening month of the transaction record. The range is 1 to
12 months.

 O_Date -specifies the opening day of the transaction record. The range is 1 to 31
days.

 O_Hour -specifies the opening hour of the transaction record. The range is 1 to 23
hours.

 O_Mint -specifies the opening minute of the transaction record. The range is 1 to
59 minutes.

 O_Sec -specifies the opening seconds of the transaction record. The range is 1 to
59 seconds.

 C_Year -specifies the closing year of the transaction record.

 C_Mnth -specifies the closing month of the transaction record. The range is 1 to 12
months.

 C_Date -specifies the closing date of the transaction record. The range is 1 to 31
days.

 C_Hour -specifies the closing hour of the transaction record. The range is 1 to 23
hours.

 C_Mint -specifies the closing minute of the transaction record. The range is 1 to 59
minutes.

 C_Sec -specifies the closing seconds of the transaction record. The range is 1 to 59
seconds.

 Nsmpls -specifies the number of samples.

 Flowtm -specifies the flow time measured in seconds.

 Av_P -specifies the average flowing absolute pressure.

 Av_T -specifies the average flowing absolute temperature.

 Av_dP - specifies average flowing absolute differential pressure.

 Av_dnB -specifies the average density at base conditions.

 Mass -specifies the total mass.

 Energy -specifies the total energy.

 VolBas -specifies the total volume at base conditions.

 %Metha -specifies the average mol % of Methane

77
The AGA38 Application

 %Nitro -specifies the average mol % of Nitrogen

 %CrbnD -specifies the average mol % of Carbon_dioxide

 %Ethan -specifies the average mol % of Ethane

 %Propa -specifies the average mol % of Propane

 %Water -specifies the average mol % of Water

 %HydrS -specifies the average mol % of Hydrogen_sulfide

 %Hydro -specifies the average mol % of Hydrogen

 %CrbnM -specifies the average mol % of Carbon_monoxide

 %Oxyge -specifies the average mol % of Oxygen

 %i_But -specifies the average mol % of Isobutane

 %n_But -specifies the average mol % of N_butane

 %i_Pen -specifies the average mol % of Isopentane

 %n_Pen -specifies the average mol % of N_pentane

 %n_Hex -specifies the average mol % of N_hexane

 %n_Hep -specifies the average mol % of N_heptane

 %n_Oct -specifies the average mol % of N_octane

 %n_Non -specifies the average mol % of N_nonane

 %n_Dec -specifies the average mol % of N_decane

 %Heliu -specifies the average mol % of Helium

 %Argon -specifies the average mol % of Argon

The gas composition average parameters in this table are relevant only if they are being
saved in the historical hourly and daily transaction records, when SvCmps (in table #1) is
equal to 1.

78
The AGA38 Application

Table #49, Event Record


The Event Record table includes the following parameters:

 ERunNu -specifies the run number corresponding to the event record. The range is
1 to the number of meter runs.

 ERIndx -specifies the event record index number. The range is 1 to the number of
records.

 ERMID1 -specifies the event record alphanumeric meter identifier. The identifier
comprises the two most significant characters of the four character meter
alphanumeric identifier.

 ERMID2 -specifies the event record alphanumeric meter identifier. The identifier
comprises the two least significant characters of the four character meter
alphanumeric identifier.

 E_Year -specifies the event year.

 E_Mnth -specifies the event month. The range is 1 to 12 months.

79
The AGA38 Application

 E_Date -specifies the event day. The range is 1 to 31 days.

 Ehour -specifies the event hour. The range is 0 to 23 hours.

 E_Mit -specifies the event minute. The range is 0 to 59 minutes.

 E_Sec -specifies the event second. The range is 0 to 59 seconds.

 Parm_N -specifies the parameter (in case of a change) or the event number (in
case of an event). The available values are:

1 ≤ Parm_N ≤ 149: the event record is a parameter change notice.

500 ≤ Parm_N ≤ 507: the event record is an event exception.

1000 ≤ Parm_N ≤ 1030: the event record is an error exception.

2000 ≤ Parm_N ≤ 2007: the event record is a warning exception.

 OldVal -specifies the old value in case of a parameter change. When an error
occurs, its value is the value with which it is compared. In case of an error event,
this parameter may be meaningless.

 NewVal -specifies the new value in case of a parameter change. When an error
occurs, its value is the current value. In case of an error event, this parameter may
be meaningless.

80
The AGA38 Application

Table #50, Version Revision


The Version Revision table includes the following parameters:

 Vers_D -specifies the AGA3 1992 and the AGA8 1992 downloadable software
version.

 Rev_D -specifies the AGA3 1992 and the AGA8 1992 downloadable software
(AGA38 ‘C’ application revision.)

 Vers_A -specifies the AGA3 1992 and the AGA8 1992 ladder application version.

 Rev_A -specifies the AGA3 1992 and the AGA8 1992 ladder application revision.

81
The AGA38 Application

Table #51, Second counters


The Second counters table includes the following parameters:

 AGA8Sc -specifies the AGA8 second counter. When this counter equals IMP, the
AGA8 process is activated by the RUNP call.

 LastSc -specifies the last sampled value of the seconds counter.

 CurSc – specifies the current value of system seconds counter.

Table #52, Accumulators (o) 1-2


Non-resettable and resettable accumulators for Uncorrected Volume, Corrected Volume,
Mass and Energy.

The non-resettable accumulators (Acc1Qf, Acc1Qb, Acc1M, Acc1E ) are initialized to the
value set in the table (default 0.0) and cannot be further changed in runtime.

The resettable accumulators (Acc2Qf, Acc2Qb, Acc2M, Acc2E ) are initialized to the
value set in the table (default 0.0) and can be further changed in runtime.

82
The AGA38 Application

 Acc1Qf – Accumulative value for Uncorrected Volume (non-resettable


accumulator)

 Acc1Qb – Accumulative value for Corrected Volume (non-resettable accumulator)

 Acc1M – Accumulative value for Mass (non-resettable accumulator)

 Acc1E – Accumulative value for Energy (non-resettable accumulator). Start to


accumulate and initialize at load time (compilation).

 Acc2Qf – Accumulative value for Uncorrected Volume, reset and update from
value entered in table #53 Acc2QfU field.

 Acc2Qb – Accumulative value for Corrected Volume, reset and update from value
entered in table #53 Acc2QbU field.

 Acc2M – Accumulative value for Mass, reset and update from value entered in
table #53 Acc2MU field.

 Acc2E – Accumulative value for Energy, reset and update from value entered in
table #53 Acc2EU field.

83
The AGA38 Application

Table #53, Accumulators 2 Update


This table allows the user to update (Acc2Qf,Acc2Qb,Acc2M,Acc2E) resettable
accumulators with new values of Uncorrected Volume, Corrected Volume, Mass and
Energy.

 Acc2Updt – The update command.

1- Update command request. If Acc2Updt == 1 and Acc2Pass is a legal


password, the resettable accumulators (Acc2Qf,Acc2Qb,Acc2M,Acc2E) are
set to (Acc2QfU,Acc2QbU,Acc2MU,Acc2EU ) values.

 Acc2Pass – Password for taking the next fields as initialize and update values for
Table #52. See Acc2Updt above.

 Acc2QfU – New value for reset and update of table #52 for Acc2Qf field
(Uncorrected volume)

 Acc2QbU – New value for reset and update of table #52 for Acc2Qb field
(Corrected Volume).

 Acc2MU – New value for reset and update of table #52 for Acc2M field (Mass).

 Acc2EU – New value for reset and update of table #52 for Acc2E field (Enrgy).

84
The AGA38 Application

How to Customize the Database


When customizing the database, consider the following restrictions:

 Do not delete any table or any column from the AGA38 tables #1 to #53.

 Do not add any column in the AGA38 tables #1 to #53.

 Do not append any new table between the AGA38 tables #1 to #53.

New tables may be defined only before table #1 or after table #53.

85
The AGA38 Application

The Ladder Application


Most of the AGA software is written using the ‘C’ language. The ‘C’ code files are
compiled, linked and downloaded to the flash memory. Some functions are defined by the
user using the ladder diagram language. The ladder part of AGA consists of two processes:

Process Description
MAIN Main process
AGA8P AGA8 process

The Main Process Rungs


The Main Process rungs are:
Rung Description
Histry Retrieve hist. rec.
Get1S Get Current seconds from clock
Chck1S Check if 1 second
SaveSc Save the sec counter
ScanP Scan Pressure
ScanT Scan Temperature
ScanDP Scan Differential P.
ScanDn Scan densitometers
_aga3 Call to aga3
CALL_8 Wakeup AGA 8
SecCnt Count seconds
AGAOut Exit the AGA part
EntryC Entry for customer

Histry -Retrieve information from historical database.


This rung retrieves historical data from the historical database. There are two functions
h_next and hindex.

h_next -the main purpose of h_next is to fetch an hourly/daily or event record.

hindex -calculates the location of the record indices in the database and optionally fetches
the first record.
F_Stat
U h_next
= C
1 L

R_Stat R_Stat U hindex


> < C
0 3 L
Rung: Histry

86
The AGA38 Application

The h_next function


In order to fetch an hourly/daily or event record from the historical database, the HsFtch
(History Fetch) table should be first set to indicate the following parameters:

− the meter run number

− the record type (hourly, daily or event)

− the record number

When F_Stat (Fetch status) in the HsFtch (History Fetch) table equals 1, the h_next
function is activated.

The h_next function fetches one hourly/daily or an event logger record upon request set in
the HsFtch (History Fetch) table.

The hourly/daily records are fetched to the HrDlyR (Hourly/Daily Rec) table. The event
records are fetched to the EvntRc (Event record) table.

To Fetch the next record you should only set the F_Stat (Fetch status) in HsFtch (History
Fetch) table to 1, because the index (record number) is incremented after each successful
fetch.

The hindex function


In order to calculate the indices (location) of a group of time ranged records, the RIFind
(RecordIndexFind) table should be first set to indicate the following parameters:

− the meter run number

− the record type (hourly, daily or event)

− time1 -time range beginning

− time2 -time range end

− the compare conditions

The index of the first record and the number of records satisfying the conditions are set in
R_Indx and R_Num integers in the RIFind (RecordIndexFind table). In addition the
HsFtch (History Fetch) table is programmed to fetch the first record.

It is also possible to calculate the indices and fetch the first record. In this case, the HsFtch
(History Fetch) table is programmed to fetch the second record. The fetched record is
saved in the HrDlyR (Hourly/Daily Rec) table or in the EvntRc (Event record) table,
according to its type.

Get1S - Get Current seconds from clock.


This rung gets the current seconds "CurSc" from the clock.
U getCurSc
C CurSc
L
Rung: Get1S

87
The AGA38 Application

Chck1S -Check if the second counter has changed.


When the second counter shifts, the AGA3 is turned on. The transition is detected by
comparing the "CurSc" value to the "LastSc". If less than one second has passed, the
ladder exits the AGA part by jumping to the AGAOut rung.
CurSc AGAOut
= (JMP)
LastSc Rung: Chck1S

SaveSc -Save the current value of the second counter.


Saves the current value of the second counter, in order to subsequently compare it with the
running second counter. This way it determines if one second has passed.
LastSc
(MOV)
CurSc
Rung: SaveSc

ScanP –Scan static pressure meter rung.


Scan the P_Fail (module fail) bits for all static pressure meters.

Scan the P_Flow analog values for all static pressure meters.
P_Fail
(SCN)

P_Flow
(SCN)
Rung: ScanP

ScanT -Scan temperature meters rung.


Scan the T_Fail (module fail) bits for all static pressure meters. Scan the T_Flow analog
values for all static pressure meters
T_Fail
(SCN)

T_Flow
(SCN)
Rung: ScanT

ScanDP -Scan differential meters rung.


Scan the dP2Fal (module fail) bits for all optional differential pressure meters number 2.

Scan the dP2 analog values for all optional differential pressure meters number 2.

Scan the dP1Fal (module fail) bits for all differential pressure meters number 1.

Scan the dP1 analog values for all differential pressure meters number 1.

88
The AGA38 Application

dP2Fal
(SCN)

dP2
(SCN)

dP1Fal
(SCN)

dP1
(SCN)
Rung: ScanDP

ScanDn - Scan densitometers rung


Scan the DnFail (module fail) bits for all optional densitometers.

Scan the DnFlow - analog values for all optional densitometers.


DnFlow
(SCN)

DnFail
(SCN)
Rung: ScanDn

_aga3 -Call the AGA3 calculations.


Calls the AGA3 calculations for all the meter runs. The configuration table is CONFG1.

The AGA3 software presumes that the tables following CONFG1 remain in the same
order. A new table may be appended before the CONFIG1 table or after the last AGA
table.

U aga3
C CONFG1
L
Rung:_aga3

CALL_8 -Wakeup the AGA8 process.


When Aga8Sc = 0, the AGA 8 calculations may be activated.
Aga8Sc AGA8P
= (RNP)
0 TskPrD
Rung: CALL_8

SecCnt -Count seconds from last activation of AGA8.


1) Increment the Aga8Sc counter.

89
The AGA38 Application

2) If AGA8TP (the AGA8 time period) is greater than or equal to the Aga8Sc counter,
reset the counter. In this case, AGA8 will be activated on the next scan.
Aga8Sc
(CTU)

Aga8Sc Aga8Sc
> (RST)
AGA8TP

Aga8Sc
=
AGA8TP Rung: SecCnt

AGAOut
This is the common point for exiting the AGA application. The AGAOut rung is reached
every scan.

The rung performs a jump to the EntryC rung. EntryC is the entry point for the customer's
ladder.

EntryC
(JMP)
Rung: AGAOut

EntryC
The EntryC is the customer's starting point. The customer may add his application starting
from this rung.

Rung: EntryC

The Rung List for AGA8P Process


Rung Description
AGA8 Run AGA8 for All

U AGA8
C
L
Rung: AGA8

This rung calls for AGA8 functions written in the ‘C’ language.

How to Customize the AGA38 Application


When customizing the AGA38 application using the ladder diagram language, consider the
following restrictions:

• In the MAIN process, add your rungs starting from the EntryC rung.

If any rung is added prior to the EntryC, the quantity calculation result may not be correct!

90
The AGA38 Application

• The MAIN process scan time should be equal to or less than one second.

If the scan time is greater than one second, the integration (accumulation) process for
quantities may be not correct!

• It is recommended to leave the AGA8P process running under the TskprD priority
unchanged. However, if you decide to add any functions to this process, verify that a new
scan is performed each AGA8TP (AGA8 Time Period interval). AGA8TP is configured in
the AGA config table.

AGA 8 Calculations
The AGA8P process runs at TskPrD, the lowest ladder process. This process is activated
by AGA3 once in AGA8TP seconds (once in the AGA8 Time Period). The AGA8TP is
configured in the AGA config table.

The main purpose of this process is to calculate the density at base and flowing conditions,
the specific gravity and the volumetric gross heating value, which are used by the AGA3
process.

91
Stacked Differential Pressure Transducers

Stacked Differential Pressure Transducers

To increase the accuracy of the calculated mass, volume and energy flow rates on runs
where both low flow and high flow conditions are normal due to seasonal gas usage, two
differential pressure transducers may be utilized on the same run. Usually, they are overlap
in range where the low flow condition produces a mid-scale measurement on the lower
ranged transducer and the high flow condition produces a mid-scale measure on the higher
ranged transducer.

If dP1dP2,i = 0.0 then for meter run (i+1) only one differential pressure transducer is
utilized. In this case the AGA software assumes that the engineering value of differential
pressure is dP1,i and it is also assumed that there is no differential pressure read from any
transducer to dP2,i .

If dP1dP2,i is not equal to 0.0 then for meter run (i+1) two differential pressure
transducers are utilized. In this case dP1dP2,i is the switch value or what is called the
stacked differential pressure limit. In this case it is assumed that dP1,i is the value read
from the lower range transducer and dP2,i is the value read from the higher range
transducer.

The RTU will utilize the higher ranged transducer's measured value if any of the following
are true:

- The higher ranged transducer did not fail AND the higher ranged transducer’s
value is greater than the stacked differential pressure limit (dP1dP2,i).

- The lower ranged transducer failed and the higher ranged transducer did not.

The RTU will utilize the lower ranged transducer's measured value if any of the following
are true:

- The higher ranged transducer did not fail AND the higher ranged transducer
value is less than or equal to the stacked differential pressure limit (dP1dP2,i)
AND the lower ranged transducer did not fail.

- The higher ranged transducer failed and the lower ranged transducer did not.

If both transducers have failed then the flow calculation will utilize the differential
pressure according to the chosen freeze options. The available values are:

- Last valid differential pressure

- Last average differential pressure

- Default differential pressure

92
Stacked Differential Pressure Transducers

The general algorithm for determining differential pressure is:


if (dP1dP2,i is zero) then /* only dP1,i is used */
it is assumed that only the dP1,i is used
if (dP1,i is OK) then
dP1,i is the differential pressure
else /* some failure with dP1,i and only dP1,i is used */
the differential pressure is determined according
the freeze option
endif
else /* dP1dP2,i <> 0 (dP1,i and dP2,i are both used) */
if (dP1,i and dP2,i are both OK) then
if (dP1dP2,i < dP2,i) then
/* high range, take dP2,i */
dP2,i is the differential pressure
else
/* low range, take dP1 */
dP1,i is the differential pressure
endif
else /* some failure with dP1,i or dP2,i */
if (dP1,i is OK) then
dP1 is the differential pressure
else
if (dP2,i is OK) then
dP2,i is the differential pressure
else /* some failure with both dP1 and dP2 */
the differential pressure is determined
according to the freeze option
endif
endif
endif
endif

93
AGA Software Failure

AGA Software Failure

General
As already mentioned, the main purpose of AGA8 software is to calculate the flowing and
base densities and the gross volumetric heating value. These values are then used by the
AGA3 software to calculate the mass flow rate, the volumetric flow rate and the energy
flow rate.

In some situations, the AGA8 calculation cannot be performed or finalized, for example
when:

• The overall percentage of gases does not add up to 100%, or

• The iteration process to calculate the density does not converge.

Flowing Density
When the flowing density is not a live input, it is calculated by the AGA8. If it fails to
perform or finalize the calculations, the DnMode (flowing density mode or status) is equal
to calc_by_AGA8_failed state (5). In this case, the flowing density is determined
according to DnFrzO (density freeze option), similar to a live input. For options, see Live
Input Failures.

The base density is calculated by AGA8. If it fails to perform or finalize the calculations,
the DBMod (base density mode or status) is equal to calc_by_AGA8_failed state (2). In
this case, the base density is determined according to DBFrzO (base density freeze option).
The available values are:

0 - the default base density

1 - the last valid base density

Gross Volumetric Heating Value


The gross volumetric heating value is calculated by AGA8. If it fails to perform or finalize
the calculations, the HVMode (gross volumetric heating value mode or status) is equal to
calc_by_AGA8_failed state (2). In this case, the gross volumetric heating value is
determined according to HVFrzO (gross volumetric heating value freeze option). The
available values are:

0 -the default gross volumetric heating value

1 -the last valid gross volumetric heating value

94
AGA Software Failure

AGA3
In some situations, the AGA3 calculations cannot be performed or finalized. Then
RunMod is 1. The calculation of flow rates is frozen to one of the FrzOpt options:

0 -The volume/mass/energy flow rates are the defaults.

1 -The volume/mass/energy flow rates are the last calculated.

2 -The volume/mass/energy flow rates are the last calculated averages.

When a failure is detected, an event record is posted to the Event Logger. This event
record specifies the time and date of the event and the event itself. In addition an error
message is posted to the error logger and it can be retrieved using the Error Logger utility.

95
Meter Run Status

Meter Run Status

The RunStt table reflects the status of each meter run. The most severe current error or
warning is always displayed. See Table #22, Meter Run Status above.

The Status column shows the status of each meter run. The available values are:

0 -the meter run calculation is OK.

1 –AGA3 calculation failure. In this case, the error is described in the Err_Sw column.

2 -AGA8 calculation failure. In this case, the error is described in the Err_Sw column.

3 -the differential pressure failed.

4 -the static pressure meter failed.

5 -the temperature meter is failed.

6 -the optional densitometer failed.

7 -AGA calculation warning

The Err_Sw column displays the AGA3 or AGA8 calculation error (when Status = 1 or
Status = 2), or the warning (when Status = 7).

The list of errors displayed in the Err_Sw column (when Status = 1 or Status = 2) is:
1000- Flowing temperature too low
1001- Flowing temperature too high
1002- Flowing pressure too low
1003- Flowing pressure too high
1004- Base temperature too low
1005- Base temperature high
1006- Base pressure too low
1007- Base pressure high
1008- Gas composition error (some composition is negative or the sum is not 100%)
1009- Internal error (please report)
1010- AGA 8 cannot be calculated for non vapor
1011- AGA 8 calculation does not converge
1012- Unit type error.
1013- Element material error
1014- Tube material error
1015- Static tap location error
1016- Orifice diameter error (less than or equal to 0)
1017- Pipe diameter error (less than or equal to 0)
1018- Pipe diameter less than or equal to orifice diameter
1019- Not vapor and not liquid
1020- Viscosity is less than 0
1021- Plate thermal expansion coefficient is negative
1022- Tube thermal expansion coefficient is negative
1023- Flowing density is negative
1024- Base density is negative
1025- Differential pressure is negative
1026- AGA3 calculation does not converge
1027- Heating value reference temperature too high
1028- Heating value reference temperature too low

96
Meter Run Status

The list of warnings displayed in the Err_Sw column (when Status = 7) is:
2000- Reynold number is too small
2001- Reynold number is too large
2002 Beta ratio is too large
2003 Beta ratio is large
2004 Beta ratio is too small
2005 Beta ratio is small
2006 Bore is too small

97
Changing the Running Parameters on Line

Changing the Running Parameters on Line

The system integrator and the maintenance person are allowed to change all the parameters
of the meter run, except for the global configuration parameters defined in the AGA config
table.

The operator is required to change the orifice plate periodically. Therefore, he must freeze
the flow rate calculations using the Flow control table. See Table #19, Flow Control
above.

The operator may also change the orifice plate parameters in the AGA Statics 2 table. This
table specifies the orifice plate and tube parameters. See Table #4, AGA Statics 2 above.

98
Updating the Configuration Logger

Updating the Configuration Logger

The configuration logger parameters can be updated by new values taken from the tables.
The configuration logger can be updated on a meter run basis. Once the configuration
logger is updated, the AGA calculations proceed according to the new parameters. During
the configuration logger update, each parameter change is recorded in the event logger for
audit trail purposes.

In order to update the configuration logger for a specific run perform the following steps:

Step 1. In the Config Change table, set the CfUpdt,I parameter to 1. I is the index of the
meter run.

Step 2. In the Config Change table, set the CfPswd,I parameter to your password. The
passwords are set in the global configuration table (AGA config). If the
password is not correct, the configuration logger is not updated.

After the configuration logger is updated, both CfPswd,I and CfUpdt,I are cleared.

99
Updating the Configuration Logger

Changing Parameters for a Specific Meter Run


To change a sequence of parameters for a specific meter run, perform the following steps:

Step 1. Update all the required parameters in the user tables. At this stage, the
calculations are still performed according to the parameters in the configuration
logger, and not according to the updated parameters in the tables.

Step 2. Update the configuration logger of the specific run, as described in the previous
section.

100
Orifice Plate Replacement

Orifice Plate Replacement

During orifice plate replacement it is recommended to stop the flow rate calculations and
to freeze them according to one of the following freeze options:

 The volume/mass/energy default flow rates.

 The volume/mass/energy last calculated flow rates.

 The volume/mass/energy last calculated averages flow rates.

To freeze the flow rates calculations, perform the following steps:

Step 1. In the Flow control table, set the RunMod,I=2.

Step 2. Verify that the flow rates freeze option for the meter run is set to the correct
option.

The available options are:

Freeze option identifier for Default Last valid Last average


meter run #(I+1)

FrzOpt,I 0 1 2

If the flow rates freeze option is the default one, then the default values for flow rates are
taken from the following list of identifiers:

 QFDflt,I -the default volumetric flow rate at flow T, P

 QBDflt,I -the default volumetric flow rate at base T, P

 M_Dflt,I -the default mass flow rate

 E_Dflt,I -the default energy flow rate.

Step 3. Update the configuration logger. See Updating the Configuration Logger.

After performing these steps, the AGA3 flow rate calculations are stopped and the flow
rates are frozen to the required option. The live inputs are still scanned and displayed but
are not used in any calculation. The only purpose for scanning the live inputs during the
orifice plate replacement is for display.

When RunMod,I is equal to 2, the average calculations of the live inputs proceed
according to the freeze option of each live input. The available options are:

101
Orifice Plate Replacement

Freeze option identifier for Default Last valid Last average


meter run #(I+1)

Pressure PfrzOp 0 1 2
Temperature TfrzOp 0 1 2
Differential pressure dPFrzO 0 1 2
Densitometer DnFrzO 0 1 2

During the orifice plate replacement, if the read live input is in the permissible range and
no other failure has occurred, the status or mode of work of each live input meter is
unchanged. The available options are:

Live input status identifier Running Reading Manually


for meter run #(I+1) and OK failure frozen

Pressure P_Mode 0 1 2
Temperature T_Mode 0 1 2
Differential pressure dPMode 0 1 2
Densitometer DnMode 0 1 2

Replace the orifice plate. Following replacement, perform the following steps to restart the
meter run:

Step 1. In the Flow control table, set the RunMod,I=0 to restart the flow rates and
quantities calculations.

Step 2. Verify that the flow rates freeze option for the meter run is set to the correct
option.

The available options are:

Freeze option identifier for Default Last valid Last average


meter run #(I+1)

FrzOpt,I 0 1 2

Step 3. Verify that the default flow rates are properly set for running. The available
values are:

 QFDflt,I -the default volumetric flow rate at flow T, P

 QBDflt,I -the default volumetric flow rate at base T, P

 M_Dflt,I -the default mass flow rate

 E_Dflt,I -the default energy flow rate

Step 4. Update the configuration logger. See Updating the Configuration Logger.

102
Calibration

Calibration

The live inputs must be calibrated periodically. During calibration, the temperature,
pressure, differential pressure meters and optional densitometer readings are not accurate.
Therefore, it is recommended to freeze each calibrated input to one of the available
options: default, last valid or last average.

Step 1. Before starting the calibration process, set the following parameters for the
specific meter run:

P_Mode,I = 2: if the pressure is calibrated

T_Mode,I = 2: if the temperature is calibrated

dPMode,I = 2: if the differential pressure is calibrated

DnMode,I = 2: if the optional densitometer is calibrated

Step 2. Verify that the freeze options of the calibrated inputs are set to one of the
following values:

The available options are:

Freeze option identifier Default Last valid Last average

Pressure PFrzOp,I 0 1 2
Temperature TFrzOp,I 0 1 2
Differential pressure dPFrzO,I 0 1 2
Densitometer DnFrzO,I 0 1 2

Step 3. Also verify that the defaults are set to the required values. The available values
are:

 P_Dflt,I -the pressure

 T_Dflt,I -the temperature

 dPDflt,I - the differential pressure

 DnDflt,I - the densitometer

Step 4. Update the configuration logger. See Updating the Configuration Logger.

Step 5. Perform the calibration procedure.

103
Calibration

Step 6. After performing the calibration, change the following mode variables to RUN
mode:

P_Mode,I = 0: if the pressure is calibrated.

T_Mode,I = 0: if the temperature meter is calibrated.

dPMode,I = 0: if the differential pressure meter is calibrated.

DnMode,I = 0: if densitometer meter is calibrated.

Step 7. Verify that the freeze options of the calibrated inputs are set to one of the
following values:

Freeze option Default Last valid Last average


identifier

Pressure PFrzOp,I 0 1 2
Temperature TFrzOp,I 0 1 2
Differential pressure dPFrzO,I 0 1 2
Densitometer DnFrzO,I 0 1 2

Step 8. Also verify that the defaults are set to the required values. The available values
are:

 P_Dflt,I -the default pressure

 T_Dflt,I -the default temperature

 dPDflt ,I -the default differential pressure

 DnDflt,I - the default flowing density

Step 9. Update the configuration logger. See Updating the Configuration Logger.

Hourly Transaction Records


The hourly quantity transaction records are the average or summation of data collected and
calculated during a maximum of 60 consecutive minutes. An hourly transaction record
ends and a new hourly record begins at the end of each contract hour or any time a
constant flow parameter is changed.

A constant flow parameter includes only measured or known parameters that do not
depend on any averaged logged parameter.

There are 24 hourly transaction records per each day and an additional transaction record
per each time one or more constant flow parameter is changed. The following data is
collected in an hourly transaction records:

104
Calibration

 date period

 time

 mass, volume, energy

 flow time

 average differential pressure

 average temperature

 average static pressure

 average base density at base conditions

 optional average gas composition (when SvCmps=1)

The HistrH integer in the AGA config table specifies the maximum number of hourly
transaction records, per one meter run.

The TimeH integer in the AGA config table specifies the time period, measured in days,
for which the hourly transaction records are saved.

105
Daily Transaction Records

Daily Transaction Records

The daily quantity transaction records are the average or summation of data collected and
calculated during a contract day. A daily quantity transaction record ends and a new daily
record begins at the end of each contract day or any time a constant flow parameter is
changed.

A constant flow parameter includes only the measured or known parameters that do not
depend on any averaged logged parameter.

There is one daily quantity transaction record per each contract day plus an additional
daily transaction record per each time one or more constant flow parameter are changed.

The following data is collected in the daily quantity transaction record:

 date period

 time

 mass, volume, energy

 flow time

 average differential pressure

 average temperature

 average static pressure

 average base density at base conditions

 optional average gas composition (when SvCmps=1)

The HistrD integer in the AGA config table specifies the maximum number of daily
transaction records, per one meter run.

The TimeD integer in the AGA config table specifies the time period, measured in days,
for which the daily transaction records are saved.

106
Event Logger

Event Logger

The main purpose of the event logger is to note and record exceptions and changes to the
flow parameters contained in the configuration logger, that have an impact on the quantity
transaction record.

Upon each parameter change that affects the flow or quantities calculation, an event record
is posted to the event logger.

The event record includes the date and time of the change, the old and new values, the
identifier of the parameter changed and the identifier of the meter run.

An event record is also posted to the event logger for the following exceptions:

 AC power up time

 AC power fail time

 AC power recovery time

 time change

 errors

The events are listed chronologically in the event logger.

The HistrE integer in the AGA config table specifies the maximum number of events per
one meter run.

The TimeE integer in the AGA config table specifies the time period, measured in days, for
which the event records are saved.

107
Historical Data

Historical Data

As mentioned before, the hourly and daily transaction records and the event records are
saved for audit purposes.

The maximum number of saved records are specified in the HourRN, DayRN and EvntRN
columns of the History Info table, as described in section Table #44, History Info above.

The system integrator and the maintenance person are authorized to delete some or all of
the following data for a meter run:

 the hourly transaction records

 the daily transaction records

 the event records

To delete any historical data for the meter run #(I+1), perform the following steps:

Step 1. Set ClrPwd,I to the password of the system integrator or the maintenance
person

Step 2. Set ClrMod,I for the specific run. The available values are:

1 -clear all hourly transaction records, daily transaction records and event log

2 -clear all hourly transaction records

3 -clear all daily transaction records

4 -clear all event log records

After deleting the required records, ClrMod,I and ClrPwd,I are both set to zero as a
confirmation and the HourRN,I, DayRN,I and EvntRN,I are updated.

Historical Data Retrieval


The following tables contribute to historical data retrieval:

History Info table: This table is used to delete historical data and to view the
current number of historical records.

RecordsIndexFind table: This table is used to calculate the index of the first
record and the number of records satisfying some time conditions.

Time Range Qty table: This table is used to view the quantities derived from
transaction records over a period of time.

History Fetch table: This table is used to fetch one record according to an index of
the record.

108
Historical Data

Hourly/Daily Rec table: This table displays one hourly or daily transaction record.

Event Record table: This table displays one event record.

For further information, refer to the specific section for each table.

Hourly and Daily Transaction Record Description


The hourly and the daily record have the same format. For more details refer to the Table
#48, Hourly/Daily Rec section.

109
Configuration Logger Parameter List

Configuration Logger Parameter List

Table name Parameter name Parm_N as it appears


in the event record
AGA config Nruns 1
Units 2
IMP 3
Avgtch 4
BTU 5
HistrD 6
HistrH 7
HistrE 8
TimeD 9
TimeH 10
TimeE 11
PasswS 12
PasswO 13
PasswM 14
PasswV 15
AGA8WT 16
AGA8TP 17
SvCmps 142
SramBack 145
Contract Time CtrctH 18
CtrctM 19
CtrctS 20
AGA statics 1 M_ID1 21
M_ID2 22
P_Base 23
T_Base 24
FluidT 25
Isentr 26
Vscsty 27
AGA statics 2 Plat_M 28
Plac_C 29
Plat_d 30
Plat_T 31
Tube_M 32
Tube_C 33
Tube_D 34
Tube_T 35
Pressure Meter 1 P_Fail 36

110
Configuration Logger Parameter List

Table name Parameter name Parm_N as it appears


in the event record
TapLoc 37
P_Mode 38
PFrzOp 39
P_Dflt 40
P_Min 41
P_Max 42
Pressure Meter 2 P_Type 43
Elev_H 44
Temperature meter T_Fail 45
T_Mode 46
TFrzOp 47
T_Dflt 48
T_Min 49
T_Max 50
Diff. P. meter 1 dP1Fal 51
dP2Fal 52
LoFlow 53
dP1dP2 54
Diff. P. meter 2 dPMode 55
dPFrzO 56
dPDflt 57
dP1Min 58
dP1Max 59
dP2Min 60
dP2Max 61
Flow. density DnFail 62
DnMode 63
DnFrzO 64
DnDflt 65
Dn_Min 66
Dn_Max 67
Base density DBMod 68
DBFrzO 69
DBDflt 70
Heating Value HVMode 71
HVFrzO 72
HVDflt 73
HVTemp 74
HVPres 75
Gas Components 1 Methan 76
Nitrog 77
CrbnDi 78
Ethane 79

111
Configuration Logger Parameter List

Table name Parameter name Parm_N as it appears


in the event record
Propan 80
Water 81
HydrSu 82
Hydrog 83
Gas Components 2 CrbnMo 84
Oxygen 85
i_Buta 86
n_Buta 87
i_Pent 88
n_Pent 89
n_Hexa 90
n_Hept 91
Gas Components 3 n_Octa 92
n_Nona 93
n_Deca 94
Helium 95
Argono 96
Chromotograph ChrUsd 97
Parms for Calc DBCalc 98
HVCalc 99
AGA 8 90 output Z_Base 100
Gr 101
Flow control RunMod 102
FrzOpt 103
QFDflt 104
QBDflt 105
M_Dflt 106
E_Dflt 107
Accumulators 1-2 Acc2Qf 146
Acc2Qb 147
Acc2M 148
Acc2E 149

112
Event Exceptions

Event Exceptions

Event description Parm_N as it appears


in the event record
Power up 500
The time before it is being changed 501
The time after it has been changed 502
Power fail 503
Warm restart (power recovery) 504
The daily transaction records were cleared 505
The hourly transaction records were cleared 506
The event records in the logger were cleared 507

Error Exceptions

Error exception description Parm_N as it


appears in the event
record
Flowing temperature is too low 1000
Flowing temperature is too high 1001
Flowing pressure is too low 1002
Flowing pressure is too high 1003
Base temperature is too low 1004
Base temperature is too high 1005
Base pressure is too low 1006
Base pressure is too high 1007
Gas composition error(negative or in total not 100% 1008
AGA8 activation internal error 1009
AGA8 does not perform calculations for non vapor 1010
AGA8 calculations do not converge 1011
Units definition error 1012
Orifice plate material definition error 1013
Tube material definition error 1014
Static tap location definition error 1015
Small diameter (d) is less than or equal to zero 1016
Big diameter (D) is less than or equal to zero 1017
Small diameter ≥ Big diameter 1018
State definition error 1019
Viscosity is negative 1020
The orifice plate thermal expansion factor is negative 1021
The tube thermal expansion factor is negative 1022
Flowing density is negative 1023
Density at base conditions is negative 1024
Differential pressure is negative 1025
AGA 3 calculations do not converge 1026
Heating value reference temperature is too high 1027
Heating value reference temperature is too low 1028

113
Warning Exceptions

Warning Exceptions

Warning exception description Parm_N as it


appears in the event
record
Reynold number is too small 2000
Reynold number is too large 2001
Beta ratio is too large 2002
Beta ratio is large 2003
Beta ratio is too small 2004
Beta ratio is small 2005
Bore is too small 2006

114
AGA History Upload Tool

AGA History Upload Tool

The AGA History Upload Tool is installed independently of the STS. This tool uploads the
AGA historical database from a selected RTU to a Microsoft Excel® compatible, comma
separated file on the PC. The historical records can then be viewed and analyzed by the
user in the tool or using Excel.

For more information, see the AGA History Upload Tool User Guide.

115
Upgrading the MOSCAD AGA Application to ACE3600

Upgrading the MOSCAD AGA Application


to ACE3600

MOSCAD AGA applications can be upgraded to work on the ACE3600 RTU. Below are
some tips to help make this process go smoothly.

Guidelines have been provided with the STS installation directory to help upgrade your
application from MOSCAD to ACE3600. In the [C|D]:\STS<version>\Doc folder, open
the file entitled STS_Application_Note_-_legacy_ladder_application_upgrade.htm.

Carefully follow the steps in the note, specifically the chapter entitled “Application
upgrade (from MOSCAD Toolbox)”. Once you have upgraded the application to
ACE3600, do the following:

1. In the ACE3600 Application Programmer, open your upgraded AGA38 ladder diagram
process.

 Refer to this manual and to the AGA38 example projects provided by Motorola for
reference.

 Modify the upgraded ladder in the ACE3600 application to match the structure in
the reference ladders (modifying/adding/removing elements and variables as
necessary.)
Note: If the ladder is not updated, the AGA may not run correctly.

2. In the ACE3600 Application Programmer, open your upgraded AGA38 database


tables.

 Refer to this manual and to the AGA38 example projects provided by Motorola for
reference.

 Modify the upgraded database tables in the ACE3600 application to match the
structure in the reference database tables.

Upgraded tables:
In table #1 AGA config, add a new row ‘SvCmps’ (row 17).
In table #1 AGA config, add a new row ‘Sramback’ (row 18) at the end.
New table: Add a new table ‘Accumulators (O) 1-2’ (#52 in the example
project.)
New table: Add a new table ‘Accumulators 2 Update (I)’: (#53 in the example
project.)
Note: If the tables are not updated, the AGA may not run correctly.

3. If you have your own tables, review them and modify as necessary to suit the
ACE3600.

IMPORTANT:

 Do not change the order of the AGA38 tables.

116
Upgrading the MOSCAD AGA Application to ACE3600

 Do not insert a user-defined table in between AGA38 tables. Append them


AFTER the AGA38 tables, or insert them BEFORE the AGA38 tables.

 Do not remove or omit any of the AGA38 tables.

4. Upgrade the process rungs. These changes in the rungs are necessary for the
application to be run.

 If your MOSCAD application rungs are the same as the MOSCAD AGA38 Demo
application, update the first five rungs according to ACE3600 AGA38 Demo
application. Review each rung in the ACE3600 AGA38 Demo application
carefully and update your rungs accordingly.
Note that the 'Histry' (Retrieve hist. rec.) rung should no longer call ‘upload’.

The name of the rung ‘aga3’ (Call to AGA3) should be changed to ‘_aga3’ (Call
to AGA3).

 If your MOSCAD application rungs are different than the MOSCAD AGA38
Demo application, study the AGA38 ACE3600 rungs carefully before applying
the changes to your application.

117
Merging a User-Developed ‘C’ Application with AGA38

Merging a User-Developed ‘C’ Application


with AGA38

The AGA38 ‘C’ application driver (aga38_c_driver.plz) uses the following tasks from the
list of available tasks for ‘C’ applications:

 CB_TaskA

 CB_TaskB

When merging a user-developed ‘C’ application with the AGA38 application, bear in mind
that both tasks (CB_TaskA, CB_TaskB) are used by AGA38 and should not be activated
or used by user-developed ‘C’ application:

When AGA38 and PID applications are used together on an ACE3600 platform, the
following tasks should not be activated or used by a user-developed ‘C’ application:

 CB_TaskA (task used by AGA38)

 CB_TaskB (task used by AGA38)

 CB_TaskE (task used by PID)

 CB_TaskD (task used by PID)

118

You might also like