Professional Documents
Culture Documents
Aga38 - Gas - Calculations On ACE3600
Aga38 - Gas - Calculations On ACE3600
Flow Calculations
6802987C05-A
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
ii
Specifications
Specifications
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.
Calculation Precision Calculations are made using double precision floating point.
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.
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
Engineering Units Supported Eight types of units are supported: US1, US2, US3, IP,
METRIC1, METRIC2, METRIC3, SI
Orifice Plate Materials and Stainless Steel, Monel, Carbon Steel, Other.
Tube Materials Supported
If Other, the Plate/Tube thermal expansion coefficient must
be specified.
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
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.
v
General
The ACE3600 RTU supports two well-known standards for natural gas orifice metering:
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:
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.
This standard has been adopted and recommended by the following institutes:
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.
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
- Optional densitometer
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:
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:
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 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 SRAM card must be installed on the CPU module. See the SRAM (Static
RAM) Memory Plug-in Requirements section for more information.
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:
3
Software Installation
AGA38 memory requirement size = {25000 + {Nruns [Ts(Nh + Nd) + 28Ne + 23000]} } *Bf
where:
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:
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
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
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
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.)
6
Software Installation
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.
Advanced tab -> Timer Service -> Number of '100 msec' ticks passed before declaring
error <3-10> [4]: as follows:
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
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:
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
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.
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
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:
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.
Pressure PfrzOp 0 1 2
Temperature TfrzOp 0 1 2
Densitometer DnFrzO 0 1 2
Pressure P_Mode 0 1 2
11
Software Installation
Temperature T_Mode 0 1 2
Densitometer DnMode 0 1 2
12
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.
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.
0 Qualifiers
16 Chromotograph (I)
13
The AGA38 Application
45 RecordsIndexFind (I)
14
The AGA38 Application
52 Accumulators (O)
53 Accumulators 2 (I)
Update
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
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.
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).
T Temperature °F °F °F °F
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
Elevation ft ft ft ft
Volume 3 3 3 3
ft ft ft ft
T Temp. °C °C °C °K
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
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
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.
NOTE:
It is recommended that the IMP parameter be greater than the AGA8TP parameter.
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:
18
The AGA38 Application
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.
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.
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
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.
20
The AGA38 Application
M_ID1 & M_ID2 - the meter ID (two integers for four characters)
Isentr - isentropic exponent. This parameter is not relevant for liquid flow
calculation.
Vscsty - viscosity
21
The AGA38 Application
0 - Stainless Steel
1 - Monel
2 - Carbon Steel
3 - other. If Plat_M=3, then Plat_C (plate thermal expansion coefficient) should
be specified.
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.
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
23
The AGA38 Application
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
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
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).
24
The AGA38 Application
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
T_Flow is a scaled analog input (sAI) with the following configuration table.
0 0% 0.0 1.0
1 0% 0.0 1.0
T_Fail - fail bit for module including the analog input of the flowing temperature
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
T_Dflt - the default temperature. This option is relevant if the temperature freeze
option (TFrzOp) is active and is equal to 0.
27
The AGA38 Application
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
dP1Fal - fail bit for module including the analog input of dP1
dP2Fal - fail bit for module including the analog input of dP2, if any.
29
The AGA38 Application
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:
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
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
DnFail - fail bit for module including the analog input of the optional
31
The AGA38 Application
densitometer.
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:
DnDflt - the default density when the ‘density is frozen’ option is active and
DnFrzO is 0 or DnMode=3.
32
The AGA38 Application
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:
33
The AGA38 Application
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:
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)
35
The AGA38 Application
36
The AGA38 Application
37
The AGA38 Application
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:
e) Gas composition
38
The AGA38 Application
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)
HVCalc -specifies the heating value for AGA3 (calculated by AGA8 or default)
39
The AGA38 Application
HV8 -specifies the volumetric gross heating value at heating value reference
temperature.
40
The AGA38 Application
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.
41
The AGA38 Application
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.
42
The AGA38 Application
b) the operator’s
c) a maintenance person’s
CfPswd -specifies the password. The updated parameters vary, according to the
type of password.
43
The AGA38 Application
Status -specifies the run status. The following values are available:
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.
44
The AGA38 Application
7 -Warning
45
The AGA38 Application
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
QbCurH -specifies the volume at base conditions for the current (not yet
terminated) contract hour
47
The AGA38 Application
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
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
49
The AGA38 Application
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
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
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
dPBfrN - specifies the average differential pressure during the day before
yesterday, including ‘no flow’ periods.
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
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.
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.
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.
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.
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.
58
The AGA38 Application
LstAQf -specifies the last calculated volumetric flow rate average at flowing
conditions.
LstAQb -specifies the last calculated volumetric flow rate average at base
conditions.
59
The AGA38 Application
DBMaxP -specifies the day before yesterday maximum absolute static pressure.
DBMinP -specifies the day before yesterday minimum absolute static pressure.
60
The AGA38 Application
LDMaxP -specifies the last contract day maximum absolute static pressure.
LDMinP -specifies the last contract day minimum absolute static pressure.
61
The AGA38 Application
CDMaxP -specifies the current contract day maximum absolute static pressure.
CDMinP -specifies the current contract day minimum absolute static pressure.
62
The AGA38 Application
LHMaxP -specifies the last contract hour maximum absolute static pressure.
LHMinP -specifies the last contract hour minimum absolute static pressure.
63
The AGA38 Application
CHMaxP -specifies the current contract hour maximum absolute static pressure.
CHMinP -specifies the current contract hour minimum absolute static pressure.
64
The AGA38 Application
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
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
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.
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.
RRun_N -specifies the run number which retrieves a record. The range is 1 to the
number of runs.
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').
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.
- 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
- 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.
71
The AGA38 Application
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:
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').
QVolBs -specifies the total volume at base reference conditions, provided the
reference base pressure and temperature have not been changed.
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.
F_Stat -specifies the return status for ‘fetch’ and ‘start fetching’ flag. The
available values are:
When the record fetch failed, F_Stat has negative values, as described below:
-4 -the record index is out of the range of saved records of a specific type for a
specific meter run.
75
The AGA38 Application
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:
76
The AGA38 Application
alphanumeric identifier.
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_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.
77
The AGA38 Application
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
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.
79
The AGA38 Application
Parm_N -specifies the parameter (in case of a change) or the event number (in
case of an event). The available values are:
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
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
AGA8Sc -specifies the AGA8 second counter. When this counter equals IMP, the
AGA8 process is activated by the RUNP call.
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
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
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
Do not delete any table or any column from 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
Process Description
MAIN Main process
AGA8P AGA8 process
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
86
The AGA38 Application
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 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.
87
The AGA38 Application
Scan the P_Flow analog values for all static pressure meters.
P_Fail
(SCN)
P_Flow
(SCN)
Rung: ScanP
T_Flow
(SCN)
Rung: ScanT
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
DnFail
(SCN)
Rung: ScanDn
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
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
U AGA8
C
L
Rung: AGA8
This rung calls for AGA8 functions written in the ‘C’ language.
• 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
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:
92
Stacked Differential Pressure Transducers
93
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:
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:
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:
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
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:
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.
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
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
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
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
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:
Step 2. Verify that the flow rates freeze option for the meter run is set to the correct
option.
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:
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
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:
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.
FrzOpt,I 0 1 2
Step 3. Verify that the default flow rates are properly set for running. The available
values are:
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:
Step 2. Verify that the freeze options of the calibrated inputs are set to one of the
following values:
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:
Step 4. Update the configuration logger. See Updating the Configuration Logger.
103
Calibration
Step 6. After performing the calibration, change the following mode variables to RUN
mode:
Step 7. Verify that the freeze options of the calibrated inputs are set to one of the
following values:
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:
Step 9. Update the configuration logger. See Updating the Configuration Logger.
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
flow time
average temperature
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
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.
date period
time
flow time
average temperature
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
time change
errors
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:
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
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.
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.
For further information, refer to the specific section for each table.
109
Configuration Logger Parameter List
110
Configuration Logger Parameter List
111
Configuration Logger Parameter List
112
Event Exceptions
Event Exceptions
Error Exceptions
113
Warning Exceptions
Warning Exceptions
114
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
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.
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:
116
Upgrading the MOSCAD AGA Application to ACE3600
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
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:
118