ControlEdge Builder Function and Function Block Configuration Reference Guide-RTDOC-X286-en-170A
ControlEdge Builder Function and Function Block Configuration Reference Guide-RTDOC-X286-en-170A
ControlEdge RTU
Release 170
2
Contents
CONTENTS
Contents 3
Chapter 1 - About this guide 13
Chapter 2 - Overview of Honeywell Provided Libraries 17
Chapter 3 - AGA 23
AGA8_GrossMethod1 26
AGA8_GrossMethod2 31
AGA8_DetailMethod 37
AGA8_GERGMethod 45
AGA3_Orifice 50
AGA3_Orifice_LIQ 57
AGA7_Turbine and AGA9_Ultrasonic 61
AGA11_Coriolis 66
AGA5_HV_CONSTANT 68
AGA5_DETAIL 69
3
Contents
4
Contents
HW_BYTES_TO_DWORD 250
HW_BYTES_TO_WORD 251
HW_BYTE_OF_DINT 251
HW_BYTE_OF_INT 252
HW_BYTE_OF_DWORD 252
HW_BYTE_OF_UDINT 253
HW_BYTE_OF_UINT 253
HW_BYTE_OF_WORD 254
HW_SINT_TO_BITS 254
HW_SINT_OF_DINT 255
HW_SINT_OF_DWORD 255
HW_SINT_OF_INT 256
HW_SINT_OF_UDINT 256
HW_SINT_OF_UINT 257
HW_SINT_OF_WORD 257
HW_SINTS_TO_DINT 258
HW_SINTS_TO_DWORD 258
HW_SINTS_TO_INT 259
HW_SINTS_TO_UDINT 259
HW_SINTS_TO_UINT 260
HW_SINTS_TO_WORD 260
HW_USINT_OF_INT 261
HW_USINT_OF_UDINT 261
HW_USINT_OF_DINT 262
HW_USINT_OF_DWORD 262
HW_USINT_OF_UINT 263
HW_USINT_OF_WORD 263
5
Contents
HW_USINT_TO_BITS 264
HW_USINTS_TO_DINT 264
HW_USINTS_TO_DWORD 265
HW_USINTS_TO_INT 265
HW_USINTS_TO_UDINT 266
HW_USINTS_TO_UINT 266
HW_USINTS_TO_WORD 267
HWAI2PV 267
HWAO 268
HWAUTOMAN 270
HWCV2AO 276
HWDACA 277
HWFANOUT 282
HWIOSTS 287
HWMCC 288
HWMLV 296
HWMOV 307
HWNOMINATION 318
HWOVERSEL 326
HWTOTALISER 330
HWPI 339
HWPIACC 342
HWPID 344
HWRATIOCTL 357
HWRETAIN 364
HWSDV 366
HWSLEWRATE 377
6
Contents
HWSPLITRNG 378
HWTOT_LREAL_TO_REAL 379
7
Contents
HEATING_VALUE_US_TO_SI 419
INH2O_TO_MPA 420
KGPERM_TO_REL_DENSITY 420
KPA_TO_PSIG 421
MASS_FLORATE_US_TO_MET 422
MILIBAR_TO_INH2O 423
MILIBAR_TO_MPA 423
PSIA_TO_MPA 424
RELATIVE_DENSITY_TO_KGPE 425
THERMAL_EXPAN_CEL_TO_FEH 425
THERMAL_EXPAN_FAH_TO_CEL 426
VISCO_US_TO_CENTIPOISE 427
8
Contents
9
Contents
UaNamespaceGetIndex 528
UaTranslatePath 530
UaTranslatePaths 533
UaNodeGetHandle 535
UaNodeGetHandleList 538
UaNodeReleaseHandle 540
UaNodeReleaseHandleList 542
UaMethodCall 544
UaMethodReleaseHandle 545
UaMethodGetHandle 547
UaRead 549
UaReadList 552
UaWrite 556
UaWriteList 559
UA_MonitoredItemAdd 562
UAMonitoredItemRemove 564
UASubscriptionCreate 565
UA_SubscriptionDelete 566
UASubscriptionOperate 567
The Block Diagram 568
Read and Write 568
Calling Methods 569
OPC UA DataType Reference 570
OPC UA Error Code Reference 575
10
Contents
HonUaHandleDetector 599
HonUaManageSubscription 599
HonUaReadNode 600
HonUaReadNodeList 601
HonUaStateDetector 603
HonUaSubscribeNode 603
HonUaTranslatePathList 604
HonUaVariantToString 606
HonUaWriteNode 606
HonUaWriteNodeList 607
11
Contents
Notices 666
12
CHAPTER
Revision history
Intended audience
This documentation is intended for the following audience: Users who
plan, install, configure, operate, or maintain ControlEdge™ 900 and
2020 controllers running the eCLR (IEC 61131-3) execution
environment.
Prerequisite skills
Knowledge of SCADA systems and experience of working in a
Microsoft Windows environment are required.
Special terms
The following table describes some commonly used industry-wide
and Honeywell-specific terminology:
13
Chapter 1 - About this guide
Terminology Description
AI Analog Input
AO Analog Output
ControlEdge A integrated configuration tool to design, configure, program and
Builder maintain ControlEdge controllers.
DI Digital Input
DO Digital Output
EFM Electronic Flow Measurement
Experion® Experion® Process Knowledge System
PKS
HART-IP HART-IP extends the HART protocol to Ethernet connected nodes. This
facilitates host level systems and asset management applications to
access and integrate measurement and device diagnostics information
from HART-enabled field devices using the existing plant networking
infrastructure.
Modbus A communication protocol supports communication between Modbus
slave devices and Modbus master devices via serial port or Ethernet
port.
OPC UA An industrial machine-to-machine (M2M) communication protocol is
developed by the OPC Foundation, which provides a path forward from
the original OPC communications model (namely the Microsoft
Windows only process exchange COM/DCOM) to a cross-platform
service-oriented architecture (SOA) for process control, while enhancing
security and providing an information model.
PI Pulse Input
SCADA Supervisory Control and Data Acquisition
Related documents
The following list identifies publications that may contain information
relevant to the information in this document.
14
Chapter 1 - About this guide
15
Chapter 1 - About this guide
16
CHAPTER
Licensed Library
Library Name Short Description
By Type
Base HWFBLib User HWFBLib provides library of common
regulatory and device control function
blocks based on Honeywell’s mature
control products.
Funclib Firmware Funclib provides some common utility
functions for processing values such as
max, min, linearization, etc.
HART and HART_ Firmware These function blocks access the HART
V2 field devices connected to HART-enabled
AI/AO channels. HART command 3 and
command 48 are supported.
UnitConversionlib Firmware Converts temperature from Fahrenheit to
Kelvin, temperature from Celsius to Kelvin,
temperature from Fahrenheit to Rankine,
etc.
Utilitylib Firmware Utility sets the controller Real Time Clock
by a provided Timestamp value and reads
out the current time and date from the
real-time clock and presents them as
parameters.
MODBUS Firmware Modbus is a serial communication
protocol developed by Modicon
published by Modicon® in 1979 for use
with its programmable logic controllers
(PLCs). In simple terms, it is a method
used for transmitting information over
serial lines between electronic devices.
OPC UA Firmware OPC UA is a machine to machine
communication protocol for industrial
17
Chapter 2 - Overview of Honeywell Provided Libraries
Licensed Library
Library Name Short Description
By Type
automation developed by the OPC
Foundation.
OPCUAFBHelpers User Honeywell Provided OPCUA Function
blocks.
CRC_16 Firmware Calculates CRC-16
User Defined Firmware Receives user defined data from the target
device and send user defined data to the
target device.
ETHERNETIP Firmware Reads a variable value from a peer to peer
controller and writes a value to a peer to
peer controller through the tag name.
MDIS Firmware The MDIS library has a set of OPC UA
function blocks representing all the MDIS
OPC UA object types as defined in the
MDIS OPC UA Companion Specification
V1.2. The MDIS OPC UA Object function
blocks are used to obtain data from MDIS
OPC UA compliant Servers.
ELEPIU User Connects to the ELEPIU MUX board and
provides the temperatures in a data
structure for SCADA or PCDI connections.
Gas and AGALib and Firmware Calculates Gas Super compressibility,
Liquid AGALib_V2 and Density and Compressibility at standard
Metering AGALib_V3 and flowing conditions using heating
Calculation value/ without heating value/ all 21 gas
Library elements; calculates Gas energy using gas
heating value/ all 21 gas elements;
calculates corrected flow rates for Orifice
meter; calculates corrected flow rates for
Turbine meter; calculates corrected flow
rates for Ultrasonic meter; calculates
corrected flow rate for Coriolis meter.
API 11.1 Lib Firmware API 11.1 calculates for Crude Oil,
Lubricating Oil, Refined Products, Special
Products with Alternate conditions and or
Observed conditions in both US units and
Metric Units.
18
Chapter 2 - Overview of Honeywell Provided Libraries
Licensed Library
Library Name Short Description
By Type
API 21.1 Lib and Firmware This library provides function blocks to
API 21.1 Lib_V2 support API21.1 for electronic gas
measurement systems. These function
blocks provide flow measurement,
reporting and change management logs
required for accurate and auditable gas
measurement.
API 21.2 Lib and Firmware This library provides function blocks to
API 21.2 Lib_V2 support API 21.2 measures the liquid flow
for the configured meter type. The
function block calculates meter density,
Gross and Net standard volume,
Sediments and Water volume, mass flow
rate, averaging and Totalization based on
the input parameters. It generates events,
alarms, hourly and daily QTR's which can
be read from SCADA using MODBUS or
DNP3 protocol.
apingl lib Firmware The basic function of API NGL block when
set for line to base operation is to
calculate standard density and associated
volume correction factor from an
observed density, temperature and
pressure with an option to either calculate
a vapor pressure or use an operator
entered value. The basic function of API
NGL block when set for base to line
operation is to calculate meter density
and associated volume correction factor
from an observed density, temperature
and pressure with an option to either
calculate a vapor pressure or use an
operator entered value.
ISO5167DualLib Firmware ISO 5167 is an international standard
covering the measurement of fluid flow by
means of pressure differential devices
such as orifice plates and venturis. When
some parameters are known, ISO 5167
allows other variables to be calculated.
19
Chapter 2 - Overview of Honeywell Provided Libraries
Licensed Library
Library Name Short Description
By Type
The most common usage is to calculate
mass flow rate from differential pressure,
static pressure and density. ISO 5167 is
widely used in most areas of the world
except North America. The basic function
of the ISO 5167 block is to calculate mass
flow rate from primary element DP and
other required inputs.
ISO5167DualJTLib Firmware ISO 5167JT is an international standard
covering the measurement of fluid flow by
means of pressure differential devices
such as orifice plates and venturis. When
some parameters are known, ISO 5167
allows other variables to be calculated.
The most common usage is to calculate
mass flow rate from differential pressure,
static pressure and density. ISO 5167 is
widely used in most areas of the world
except North America. The basic function
of the ISO 5167 block is to calculate mass
flow rate from primary element DP and
other required inputs.
ISO6976lib Firmware ISO 6976 block calculates for Calorific
value on a molar, mass and volumetric
basis; Calorific value on a superior and
inferior basis; Calculation of values on an
ideal and a real basis; Standard density
and compressibility at the 15 deg C and
1.01325 bara conditions regardless of the
chosen combustion/ metering.
20
Chapter 2 - Overview of Honeywell Provided Libraries
Library Specification
Metering Gas
Calculation
AGA 3 (1992) Orifice Meter
Library
AGA 3 (2012) Orifice Meter
AGA 5 (2009) Volume to Energy Calculation
AGA 7 (1996) Turbine Meter
AGA 8 (1994) Gas Compressibility
AGA 8 (2017) Gas Compressibility
AGA 9 (1996) Ultrasonic Meter
AGA 11 (2013) Coriolis Meter
ISO 6976 (1995) Natural gas: calorific value density, relative
density and Wobbe Index
Liquid
21
Chapter 2 - Overview of Honeywell Provided Libraries
22
CHAPTER
3 AGA
The following libraries of AGA Function Blocks are supported:
Library Description
AGALib Basic version of AGA function block library. It supports AGA 3 (1992), AGA5
(1996), AGA8 (1994), AGA 7(1996), AGA 11 (2013) and AGA 9 (1996)
Function block with structure input is not supported and will not be
available in this library.
NOTE: When the outcode for any of the function block in AGALib_V3
is error, other corresponding output parameters from the same
function block are invalid. Hence caution must be taken in project
engineering when processing of the output parameters in conjunction
with the outcode.
23
Chapter 3 - AGA
24
Chapter 3 - AGA
25
Chapter 3 - AGA
AGA8_GrossMethod1
Description
AGA8_GrossMethod1 and AGA8_GrossMethod1_st calculate Gas
Compressibility, Density and Gas Super-compressibility at base,
standard and flowing condition that is flowing temperature and
pressure based on the input parameters defined below.
n AGA8_GrossMethod1
26
Chapter 3 - AGA
Input
Data
Input Parameter Description
types
UnitSystem INT {1} for US unit system and {2} for Metric unit
system
GasCompFormat INT Gas Composition Format:
27
Chapter 3 - AGA
Data
Input Parameter Description
types
Hydrogen_Fraction LREAL It can be in Mole Fraction or Percentage.
CO_Fraction LREAL It can be in Mole Fraction or Percentage.
FlowingTemp LREAL It is in FAHRENHEIT for US unit and Celcius
for Metric unit.
FlowingPressure LREAL It is in PSIA for US unit and Kpa for Metric
unit.
DifferentialPressure LREAL It is in INH2O for US unit and in Kpa for
Metric unit.
28
Chapter 3 - AGA
Data
Input Parameter Description
types
Recommended default value is 60 °
Fahrenheit.
RefPressForCalorimeterDensity LREAL It is the reference pressure for Calorimeter
Density. It is in PSIA for US unit and Kpa for
Metric unit.
Output
Data
Output Parameter Description
types
GasDensityAtFlowCond LREAL It is Gas Density at flowing temperature and
pressure. It will be in KG/M^3 for (Metric System) &
LBM/FT^3 for (US System). It is an input to AGA3
Function Block.
GasDensityAtBaseCond LREAL It is Gas Density at base temperature and pressure.
It will be in KG/M^3 for (Metric System) &
LBM/FT^3 for (US System).
29
Chapter 3 - AGA
Data
Output Parameter Description
types
GasSuperCompBaseCond LREAL It is gas super-compressiblity factor at standard
conditions. It is an input to AGA 3 function block
and it is unitless.
GasRelDenAtStdCond LREAL It is Gas Relative Density at standard temperature
and pressure. It is an input to AGA3 Function
Block. It is unitless.
Zb LREAL It is gas compressibility factor at base condition.
Zf LREAL It is gas compressibility factor at flowing
condition.
Out_Code INT This out parameter returns success or fail code.
30
Chapter 3 - AGA
AGA8_GrossMethod2
Description
This AGA8_GrossMethod2 function block calculates Gas
Compressibility, Density and Gas Super-compressibility at base,
standard and flowing condition that is flowing temperature and
pressure based on the input parameters defined below. It takes
Nitrogen fraction as input but does not take gas heating value. This
description is applicable to following function blocks
n AGA8_GrossMethod2
31
Chapter 3 - AGA
Input
Data
Input Parameter Description
types
UnitSystem INT {1} for US unit system and {2} for Metric unit
system
GasCompFormat INT Gas Composition Format - {1} for Mole Fraction
and {2} for Percentage
32
Chapter 3 - AGA
Data
Input Parameter Description
types
Metric unit.
FlowingPressure LREAL It is in PSIA for US unit and Kpa for Metric unit.
DifferentialPressure LREAL It is in INH2O for US unit and in Kpa for Metric
unit.
Ouput
Data
Output Parameter Description
types
GasDensityAtFlowCond LREAL It is Gas Density at flowing temperature and
pressure. It will be in KG/M^3 for (Metric System) &
LBM/FT^3 for (US System).It is an input to AGA3
Function Block
33
Chapter 3 - AGA
Data
Output Parameter Description
types
GasDensityAtBaseCond LREAL It is Gas Density at base temperature and pressure.
It will be in KG/M^3 for (Metric System) &
LBM/FT^3 for (US System).
34
Chapter 3 - AGA
Following is the table that describes different out code for both
AGA8_GrossMethod1 and AGA8_GrossMethod2 function blocks:
Out
Description Apply to
Code
0 SUCCESS All
5 ERROR: THE ROOT WAS NOT BOUNDED IN DGROSS All
6 ERROR: NO CONVERGENCE IN DGROSS All
7 ERROR: VIRGS SQURE ROOT NEGATIVE All
8 ERROR: COMBINED VALUES OF GRGR, X[2] AND HV All
NOT CONSISTENT
9 ERROR: INVALID TERM IN VIRGS All
11 ERROR: METHOD WAS NOT 1 OR 2 All
12 ERROR: FLOWING PRESSURE (PF) <= 0.0 OR > 1740.0 All
PSIA
13 ERROR: FLOWING TEMPERATURE (TF) < 14.0 OR > All
149.0 DEG F
14 ERROR: HEATING VALUE (HV) < 477.0 OR > 1211.0 AGA8_
BTU/FT^3 GrossMethod1
AGA8_
35
Chapter 3 - AGA
Out
Description Apply to
Code
GrossMethod1_V2
AGA8_
GrossMethod1_V3
15 ERROR: GAS RELATIVE DENSITY (GRGR) < 0.55 OR > All
0.870
16 ERROR: MOLE FRACTION FOR N2 < 0.0 OR > 0.50 All
OR FOR CO2 < 0.0 OR > 0.30
OR FOR H2 < 0.0 OR > 0.10
OR FOR CO < 0.0 OR > 0.03
17 ERROR: REFERENCE TEMPERATURE < 32.0 OR > 77.0 All
DEG F
18 ERROR: REFERENCE PRESSURE < 13.0 OR > 16.0 PSIA All
22 WARNING: FLOWING PRESSURE (PF) <= 0.0 OR > 1200.0 AGA8_
PSIA GrossMethod1&2
AGA8_
GrossMethod1&2_
V2
23 WARNING: FLOWING TEMPERATURE (TF) < 32.0 OR > AGA8_
130.0 DEG F GrossMethod1&2
AGA8_
GrossMethod1&2_
V2
24 WARNING: HEATING VALUE (HV) < 805.0 OR > 1208.0 AGA8_
BTU/FT^3 GrossMethod1
AGA8_
GrossMethod1_V2
25 WARNING: GAS RELATIVE DENSITY (GRGR) < 0.55 OR > AGA8_
0.800 GrossMethod1&2
AGA8_
GrossMethod1&2_
V2
26 WARNING: MOLE FRACTION FOR N2 < 0.0 OR > 0.20 AGA8_
OR FOR CO2 < 0.0 OR > 0.20 GrossMethod1&2
36
Chapter 3 - AGA
Out
Description Apply to
Code
OR FOR H2 < 0.0 OR > 0.0 AGA8_
OR FOR CO < 0.0 OR >0.0 GrossMethod1&2_
V2
81 WARNING: FLOWING PRESSURE (PF) > 1500.0 PSIA AGA8_
AGA8 2017 RANGE 1 GrossMethod1&2_
V3
82 WARNING: FLOWING TEMPERATURE (TF) < 17.01 OR > AGA8_
143.0 DEG F AGA8 2017 RANGE 2 OR (TF) < 25.0 OR > GrossMethod1&2_
143.0 DEG F AGA8 2017 RANGE 1 V3
83 WARNING: HEATING VALUE (HV) < 665.0 OR > 1100.0 AGA8_
BTU/FT^3 AGA8 2017 RANGE 2 OR (HV) < 930.0 OR > GrossMethod1_V3
1040.0 BTU/FT^3 AGA8 2017 RANGE 1
84 WARNING: GAS RELATIVE DENSITY (GRGR) < 0.554 OR > AGA8_
0.801 AGA8 2017 RANGE 2 OR (GRGR) < 0.554 OR > GrossMethod1&2_
0.630 AGA8 RANGE 1 V3
85 WARNING: MOLE FRACTION FOR N2 > 0.20 AGA8 2017 AGA8_
RANGE 2 OR N2 > 0.07 AGA8 2017 RANGE 1 GrossMethod1&2_
V3
OR FOR CO2 > 0.25 AGA8 2017 RANGE 2 OR CO2 > 0.03
AGA8 2017 RANGE 1
AGA8_DetailMethod
Description
This AGA8_DetailMethod function block calculates Gas
Compressibility, Density and Gas Super-compressibility at base,
standard and flowing condition that is flowing temperature and
pressure based on the input parameters defined below. It is used
when all 21 gas composition elements are available to get more
accurate densities. This description is applicable to following function
blocks
37
Chapter 3 - AGA
n AGA8_DetailMethod
38
Chapter 3 - AGA
Input
Data
Input Parameter Description
types
UnitSystem INT {1} for US unit system and {2} for Metric unit
system
GasCompFormat INT Gas Composition Format: {1} for Mole Fraction
and {2} for Percentage
39
Chapter 3 - AGA
Data
Input Parameter Description
types
I_Butane LREAL It can be in Mole Fraction or Percentage
N_Butane LREAL It can be in Mole Fraction or Percentage
I_Pentane LREAL It can be in Mole Fraction or Percentage
N_Pentane LREAL It can be in Mole Fraction or Percentage
Hexane LREAL It can be in Mole Fraction or Percentage
Heptane LREAL It can be in Mole Fraction or Percentage
Octane LREAL It can be in Mole Fraction or Percentage
Nonane LREAL It can be in Mole Fraction or Percentage
Decane LREAL It can be in Mole Fraction or Percentage
Helium LREAL It can be in Mole Fraction or Percentage
Argon LREAL It can be in Mole Fraction or Percentage
FlowingTemp LREAL It is in FAHRENHEIT for US unit and Celcius for
Metric unit.
FlowingPressure LREAL It is in PSIA for US unit and Kpa for Metric unit.
DifferentialPressure LREAL It is in INH2O for US unit and in Kpa for Metric
unit.
40
Chapter 3 - AGA
Data
Input Parameter Description
types
for reference temperature.
RefPressureForRelDensity LREAL It is in PSIA for US unit and Kpa for Metric unit.
Ouput
Data
Output Parameter Description
types
GasDensityAtFlowCond LREAL It is Gas Density at flowing temperature and
pressure. It will be in KG/M^3 for (Metric System) &
LBM/FT^3 for (US System).It is an input to AGA3
Function Block
GasDensityAtBaseCond LREAL It is Gas Density at base temperature and pressure.
It will be in KG/M^3 for (Metric System) &
LBM/FT^3 for (US System).
41
Chapter 3 - AGA
Data
Output Parameter Description
types
Zb LREAL It is gas compressibility factor at base condition. It
is an input to AGA5_DETAIL function block.
Zf LREAL It is gas compressibility factor at flowing
condition.
Out_Code INT This out parameter returns success or fail code.
42
Chapter 3 - AGA
Following is the table that describes different out code for AGA8_
DetailMethod function blocks.
Out
Code Description Apply to
0 SUCCESS All
1 ERROR: PRESSURE HAS A NEGATIVE DERIVATIVE DEFAULT All
GAS DENSITY USED
43
Chapter 3 - AGA
Out
Code Description Apply to
44
Chapter 3 - AGA
Out
Code Description Apply to
AGA8_GERGMethod
Description
This AGA8_GERGMethod function block calculates Gas
Compressibility, Density and Gas Super-compressibility at base,
standard and flowing condition that is flowing temperature and
pressure based on the input parameters defined below. Apart from
this, it also calculating speed of sound in gas that can be used in
health monitoring of Ultrasonic meters. It is used when all 21 gas
composition elements are available to get more accurate densities.
This description is applicable to following function blocks. This
function block is based on AGA 8 (2017) upgrade and available only
from R161.2 release.
45
Chapter 3 - AGA
Input
Data
Input Parameter Description
types
UnitSystem INT {1} for US unit system and {2} for Metric unit
system
46
Chapter 3 - AGA
Data
Input Parameter Description
types
GasCompFormat INT Gas Composition Format:
47
Chapter 3 - AGA
Data
Input Parameter Description
types
Argon LREAL It can be in Mole Fraction or Percentage
FlowingTemp LREAL It is in FAHRENHEIT for US unit and Celcius for
Metric unit.
FlowingPressure LREAL It is in PSIA for US unit and Kpa for Metric unit.
DifferentialPressure LREAL It is in INH2O for US unit and in Kpa for Metric
unit.
Output
Data
Output Parameter Description
types
GasDensityAtFlowCond LREAL It is Gas Density at flowing temperature and
pressure. It will be in KG/M^3 for (Metric System) &
48
Chapter 3 - AGA
Data
Output Parameter Description
types
LBM/FT^3 for (US System). It is an input to AGA3
Function Block.
GasDensityAtBaseCond LREAL It is Gas Density at base temperature and pressure.
It will be in KG/M^3 for (Metric System) &
LBM/FT^3 for (US System).
49
Chapter 3 - AGA
AGA3_Orifice
Description
This AGA3_Orifice function block calculates the volumetric flow-rate
for an orifice meter using flange or pipe tap based on the input
parameters defined below. It is used along with any one of the AGA8
function blocks since it requires densities @flowing, standard and
base conditions as well as gas super compressibility and gas relative
density @ standard condition coming out of AGA8 function block. This
description is applicable to following function blocks
50
Chapter 3 - AGA
n AGA3_Orifice
51
Chapter 3 - AGA
Input
Data
Input Parameter Description
types
UnitSystem INT {1} for US unit system and {2} for Metric unit system
FlowingTemp LREAL It is in FAHRENHEIT for US unit and Celcius for
Metric unit.
FlowingPressure LREAL It is in PSIA for US unit and Kpa for Metric unit.
DifferentialPressure LREAL It is in INH2O for US unit and in Kpa for Metric unit.
GasDensityAtFlowCond LREAL It is Gas Density at flowing temperature and
pressure. It is in KG/M^3 for (Metric System) &
LBM/FT^3 for (US System). It is an output of AGA8.
GasDensityAtStdCond LREAL It is Gas Density at standard temperature and
pressure. It is in KG/M^3 for (Metric System) &
LBM/FT^3 for (US System).It is an output of AGA8.
GasDensityAtBaseCond LREAL It is Gas Density at base temperature and pressure. It
is in KG/M^3 for (Metric System) & LBM/FT^3 for
(US System).It is an output of AGA8.
GasSuperComp LREAL It is unit less number. It is an output of AGA8
GasRelDenAtStdCond LREAL It is unit less number. It is an output of AGA8
TapsType INT FLANGE=1 and PIPE=2
OrificeMaterial INT STAINLESS STEEL=1, MONEL=2, CARBON STEEL=3,
STAINLESS_S_304=4 and STAINLESS_S_316=5
PipeMaterial INT STAINLESS STEEL=1, MONEL=2, CARBON STEEL=3,
52
Chapter 3 - AGA
Data
Input Parameter Description
types
STAINLESS_S_304=4 and STAINLESS_S_316=5
FluidType INT COMPRESSIBLE FLUID =1 and NON-
COMPRESSIBLE FLUID=2
TapsLocation INT UPSTREAM=1 and DOWNSTREAM=2
OrificeDiameter LREAL It is in inches for US unit system & in milimeter for
Metric unit system.
OrfDiaMsrdTemp LREAL It is in FAHRENHEIT for US unit and Celcius for
Metric unit.
PipeDiameter LREAL It is in inches for US unit system & in milimeter for
Metric unit system.
PipeDiaMsrdTemp LREAL It is in FAHRENHEIT for US unit and Celcius for
Metric unit.
AbsViscosity LREAL AGA3 Orifice method expects absolute viscosity in
CENTIPOISE unit only for both US & Metric unit
system.
(RECOMMENDED DEFAULT=0.010268 cP - PG 34
PART 4)
IsenExponent LREAL ISENTROPIC EXPONENT is unit less number.
(RECOMMENDED DEFAULT=1.3 - PG 34 PART 4)
CalibFactor LREAL It is unit less number. Default value is 1.0
AirCompFactAtStdCond LREAL It is unit less number. COMPRESSIBILITY FACTOR
OF AIR AT standard temperature and pressure. It is
used for Pipe tap only.
AtmosphericPressure LREAL It is in PSIA for US unit and Kpa for Metric unit.
53
Chapter 3 - AGA
Output
Output
Data
Parameter Description
types
Aga3_QV LREAL This is volume flow rate at standard (TS & PS) conditions. It is in
Scf/Hr for US unit system and in cubic meter per hour in Metric
unit system.
Aga3_QM LREAL This is mass flow rate. It is in Lbm/Hr for US unit system and
Kg/Hr for Metric unit system.
Aga3_QB LREAL This is volumetric flow rate at base (TB & PB) conditions. It is in
Scf/Hr for US unit system and in cubic meter per hour in Metric
unit system.
CD LREAL It is Orifice plate coefficient of discharge (flange).
Y LREAL It is Expansion factor (flange and pipe).
EV LREAL It is Velocity of approach factor (flange).
Out_Code INT This out parameter returns success or fail code.
54
Chapter 3 - AGA
Following is the table that describes different out code for AGA3_
Orifice function blocks.
Out
Code Description Apply to
55
Chapter 3 - AGA
Out
Code Description Apply to
56
Chapter 3 - AGA
AGA3_Orifice_LIQ
Description
This AGA3_Liquid Orifice function block calculates the volumetric
flow-rate of Liquid for an orifice meter using flange or pipe tap based
on the input parameters defined below. It is used along with any one
of the API 11.1 function blocks since it requires densities @flowing,
standard and base conditions. This standard is based on AGA 3 (2012)
update and this block is available from R161.2 release.
57
Chapter 3 - AGA
Input
Data
Input Parameter Description
types
UnitSystem INT {1} for US unit system and {2} for Metric unit system
FlowingTemp LREAL It is in FAHRENHEIT for US unit and Celcius for
Metric unit.
FlowingPressure LREAL It is in PSIA for US unit and Kpa for Metric unit.
DifferentialPressure LREAL It is in INH2O for US unit and in Kpa for Metric unit.
GasDensityAtFlowCond LREAL It is Gas Density at flowing temperature and
pressure. It is in KG/M^3 for (Metric System) &
LBM/FT^3 for (US System). It is an output of AGA8.
GasDensityAtStdCond LREAL It is Gas Density at standard temperature and
pressure. It is in KG/M^3 for (Metric System) &
LBM/FT^3 for (US System).It is an output of AGA8.
GasDensityAtBaseCond LREAL It is Gas Density at base temperature and pressure. It
is in KG/M^3 for (Metric System) & LBM/FT^3 for
(US System).It is an output of AGA8.
GasSuperComp LREAL It is unit less number. It is an output of AGA8
GasRelDenAtStdCond LREAL It is unit less number. It is an output of AGA8
TapsType INT FLANGE=1 and PIPE=2
OrificeMaterial INT STAINLESS STEEL=1, MONEL=2, CARBON STEEL=3,
STAINLESS_S_304=4 and STAINLESS_S_316=5
PipeMaterial INT STAINLESS STEEL=1, MONEL=2, CARBON STEEL=3,
STAINLESS_S_304=4 and STAINLESS_S_316=5
FluidType INT COMPRESSIBLE FLUID =1 and NON-
COMPRESSIBLE FLUID=2
TapsLocation INT UPSTREAM=1 and DOWNSTREAM=2
OrificeDiameter LREAL It is in inches for US unit system & in milimeter for
Metric unit system.
OrfDiaMsrdTemp LREAL It is in FAHRENHEIT for US unit and Celcius for
Metric unit.
PipeDiameter LREAL It is in inches for US unit system & in milimeter for
Metric unit system.
PipeDiaMsrdTemp LREAL It is in FAHRENHEIT for US unit and Celcius for
58
Chapter 3 - AGA
Data
Input Parameter Description
types
Metric unit.
AbsViscosity LREAL AGA3 Orifice method expects absolute viscosity in
CENTIPOISE unit only for both US & Metric unit
system.
(RECOMMENDED DEFAULT=0.010268 cP - PG 34
PART 4)
IsenExponent LREAL ISENTROPIC EXPONENT is unit less number.
(RECOMMENDED DEFAULT=1.3 - PG 34 PART 4)
CalibFactor LREAL It is unit less number. Default value is 1.0
AirCompFactAtStdCond LREAL It is unit less number. COMPRESSIBILITY FACTOR
OF AIR AT standard temperature and pressure. It is
used for Pipe tap only.
AtmosphericPressure LREAL It is in PSIA for US unit and Kpa for Metric unit.
Output
Output
Data
Parameter Description
types
Aga3_QV LREAL This is volume flow rate at standard (TS & PS) conditions. It is in
Scf/Hr for US unit system and in cubic meter per hour in Metric
unit system.
Aga3_QM LREAL This is mass flow rate. It is in Lbm/Hr for US unit system and
Kg/Hr for Metric unit system.
Aga3_QB LREAL This is volumetric flow rate at base (TB & PB) conditions. It is in
Scf/Hr for US unit system and in cubic meter per hour in Metric
unit system.
CD LREAL It is Orifice plate coefficient of discharge (flange).
Y LREAL It is Expansion factor (flange and pipe).
59
Chapter 3 - AGA
Output
Data
Parameter Description
types
Out
Description
Code
51 ERROR: NTAPS WAS NOT 0, 1 OR 2
52 ERROR: FLOWING PRESSURE WAS <= 0.0 OR > 40000. PSIA
53 ERROR: FLOWING TEMPERATURE < -200. OR > 760. DEG F
54 ERROR: MATORF OR MATPIPE WAS NOT 0, 1, 2 OR 3
55 ERROR: ORIFICE DIAMETER WAS <= 0 OR => 100.0 INCHES
56 ERROR: PIPE DIAMETER WAS <= 0 OR => 100.0 INCHES
57 ERROR: FLOWING OR STANDARD DENSITY WAS <= 0.0 LBM/FT^3
58 ERROR: DIFFERENTIAL PRESSURE WAS <= 0.0 INCHES H2O
60 ERROR: ISENTROPIC EXPONENT <= 1.0 OR => 2.0
61 ERROR: IFLUID WAS NOT 0, 1 OR 2
62 ERROR: STANDARD TEMPERATURE WAS NOT = 60.0 DEG F
63 ERROR: STANDARD PRESSURE WAS NOT = 14.73 PSIA
64 ERROR: TAP LOCATION WAS NOT 0, 1 OR 2 FOR NTAPS=2 (PIPE) OR TAP
LOCATION WAS NOT 1 FOR NTAPS=1 (FLANGE)
65 ERROR: SUPERCOMPRESSIBILITY FACTOR WAS <= 0.0
66 ERROR: RELATIVE DENSITY AT STANDARD CONDITIONS WAS < 0.07 OR > 1.52
67 ERROR: CALIBRATION FACTOR WAS <= 0.0
60
Chapter 3 - AGA
Out
Description
Code
68 ERROR: COMPRESSIBILITY FACTOR AT STANDARD CONDITIONS <= 0.0
69 ERROR: BETA RATIO (DO/DM) <= 0.0 OR => 1.0
70 ERROR: IF NTAPS = 1, GOF2015_OPTION NOT = 1 OR = 0
71 ERROR: IF NTAPS = 2, GOF2015_OPTION NOT = 0
72 ERROR: DIFFERENTIAL PRESSURE WAS GREATER THAN UPSTREAM STATIC
PRESSURE
80 WARNING: IF GOF2015_OPTION = 1, (HW)/(27.7072*(PF)) = OR > 0.25;
n AGA7_Turbine
61
Chapter 3 - AGA
n AGA9_Ultrasonic
62
Chapter 3 - AGA
Input
Data
Input Parameter Description Apply to
types
UnitSystem INT {1} US unit system and {2} Metric unit All
system
FlowType INT {1} Pulse Accumulated or {2} Analog All
Flow Rate
FlowingTemp LREAL If the unit system is US then it should All
be in FAHRENHEIT and if the unit
system is Metric then it should be in
Celsius
FlowingPressure LREAL If the unit system is US then it should All
be in PSIA and if the unit system is
Metric then it should be in KPA.
AtmosphericPressure LREAL If the unit system is US then it should All
be in PSIA and if the unit system is
Metric then it should be in KAR
It is an output parameter of
AGA8function block.
GasSuperComp LREAL It is unit less number. It is gas super All
compressibility calculated by AGA8
function block.
63
Chapter 3 - AGA
Data
Input Parameter Description Apply to
types
It is an output parameter of AGA8
function block.
HeatingValue LREAL For US unit system it should be in All
Btu/ft^3 and for Metric unit system it
should be in MJ/m^3.
AGA7_
Turbine_V2
& AGA9_
Ultrasonic_
V2
AnalogInput LREAL Value of analog input if flow type is AGA7_
Analog. The value should be in lb^3/hr Turbine_V3
for US unit or m^3/hr for Metric unit. & AGA9_
Ultrasonic_
V3
Pulse UDINT Pulse counter value AGA7_
Turbine_V3
& AGA9_
Ultrasonic_
V3
MeterCalFactor LREAL This input parameter is a Meter All
Calibration factor which is a unit less
value.
BaseTemp LREAL If the unit system is US then it must be All
in Deg Fahrenheit. If the unit system is
Metric then it must be in Deg Celsius.
64
Chapter 3 - AGA
Data
Input Parameter Description Apply to
types
The recommended default is 60 Deg F.
BasePressure LREAL If the unit system is US then it must be All
in PSIA. If the unit system is Metric then
it must be in KPA.
Output
Following table describes output parameters for AGA7_Turbine
function block.
Output
Data
Parameter Description
types
AGA7_Qv LREAL This is uncorrected volume @ Flowing conditions TF and PF. It’s
US unit is SCF/HR and Metric unit is M^3 /HR
AGA7_Qb LREAL This is Corrected volume at base conditions using compressibility
from AGA8. It’s US unit is SCF/HR and Metric unit is M^3 /HR
AGA7_Qm LREAL This is mass using base density (RHOB) from AGA8. Its US unit is
LBM/HR and Metric unit is KG/HR.
AGA7_Qe LREAL This is energy flow using heating value. It’s US unit is BTU/Hr
(British thermal units) and Metric unit is GJ/hr (gigajoules per
hour)
Output
Data
Parameter Description
types
AGA9_Qv LREAL This is uncorrected volume @ Flowing conditions TF and PF. It’s
US unit is SCF/HR and Metric unit is M^3 /HR
AGA9_Qb LREAL This is Corrected volume at base conditions using compressibility
from AGA8. It’s US unit is SCF/HR and Metric unit is M^3 /HR
AGA9_Qm LREAL This is mass using base density (RHOB) from AGA8. Its US unit is
65
Chapter 3 - AGA
Output
Data
Parameter Description
types
AGA11_Coriolis
Description
AGA11_Coriolis function block converts gas mass (absolute) to
volume at base condition; based on the input parameters defined
below. This description is applicable to following function block:
66
Chapter 3 - AGA
n AGA11_Coriolis
Input
Input Parameter Data types Description
Gas_Mass LREAL Gas mass should be in US unit or Metric
unit.
Output
Output Data
Description
Parameter types
AGA11_Qb LREAL This is volume @ base conditions. It’s US unit is SCF/HR and
Metric unit is M^3 /HR
67
Chapter 3 - AGA
AGA5_HV_CONSTANT
Description
AGA5_HV_CONSTANT function block calculates gas flow energy when
we have gas heating value and volume at base condition. This function
block can be used when gas heating value is directly available.
Input
Data
Input Parameter Description
types
Unit System INT It is unit less number. For US unit it is 1 and
for Metric it is 2
Heating Value LREAL If using US {1} unit then heating value
should be in US unit. If using Metric {2} unit
then its value should be in Metric unit. Its US
unit is BTU/FT^3.
68
Chapter 3 - AGA
Data
Input Parameter Description
types
The recommended default is 14.73 PSIA
RefTempForCalorimeterDensity LREAL It is the reference temperature for
Calorimeter Density; If the unit system is US
then it must be in Deg Fahrenheit. If the unit
system is Metric then it must be in Deg
Celsius.
Output
Output Data
Description
Parameter types
Aga5_hv LREAL This is gas flow energy at base condition. It’s US unit is
BTU/Hr.
AGA5_DETAIL
Description
AGA5_DETAIL function block calculates gas flow energy when all 21
gas elements are available. This description is applicable to following
function block:
69
Chapter 3 - AGA
n AGA5_DETAIL
n AGA5_DETAIL_st
This function block can be used to calculate gas energy flow or gas
heating value when all 21 gas composition elements are available.
Input
Data Apply
Input Parameter Description
types to
Unit System INT For US unit it is 1 and for Metric it is All
2
70
Chapter 3 - AGA
Data Apply
Input Parameter Description
types to
GasCompFormat INT Gas Composition Format - {1} for All
Mole Fraction and {2} for Percentage
NOTE: It is recommended to
use 2 percentage as a default
option.
71
Chapter 3 - AGA
Data Apply
Input Parameter Description
types to
N_Pentane LREAL It can be in Mole Fraction or All
Percentage
Hexane LREAL It can be in Mole Fraction or All
Percentage
Heptane LREAL It can be in Mole Fraction or All
Percentage
Octane LREAL It can be in Mole Fraction or All
Percentage
Nonane LREAL It can be in Mole Fraction or All
Percentage
Decane LREAL It can be in Mole Fraction or All
Percentage
Helium LREAL It can be in Mole Fraction or All
Percentage
Argon LREAL It can be in Mole Fraction or All
Percentage
BaseTemp LREAL If the unit system is US then it must All
be in Deg Fahrenheit. If the unit
system is Metric then it must be in
Deg Celsius.
72
Chapter 3 - AGA
Data Apply
Input Parameter Description
types to
value should be in US unit. If using
Metric {2} unit then it's value should
be in Metric unit. It's US unit is
FT^3/Hr
Output
Data
Output Parameter Description Apply to
types
HeatingValue LREAL This is gas heating value in BTU/FT^3 AGA5_Detail &
for US unit. AGA5_Detail_V2
GrossHeatingValue LREAL This is gross heating value in AGA5_Detail_V3
BTU/FT^3 for US unit. MJ/M3 for
Metric.
NetHeatingValue LREAL This is net heating value in BTU/FT^3 AGA5_Detail_V3
for US unit. MJ/M3 for Metric.
Aga5_hv LREAL This is gas flow energy at base All
condition. It’s US unit is BTU/Hr.
Aga5_qd LREAL This is dry gas flow energy at base All
condition. It’s US unit is BTU/Hr.
Outcode INT This out parameter returns success or AGA5_Detail_V3
fail code.
73
Chapter 3 - AGA
Out
Description Apply to
Code
1 ERROR: A COMPONENT MOLE FRACTION < 0.0 OR > 1.0 AGA5_DETAIL_
V3
2 WARNING: SUM OF MOLE FRACTIONS < 0.9999 OR > AGA5_DETAIL_
1.0001 V3
3 WARNING: PRESSURE BASE (PB) <= 0.0 OR >= 16 PSIA AGA5_DETAIL_
V3
4 WARNING: TEMPERATURE BASE (TB) <= 32.0 OR >= 77.0 AGA5_DETAIL_
DEG F V3
74
CHAPTER
4 API 11.1
The following API 11.1 function blocks are available:
75
Chapter 4 - API 11.1
Supported commodities
n Crude oil
n Refined products
n Special products
n Lubricating oil
76
Chapter 4 - API 11.1
Supported calculations
n API TYPE1- US unit system
n API TYPE2- US unit system
n API TYPE3- US unit system
n API TYPE4- Metric unit system
n API TYPE5- Metric unit system
n API TYPE6- Metric unit system
Parameter Description
0 No error, Calculations Successful
1 Error - Illegal arguments
2 Error - Memory allocation
3 Error - VCF out of range
4 Error - Non convergence
5 Error - Temperature out of range
6 Error - Density out of range
7 Error - Pressure out of range
8 Error - Alpha60 out of range
9 Error - Supercritical fluid
10 Error - No reference fluids
11 Error - No Solution
77
Chapter 4 - API 11.1
n CRUDE_OIL_ALT_US
n REFINED_PRODUCTS_ALT_US
n SPECIAL_PRODUCTS_ALT_US
78
Chapter 4 - API 11.1
n LUBRICATING_OIL_ALT_US
These Function block expects the input values in the proper units (°F,
psig, and kg/m³). If they are not in the proper units then appropriate
unit conversion block should be used. The density values calculated
by these function block are in the units of kg/m³. If these units do not
match the original input units, then the output densities should be
converted to that of the original input value’s units appropriate unit
conversion block.
Input
Data
Input Parameter Description
types
AlternateTemperature LREAL Value of alternate temperature in °F
AlternatePressure LREAL Value of alternate Pressure in kpa
BaseDensity LREAL Value of base density (kg/m3). If input
density type is relative density or API Gravity
then it must be converted into Density
(kg/m3) using provided unit conversion
blocks
VolumeatAlternetTempPressure LREAL No Conversion needed, Most of the time it is
optional input
Output
Data
Output Parameter Description
types
VCFTemerature LREAL Volume correction factor due to temperature
VCFPressure LREAL Volume correction factor due to pressure
ScaledCompressibilityFactor LREAL Scaled compressibility factor
79
Chapter 4 - API 11.1
Data
Output Parameter Description
types
CombineVCF LREAL Combined volume correction factor due to
temperature and pressure
AlternetDensity LREAL Density at alternate conditions
VolumeatBase LREAL Volume at base conditions
Out_Code INT This out parameter returns success or fail code.
n CRUDE_OIL_OBS_US
80
Chapter 4 - API 11.1
n REFINED_PRODUCTS_OBS_US
n SPECIAL_PRODUCTS_OBS_US
n LUBRICATING_OIL_OBS_US
These Function block expects the input values in the proper units (°F,
Kpa, and kg/m³). If they are not in the proper units then appropriate
unit conversion block should be used. The density values calculated
by these function block are in the units of kg/m³. If these units do not
match the original input units, then the output densities should be
converted to that of the original input value’s units appropriate unit
conversion block.
81
Chapter 4 - API 11.1
Input
Data
Input Parameter Description
types
ObservedTemperature LREAL Value of observed temperature in °F
ObservedPressure LREAL Value of observed Pressure in kpa
ObservedDensity LREAL Value of observed density (kg/m3). If input
density type is relative density or API
Gravity then it must be converted into
Density(kg/m3) using provided unit
conversion blocks
AlphaAt60F LREAL Pre-calculated 60°F thermal expansion
factor. This input parameter is only
applicable for special products. For other
commodity types this parameter is not
present
VolumeatObservedTempPressure LREAL No Conversion needed, Most of the time it
is optional input
Ouput
Data
Output Parameter Description
types
VCFTemerature LREAL Volume correction factor due to temperature
VCFPressure LREAL Volume correction factor due to pressure
ScaledCompressibilityFactor LREAL Scaled compressibility factor
CombineVCF LREAL Combined volume correction factor due to
temperature and pressure
BaseDensity LREAL Density at Base conditions
VolumeatBase LREAL Volume at base conditions
Out_Code INT This out parameter returns success or fail code.
82
Chapter 4 - API 11.1
n CRUDE_OIL_AO_US
n REFINED_PRODUCTS_AO_US
83
Chapter 4 - API 11.1
n SPECIAL_PRODUCTS_AO_US
n LUBRICATING_OIL_AO_US
These Function block expects the input values in the proper units (°F,
Kpa, and kg/m³). If they are not in the proper units then appropriate
unit conversion block should be used. The density values calculated
by these function block are in the units of kg/m³. If these units do not
match the original input units, then the output densities should be
converted to that of the original input value’s units appropriate unit
conversion block.
84
Chapter 4 - API 11.1
Input
Data
Input Parameter Description
types
AlternetTemperature LREAL Value of alternate temperature in °F
Output
Data
Output Parameter Description
types
VCFBaseAndObservedTemerature LREAL Volume correction factor due to
temperature between the base and
observed temperatures
VCFBaseAndObservedPressure LREAL Volume correction factor due to pressure
between the base and observed pressures
at the observed
temperature
85
Chapter 4 - API 11.1
Data
Output Parameter Description
types
SCFObserved LREAL Scaled compressibility factor at the
observed temperature
CombineVCFBaseAndObserved LREAL Combined volume correction factor due to
temperature and pressure between the
base and observed
conditions
BaseDensity LREAL Density at Base conditions
temperature
SCFAlternet LREAL Scaled compressibility factor at the
alternate temperature
CombineVCFBaseAndAlternet LREAL Combined volume correction factor due to
temperature and pressure between the
base and alternate
conditions
AlternetDensity LREAL Density at alternate conditions
86
Chapter 4 - API 11.1
n CRUDE_OIL_ALT_ME
n REFINED_PRODUCTS_ALT_ME
n SPECIAL_PRODUCTS_ALT_ME
87
Chapter 4 - API 11.1
n LUBRICATING_OIL_ALT_ME
These Function block expects the input values in the proper units (°C,
kPa). If they are not in the proper units then appropriate unit
conversion block should be used. The density values calculated by
these function block are in the units of kg/m³. If these units do not
match the original input units, then the output densities should be
converted to that of the original input value’s units appropriate unit
conversion block.
Input
Data
Input Parameter Description
types
BaseTemperature LREAL Value of Base temperature °C
AlternateTemperature LREAL Value of alternate temperature in °C
AlternatePressure LREAL Value of alternate Pressure in kpa
BaseDensity LREAL Value of base density (kg/m3). If input
density type is relative density or API Gravity
then it must be converted into Density
(kg/m3) using provided unit conversion
blocks
AlphaAt60F LREAL Pre-calculated 60°F thermal expansion
factor. This input parameter is only
applicable for special products. For other
commodity types this parameter is not
present
VolumeatAlternetTempPressure LREAL No Conversion needed, Most of the time it is
optional input
88
Chapter 4 - API 11.1
Output
Data
Output Parameter Description
types
VCFTemerature LREAL Volume correction factor due to temperature
VCFPressure LREAL Volume correction factor due to pressure
ScaledCompressibilityFactor LREAL Scaled compressibility factor
CombineVCF LREAL Combined volume correction factor due to
temperature and pressure
AlternetDensity LREAL Density at alternate conditions
VolumeatBase LREAL Volume at base conditions
Out_Code INT This out parameter returns success or fail code.
n CRUDE_OIL_OBS_ME
89
Chapter 4 - API 11.1
n REFINED_PRODUCTS_OBS_ME
n SPECIAL_PRODUCTS_OBS_ME
n LUBRICATING_OIL_OBS_ME
These Function block expects the input values in the proper units (°C,
Kpa, and kg/m³). If they are not in the proper units then appropriate
unit conversion block should be used. The density values calculated
by these function block are in the units of kg/m³. If these units do not
match the original input units, then the output densities should be
converted to that of the original input value’s units appropriate unit
conversion block.
90
Chapter 4 - API 11.1
Input
Data
Input Parameter Description
types
BaseTemperature LREAL Value of Base temperature °C
ObservedTemperature LREAL Value of observed temperature in °C
ObservedPressure LREAL Value of observed Pressure in kpa
ObservedDensity LREAL Value of observed density (kg/m3). If input
density type is relative density or API
Gravity then it must be converted into
Density(kg/m3) using provided unit
conversion blocks
AlphaAt60F LREAL Pre-calculated 60°F thermal expansion
factor. This input parameter is only
applicable for special products. For other
commodity types this parameter is not
present
VolumeatObservedTempPressure LREAL No Conversion needed, Most of the time it
is optional input
Output
Data
Output Parameter Description
types
VCFTemerature LREAL Volume correction factor due to temperature
VCFPressure LREAL Volume correction factor due to pressure
ScaledCompressibilityFactor LREAL Scaled compressibility factor
CombineVCF LREAL Combined volume correction factor due to
temperature and pressure
BaseDensity LREAL Density at Base conditions
VolumeatBase LREAL Volume at base conditions
Out_Code INT This out parameter returns success or fail code.
91
Chapter 4 - API 11.1
n CRUDE_OIL_AO_ME
n REFINED_PRODUCTS_AO_ME
92
Chapter 4 - API 11.1
n SPECIAL_PRODUCTS_AO_ME
n LUBRICATING_OIL_AO_ME
These Function block expects the input values in the proper units (°C,
Kpa, and kg/m³). If they are not in the proper units then appropriate
unit conversion block should be used. The density values calculated
by these function block are in the units of kg/m³. If these units do not
match the original input units, then the output densities should be
converted to that of the original input value’s units appropriate unit
conversion block.
Input
Data
Input Parameter Description
types
BaseTemperature LREAL Value of Base temperature °C
AlternetTemperature LREAL Value of alternate temperature in °F
AlternetPressure LREAL Value of alternate Pressure in kpa
93
Chapter 4 - API 11.1
Data
Input Parameter Description
types
ObservedTemperature LREAL Value of observed temperature in °F
ObservedPressure LREAL Value of observed Pressure in kpa
ObservedDensity LREAL Value of observed density (kg/m3). If
input density type is relative density or
API Gravity then it must be converted into
Density(kg/m3) using provided unit
conversion blocks
AlphaAt60F LREAL Pre-calculated 60°F thermal expansion
factor. This input parameter is only
applicable for special products. For other
commodity types this parameter is not
present
VolumeatObservedTempPressure LREAL No Conversion needed, Most of the time
it is optional input
Output
Data
Output Parameter Description
types
VCFBaseAndObservedTemerature LREAL Volume correction factor due to
temperature between the base and
observed temperatures
VCFBaseAndObservedPressure LREAL Volume correction factor due to pressure
between the base and observed pressures
at the observed
temperature
SCFObserved LREAL Scaled compressibility factor at the
observed temperature
CombineVCFBaseAndObserved LREAL Combined volume correction factor due to
temperature and pressure between the
base and observed
conditions
BaseDensity LREAL Density at Base conditions
VolumeatBase LREAL Volume at base conditions
94
Chapter 4 - API 11.1
Data
Output Parameter Description
types
VCFBaseAndAlternetTemerature LREAL Volume correction factor due to
temperature between the base and
alternate temperatures
VCFBaseAndAlternetPressure LREAL Volume correction factor due to pressure
between the base and alternate pressures
at the alternate
temperature
SCFAlternet LREAL Scaled compressibility factor at the
alternate temperature
CombineVCFBaseAndAlternet LREAL Combined volume correction factor due to
temperature and pressure between the
base and alternate
conditions
AlternetDensity LREAL Density at alternate conditions
VolumeatAlternet LREAL Volume at alternate conditions
Out_Code INT This out parameter returns success or fail
code.
95
Chapter 4 - API 11.1
96
CHAPTER
5 API 21.1
Library Description
API21_1Lib The function block library provides support for creating flow
measurement calculations for gas based on API 21.1 standard for
Orifice, Turbine, Corolis and ultrasonic meters.
API21_1_V2 It is supported from R161.2 release.
The following API 21.1 meter run function blocks are available.
Function
Description
Block
Orifice_Dtl_ Orifice_Dtl_MeterRun calculates
MeterRun
1. Gas compressibility factor, density, relative density and molecular
weight from AGA8 detailed method.
2. Volume flow rate at standard condition, mass flow rate and volume
flow rate at base condition from AGA3.
2. Volume flow rate at standard condition, mass flow rate and volume
flow rate at base condition from AGA3.
97
Chapter 5 - API 21.1
Function
Description
Block
3. Gas energy per hour
98
Chapter 5 - API 21.1
Function
Description
Block
1. Gas compressibility factor, density, relative density and molecular
weight from AGA8 gross method.
99
Chapter 5 - API 21.1
Description
This Orifice_Dtl_MeterRun function block calculates gas
compressibility factor, density, relative density and molecular weight
from AGA8 detailed method, volume flow rate at standard condition,
mass flow rate and volume flow rate at base condition from AGA3 and
gas energy per hour from AGA5. It also calculates hourly and daily
averages and totals. It generates hourly & daily QTRs and sends them
to EFM application which logs them on the contoller’s MRAM and
flash memory. It also generates alarms when any of the process value
crosses specified alarm limit. Orifice_Dtl_MeterRun expects the input
parameters to be in US or Metric unit system. The exception is
absolute viscosity of the gas that should be in centipoise in either unit
system.
Input
Data
Input Parameter Description Apply to
types
Methane REAL It could be in mole fraction or All
percentage.
Nitrogen REAL It could be in mole fraction or All
percentage.
CO2 REAL It could be in mole fraction or All
percentage.
100
Chapter 5 - API 21.1
Data
Input Parameter Description Apply to
types
Ethane REAL It could be in mole fraction or All
percentage.
Propane REAL It could be in mole fraction or All
percentage.
Water REAL It could be in mole fraction or All
percentage.
H2S REAL It could be in mole fraction or All
percentage.
Hydrogen REAL It could be in mole fraction or All
percentage.
CO REAL It could be in mole fraction or All
percentage.
Oxygen REAL It could be in mole fraction or All
percentage.
IButane REAL It could be in mole fraction or All
percentage.
NButane REAL It could be in mole fraction or All
percentage.
IPentane REAL It could be in mole fraction or All
percentage.
NPentane REAL It could be in mole fraction or All
percentage.
Hexane REAL It could be in mole fraction or All
percentage.
Heptane REAL It could be in mole fraction or All
percentage.
Octane REAL It could be in mole fraction or All
percentage.
Nonane REAL It could be in mole fraction or All
percentage.
Decane REAL It could be in mole fraction or All
percentage.
101
Chapter 5 - API 21.1
Data
Input Parameter Description Apply to
types
Helium REAL It could be in mole fraction or All
percentage.
Argon REAL It could be in mole fraction or All
percentage.
DetailMethod INT Selection for Detail method: Orifice_
Dtl_
1- Detail Method MeterRun_
2- GERG Method. GERG Method is V2
only applicable for V2 function block.
BaseTemp REAL Base temperature should be in All
Fahrenheit for US unit system and in
Celcius for Metric unit system. The
recommended default is 60 Deg F.
BasePressure REAL Base pressure should be in Psia for US All
unit system and in Kpa for Metric unit
system. The recommended default is
14.73 Psia.
FlowingTemp REAL Flowing temperature should be in All
Fahrenheit for US unit system and in
Celcius for Metric unit system.
TempHiHi REAL This is the HiHi limit for flowing All
temperature. It should be either in
Fahrenheit or Celcius.
TempHi REAL This is the Hi limit for flowing All
temperature. It should be either in
Fahrenheit or Celcius.
TempLoLo REAL This is the LoLo limit for flowing All
temperature. It should be either in
Fahrenheit or Celcius.
TempLo REAL This is the Lo limit for flowing All
temperature. It should be either in
Fahrenheit or Celcius.
FlowTempIOSelection INT IO selection for meter temperature. The Orifice_
value should be {1} for Live or {2) for Dtl_
Keypad value. MeterRun_
V2
102
Chapter 5 - API 21.1
Data
Input Parameter Description Apply to
types
FlowTempStsStatus USINT Analog input channel status for meter Orifice_
temperature. The value should be {0} for Dtl_
Good or any positive integer for bad MeterRun_
status. V2
FlowTempKeypadVal REAL Keypad value for meter temperature. Orifice_
The value that should be used when the Dtl_
meter temperature status is bad. MeterRun_
V2
FlowingPressure REAL Flowing pressure should be in Psia for All
US unit system and in Kpa for Metric
unit system.
PressureHiHi REAL This is the HiHi limit for flowing All
pressure. It should be either in Psia or
Kpa.
PressureHi REAL This is the Hi limit for flowing pressure. All
It should be either in Psia or Kpa.
PressureLoLo REAL This is the LoLo limit for flowing All
pressure. It should be either in Psia or
Kpa.
PressureLo REAL This is the Lo limit for flowing pressure. All
It should be either in Psia or Kpa.
FlowPresIOSelection INT IO selection for meter pressure. The Orifice_
value should be {1} for Live or {2) for Dtl_
Keypad value. MeterRun_
V2
FlowPresStsStatus USINT Analog input channel status for meter Orifice_
pressure. The value should be {0} for Dtl_
Good or any positive integer for Bad MeterRun_
status. V2
FlowPresKeypadVal REAL Analog input channel status for meter Orifice_
pressure. The value should be {0} for Dtl_
Good or any positive integer for Bad MeterRun_
status. V2
DifferentialPressure REAL Differential Pressure should be in All
Inches of H2O for US unit system and
103
Chapter 5 - API 21.1
Data
Input Parameter Description Apply to
types
in Kpa for Metric unit system.
DPHiHi REAL This is the HiHi limit for differential All
pressure. It should be either in Inches of
H2O or Kpa.
DPHi REAL This is the Hi limit for differential All
pressure. It should be either in Inches of
H2O or Kpa.
DPLoLo REAL This is the LoLo limit for differential All
pressure. It should be either in Inches of
H2O or Kpa.
DPLo REAL This is the Lo limit for differential All
pressure. It should be either in Inches of
H2O or Kpa.
LowDPCutOff REAL This is the low differential pressure cut All
off limit. It should be either in Inches of
H2O or Kpa. This limit decides no flow
condition.
MeterRunId INT This is an integer number that All
represents a configured meter run
identifier.
GasCompFormat INT This parameter is for the gas All
composition format. It should be either
mole fraction {1} or percentage {2}.
104
Chapter 5 - API 21.1
Data
Input Parameter Description Apply to
types
AvgMethod INT This parameter is for averaging method All
to be used for averaging. As of now, it
only supports value {1} that is for time
weighted linear average.
MaintMode INT Parameter to Start or Stop the Orifice_
Maintenance Mode. The value should Dtl_
be either {0} Maintenance End or {1} for MeterRun_
Maintenance Start. When Maintenance V2
mode is started, an independent
totalizer will be started and accumulate
all the flow until the maintenance mode
is stopped. During this period, non-
resettable totals, hourly/daily/batch
totals will be not incremented.
AGA8Version INT Selection for AGA 8 algorithm selection: Orifice_
Dtl_
1- AGA 8 (1994) MeterRun_
2 - AGA 8 (2017) V2
105
Chapter 5 - API 21.1
Data
Input Parameter Description Apply to
types
either in Fahrenheit for US unit system
and in Celcius for Metric unit system.
PipeDiameter REAL This parameter is the for pipe diameter. All
It should be either in inches for US unit
system or in millimeter for Metric unit
system.
PipeDiaMsrdTemp REAL This parameter represents the All
temperature at which pipe diameter is
measured. It should be either in
Fahrenheit for US unit system and in
Celcius for Metric unit system.
AbsViscosity REAL This parameter represents the absolute All
viscosity of the gas in Centipoise. In
either unit system, it must be in
centipoise only.
(Recommended default=0.010268 cP -
pg 34 part 4)
IsenExponent REAL This parameter isentropic exponent is a All
unit less number. (Recommended
default=1.3 - pg 34 part 4)
AGA3Version INT Selection for AGA 3 algorithm selection: Orifice_
Dtl_
1- AGA 3 (1992) MeterRun_
2- AGA 3 (2012) V2
106
Chapter 5 - API 21.1
Data
Input Parameter Description Apply to
types
UserDefined2 REAL This parameter is an optional one, if All
user wants to average some parameter
then user can use it, it will be averaged
and logged in the QTR.
UserDefined3 REAL This parameter is an optional one, if All
user wants to average some parameter
then user can use it, it will be averaged
and logged in the QTR.
UserDefined4 REAL This parameter is an optional one, if All
user wants to average some parameter
then user can use it, it will be averaged
and logged in the QTR.
Output
Data
Output Parameter Description Apply to
types
Out_Code INT This out parameter returns success or All
fail code.
GasCompAtBaseCond LREAL This parameter is gas compressibility All
factor at base condition. It is
calculated in AGA8 Detailed method.
It is unit less.
GasDensityAtBaseCond LREAL This parameter is gas density at base All
condition. It is calculated through
AGA8 Detailed method. It is in
lbm/ft^3 for US unit system and in
kg/m^3 for Metric unit system.
GasRelDenAtBaseCond LREAL This parameter is gas relative density All
at base condition. It is calculated
through AGA8 Detailed method. It is
unit less.
GasMolecularWeight LREAL This parameter is gas molecular All
weight at base condition. It is
calculated through AGA8 Detailed
method. It is in lbm for US unit
107
Chapter 5 - API 21.1
Data
Output Parameter Description Apply to
types
system and in kg for Metric unit
system.
Aga3QV LREAL This parameter is volume flow rate at All
flowing condition. It is calculated
through AGA3 method. It is in ft^3/hr
for US unit system and in m^3/hr for
Metric unit system.
Aga3QM LREAL This parameter is gas mass flow rate. All
It is calculated through AGA3
method. It is in lbm/hr for US unit
system and in kg/hr for Metric unit
system.
Aga3QB LREAL This parameter is volume flow rate at All
base condition. It is calculated
through AGA3 method. It is in ft^3/hr
for US unit system and in m^3/hr for
Metric unit system.
Energy LREAL This parameter is gas energy per All
hour. It is calculated through AGA5
method. It is in Btu/hr for US unit
system and in MJ/hr for Metric unit
system.
PrevHrAvgTemp LREAL This parameter is previous hour All
average for temperature.
PreDayAvgTemp LREAL This parameter is previous day All
average for temperature.
PrevHrAvgPressure LREAL This parameter is previous hour All
average for pressure.
PreDayAvgPressure LREAL This parameter is previous day All
average for pressure.
PrevHrAvgDP LREAL This parameter is previous hour All
average for differential pressure.
PreDayAvgDP LREAL This parameter is previous day All
average for differential pressure.
PrevHrAvgDenAtBase LREAL This parameter is previous hour All
108
Chapter 5 - API 21.1
Data
Output Parameter Description Apply to
types
average for density at base condition.
PreDayAvgDenAtBase LREAL This parameter is previous day All
average for density at base condition.
PrevHrAvgRelDenAtBase LREAL This parameter is previous hour All
average for relative density at base
condition.
PreDayAvgRelDenAtBase LREAL This parameter is previous day All
average for relative density at base
condition.
PrevHrAvgFlowExt LREAL This parameter is previous hour All
average for flow extension.
PreDayAvgFlowExt LREAL This parameter is previous day All
average for flow extension.
PrevHrAvgUserDefined1 LREAL This parameter is previous hour All
average for user defined parameter1.
PreDayAvgUserDefined1 LREAL This parameter is previous day All
average for user defined parameter1.
PrevHrAvgUserDefined2 LREAL This parameter is previous hour All
average for user defined parameter2.
PreDayAvgUserDefined2 LREAL This parameter is previous day All
average for user defined parameter2.
PrevHrAvgUserDefined3 LREAL This parameter is previous hour All
average for user defined parameter3.
PreDayAvgUserDefined3 LREAL This parameter is previous day All
average for user defined parameter3.
PrevHrAvgUserDefined4 LREAL This parameter is previous hour All
average for user defined parameter4.
PreDayAvgUserDefined4 LREAL This parameter is previous day All
average for user defined parameter4.
QbTH LREAL This parameter is volume flow rate at All
base condition total for this hour.
QbLH LREAL This parameter is volume flow rate at All
base condition total for last hour.
109
Chapter 5 - API 21.1
Data
Output Parameter Description Apply to
types
QbTD LREAL This parameter is volume flow rate at All
base condition total for this day.
QbLD LREAL This parameter is volume flow rate at All
base condition total for last day.
MTH LREAL This parameter is mass flow rate total All
for this hour.
MLH LREAL This parameter is mass flow rate total All
for last hour.
MTD LREAL This parameter is mass flow rate total All
for this day.
MLD LREAL This parameter is mass flow rate total All
for last day.
ETH LREAL This parameter is energy total for this All
hour.
ELH LREAL This parameter is energy total for last All
hour.
ETD LREAL This parameter is energy total for this All
day.
ELD LREAL This parameter is energy total for last All
day.
QbNR LREAL Non-Resettable or Cumulative total Orifice_
for volume at Base. Unit - ft3/hr for Dtl_
US, m3/hr for Metric. MeterRun_
V2
MNR LREAL Non-Resettable or Cumulative total Orifice_
for Mass. Unit - lbm/hr for US, kg/hr Dtl_
for Metric. MeterRun_
V2
ENR LREAL Non-Resettable or Cumulative total Orifice_
for Energy. Unit -Btu/hr for US, Dtl_
MJ/hr for Metric. MeterRun_
V2
QbRollover INT Rollover flag for volume at base Orifice_
condition non-resettable total. The Dtl_
110
Chapter 5 - API 21.1
Data
Output Parameter Description Apply to
types
value {1} indicates Rollover otherwise MeterRun_
{0}. The value for roll-over is V2
999,999,999. The rollover flag will be
on 5 times interval time.
MRollover INT Rollover flag for Non-Resettable Orifice_
Mass total. The value {1} indicates Dtl_
Rollover otherwise {0}. The value for MeterRun_
roll-over is 999,999,999. The rollover V2
flag will be on 5 times interval time.
ERollover INT Rollover flag for Non-Resettable Orifice_
Energy total. The value {1} indicates Dtl_
Rollover otherwise {0}. The value for MeterRun_
roll-over is 999,999,999. The rollover V2
flag will be on 5 times interval time.
QbMaint LREAL Volume at Base in Maintenance Orifice_
mode. Dtl_
MeterRun_
V2
MMaint LREAL Mass in Maintenance mode. Orifice_
Dtl_
MeterRun_
V2
EMaint LREAL Energy at Base in Maintenance Orifice_
mode. Dtl_
MeterRun_
V2
GERG2008CV LREAL Heat Capacity at Constant Volume Orifice_
(J/mol K). Dtl_
MeterRun_
V2
GERG2008CP LREAL Heat Capacity at Constant Pressure Orifice_
(J/mol K). Dtl_
MeterRun_
V2
GERG2008W LREAL Speed of sound in gas being Orifice_
measured. Unit - ft/sec for US, Dtl_
111
Chapter 5 - API 21.1
Data
Output Parameter Description Apply to
types
meter/sec for Metric. MeterRun_
V2
Following are the error codes for the above meter run function block.
Out
Code Description Apply to
0 SUCCESS All
1¹ ERROR: PRESSURE HAS A NEGATIVE DERIVATIVE DEFAULT GAS All
DENSITY USED
ERROR: A COMPONENT MOLE FRACTION < 0.0 OR > 1.0 Orifice_
Dtl_
MeterRun_
V2
2¹ WARNING: DENSITY IN BRAKET EXCEEDS MAXIMUM DEFAULT All
PROCEEDURE USED
WARNING: SUM OF MOLE FRACTIONS < 0.9999 OR > 1.0001 Orifice_
Dtl_
MeterRun_
V2
3¹ ERROR: MAXIMUM ITERATIONS EXCEEDED IN BRAKET DEFAULT All
DENSITY USED
WARNING: PRESSURE BASE (PB) <= 0.0 OR >= 16 PSIA Orifice_
Dtl_
MeterRun_
V2
112
Chapter 5 - API 21.1
Out
Code Description Apply to
113
Chapter 5 - API 21.1
Out
Code Description Apply to
114
Chapter 5 - API 21.1
Out
Code Description Apply to
115
Chapter 5 - API 21.1
Out
Code Description Apply to
116
Chapter 5 - API 21.1
Description
This Orifice_GM_MeterRun function block calculates gas
compressibility factor, density, relative density and molecular weight
from AGA8 gross method, volume flow rate at standard condition,
mass flow rate and volume flow rate at base condition from AGA3 and
gas energy per hour from AGA5. It also calculates hourly and daily
averages and totals. It generates hourly & daily QTRs and sends them
117
Chapter 5 - API 21.1
Input
Data
Input Parameter Description Apply to
types
GrossMethod INT This parameter represents gross All
method number. It should be
either {1} for gross method 1
and {2} for gross method 2.
GasRelDensity REAL This parameter is gas relative All
density at reference condition. It
is unit less.
CO2 REAL It could be in mole fraction or All
percentage.
Hydrogen REAL It could be in mole fraction or All
percentage.
CO REAL It could be in mole fraction or All
percentage.
Nitrogen REAL It could be in mole fraction or All
percentage. This parameter is
only required for gross method
2, for gross method 1, it can be
zero.
GasHeatingValue REAL This parameter is gas heating All
value. It is only required for
gross method 1, for gross
method 2, it can be zero. It is in
Btu/ft^3 for US unit system and
in MJ/m^3 for Metric unit
system.
RefTempForCalorimeterDensity REAL This parameter is reference All
temperature for calorimeter
density. It should be in
Fahrenheit for US unit system
118
Chapter 5 - API 21.1
Data
Input Parameter Description Apply to
types
and in Celcius for Metric unit
system. The recommended
default is 60 Deg F.
RefPressForCalorimeterDensity REAL This parameter is reference All
pressure for calorimeter density.
It should be in Psia for US unit
system and in Kpa for Metric
unit system. The recommended
default is 14.73 Psia.
RefTempForCombustion REAL This parameter is reference All
temperature for combustion. It
should be in Fahrenheit for US
unit system and in Celcius for
Metric unit system. The
recommended default is 60 Deg
F.
BaseTemp REAL Base temperature should be in All
Fahrenheit for US unit system
and in Celcius for Metric unit
system. The recommended
default is 60 Deg F.
BasePressure REAL Base pressure should be in Psia All
for US unit system and in Kpa
for Metric unit system. The
recommended default is 14.73
Psia.
FlowingTemp REAL Flowing temperature should be All
in Fahrenheit for US unit system
and in Celcius for Metric unit
system.
TempHiHi REAL This is the HiHi limit for flowing All
temperature. It should be either
in Fahrenheit or Celcius.
TempHi REAL This is the Hi limit for flowing All
temperature. It should be either
in Fahrenheit or Celcius.
119
Chapter 5 - API 21.1
Data
Input Parameter Description Apply to
types
TempLoLo REAL This is the LoLo limit for flowing All
temperature. It should be either
in Fahrenheit or Celcius.
TempLo REAL This is the Lo limit for flowing All
temperature. It should be either
in Fahrenheit or Celcius.
FlowTempIOSelection INT IO selection for meter Orifice_
temperature. The value should GM_
be {1} for Live or {2) for Keypad MeterRun_
value. V2
FlowTempStsStatus USINT Analog input channel status for Orifice_
meter temperature. The value GM_
should be {0} for Good or any MeterRun_
positive integer for bad status. V2
FlowTempKeypadVal REAL Keypad value for meter Orifice_
temperature. The value that GM_
should be used when the meter MeterRun_
temperature status is bad. V2
FlowingPressure REAL Flowing pressure should be in All
Psia for US unit system and in
Kpa for Metric unit system.
PressureHiHi REAL This is the HiHi limit for flowing All
pressure. It should be either in
Psia or Kpa.
PressureHi REAL This is the Hi limit for flowing All
pressure. It should be either in
Psia or Kpa.
PressureLoLo REAL This is the LoLo limit for flowing All
pressure. It should be either in
Psia or Kpa.
PressureLo REAL This is the Lo limit for flowing All
pressure. It should be either in
Psia or Kpa.
FlowPresIOSelection INT IO selection for meter pressure. Orifice_
The value should be {1} for Live GM_
or {2) for Keypad value. MeterRun_
120
Chapter 5 - API 21.1
Data
Input Parameter Description Apply to
types
V2
FlowPresStsStatus USINT Analog input channel status for Orifice_
meter pressure. The value GM_
should be {0} for Good or any MeterRun_
positive integer for Bad status. V2
FlowPresKeypadVal REAL Analog input channel status for Orifice_
meter pressure. The value GM_
should be {0} for Good or any MeterRun_
positive integer for Bad status. V2
DifferentialPressure REAL Differential Pressure should be All
in Inches of H2O for US unit
system and in Kpa for Metric
unit system.
DPHiHi REAL This is the HiHi limit for All
differential pressure. It should
be either in Inches of H2O or
Kpa.
DPHi REAL This is the Hi limit for All
differential pressure. It should
be either in Inches of H2O or
Kpa.
DPLoLo REAL This is the LoLo limit for All
differential pressure. It should
be either in Inches of H2O or
Kpa.
DPLo REAL This is the Lo limit for All
differential pressure. It should
be either in Inches of H2O or
Kpa.
LowDPCutOff REAL This is the low differential All
pressure cut off limit. It should
be either in Inches of H2O or
Kpa. This limit decides no flow
condition.
MeterRunId INT This is an integer number that All
represents a configured meter
121
Chapter 5 - API 21.1
Data
Input Parameter Description Apply to
types
run identifier.
GasCompFormat INT This parameter is for the gas All
composition format. It should
be either mole fraction {1} or
percentage {2}.
NOTE: It is
recommended to use 2
percentage as a default
option.
122
Chapter 5 - API 21.1
Data
Input Parameter Description Apply to
types
hourly/daily/batch totals will be
not incremented.
AGA8Version INT Selection for AGA 8 algorithm Orifice_
selection: GM_
MeterRun_
1- AGA 8 (1994) V2
2 - AGA 8 (2017)
TapsType INT Flange=1 and Pipe=2 All
OrificeMaterial INT STAINLESS STEEL=1, All
MONEL=2, CARBON STEEL=3,
STAINLESS_S_304=4 and
STAINLESS_S_316=5
PipeMaterial INT STAINLESS STEEL=1, All
MONEL=2, CARBON STEEL=3,
STAINLESS_S_304=4 and
STAINLESS_S_316=5
FluidType INT Compressible Fluid =1 All
and Non-Compressible Fluid=2
TapsLocation INT Upstream=1 and Downstream=2 All
OrificeDiameter REAL This parameter is the for orifice All
plate diameter. It should be
either in inches for US unit
system or in millimeter for
Metric unit system.
OrfDiaMsrdTemp REAL This parameter represents the All
temperature at which orifice
plate diameter is measured. It
should be either in Fahrenheit
for US unit system and in
Celcius for Metric unit system.
PipeDiameter REAL This parameter is the for pipe All
diameter. It should be either in
inches for US unit system or in
millimeter for Metric unit
system.
123
Chapter 5 - API 21.1
Data
Input Parameter Description Apply to
types
PipeDiaMsrdTemp REAL This parameter represents the All
temperature at which pipe
diameter is measured. It should
be either in Fahrenheit for US
unit system and in Celcius for
Metric unit system.
AbsViscosity REAL This parameter represents the All
absolute viscosity of the gas in
Centipoise. In either unit system,
it must be in centipoise only.
(Recommended
default=0.010268 cP - pg 34
part 4)
IsenExponent REAL This parameter isentropic All
exponent is a unit less number.
(Recommended default=1.3 - pg
34 part 4)
AGA3Version INT Selection for AGA 3 algorithm Orifice_
selection: GM_
MeterRun_
1- AGA 3 (1992) V2
2- AGA 3 (2012)
AtmosphericPressure REAL Atmospheric pressure should be All
in Psia for US unit system and
in Kpa for Metric unit system.
124
Chapter 5 - API 21.1
Data
Input Parameter Description Apply to
types
UserDefined2 REAL This parameter is an optional All
one, if user wants to average
some parameter then user can
use it, it will be averaged and
logged in the QTR.
UserDefined3 REAL This parameter is an optional All
one, if user wants to average
some parameter then user can
use it, it will be averaged and
logged in the QTR.
UserDefined4 REAL This parameter is an optional All
one, if user wants to average
some parameter then user can
use it, it will be averaged and
logged in the QTR.
Output
Data
Output Parameter Description Apply to
types
Out_Code INT This out parameter returns success All
or fail code.
GasCompAtBaseCond LREAL This parameter is gas All
compressibility factor at base
condition. It is calculated in AGA8
Detailed method. It is unit less.
GasDensityAtBaseCond LREAL This parameter is gas density at base All
condition. It is calculated through
AGA8 Detailed method. It is in
lbm/ft^3 for US unit system and in
kg/m^3 for Metric unit system.
GasRelDenAtBaseCond LREAL This parameter is gas relative density All
at base condition. It is calculated
through AGA8 Detailed method. It is
unit less.
GasMolecularWeight LREAL This parameter is gas molecular All
125
Chapter 5 - API 21.1
Data
Output Parameter Description Apply to
types
weight at base condition. It is
calculated through AGA8 Detailed
method. It is in lbm for US unit
system and in kg for Metric unit
system.
Aga3QV LREAL This parameter is volume flow rate at All
flowing condition. It is calculated
through AGA3 method. It is in
ft^3/hr for US unit system and in
m^3/hr for Metric unit system.
Aga3QM LREAL This parameter is gas mass flow rate. All
It is calculated through AGA3
method. It is in lbm/hr for US unit
system and in kg/hr for Metric unit
system.
Aga3QB LREAL This parameter is volume flow rate at All
base condition. It is calculated
through AGA3 method. It is in
ft^3/hr for US unit system and in
m^3/hr for Metric unit system.
Energy LREAL This parameter is gas energy per All
hour. It is calculated through AGA5
method. It is in Btu/hr for US unit
system and in MJ/hr for Metric unit
system.
PrevHrAvgTemp LREAL This parameter is previous hour All
average for temperature.
PreDayAvgTemp LREAL This parameter is previous day All
average for temperature.
PrevHrAvgPressure LREAL This parameter is previous hour All
average for pressure.
PreDayAvgPressure LREAL This parameter is previous day All
average for pressure.
PrevHrAvgDP LREAL This parameter is previous hour All
average for differential pressure.
PreDayAvgDP LREAL This parameter is previous day All
126
Chapter 5 - API 21.1
Data
Output Parameter Description Apply to
types
average for differential pressure.
PrevHrAvgDenAtBase LREAL This parameter is previous hour All
average for density at base
condition.
PreDayAvgDenAtBase LREAL This parameter is previous day All
average for density at base
condition.
PrevHrAvgRelDenAtBase LREAL This parameter is previous hour All
average for relative density at base
condition.
PreDayAvgRelDenAtBase LREAL This parameter is previous day All
average for relative density at base
condition.
PrevHrAvgFlowExt LREAL This parameter is previous hour All
average for flow extension.
PreDayAvgFlowExt LREAL This parameter is previous day All
average for flow extension.
PrevHrAvgUserDefined1 LREAL This parameter is previous hour All
average for user defined parameter1.
PreDayAvgUserDefined1 LREAL This parameter is previous day All
average for user defined parameter1.
PrevHrAvgUserDefined2 LREAL This parameter is previous hour All
average for user defined parameter2.
PreDayAvgUserDefined2 LREAL This parameter is previous day All
average for user defined parameter2.
PrevHrAvgUserDefined3 LREAL This parameter is previous hour All
average for user defined parameter3.
PreDayAvgUserDefined3 LREAL This parameter is previous day All
average for user defined parameter3.
PrevHrAvgUserDefined4 LREAL This parameter is previous hour All
average for user defined parameter4.
PreDayAvgUserDefined4 LREAL This parameter is previous day All
average for user defined parameter4.
127
Chapter 5 - API 21.1
Data
Output Parameter Description Apply to
types
QbTH LREAL This parameter is volume flow rate at All
base condition total for this hour.
QbLH LREAL This parameter is volume flow rate at All
base condition total for last hour.
QbTD LREAL This parameter is volume flow rate at All
base condition total for this day.
QbLD LREAL This parameter is volume flow rate at All
base condition total for last day.
MTH LREAL This parameter is mass flow rate All
total for this hour.
MLH LREAL This parameter is mass flow rate All
total for last hour.
MTD LREAL This parameter is mass flow rate All
total for this day.
MLD LREAL This parameter is mass flow rate All
total for last day.
ETH LREAL This parameter is energy total for All
this hour.
ELH LREAL This parameter is energy total for All
last hour.
ETD LREAL This parameter is energy total for All
this day.
ELD LREAL This parameter is energy total for All
last day.
QbNR LREAL Non-Resettable or Cumulative total Orifice_
for volume at Base. Unit - ft3/hr for GM_
US, m3/hr for Metric. MeterRun_
V2
MNR LREAL Non-Resettable or Cumulative total Orifice_
for Mass. Unit - lbm/hr for US, kg/hr GM_
for Metric. MeterRun_
V2
ENR LREAL Non-Resettable or Cumulative total Orifice_
for Energy. Unit -Btu/hr for US, GM_
128
Chapter 5 - API 21.1
Data
Output Parameter Description Apply to
types
MJ/hr for Metric. MeterRun_
V2
QbRollover INT Rollover flag for volume at base Orifice_
condition non-resettable total. The GM_
value {1} indicates Rollover MeterRun_
otherwise {0}. The value for roll-over V2
is 999,999,999. The rollover flag will
be on 5 times interval time.
MRollover INT Rollover flag for Non-Resettable Orifice_
Mass total. The value {1} indicates GM_
Rollover otherwise {0}. The value for MeterRun_
roll-over is 999,999,999. The rollover V2
flag will be on 5 times interval time.
ERollover INT Rollover flag for Non-Resettable Orifice_
Energy total. The value {1} indicates GM_
Rollover otherwise {0}. The value for MeterRun_
roll-over is 999,999,999. The rollover V2
flag will be on 5 times interval time.
QbMaint LREAL Volume at Base in Maintenance Orifice_
mode. GM_
MeterRun_
V2
MMaint LREAL Mass in Maintenance mode. Orifice_
GM_
MeterRun_
V2
EMaint LREAL Energy at Base in Maintenance Orifice_
mode. GM_
MeterRun_
V2
129
Chapter 5 - API 21.1
Following are the error codes for the above meter run function block.
Out
Description Apply to
Code
0 SUCCESS All
5 ERROR: THE ROOT WAS NOT BOUNDED IN DGROSS All
6 ERROR: NO CONVERGENCE IN DGROSS All
7 ERROR: VIRGS SQURE ROOT NEGATIVE All
8 ERROR: COMBINED VALUES OF GRGR, X[2] AND HV NOT All
CONSISTENT
9 ERROR: INVALID TERM IN VIRGS All
11 ERROR: METHOD WAS NOT 1 OR 2 All
12 ERROR: FLOWING PRESSURE (PF) <= 0.0 OR > 1740.0 PSIA All
13 ERROR: FLOWING TEMPERATURE (TF) < 14.0 OR > 149.0 DEG F All
14 ERROR: HEATING VALUE (HV) < 477.0 OR > 1211.0 BTU/FT^3 All
15 ERROR: GAS RELATIVE DENSITY (GRGR) < 0.55 OR > 0.870 All
16 ERROR: MOLE FRACTION FOR N2 < 0.0 OR > 0.50 All
OR FOR CO2 < 0.0 OR > 0.30
OR FOR H2 < 0.0 OR > 0.10
OR FOR CO < 0.0 OR > 0.03
17 ERROR: REFERENCE TEMPERATURE < 32.0 OR > 77.0 DEG F All
18 ERROR: REFERENCE PRESSURE < 13.0 OR > 16.0 PSIA All
22 WARNING: FLOWING PRESSURE (PF) <= 0.0 OR > 1200.0 PSIA Orifice_
GM_
MeterRun
23 WARNING: FLOWING TEMPERATURE (TF) < 32.0 OR > 130.0 DEG Orifice_
F GM_
MeterRun
24 WARNING: HEATING VALUE (HV) < 805.0 OR > 1208.0 BTU/FT^3 Orifice_
130
Chapter 5 - API 21.1
Out
Description Apply to
Code
GM_
MeterRun
25 WARNING: GAS RELATIVE DENSITY (GRGR) < 0.55 OR > 0.800 Orifice_
GM_
MeterRun
26 WARNING: MOLE FRACTION FOR N2 < 0.0 OR > 0.20 Orifice_
OR FOR CO2 < 0.0 OR > 0.20 GM_
OR FOR H2 < 0.0 OR > 0.0 MeterRun
OR FOR CO < 0.0 OR >0.0
51 ERROR: NTAPS WAS NOT 0, 1 OR 2 All
54 ERROR: MATORF OR MATPIPE WAS NOT 0, 1, 2 OR 3 All
55 ERROR: ORIFICE DIAMETER WAS <= 0 OR => 100.0 INCHES All
56 ERROR: PIPE DIAMETER WAS <= 0 OR => 100.0 INCHES All
57 ERROR: FLOWING OR STANDARD DENSITY WAS <= 0.0 LBM/FT^3 All
58 ERROR: DIFFERENTIAL PRESSURE WAS <= 0.0 INCHES H2O All
59 ERROR: GAS VISCOSITY WAS <= 0.005 OR > 0.5 CENTIPOISES All
60 ERROR: ISENTROPIC EXPONENT <= 1.0 OR => 2.0 All
61 ERROR: IFLUID WAS NOT 0, 1 OR 2 All
62 ERROR: STANDARD TEMPERATURE WAS NOT = 60.0 DEG F All
63 ERROR: STANDARD PRESSURE WAS NOT = 14.73 PSIA All
64 ERROR: TAP LOCATION WAS NOT 0, 1 OR 2 FOR NTAPS=2 (PIPE) All
OR TAP LOCATION WAS NOT 1 FOR NTAPS=1 (FLANGE)
65 ERROR: SUPERCOMPRESSIBILITY FACTOR WAS <= 0.0 All
66 ERROR: RELATIVE DENSITY AT STANDARD CONDITIONS WAS < All
0.07 OR > 1.52
67 ERROR: CALIBRATION FACTOR WAS <= 0.0 All
68 ERROR: COMPRESSIBILITY FACTOR AT STANDARD CONDITIONS All
<= 0.0
69 ERROR: BETA RATIO (DO/DM) <= 0.0 OR => 1.0 All
70 ERROR: IF NTAPS = 1, GOF2015_OPTION NOT = 1 OR = 0 Orifice_
131
Chapter 5 - API 21.1
Out
Description Apply to
Code
GM_
MeterRun_
V2
71 ERROR: IF NTAPS = 2, GOF2015_OPTION NOT = 0 Orifice_
GM_
MeterRun_
V2
72 ERROR: DIFFERENTIAL PRESSURE WAS GREATER THAN Orifice_
UPSTREAM STATIC PRESSURE GM_
MeterRun_
V2
75 WARNING: ORIFICE DIAMETER WAS <= 0.45 INCHES All
76 WARNING: PIPE DIAMETER WAS <= 2.0 INCHES All
79 WARNING: BETA RATIO (DO/DM) WAS <= 0.1 OR >= 0.75 All
80 WARNING: IF GOF2015_OPTION = 1, (HW)/(27.7072*(PF)) = OR > Orifice_
0.25; GM_
MeterRun_
IF GOF2015_OPTION = 0, (HW)/(27.707*(PF)) > 0.2 V2
81 WARNING: FLOWING PRESSURE (PF) > 1500.0 PSIA AGA8 2017 Orifice_
RANGE 1 GM_
MeterRun_
V2
82 WARNING: FLOWING TEMPERATURE (TF) < 17.01 OR > 143.0 DEG Orifice_
F AGA8 2017 RANGE 2 OR (TF) < 25.0 OR > 143.0 DEG F AGA8 GM_
2017 RANGE 1 MeterRun_
V2
83 WARNING: HEATING VALUE (HV) < 665.0 OR > 1100.0 BTU/FT^3 Orifice_
AGA8 2017 RANGE 2 OR (HV) < 930.0 OR > 1040.0 BTU/FT^3 GM_
AGA8 2017 RANGE 1 MeterRun_
V2
84 WARNING: GAS RELATIVE DENSITY (GRGR) < 0.554 OR > 0.801 Orifice_
AGA8 2017 RANGE 2 OR (GRGR) < 0.554 OR > 0.630 AGA8 RANGE GM_
1 MeterRun_
V2
85 WARNING: MOLE FRACTION FOR N2 > 0.20 AGA8 2017 RANGE 2 Orifice_
132
Chapter 5 - API 21.1
Out
Description Apply to
Code
OR N2 > 0.07 AGA8 2017 RANGE 1 GM_
MeterRun_
OR FOR CO2 > 0.25 AGA8 2017 RANGE 2 OR CO2 > 0.03 AGA8 V2
2017 RANGE 1
133
Chapter 5 - API 21.1
Description
This Turbine_Dtl_MeterRun function block calculates gas
compressibility factor, density, relative density and molecular weight
from AGA8 detailed method, uncorrected flow, mass flow rate and
volume flow rate at base condition from AGA7 and gas energy per
hour from AGA5. It also calculates hourly and daily averages and
totals. It generates hourly & daily QTRs and sends them to EFM
application which logs them on he contoller’s MRAM and flash
memory. It also generates alarms when any of the process value
crosses specified alarm limit.
Turbine_Dtl_MeterRun expects the input parameters to be in US or
Metric unit system.
This description is also applicable to function block Ultrasonic_Dtl_
MeterRun. Both Turbine and Ultrasonic meters are technically same.
Input
Data
Input Parameter Description Apply to
types
Methane REAL It could be in mole fraction or percentage. All
134
Chapter 5 - API 21.1
Data
Input Parameter Description Apply to
types
135
Chapter 5 - API 21.1
Data
Input Parameter Description Apply to
types
136
Chapter 5 - API 21.1
Data
Input Parameter Description Apply to
types
FlowTempIOSelection INT IO selection for meter temperature. The Turbine_
value should be {1} for Live or {2) for Dtl_
Keypad value. MeterRun_
V2
FlowTempStsStatus USINT Analog input channel status for meter Turbine_
temperature. The value should be {0} for Dtl_
Good or any positive integer for bad MeterRun_
status. V2
FlowTempKeypadVal REAL Keypad value for meter temperature. The Turbine_
value that should be used when the meter Dtl_
temperature status is bad. MeterRun_
V2
FlowingPressure REAL Flowing pressure should be in Psia for US All
unit system and in Kpa for Metric unit
system.
PressureHiHi REAL This is the HiHi limit for flowing pressure. All
It should be either in Psia or Kpa.
PressureHi REAL This is the Hi limit for flowing pressure. It All
should be either in Psia or Kpa.
PressureLoLo REAL This is the LoLo limit for flowing pressure. All
It should be either in Psia or Kpa.
PressureLo REAL This is the Lo limit for flowing pressure. It All
should be either in Psia or Kpa.
PulseOrAnalogCount REAL For pulse input, it would be a number Turbine_
while for analog input, it should be in Dtl_
ft^3/hr for US unit system and in m^3/hr MeterRun
for Metric unit system.
PulseOrAnalogHiHi REAL This is the HiHi limit for pulse or analog Turbine_
input. For pulse input, it would be a Dtl_
number while for analog input, it should MeterRun
be in ft^3/hr for US unit system and in
m^3/hr for Metric unit system.
PulseOrAnalogHi REAL This is the Hi limit for pulse or analog Turbine_
input. For pulse input, it would be a Dtl_
number while for analog input, it should MeterRun
137
Chapter 5 - API 21.1
Data
Input Parameter Description Apply to
types
be in ft^3/hr for US unit system and in
m^3/hr for Metric unit system.
PulseOrAnalogLoLo REAL This is the LoLo limit for pulse or analog Turbine_
input. For pulse input, it would be a Dtl_
number while for analog input, it should MeterRun
be in ft^3/hr for US unit system and in
m^3/hr for Metric unit system.
PulseOrAnalogLo REAL This is the Lo limit for pulse or analog Turbine_
input. For pulse input, it would be a Dtl_
number while for analog input, it should MeterRun
be in ft^3/hr for US unit system and in
m^3/hr for Metric unit system.
LowPulseCutOff REAL This is the low pulse cut off limit. For Turbine_
pulse input, it is a number. For analog Dtl_
input, it should be in ft^3/hr for US unit MeterRun
system and in m^3/hr for Metric unit
system.
FlowPresIOSelection INT IO selection for meter pressure. The value Turbine_
should be {1} for Live or {2) for Keypad Dtl_
value. MeterRun_
V2
FlowPresStsStatus USINT Analog input channel status for meter Turbine_
pressure. The value should be {0} for Good Dtl_
or any positive integer for Bad status. MeterRun_
V2
FlowPresKeypadVal REAL Analog input channel status for meter Turbine_
pressure. The value should be {0} for Good Dtl_
or any positive integer for Bad status. MeterRun_
V2
Analog REAL Value of analog input if flow type = analog. Turbine_
The value should be in lb^3/hr for US unit Dtl_
or m^3/hr for Metric unit. MeterRun_
V2
AnalogHiHi REAL This is the HiHi limit for analog input. The Turbine_
value should be in lb^3/hr for US unit or Dtl_
m^3/hr for Metric unit. MeterRun_
V2
138
Chapter 5 - API 21.1
Data
Input Parameter Description Apply to
types
AnalogHi REAL This is the Hi limit for analog input. The Turbine_
value should be in lb^3/hr for US unit or Dtl_
m^3/hr for Metric unit. MeterRun_
V2
AnalogLoLo REAL This is the LoLo limit for analog input. The Turbine_
value should be in lb^3/hr for US unit or Dtl_
m^3/hr for Metric unit. MeterRun_
V2
AnalogLo REAL This is the Lo limit for analog input. The Turbine_
value should be in lb^3/hr for US unit or Dtl_
m^3/hr for Metric unit. MeterRun_
V2
LowFlowCutOff REAL Low flow cutoff value checks the no flow Turbine_
condition in the calculations. If the flow is Dtl_
s less than this number, it will be MeterRun_
considered as no flow condition. Unit is V2
m3/hr for Metric unit, ft3/hr for US unit.
Pulse UDINT Pulse counter value Turbine_
Dtl_
MeterRun_
V2
LowPulseCutOff UINT Low pulse cutoff value checks the no flow Turbine_
condition in the calculations. If the Pulse Dtl_
increment is less than this number, it will MeterRun_
be considered as no flow condition. V2
MeterCalFactor REAL This parameter represents meter All
calibration factor. It is a number.
MeterRunId INT This is an integer number that represents All
a configured meter run identifier.
GasCompFormat INT This parameter is for the gas composition All
format. It should be either mole fraction
{1} or percentage {2}.
139
Chapter 5 - API 21.1
Data
Input Parameter Description Apply to
types
FlowType INT This parameter represents the flow type, it All
should be either {1} Pulse Accumulated or
{2} Analog Flow Rate.
InputUnit INT This parameter is for all the inputs of All
meter run function block. It should be
either US {1} or Metric {2}.
ContractUnit INT This parameter is for all the outputs of All
meter run function block. It should be
either US {1} or Metric {2}.
ContractStartday INT This parameter represents the start of gas All
QTR day. Its value should be from 0 to 23.
AvgMethod INT This parameter is for averaging method to All
be used for averaging. As of now, it only
supports value {1} that is for time
weighted linear average.
MaintMode INT Parameter to Start or Stop the Turbine_
Maintenance Mode. The value should be Dtl_
either {0} Maintenance End or {1} for MeterRun_
Maintenance Start. When Maintenance V2
mode is started, an independent totalizer
will be started and accumulate all the flow
until the maintenance mode is stopped.
During this period, non-resettable totals,
hourly/daily/batch totals will be not
incremented.
AGA8Version INT Selection for AGA 8 algorithm selection: Turbine_
Dtl_
1- AGA 8 (1994) MeterRun_
2 - AGA 8 (2017) V2
140
Chapter 5 - API 21.1
Data
Input Parameter Description Apply to
types
UserDefined1 REAL This parameter is an optional one, if user All
wants to average some parameter then
user can use it, it will be averaged and
logged in the QTR.
UserDefined2 REAL This parameter is an optional one, if user All
wants to average some parameter then
user can use it, it will be averaged and
logged in the QTR.
UserDefined3 REAL This parameter is an optional one, if user All
wants to average some parameter then
user can use it, it will be averaged and
logged in the QTR.
UserDefined4 REAL This parameter is an optional one, if user All
wants to average some parameter then
user can use it, it will be averaged and
logged in the QTR.
Output
Data
Output Parameter Description Apply to
types
Out_Code INT This out parameter returns success or All
fail code.
GasCompAtBaseCond LREAL This parameter is gas compressibility All
factor at base condition. It is
calculated in AGA8 Detailed method. It
is unit less.
GasDensityAtBaseCond LREAL This parameter is gas density at base All
condition. It is calculated through
AGA8 Detailed method. It is in lbm/ft^3
for US unit system and in kg/m^3 for
Metric unit system.
GasRelDenAtBaseCond LREAL This parameter is gas relative density All
at base condition. It is calculated
through AGA8 Detailed method. It is
unit less.
141
Chapter 5 - API 21.1
Data
Output Parameter Description Apply to
types
GasMolecularWeight LREAL This parameter is gas molecular weight All
at base condition. It is calculated
through AGA8 Detailed method. It is in
lbm for US unit system and in kg for
Metric unit system.
UncorrectedFlow LREAL This parameter is uncorrecetd flow All
rate. It is calculated through AGA7
method. It is in ft^3/hr for US unit
system and in m^3/hr for Metric unit
system.
Aga7QM LREAL This parameter is gas mass flow rate. It All
is calculated through AGA7 method. It
is in lbm/hr for US unit system and in
kg/hr for Metric unit system.
Aga7QB LREAL This parameter is volume flow rate at All
base condition. It is calculated
through AGA7 method. It is in ft^3/hr
for US unit system and in m^3/hr for
Metric unit system.
Energy LREAL This parameter is gas energy per hour. All
It is calculated through AGA5 method.
It is in Btu/hr for US unit system and in
MJ/hr for Metric unit system.
PrevHrAvgTemp LREAL This parameter is previous hour All
average for temperature.
PreDayAvgTemp LREAL This parameter is previous day average All
for temperature.
PrevHrAvgPressure LREAL This parameter is previous hour All
average for pressure.
PreDayAvgPressure LREAL This parameter is previous day average All
for pressure.
PrevHrAvgPulse LREAL This parameter is previous hour All
average for analog input.
PreDayAvgPulse LREAL This parameter is previous day average All
for analog input.
142
Chapter 5 - API 21.1
Data
Output Parameter Description Apply to
types
PrevHrAvgDenAtBase LREAL This parameter is previous hour All
average for density at base condition.
PreDayAvgDenAtBase LREAL This parameter is previous day average All
for density at base condition.
PrevHrAvgRelDenAtBase LREAL This parameter is previous hour All
average for relative density at base
condition.
PreDayAvgRelDenAtBase LREAL This parameter is previous day average All
for relative density at base condition.
PrevHrAvgUncorrFlow LREAL This parameter is previous hour All
average for uncorrected flow.
PreDayAvgUncorrFlow LREAL This parameter is previous day average All
for uncorrected flow.
PrevHrAvgUserDefined1 LREAL This parameter is previous hour All
average for user defined parameter1.
PreDayAvgUserDefined1 LREAL This parameter is previous day average All
for user defined parameter1.
PrevHrAvgUserDefined2 LREAL This parameter is previous hour All
average for user defined parameter2.
PreDayAvgUserDefined2 LREAL This parameter is previous day average All
for user defined parameter2.
PrevHrAvgUserDefined3 LREAL This parameter is previous hour All
average for user defined parameter3.
PreDayAvgUserDefined3 LREAL This parameter is previous day average All
for user defined parameter3.
PrevHrAvgUserDefined4 LREAL This parameter is previous hour All
average for user defined parameter4.
PreDayAvgUserDefined4 LREAL This parameter is previous day average All
for user defined parameter4.
QbTH LREAL This parameter is volume flow rate at All
base condition total for this hour.
QbLH LREAL This parameter is volume flow rate at All
base condition total for last hour.
143
Chapter 5 - API 21.1
Data
Output Parameter Description Apply to
types
QbTD LREAL This parameter is volume flow rate at All
base condition total for this day.
QbLD LREAL This parameter is volume flow rate at All
base condition total for last day.
MTH LREAL This parameter is mass flow rate total All
for this hour.
MLH LREAL This parameter is mass flow rate total All
for last hour.
MTD LREAL This parameter is mass flow rate total All
for this day.
MLD LREAL This parameter is mass flow rate total All
for last day.
ETH LREAL This parameter is energy total for this All
hour.
ELH LREAL This parameter is energy total for last All
hour.
ETD LREAL This parameter is energy total for this All
day.
ELD LREAL This parameter is energy total for last All
day.
QbNR LREAL Non-Resettable or Cumulative total for Turbine_
volume at Base. Unit - ft3/hr for US, Dtl_
m3/hr for Metric. MeterRun_
V2
MNR LREAL Non-Resettable or Cumulative total for Turbine_
Mass. Unit - lbm/hr for US, kg/hr for Dtl_
Metric. MeterRun_
V2
ENR LREAL Non-Resettable or Cumulative total for Turbine_
Energy. Unit -Btu/hr for US, MJ/hr for Dtl_
Metric. MeterRun_
V2
QbRollover INT Rollover flag for volume at base Turbine_
condition non-resettable total. The Dtl_
144
Chapter 5 - API 21.1
Data
Output Parameter Description Apply to
types
value {1} indicates Rollover otherwise MeterRun_
{0}. The value for roll-over is V2
999,999,999. The rollover flag will be
on 5 times interval time.
MRollover INT Rollover flag for Non-Resettable Mass Turbine_
total. The value {1} indicates Rollover Dtl_
otherwise {0}. The value for roll-over is MeterRun_
999,999,999. The rollover flag will be V2
on 5 times interval time.
ERollover INT Rollover flag for Non-Resettable Turbine_
Energy total. The value {1} indicates Dtl_
Rollover otherwise {0}. The value for MeterRun_
roll-over is 999,999,999. The rollover V2
flag will be on 5 times interval time.
QbMaint LREAL Volume at Base in Maintenance mode. Turbine_
Dtl_
MeterRun_
V2
MMaint LREAL Mass in Maintenance mode. Turbine_
Dtl_
MeterRun_
V2
EMaint LREAL Energy at Base in Maintenance mode. Turbine_
Dtl_
MeterRun_
V2
GERG2008CV LREAL Heat Capacity at Constant Volume Turbine_
(J/mol K). Dtl_
MeterRun_
V2
GERG2008CP LREAL Heat Capacity at Constant Pressure Turbine_
(J/mol K). Dtl_
MeterRun_
V2
GERG2008W LREAL Speed of sound in gas being Turbine_
measured. Unit - ft/sec for US, Dtl_
145
Chapter 5 - API 21.1
Data
Output Parameter Description Apply to
types
meter/sec for Metric. MeterRun_
V2
Following are the error codes for the above meter run function block.
146
Chapter 5 - API 21.1
147
Chapter 5 - API 21.1
148
Chapter 5 - API 21.1
149
Chapter 5 - API 21.1
Description
This Turbine_GM_MeterRun function block calculates gas
compressibility factor, density, relative density and molecular weight
from AGA8 gross method, uncorrected flow, mass flow rate and
volume flow rate at base condition from AGA7 and gas energy per
hour from AGA5. It also calculates hourly and daily averages and
totals. It generates hourly & daily QTRs and sends them to EFM
application which logs them on the controller’s MRAM and flash
memory. It also generates alarms when any of the process value
crosses specified alarm limit.
Turbine_GM_MeterRun expects the input parameters to be in US or
Metric unit system.
This description is also applicable to function block Ultrasonic_GM_
MeterRun. Both Turbine and Ultrasonic meters are technically same.
Input
Data
Input Parameter Description Apply to
types
GrossMethod INT This parameter represents gross All
method number. It should be
either {1} for gross method 1
and {2} for gross method 2.
GasRelDensity REAL This parameter is gas relative All
density at reference condition. It
is unit less.
CO2 REAL It could be in mole fraction or All
percentage.
Hydrogen REAL It could be in mole fraction or All
percentage.
CO REAL It could be in mole fraction or All
percentage.
Nitrogen REAL It could be in mole fraction or All
percentage. This parameter is
only required for gross method
2, for gross method 1, it can be
zero.
GasHeatingValue REAL This parameter is gas heating All
150
Chapter 5 - API 21.1
Data
Input Parameter Description Apply to
types
value. It is only required for gross
method 1, for gross method 2, it
can be zero. It is in Btu/ft^3 for
US unit system and in MJ/m^3
for Metric unit system.
RefTempForCalorimeterDensity REAL This parameter is reference All
temperature for calorimeter
density. It should be in
Fahrenheit for US unit system
and in Celcius for Metric unit
system. The recommended
default is 60 Deg F.
RefPressForCalorimeterDensity REAL This parameter is reference All
pressure for calorimeter density.
It should be in Psia for US unit
system and in Kpa for Metric
unit system. The recommended
default is 14.73 Psia.
RefTempForCombustion REAL This parameter is reference All
temperature for combustion. It
should be in Fahrenheit for US
unit system and in Celcius for
Metric unit system. The
recommended default is 60 Deg
F.
BaseTemp REAL Base temperature should be in All
Fahrenheit for US unit system
and in Celcius for Metric unit
system. The recommended
default is 60 Deg F.
BasePressure REAL Base pressure should be in Psia All
for US unit system and in Kpa for
Metric unit system. The
recommended default is 14.73
Psia.
FlowingTemp REAL Flowing temperature should be All
in Fahrenheit for US unit system
151
Chapter 5 - API 21.1
Data
Input Parameter Description Apply to
types
and in Celcius for Metric unit
system.
TempHiHi REAL This is the HiHi limit for flowing All
temperature. It should be either
in Fahrenheit or Celcius.
TempHi REAL This is the Hi limit for flowing All
temperature. It should be either
in Fahrenheit or Celcius.
TempLoLo REAL This is the LoLo limit for flowing All
temperature. It should be either
in Fahrenheit or Celcius.
TempLo REAL This is the Lo limit for flowing All
temperature. It should be either
in Fahrenheit or Celcius.
FlowTempIOSelection INT IO selection for meter Turbine_
temperature. The value should GM_
be {1} for Live or {2) for Keypad MeterRun_
value. V2
FlowTempStsStatus USINT Analog input channel status for Turbine_
meter temperature. The value GM_
should be {0} for Good or any MeterRun_
positive integer for bad status. V2
FlowTempKeypadVal REAL Keypad value for meter Turbine_
temperature. The value that GM_
should be used when the meter MeterRun_
temperature status is bad. V2
FlowingPressure REAL Flowing pressure should be in All
Psia for US unit system and in
Kpa for Metric unit system.
PressureHiHi REAL This is the HiHi limit for flowing All
pressure. It should be either in
Psia or Kpa.
PressureHi REAL This is the Hi limit for flowing All
pressure. It should be either in
Psia or Kpa.
152
Chapter 5 - API 21.1
Data
Input Parameter Description Apply to
types
PressureLoLo REAL This is the LoLo limit for flowing All
pressure. It should be either in
Psia or Kpa.
PressureLo REAL This is the Lo limit for flowing All
pressure. It should be either in
Psia or Kpa.
PulseOrAnalogCount REAL For pulse input, it would be a Turbine_
number while for analog input, it GM_
should be in ft^3/hr for US unit MeterRun
system and in m^3/hr for Metric
unit system.
PulseOrAnalogHiHi REAL This is the HiHi limit for pulse or Turbine_
analog input. For pulse input, it GM_
would be a number while for MeterRun
analog input, it should be in
ft^3/hr for US unit system and in
m^3/hr for Metric unit system.
PulseOrAnalogHi REAL This is the Hi limit for pulse or Turbine_
analog input. For pulse input, it GM_
would be a number while for MeterRun
analog input, it should be in
ft^3/hr for US unit system and in
m^3/hr for Metric unit system.
PulseOrAnalogLoLo REAL This is the LoLo limit for pulse or Turbine_
analog input. For pulse input, it GM_
would be a number while for MeterRun
analog input, it should be in
ft^3/hr for US unit system and in
m^3/hr for Metric unit system.
PulseOrAnalogLo REAL This is the Lo limit for pulse or Turbine_
analog input. For pulse input, it GM_
would be a number while for MeterRun
analog input, it should be in
ft^3/hr for US unit system and in
m^3/hr for Metric unit system.
LowPulseCutOff REAL This is the low pulse cut off limit. Turbine_
For pulse input, it is a number. GM_
153
Chapter 5 - API 21.1
Data
Input Parameter Description Apply to
types
For analog input, it should be in MeterRun
ft^3/hr for US unit system and in
m^3/hr for Metric unit system.
FlowPresIOSelection INT IO selection for meter pressure. Turbine_
The value should be {1} for Live GM_
or {2) for Keypad value. MeterRun_
V2
FlowPresStsStatus USINT Analog input channel status for Turbine_
meter pressure. The value should GM_
be {0} for Good or any positive MeterRun_
integer for Bad status. V2
FlowPresKeypadVal REAL Analog input channel status for Turbine_
meter pressure. The value should GM_
be {0} for Good or any positive MeterRun_
integer for Bad status. V2
Analog REAL Value of analog input if flow type Turbine_
= analog. The value should be in GM_
lb^3/hr for US unit or m^3/hr for MeterRun_
Metric unit. V2
AnalogHiHi REAL This is the HiHi limit for analog Turbine_
input. The value should be in GM_
lb^3/hr for US unit or m^3/hr for MeterRun_
Metric unit. V2
AnalogHi REAL This is the Hi limit for analog Turbine_
input. The value should be in GM_
lb^3/hr for US unit or m^3/hr for MeterRun_
Metric unit. V2
AnalogLoLo REAL This is the LoLo limit for analog Turbine_
input. The value should be in GM_
lb^3/hr for US unit or m^3/hr for MeterRun_
Metric unit. V2
AnalogLo REAL This is the Lo limit for analog Turbine_
input. The value should be in GM_
lb^3/hr for US unit or m^3/hr for MeterRun_
Metric unit. V2
LowFlowCutOff REAL Low flow cutoff value checks the Turbine_
154
Chapter 5 - API 21.1
Data
Input Parameter Description Apply to
types
no flow condition in the GM_
calculations. If the flow is s less MeterRun_
than this number, it will be V2
considered as no flow condition.
Unit is m3/hr for Metric unit,
ft3/hr for US unit.
Pulse UDINT Pulse counter value Turbine_
GM_
MeterRun_
V2
LowPulseCutOff UINT Low pulse cutoff value checks Turbine_
the no flow condition in the GM_
calculations. If the Pulse MeterRun_
increment is less than this V2
number, it will be considered as
no flow condition.
MeterCalFactor REAL This parameter represents meter All
calibration factor. It is a number.
MeterRunId INT This is an integer number that All
represents a configured meter
run identifier.
GasCompFormat INT This parameter is for the gas All
composition format. It should be
either mole fraction {1} or
percentage {2}.
NOTE: It is recommended
to use 2 percentage as a
default option.
155
Chapter 5 - API 21.1
Data
Input Parameter Description Apply to
types
or Metric {2}.
ContractUnit INT This parameter is for all the All
outputs of meter run function
block. It should be either US {1}
or Metric {2}.
ContractStartday INT This parameter represents the All
start of gas QTR day. Its value
should be from 0 to 23.
AvgMethod INT This parameter is for averaging All
method to be used for
averaging. As of now, it only
supports value {1} that is for
time weighted linear average.
MaintMode INT Parameter to Start or Stop the Turbine_
Maintenance Mode. The value GM_
should be either {0} MeterRun_
Maintenance End or {1} for V2
Maintenance Start. When
Maintenance mode is started, an
independent totalizer will be
started and accumulate all the
flow until the maintenance mode
is stopped. During this period,
non-resettable totals,
hourly/daily/batch totals will be
not incremented.
AGA8Version INT Selection for AGA 8 algorithm Turbine_
selection: GM_
MeterRun_
1- AGA 8 (1994) V2
2 - AGA 8 (2017)
AtmosphericPressure REAL Atmospheric pressure should be All
in Psia for US unit system and in
Kpa for Metric unit system.
156
Chapter 5 - API 21.1
Data
Input Parameter Description Apply to
types
measured by a pressure gauge. If
flowing pressure is already
absolute then it can be left zero.
UserDefined1 REAL This parameter is an optional All
one, if user wants to average
some parameter then user can
use it, it will be averaged and
logged in the QTR.
UserDefined2 REAL This parameter is an optional All
one, if user wants to average
some parameter then user can
use it, it will be averaged and
logged in the QTR.
UserDefined3 REAL This parameter is an optional All
one, if user wants to average
some parameter then user can
use it, it will be averaged and
logged in the QTR.
UserDefined4 REAL This parameter is an optional All
one, if user wants to average
some parameter then user can
use it, it will be averaged and
logged in the QTR.
Output
Data
Output Parameter Description All
types
Out_Code INT This out parameter returns All
success or fail code.
GasCompAtBaseCond LREAL This parameter is gas All
compressibility factor at base
condition. It is calculated in AGA8
Detailed method. It is unit less.
GasDensityAtBaseCond LREAL This parameter is gas density at All
base condition. It is calculated
157
Chapter 5 - API 21.1
Data
Output Parameter Description All
types
through AGA8 Detailed method. It
is in lbm/ft^3 for US unit system
and in kg/m^3 for Metric unit
system.
GasRelDenAtBaseCond LREAL This parameter is gas relative All
density at base condition. It is
calculated through AGA8 Detailed
method. It is unit less.
GasMolecularWeight LREAL This parameter is gas molecular All
weight at base condition. It is
calculated through AGA8 Detailed
method. It is in lbm for US unit
system and in kg for Metric unit
system.
UncorrectedFlow LREAL This parameter is uncorrecetd All
flow rate. It is calculated through
AGA7 method. It is in ft^3/hr for
US unit system and in m^3/hr for
Metric unit system.
Aga7QM LREAL This parameter is gas mass flow All
rate. It is calculated through AGA7
method. It is in lbm/hr for US unit
system and in kg/hr for Metric
unit system.
Aga7QB LREAL This parameter is volume flow rate All
at base condition. It is calculated
through AGA7 method. It is in
ft^3/hr for US unit system and in
m^3/hr for Metric unit system.
Energy LREAL This parameter is gas energy per All
hour. It is calculated through
AGA5 method. It is in Btu/hr for
US unit system and in MJ/hr for
Metric unit system.
PrevHrAvgTemp LREAL This parameter is previous hour All
average for temperature.
PreDayAvgTemp LREAL This parameter is previous day All
158
Chapter 5 - API 21.1
Data
Output Parameter Description All
types
average for temperature.
PrevHrAvgPressure LREAL This parameter is previous hour All
average for pressure.
PreDayAvgPressure LREAL This parameter is previous day All
average for pressure.
PrevHrAvgPulse LREAL This parameter is previous hour All
average for analog input.
PreDayAvgPulse LREAL This parameter is previous day All
average for analog input.
PrevHrAvgDenAtBase LREAL This parameter is previous hour All
average for density at base
condition.
PreDayAvgDenAtBase LREAL This parameter is previous day All
average for density at base
condition.
PrevHrAvgRelDenAtBase LREAL This parameter is previous hour All
average for relative density at
base condition.
PreDayAvgRelDenAtBase LREAL This parameter is previous day All
average for relative density at
base condition.
PrevHrAvgUncorrFlow LREAL This parameter is previous hour All
average for uncorrected flow.
PreDayAvgUncorrFlow LREAL This parameter is previous day All
average for uncorrected flow.
PrevHrAvgUserDefined1 LREAL This parameter is previous hour All
average for user defined
parameter1.
PreDayAvgUserDefined1 LREAL This parameter is previous day All
average for user defined
parameter1.
PrevHrAvgUserDefined2 LREAL This parameter is previous hour All
average for user defined
parameter2.
159
Chapter 5 - API 21.1
Data
Output Parameter Description All
types
PreDayAvgUserDefined2 LREAL This parameter is previous day All
average for user defined
parameter2.
PrevHrAvgUserDefined3 LREAL This parameter is previous hour All
average for user defined
parameter3.
PreDayAvgUserDefined3 LREAL This parameter is previous day All
average for user defined
parameter3.
PrevHrAvgUserDefined4 LREAL This parameter is previous hour All
average for user defined
parameter4.
PreDayAvgUserDefined4 LREAL This parameter is previous day All
average for user defined
parameter4.
QbTH LREAL This parameter is volume flow rate All
at base condition total for this
hour.
QbLH LREAL This parameter is volume flow rate All
at base condition total for last
hour.
QbTD LREAL This parameter is volume flow rate All
at base condition total for this
day.
QbLD LREAL This parameter is volume flow rate All
at base condition total for last
day.
MTH LREAL This parameter is mass flow rate All
total for this hour.
MLH LREAL This parameter is mass flow rate All
total for last hour.
MTD LREAL This parameter is mass flow rate All
total for this day.
MLD LREAL This parameter is mass flow rate All
total for last day.
160
Chapter 5 - API 21.1
Data
Output Parameter Description All
types
ETH LREAL This parameter is energy total for All
this hour.
ELH LREAL This parameter is energy total for All
last hour.
ETD LREAL This parameter is energy total for All
this day.
ELD LREAL This parameter is energy total for All
last day.
QbNR LREAL Non-Resettable or Cumulative Turbine_
total for volume at Base. Unit - GM_
ft3/hr for US, m3/hr for Metric. MeterRun_
V2
MNR LREAL Non-Resettable or Cumulative Turbine_
total for Mass. Unit - lbm/hr for GM_
US, kg/hr for Metric. MeterRun_
V2
ENR LREAL Non-Resettable or Cumulative Turbine_
total for Energy. Unit -Btu/hr for GM_
US, MJ/hr for Metric. MeterRun_
V2
QbRollover INT Rollover flag for volume at base Turbine_
condition non-resettable total. GM_
The value {1} indicates Rollover MeterRun_
otherwise {0}. The value for roll- V2
over is 999,999,999. The rollover
flag will be on 5 times interval
time.
MRollover INT Rollover flag for Non-Resettable Turbine_
Mass total. The value {1} indicates GM_
Rollover otherwise {0}. The value MeterRun_
for roll-over is 999,999,999. The V2
rollover flag will be on 5 times
interval time.
ERollover INT Rollover flag for Non-Resettable Turbine_
Energy total. The value {1} GM_
indicates Rollover otherwise {0}. MeterRun_
161
Chapter 5 - API 21.1
Data
Output Parameter Description All
types
The value for roll-over is V2
999,999,999. The rollover flag will
be on 5 times interval time.
QbMaint LREAL Volume at Base in Maintenance Turbine_
mode. GM_
MeterRun_
V2
MMaint LREAL Mass in Maintenance mode. Turbine_
GM_
MeterRun_
V2
EMaint LREAL Energy at Base in Maintenance Turbine_
mode. GM_
MeterRun_
V2
Following are the error codes for the above meter run function block.
Out
Code Description Apply to
0 SUCCESS All
5 ERROR: THE ROOT WAS NOT BOUNDED IN DGROSS All
6 ERROR: NO CONVERGENCE IN DGROSS All
7 ERROR: VIRGS SQURE ROOT NEGATIVE All
8 ERROR: COMBINED VALUES OF GRGR, X[2] AND HV NOT All
CONSISTENT
9 ERROR: INVALID TERM IN VIRGS All
162
Chapter 5 - API 21.1
Out
Code Description Apply to
163
Chapter 5 - API 21.1
Out
Code Description Apply to
DEG F AGA8 2017 RANGE 2 OR (TF) < 25.0 OR > 143.0 DEG F GM_
AGA8 2017 RANGE 1 MeterRun_
V2
83 WARNING: HEATING VALUE (HV) < 665.0 OR > 1100.0 BTU/FT^3 Turbine_
AGA8 2017 RANGE 2 OR (HV) < 930.0 OR > 1040.0 BTU/FT^3 GM_
AGA8 2017 RANGE 1 MeterRun_
V2
84 WARNING: GAS RELATIVE DENSITY (GRGR) < 0.554 OR > 0.801 Turbine_
AGA8 2017 RANGE 2 OR (GRGR) < 0.554 OR > 0.630 AGA8 GM_
RANGE 1 MeterRun_
V2
85 WARNING: MOLE FRACTION FOR N2 > 0.20 AGA8 2017 RANGE 2 Turbine_
OR N2 > 0.07 AGA8 2017 RANGE 1 GM_
MeterRun_
OR FOR CO2 > 0.25 AGA8 2017 RANGE 2 OR CO2 > 0.03 AGA8 V2
2017 RANGE 1
164
Chapter 5 - API 21.1
165
Chapter 5 - API 21.1
Description
This Coriolis_Dtl_MeterRun function block calculates gas
compressibility factor, density, relative density and molecular weight
from AGA8 detailed method, volume flow rate at base condition from
AGA11 and gas energy per hour from AGA5. It also calculates hourly
and daily averages and totals. It generates hourly & daily QTRs and
sends them to EFM application which logs them on he contoller s
MRAM and flash memory. It also generates alarms when any of the
process value crosses specified alarm limit.
Coriolis_Dtl_MeterRun expects the input parameters to be in US or
Metric unit system.
Input
Data
Input Parameter Description Apply to
types
Methane REAL It could be in mole fraction or All
percentage.
Nitrogen REAL It could be in mole fraction or All
percentage.
CO2 REAL It could be in mole fraction or All
percentage.
Ethane REAL It could be in mole fraction or All
percentage.
Propane REAL It could be in mole fraction or All
percentage.
Water REAL It could be in mole fraction or All
percentage.
H2S REAL It could be in mole fraction or All
percentage.
Hydrogen REAL It could be in mole fraction or All
percentage.
CO REAL It could be in mole fraction or All
percentage.
Oxygen REAL It could be in mole fraction or All
percentage.
IButane REAL It could be in mole fraction or All
166
Chapter 5 - API 21.1
Data
Input Parameter Description Apply to
types
percentage.
NButane REAL It could be in mole fraction or All
percentage.
IPentane REAL It could be in mole fraction or All
percentage.
NPentane REAL It could be in mole fraction or All
percentage.
Hexane REAL It could be in mole fraction or All
percentage.
Heptane REAL It could be in mole fraction or All
percentage.
Octane REAL It could be in mole fraction or All
percentage.
Nonane REAL It could be in mole fraction or All
percentage.
Decane REAL It could be in mole fraction or All
percentage.
Helium REAL It could be in mole fraction or All
percentage.
Argon REAL It could be in mole fraction or All
percentage.
DetailMethod INT Selection for Detail method: Coriolis_
Dtl_
1- Detail Method MeterRun_
2- GERG Method. GERG Method is only V2
applicable for V2 function block.
BaseTemp REAL Base temperature should be in All
Fahrenheit for US unit system and in
Celcius for Metric unit system. The
recommended default is 60 Deg F.
BasePressure REAL Base pressure should be in Psia for US All
unit system and in Kpa for Metric unit
system. The recommended default is
167
Chapter 5 - API 21.1
Data
Input Parameter Description Apply to
types
14.73 Psia.
FlowingTemp REAL Flowing temperature should be in All
Fahrenheit for US unit system and in
Celcius for Metric unit system.
TempHiHi REAL This is the HiHi limit for flowing All
temperature. It should be either in
Fahrenheit or Celcius.
TempHi REAL This is the Hi limit for flowing All
temperature. It should be either in
Fahrenheit or Celcius.
TempLoLo REAL This is the LoLo limit for flowing All
temperature. It should be either in
Fahrenheit or Celcius.
TempLo REAL This is the Lo limit for flowing All
temperature. It should be either in
Fahrenheit or Celcius.
FlowTempIOSelection INT IO selection for meter temperature. The Coriolis_
value should be {1} for Live or {2) for Dtl_
Keypad value. MeterRun_
V2
FlowTempStsStatus USINT Analog input channel status for meter Coriolis_
temperature. The value should be {0} for Dtl_
Good or any positive integer for bad MeterRun_
status. V2
FlowTempKeypadVal REAL Keypad value for meter temperature. The Coriolis_
value that should be used when the Dtl_
meter temperature status is bad. MeterRun_
V2
FlowingPressure REAL Flowing pressure should be in Psia for All
US unit system and in Kpa for Metric unit
system.
PressureHiHi REAL This is the HiHi limit for flowing pressure. All
It should be either in Psia or Kpa.
PressureHi REAL This is the Hi limit for flowing pressure. It All
should be either in Psia or Kpa.
168
Chapter 5 - API 21.1
Data
Input Parameter Description Apply to
types
PressureLoLo REAL This is the LoLo limit for flowing All
pressure. It should be either in Psia or
Kpa.
PressureLo REAL This is the Lo limit for flowing pressure. It All
should be either in Psia or Kpa.
GasMass REAL This parameter is gas mass that is Coriolis_
directly measured from coriolis meter. It Dtl_
should be in lbm/hr for US unit system MeterRun
and in kg/hr for Metric unit system.
GasMassHiHi REAL This is the HiHi limit for gas mass. It Coriolis_
should be in lbm/hr for US unit system Dtl_
and in kg/hr for Metric unit system. MeterRun
GasMassHi REAL This is the Hi limit for gas mass. It should Coriolis_
be in lbm/hr for US unit system and in Dtl_
kg/hr for Metric unit system. MeterRun
GasMassLoLo REAL This is the LoLo limit for gas mass. It Coriolis_
should be in lbm/hr for US unit system Dtl_
and in kg/hr for Metric unit system. MeterRun
GasMassLo REAL This is the Lo limit for gas mass. It Coriolis_
should be in lbm/hr for US unit system Dtl_
and in kg/hr for Metric unit system. MeterRun
LowGasMassCutOff REAL This is the low gas mass cut off limit. It Coriolis_
should be in lbm/hr for US unit system Dtl_
and in kg/hr for Metric unit system. MeterRun
FlowPresIOSelection INT IO selection for meter pressure. The value Coriolis_
should be {1} for Live or {2) for Keypad Dtl_
value. MeterRun_
V2
FlowPresStsStatus USINT Analog input channel status for meter Coriolis_
pressure. The value should be {0} for Dtl_
Good or any positive integer for Bad MeterRun_
status. V2
FlowPresKeypadVal REAL Analog input channel status for meter Coriolis_
pressure. The value should be {0} for Dtl_
Good or any positive integer for Bad MeterRun_
169
Chapter 5 - API 21.1
Data
Input Parameter Description Apply to
types
status. V2
Analog REAL Value of analog input if flow type = Coriolis_
analog. The value should be in lb^3/hr Dtl_
for US unit or m^3/hr for Metric unit. MeterRun_
V2
AnalogHiHi REAL This is the HiHi limit for analog input. Coriolis_
The value should be in lb^3/hr for US Dtl_
unit or m^3/hr for Metric unit. MeterRun_
V2
AnalogHi REAL This is the Hi limit for analog input. The Coriolis_
value should be in lb^3/hr for US unit or Dtl_
m^3/hr for Metric unit. MeterRun_
V2
AnalogLoLo REAL This is the LoLo limit for analog input. Coriolis_
The value should be in lb^3/hr for US Dtl_
unit or m^3/hr for Metric unit. MeterRun_
V2
AnalogLo REAL This is the Lo limit for analog input. The Coriolis_
value should be in lb^3/hr for US unit or Dtl_
m^3/hr for Metric unit. MeterRun_
V2
LowFlowCutOff REAL Low flow cutoff value checks the no flow Coriolis_
condition in the calculations. If the flow Dtl_
is s less than this number, it will be MeterRun_
considered as no flow condition. Unit is V2
m3/hr for Metric unit, ft3/hr for US unit.
FlowType INT This parameter represents the flow type, Coriolis_
it should be either {1} Pulse Dtl_
Accumulated or {2} Analog Flow Rate. MeterRun_
V2
Pulse UDINT Pulse counter value Coriolis_
Dtl_
MeterRun_
V2
LowPulseCutOff UINT Low pulse cutoff value checks the no Coriolis_
flow condition in the calculations. If the Dtl_
MeterRun_
170
Chapter 5 - API 21.1
Data
Input Parameter Description Apply to
types
Pulse increment is less than this number, V2
it will be considered as no flow
condition.
MeterCalFactor REAL This parameter represents meter Coriolis_
calibration factor. It is a number. Dtl_
MeterRun_
V2
MeterRunId INT This is an integer number that represents All
a configured meter run identifier.
GasCompFormat INT This parameter is for the gas All
composition format. It should be either
mole fraction {1} or percentage {2}.
171
Chapter 5 - API 21.1
Data
Input Parameter Description Apply to
types
stopped. During this period, non-
resettable totals, hourly/daily/batch
totals will be not incremented.
AGA8Version INT Selection for AGA 8 algorithm selection: Coriolis_
Dtl_
1- AGA 8 (1994) MeterRun_
2 - AGA 8 (2017) V2
172
Chapter 5 - API 21.1
Output
Data
Output Parameter Description Apply to
types
Out_Code INT This out parameter returns success All
or fail code.
GasCompAtBaseCond LREAL This parameter is gas All
compressibility factor at base
condition. It is calculated in AGA8
Detailed method. It is unit less.
GasDensityAtBaseCond LREAL This parameter is gas density at All
base condition. It is calculated
through AGA8 Detailed method. It is
in lbm/ft^3 for US unit system and
in kg/m^3 for Metric unit system.
GasRelDenAtBaseCond LREAL This parameter is gas relative All
density at base condition. It is
calculated through AGA8 Detailed
method. It is unit less.
GasMolecularWeight LREAL This parameter is gas molecular All
weight at base condition. It is
calculated through AGA8 Detailed
method. It is in lbm for US unit
system and in kg for Metric unit
system.
Aga11QB LREAL This parameter is volume flow rate All
at base condition. It is calculated
through AGA11 method. It is in
ft^3/hr for US unit system and in
m^3/hr for Metric unit system.
Energy LREAL This parameter is gas energy per All
hour. It is calculated through AGA5
method. It is in Btu/hr for US unit
system and in MJ/hr for Metric unit
system.
PrevHrAvgTemp LREAL This parameter is previous hour All
average for temperature.
PreDayAvgTemp LREAL This parameter is previous day All
average for temperature.
173
Chapter 5 - API 21.1
Data
Output Parameter Description Apply to
types
PrevHrAvgPressure LREAL This parameter is previous hour All
average for pressure.
PreDayAvgPressure LREAL This parameter is previous day All
average for pressure.
PrevHrAvgGasMass LREAL This parameter is previous hour All
average for gas mass.
PreDayAvgGasMass LREAL This parameter is previous day All
average for gas mass.
PrevHrAvgDenAtBase LREAL This parameter is previous hour All
average for density at base
condition.
PreDayAvgDenAtBase LREAL This parameter is previous day All
average for density at base
condition.
PrevHrAvgRelDenAtBase LREAL This parameter is previous hour All
average for relative density at base
condition.
PreDayAvgRelDenAtBase LREAL This parameter is previous day All
average for relative density at base
condition.
PrevHrAvgUserDefined1 LREAL This parameter is previous hour All
average for user defined
parameter1.
PreDayAvgUserDefined1 LREAL This parameter is previous day All
average for user defined
parameter1.
PrevHrAvgUserDefined2 LREAL This parameter is previous hour All
average for user defined
parameter2.
PreDayAvgUserDefined2 LREAL This parameter is previous day All
average for user defined
parameter2.
PrevHrAvgUserDefined3 LREAL This parameter is previous hour All
average for user defined
parameter3.
174
Chapter 5 - API 21.1
Data
Output Parameter Description Apply to
types
PreDayAvgUserDefined3 LREAL This parameter is previous day All
average for user defined
parameter3.
PrevHrAvgUserDefined4 LREAL This parameter is previous hour All
average for user defined
parameter4.
PreDayAvgUserDefined4 LREAL This parameter is previous day All
average for user defined
parameter4.
QbTH LREAL This parameter is volume flow rate All
at base condition total for this hour.
QbLH LREAL This parameter is volume flow rate All
at base condition total for last hour.
QbTD LREAL This parameter is volume flow rate All
at base condition total for this day.
QbLD LREAL This parameter is volume flow rate All
at base condition total for last day.
MTH LREAL This parameter is mass flow rate All
total for this hour.
MLH LREAL This parameter is mass flow rate All
total for last hour.
MTD LREAL This parameter is mass flow rate All
total for this day.
MLD LREAL This parameter is mass flow rate All
total for last day.
ETH LREAL This parameter is energy total for All
this hour.
ELH LREAL This parameter is energy total for All
last hour.
ETD LREAL This parameter is energy total for All
this day.
ELD LREAL This parameter is energy total for All
last day.
175
Chapter 5 - API 21.1
Data
Output Parameter Description Apply to
types
QbNR LREAL Non-Resettable or Cumulative total Coriolis_
for volume at Base. Unit - ft3/hr for Dtl_
US, m3/hr for Metric. MeterRun_
V2
MNR LREAL Non-Resettable or Cumulative total Coriolis_
for Mass. Unit - lbm/hr for US, kg/hr Dtl_
for Metric. MeterRun_
V2
ENR LREAL Non-Resettable or Cumulative total Coriolis_
for Energy. Unit -Btu/hr for US, Dtl_
MJ/hr for Metric. MeterRun_
V2
QbRollover INT Rollover flag for volume at base Coriolis_
condition non-resettable total. The Dtl_
value {1} indicates Rollover MeterRun_
otherwise {0}. The value for roll-over V2
is 999,999,999. The rollover flag will
be on 5 times interval time.
MRollover INT Rollover flag for Non-Resettable Coriolis_
Mass total. The value {1} indicates Dtl_
Rollover otherwise {0}. The value for MeterRun_
roll-over is 999,999,999. The V2
rollover flag will be on 5 times
interval time.
ERollover INT Rollover flag for Non-Resettable Coriolis_
Energy total. The value {1} indicates Dtl_
Rollover otherwise {0}. The value for MeterRun_
roll-over is 999,999,999. The V2
rollover flag will be on 5 times
interval time.
QbMaint LREAL Volume at Base in Maintenance Coriolis_
mode. Dtl_
MeterRun_
V2
MMaint LREAL Mass in Maintenance mode. Coriolis_
Dtl_
MeterRun_
V2
176
Chapter 5 - API 21.1
Data
Output Parameter Description Apply to
types
EMaint LREAL Energy at Base in Maintenance Coriolis_
mode. Dtl_
MeterRun_
V2
GERG2008CV LREAL Heat Capacity at Constant Volume Coriolis_
(J/mol K). Dtl_
MeterRun_
V2
GERG2008CP LREAL Heat Capacity at Constant Pressure Coriolis_
(J/mol K). Dtl_
MeterRun_
V2
GERG2008W LREAL Speed of sound in gas being Coriolis_
measured. Unit - ft/sec for US, Dtl_
meter/sec for Metric. MeterRun_
V2
Following are the error codes for the above meter run function block.
Out
Code Description Apply to
0 SUCCESS All
1¹ ERROR: PRESSURE HAS A NEGATIVE DERIVATIVE DEFAULT GAS All
DENSITY USED
ERROR: A COMPONENT MOLE FRACTION < 0.0 OR > 1.0 Coriolis_
Dtl_
MeterRun
_V2
177
Chapter 5 - API 21.1
Out
Code Description Apply to
178
Chapter 5 - API 21.1
Out
Code Description Apply to
179
Chapter 5 - API 21.1
Out
Code Description Apply to
180
Chapter 5 - API 21.1
181
Chapter 5 - API 21.1
Description
This Coriolis_GM_MeterRun function block calculates gas
compressibility factor, density, relative density and molecular weight
from AGA8 gross method, volume flow rate at base condition from
AGA11 and gas energy per hour from AGA5. It also calculates hourly
and daily averages and totals. It generates hourly & daily QTRs and
sends them to EFM application which logs them on he contoller’s
MRAM and flash memory. It also generates alarms when any of the
process value crosses specified alarm limit.
Coriolis_GM_MeterRun expects the input parameters to be in US or
Metric unit system.
Input
Data
Input Parameter Description Apply to
types
GrossMethod INT This parameter represents All
gross method number. It
should be either {1} for gross
method 1 and {2} for gross
method 2.
GasRelDensity REAL This parameter is gas relative All
density at reference condition.
It is unit less.
CO2 REAL It could be in mole fraction or All
percentage.
Hydrogen REAL It could be in mole fraction or All
percentage.
CO REAL It could be in mole fraction or All
percentage.
Nitrogen REAL It could be in mole fraction or All
percentage. This parameter is
only required for gross method
2, for gross method 1, it can be
zero.
GasHeatingValue REAL This parameter is gas heating All
value. It is only required for
gross method 1, for gross
method 2, it can be zero. It is
182
Chapter 5 - API 21.1
Data
Input Parameter Description Apply to
types
in Btu/ft^3 for US unit system
and in MJ/m^3 for Metric unit
system.
RefTempForCalorimeterDensity REAL This parameter is reference All
temperature for calorimeter
density. It should be in
Fahrenheit for US unit system
and in Celcius for Metric unit
system. The recommended
default is 60 Deg F.
RefPressForCalorimeterDensity REAL This parameter is reference All
pressure for calorimeter
density. It should be in Psia for
US unit system and in Kpa for
Metric unit system. The
recommended default is 14.73
Psia.
RefTempForCombustion REAL This parameter is reference All
temperature for combustion. It
should be in Fahrenheit for US
unit system and in Celcius for
Metric unit system. The
recommended default is 60
Deg F.
BaseTemp REAL Base temperature should be in All
Fahrenheit for US unit system
and in Celcius for Metric unit
system. The recommended
default is 60 Deg F.
BasePressure REAL Base pressure should be in All
Psia for US unit system and in
Kpa for Metric unit system. The
recommended default is 14.73
Psia.
FlowingTemp REAL Flowing temperature should All
be in Fahrenheit for US unit
system and in Celcius for
Metric unit system.
183
Chapter 5 - API 21.1
Data
Input Parameter Description Apply to
types
TempHiHi REAL This is the HiHi limit for All
flowing temperature. It should
be either in Fahrenheit or
Celcius.
TempHi REAL This is the Hi limit for flowing All
temperature. It should be
either in Fahrenheit or Celcius.
184
Chapter 5 - API 21.1
Data
Input Parameter Description Apply to
types
PressureHi REAL This is the Hi limit for flowing All
pressure. It should be either in
Psia or Kpa.
PressureLoLo REAL This is the LoLo limit for All
flowing pressure. It should be
either in Psia or Kpa.
PressureLo REAL This is the Lo limit for flowing All
pressure. It should be either in
Psia or Kpa.
GasMass REAL This parameter is gas mass Coriolis_
that is directly measured from GM_
coriolis meter. It should be in MeterRun
lbm/hr for US unit system and
in kg/hr for Metric unit system.
185
Chapter 5 - API 21.1
Data
Input Parameter Description Apply to
types
The value should be {1} for GM_
Live or {2) for Keypad value. MeterRun_
V2
FlowPresStsStatus USINT Analog input channel status Coriolis_
for meter pressure. The value GM_
should be {0} for Good or any MeterRun_
positive integer for Bad status. V2
FlowPresKeypadVal REAL Analog input channel status Coriolis_
for meter pressure. The value GM_
should be {0} for Good or any MeterRun_
positive integer for Bad status. V2
Analog REAL Value of analog input if flow Coriolis_
type = analog. The value GM_
should be in lb^3/hr for US MeterRun_
unit or m^3/hr for Metric unit. V2
AnalogHiHi REAL This is the HiHi limit for analog Coriolis_
input. The value should be in GM_
lb^3/hr for US unit or m^3/hr MeterRun_
for Metric unit. V2
AnalogHi REAL This is the Hi limit for analog Coriolis_
input. The value should be in GM_
lb^3/hr for US unit or m^3/hr MeterRun_
for Metric unit. V2
AnalogLoLo REAL This is the LoLo limit for Coriolis_
analog input. The value should GM_
be in lb^3/hr for US unit or MeterRun_
m^3/hr for Metric unit. V2
AnalogLo REAL This is the Lo limit for analog Coriolis_
input. The value should be in GM_
lb^3/hr for US unit or m^3/hr MeterRun_
for Metric unit. V2
LowFlowCutOff REAL Low flow cutoff value checks Coriolis_
the no flow condition in the GM_
calculations. If the flow is s MeterRun_
less than this number, it will be V2
considered as no flow
condition. Unit is m3/hr for
186
Chapter 5 - API 21.1
Data
Input Parameter Description Apply to
types
Metric unit, ft3/hr for US unit.
FlowType INT This parameter represents the Coriolis_
flow type, it should be either GM_
{1} Pulse Accumulated or {2} MeterRun_
Analog Flow Rate. V2
Pulse UDINT Pulse counter value Coriolis_
GM_
MeterRun_
V2
LowPulseCutOff UINT Low pulse cutoff value checks Coriolis_
the no flow condition in the GM_
calculations. If the Pulse MeterRun_
increment is less than this V2
number, it will be considered
as no flow condition.
MeterCalFactor REAL This parameter represents Coriolis_
meter calibration factor. It is a GM_
number. MeterRun_
V2
MeterRunId INT This is an integer number that All
represents a configured meter
run identifier.
GasCompFormat INT This parameter is for the gas All
composition format. It should
be either mole fraction {1} or
percentage {2}.
NOTE: It is
recommended to use 2
percentage as a default
option.
187
Chapter 5 - API 21.1
Data
Input Parameter Description Apply to
types
ContractUnit INT This parameter is for all the All
outputs of meter run function
block. It should be either US
{1} or Metric {2}.
ContractStartday INT This parameter represents the All
start of gas QTR day. Its value
should be from 0 to 23.
AvgMethod INT This parameter is for averaging All
method to be used for
averaging. As of now, it only
supports value {1} that is for
time weighted linear average.
MaintMode INT Parameter to Start or Stop the Coriolis_
Maintenance Mode. The value GM_
should be either {0} MeterRun_
Maintenance End or {1} for V2
Maintenance Start. When
Maintenance mode is started,
an independent totalizer will
be started and accumulate all
the flow until the maintenance
mode is stopped. During this
period, non-resettable totals,
hourly/daily/batch totals will
be not incremented.
AGA8Version INT Selection for AGA 8 algorithm Coriolis_
selection: GM_
MeterRun_
1- AGA 8 (1994) V2
2 - AGA 8 (2017)
AtmosphericPressure REAL Atmospheric pressure should All
be in Psia for US unit system
and in Kpa for Metric unit
system.
188
Chapter 5 - API 21.1
Data
Input Parameter Description Apply to
types
pressure gauge. If flowing
pressure is already absolute
then it can be left zero.
UserDefined1 REAL This parameter is an optional All
one, if user wants to average
some parameter then user can
use it, it will be averaged and
logged in the QTR.
UserDefined2 REAL This parameter is an optional All
one, if user wants to average
some parameter then user can
use it, it will be averaged and
logged in the QTR.
UserDefined3 REAL This parameter is an optional All
one, if user wants to average
some parameter then user can
use it, it will be averaged and
logged in the QTR.
UserDefined4 REAL This parameter is an optional All
one, if user wants to average
some parameter then user can
use it, it will be averaged and
logged in the QTR.
Output
Data
Output Parameter Description Apply to
types
Out_Code INT This out parameter returns success All
or fail code.
GasCompAtBaseCond LREAL This parameter is gas All
compressibility factor at base
condition. It is calculated in AGA8
Detailed method. It is unit less.
GasDensityAtBaseCond LREAL This parameter is gas density at All
base condition. It is calculated
189
Chapter 5 - API 21.1
Data
Output Parameter Description Apply to
types
through AGA8 Detailed method. It is
in lbm/ft^3 for US unit system and
in kg/m^3 for Metric unit system.
GasRelDenAtBaseCond LREAL This parameter is gas relative All
density at base condition. It is
calculated through AGA8 Detailed
method. It is unit less.
GasMolecularWeight LREAL This parameter is gas molecular All
weight at base condition. It is
calculated through AGA8 Detailed
method. It is in lbm for US unit
system and in kg for Metric unit
system.
Aga11QB LREAL This parameter is volume flow rate All
at base condition. It is calculated
through AGA11 method. It is in
ft^3/hr for US unit system and in
m^3/hr for Metric unit system.
Energy LREAL This parameter is gas energy per All
hour. It is calculated through AGA5
method. It is in Btu/hr for US unit
system and in MJ/hr for Metric unit
system.
PrevHrAvgTemp LREAL This parameter is previous hour All
average for temperature.
PreDayAvgTemp LREAL This parameter is previous day All
average for temperature.
PrevHrAvgPressure LREAL This parameter is previous hour All
average for pressure.
PreDayAvgPressure LREAL This parameter is previous day All
average for pressure.
PrevHrAvgGasMass LREAL This parameter is previous hour All
average for gas mass.
PreDayAvgGasMass LREAL This parameter is previous day All
average for gas mass.
190
Chapter 5 - API 21.1
Data
Output Parameter Description Apply to
types
PrevHrAvgDenAtBase LREAL This parameter is previous hour All
average for density at base
condition.
PreDayAvgDenAtBase LREAL This parameter is previous day All
average for density at base
condition.
PrevHrAvgRelDenAtBase LREAL This parameter is previous hour All
average for relative density at base
condition.
PreDayAvgRelDenAtBase LREAL This parameter is previous day All
average for relative density at base
condition.
PrevHrAvgUserDefined1 LREAL This parameter is previous hour All
average for user defined
parameter1.
PreDayAvgUserDefined1 LREAL This parameter is previous day All
average for user defined
parameter1.
PrevHrAvgUserDefined2 LREAL This parameter is previous hour All
average for user defined
parameter2.
PreDayAvgUserDefined2 LREAL This parameter is previous day All
average for user defined
parameter2.
PrevHrAvgUserDefined3 LREAL This parameter is previous hour All
average for user defined
parameter3.
PreDayAvgUserDefined3 LREAL This parameter is previous day All
average for user defined
parameter3.
PrevHrAvgUserDefined4 LREAL This parameter is previous hour All
average for user defined
parameter4.
PreDayAvgUserDefined4 LREAL This parameter is previous day All
average for user defined
191
Chapter 5 - API 21.1
Data
Output Parameter Description Apply to
types
parameter4.
QbTH LREAL This parameter is volume flow rate All
at base condition total for this hour.
QbLH LREAL This parameter is volume flow rate All
at base condition total for last hour.
QbTD LREAL This parameter is volume flow rate All
at base condition total for this day.
QbLD LREAL This parameter is volume flow rate All
at base condition total for last day.
MTH LREAL This parameter is mass flow rate All
total for this hour.
MLH LREAL This parameter is mass flow rate All
total for last hour.
MTD LREAL This parameter is mass flow rate All
total for this day.
MLD LREAL This parameter is mass flow rate All
total for last day.
ETH LREAL This parameter is energy total for All
this hour.
ELH LREAL This parameter is energy total for All
last hour.
ETD LREAL This parameter is energy total for All
this day.
ELD LREAL This parameter is energy total for All
last day.
QbNR LREAL Non-Resettable or Cumulative total Coriolis_
for volume at Base. Unit - ft3/hr for GM_
US, m3/hr for Metric. MeterRun_
V2
MNR LREAL Non-Resettable or Cumulative total Coriolis_
for Mass. Unit - lbm/hr for US, kg/hr GM_
for Metric. MeterRun_
V2
192
Chapter 5 - API 21.1
Data
Output Parameter Description Apply to
types
ENR LREAL Non-Resettable or Cumulative total Coriolis_
for Energy. Unit -Btu/hr for US, GM_
MJ/hr for Metric. MeterRun_
V2
QbRollover INT Rollover flag for volume at base Coriolis_
condition non-resettable total. The GM_
value {1} indicates Rollover MeterRun_
otherwise {0}. The value for roll-over V2
is 999,999,999. The rollover flag will
be on 5 times interval time.
MRollover INT Rollover flag for Non-Resettable Coriolis_
Mass total. The value {1} indicates GM_
Rollover otherwise {0}. The value for MeterRun_
roll-over is 999,999,999. The V2
rollover flag will be on 5 times
interval time.
ERollover INT Rollover flag for Non-Resettable Coriolis_
Energy total. The value {1} indicates GM_
Rollover otherwise {0}. The value for MeterRun_
roll-over is 999,999,999. The V2
rollover flag will be on 5 times
interval time.
QbMaint LREAL Volume at Base in Maintenance Coriolis_
mode. GM_
MeterRun_
V2
MMaint LREAL Mass in Maintenance mode. Coriolis_
GM_
MeterRun_
V2
EMaint LREAL Energy at Base in Maintenance Coriolis_
mode. GM_
MeterRun_
V2
193
Chapter 5 - API 21.1
194
Chapter 5 - API 21.1
Following are the error codes for the above meter run function block.
Out
Code Description Apply to
0 SUCCESS All
5 ERROR: THE ROOT WAS NOT BOUNDED IN DGROSS All
6 ERROR: NO CONVERGENCE IN DGROSS All
7 ERROR: VIRGS SQURE ROOT NEGATIVE All
8 ERROR: COMBINED VALUES OF GRGR, X[2] AND HV NOT All
CONSISTENT
9 ERROR: INVALID TERM IN VIRGS All
11 ERROR: METHOD WAS NOT 1 OR 2 All
12 ERROR: FLOWING PRESSURE (PF) <= 0.0 OR > 1740.0 PSIA All
13 ERROR: FLOWING TEMPERATURE (TF) < 14.0 OR > 149.0 DEG F All
14 ERROR: HEATING VALUE (HV) < 477.0 OR > 1211.0 BTU/FT^3 All
15 ERROR: GAS RELATIVE DENSITY (GRGR) < 0.55 OR > 0.870 All
16 ERROR: MOLE FRACTION FOR N2 < 0.0 OR > 0.50 All
OR FOR CO2 < 0.0 OR > 0.30
OR FOR H2 < 0.0 OR > 0.10
OR FOR CO < 0.0 OR > 0.03
17 ERROR: REFERENCE TEMPERATURE < 32.0 OR > 77.0 DEG F All
18 ERROR: REFERENCE PRESSURE < 13.0 OR > 16.0 PSIA All
22 WARNING: FLOWING PRESSURE (PF) <= 0.0 OR > 1200.0 PSIA Coriolis_
GM_
MeterRun
23 WARNING: FLOWING TEMPERATURE (TF) < 32.0 OR > 130.0 DEG Coriolis_
F GM_
MeterRun
24 WARNING: HEATING VALUE (HV) < 805.0 OR > 1208.0 BTU/FT^3 Coriolis_
GM_
MeterRun
25 WARNING: GAS RELATIVE DENSITY (GRGR) < 0.55 OR > 0.800 Coriolis_
GM_
195
Chapter 5 - API 21.1
Out
Code Description Apply to
MeterRun
26 WARNING: MOLE FRACTION FOR N2 < 0.0 OR > 0.20 Coriolis_
OR FOR CO2 < 0.0 OR > 0.20 GM_
OR FOR H2 < 0.0 OR > 0.0 MeterRun
OR FOR CO < 0.0 OR >0.0
81 WARNING: FLOWING PRESSURE (PF) > 1500.0 PSIA AGA8 2017 Coriolis_
RANGE 1 GM_
MeterRun_
V2
82 WARNING: FLOWING TEMPERATURE (TF) < 17.01 OR > 143.0 Coriolis_
DEG F AGA8 2017 RANGE 2 OR (TF) < 25.0 OR > 143.0 DEG F GM_
AGA8 2017 RANGE 1 MeterRun_
V2
83 WARNING: HEATING VALUE (HV) < 665.0 OR > 1100.0 BTU/FT^3 Coriolis_
AGA8 2017 RANGE 2 OR (HV) < 930.0 OR > 1040.0 BTU/FT^3 GM_
AGA8 2017 RANGE 1 MeterRun_
V2
84 WARNING: GAS RELATIVE DENSITY (GRGR) < 0.554 OR > 0.801 Coriolis_
AGA8 2017 RANGE 2 OR (GRGR) < 0.554 OR > 0.630 AGA8 GM_
RANGE 1 MeterRun_
V2
85 WARNING: MOLE FRACTION FOR N2 > 0.20 AGA8 2017 RANGE 2 Coriolis_
OR N2 > 0.07 AGA8 2017 RANGE 1 GM_
MeterRun_
OR FOR CO2 > 0.25 AGA8 2017 RANGE 2 OR CO2 > 0.03 AGA8 V2
2017 RANGE 1
196
CHAPTER
6 API 21.2
Library Description
API21_2 The function block library provides support for creating flow
measurement calculations for various liquids based on API 21.2
standard for Turbine, Corolis, positive displacement and ultrasonic
meters.
API21_2_V2 It is supported from R161.2 release.
The following API 21.2 meter run function blocks are available:
The function block has the capability to use keypad values when the
live values from field devices are out of range or communication
with devices is lost. The function block supports continuous
operations and reporting. The function block also supports
197
Chapter 6 - API 21.2
The function block has the capability to use keypad values when the
live values from field devices are out of range or communication
with devices is lost. The function block supports continuous
operations and reporting. The function block also supports
maintenance mode totalizer when the meter run is under
maintenance.
The function block has the capability to use keypad values when the
live values from field devices are out of range or communication
with devices is lost. The function block supports continuous
operations and reporting. The function block also supports
maintainence mode totalizer when meter run is under maintenance.
In order to get accuracy as stated in API 11.2.4, the
RoundingMethod needs to be set as enabled (1 as part of the
198
Chapter 6 - API 21.2
The function block has the capability to use keypad values when the
live values from field devices are out of range or communication
with devices is lost. The function block supports continuous
operations and reporting. The function block also supports
maintenance mode totalizer when the meter run is under
maintenance.
The function block has the capability to use keypad values when the
live values from field devices are out of range or communication
with devices is lost. The function block supports continuous
operations and reporting. The function block also supports
maintenance mode totalizer when the meter run is under
maintenance.
199
Chapter 6 - API 21.2
The function block has the capability to use keypad values when the
live values from field devices are out of range or communication
with devices is lost. The function block supports continuous
operations and reporting. The function block also supports
maintenance mode totalizer when the meter run is under
maintenance mode.
200
Chapter 6 - API 21.2
The function block has the capability to use keypad values when the
live values from field devices are out of range or communication
with devices is lost. The function block supports continuous
operations and reporting. The function block also supports
maintenance mode totalizer when the meter run is under
maintenance.
The function block has the capability to use keypad values when the
live values from field devices are out of range or communication
with devices is lost. The function block supports continuous
operations and reporting. The function block also supports
maintenance mode totalizer when the meter run is under
maintenance.
201
Chapter 6 - API 21.2
The function block has the capability to use keypad values when the
live values from field devices are out of range or communication
with devices is lost. The function block supports continuous
operations and reporting. The function block also supports
maintenance mode totalizer when the meter run is under
maintenance.
The function block has the capability to use keypad values when the
live values from field devices are out of range or communication
with devices is lost. The function block supports continuous
operations and reporting. The function block also supports
maintainence mode totalizer when meter run is under maintenance.
In order to get accuracy as stated in API 11.2.4, the
RoundingMethod needs to be set as enabled (1 as part of the
configuration).
202
Chapter 6 - API 21.2
Input
Data
Input Parameter Description Apply to
types
MeterRunID Integer Identifier for the configured All
Meter Run.
Possible values 1 to 12
(Redundant), 1 to 4 (Non-
Redundant)
MeterType Integer Type of the flow meter: All
203
Chapter 6 - API 21.2
Data
Input Parameter Description Apply to
types
Denstiometer is available or
offline base desity will be used .
The value should be either 1 for
Yes or 0 for No.
DensiMtrCount Integer The number of Densitometers All
available. The value should be
either 1 for Single or 2 for Dual
densitometer.
DensiTemp REAL Parameter to set the All
Densitometer temperature. The
value should be in Fahrenheit
for US unit and in Celcius for
Metric unit.
DensiTempLoLo REAL This is the LoLo limit for All
Densitometer temperature. The
value should be in Fahrenheit
for US unit and in Celcius for
Metric unit.
DensiTempLo REAL This is the Lo limit for All
Densitometer temperature. The
value should be in Fahrenheit
for US unit and in Celcius for
Metric unit.
DensiTempHi REAL This is the Hi limit for All
Densitometer temperature. The
value should be in Fahrenheit
for US unit and in Celcius for
Metric unit.
DensiTempHiHi REAL This is the HiHi limit for All
Densitometer temperature. The
value should be in Fahrenheit
for US unit and in Celcius for
Metric unit.
DensiTempIOSelection Integer I/O selection for Densitometer All
Temperature. The value should
be 1 for Live or 2 for Keypad
value.
204
Chapter 6 - API 21.2
Data
Input Parameter Description Apply to
types
DensiTempStsStatus USINT Analog input channel status for All
Densitometer Temperature.
205
Chapter 6 - API 21.2
Data
Input Parameter Description Apply to
types
The value should be 0 for good
or any positive integer for bad
status.
DensiPressKeypadVal REAL Keypad value for Densitometer All
pressure. The value that should
be used when the Densitometer
pressure status is not good.
Densi1MeasuredDensity REAL Density value of the All
Densitometer 1. The value
should be in lb/ft^3 for US unit
and kg/m^3 for Metric unit.
Densi2MeasuredDensity REAL Density value of the All
Densitometer 2. The value
should be in lb/ft^3 for US unit
and kg/m^3 for Metric unit. This
value is applicable only for Dual
Densitometer
MeasuredDensityIOSel Interger I/O selection for Density. The All
value should be 1 for Live or 2
for Keypad value.
Densi1Status USINT Status of Densitometer 1 . The All
value should be 0 for good
status or any positive integer for
bad status.
Densi2Status USINT Status of Densitometer 2. The All
value should be 0 for good
status or any positive integer for
bad status.
PreferredDensiMtr Interger Parameter to select the All
preferred Densitometer. The
value should be 1 for
Densitometer 1 and 2 for
Densitometer 2.
DensiKeypadValue REAL Keypad value for Densitometer All
measured density. The value
should be in lb/ft^3 for US unit
and kg/m^3 for Metric unit. This
206
Chapter 6 - API 21.2
Data
Input Parameter Description Apply to
types
value should be a base density
value. When on-line live
densitometer status is bad, base
density will be used a keypad
value.
BaseDensity REAL Density at Base conditions. The All
value should be in lb/ft^3 for US
unit and kg/m^3 for Metric unit.
BaseTemperature REAL Temperature at Base conditions. All
The value should be in
Fahrenheit for US unit and in
Celcius for Metric unit. The
recommended default is 60 Deg
F for US and 15/20 Deg C for
Metric.
MeterFactor REAL Meter K factor to convert pulse All
form flow meter into volume.
The value should be in
pulse/ft^3 for US unit in
pulse/m^3 for Metric unit. When
the flow type is equal to analog,
this is the correction factor to
apply for volume calculation
and default value should be 1.0.
RoundingMethod Integer Option to enable or disable the All
rounding of output parameter
values. The value should be 0
for Disabled and 1 for Enabled.
Temp REAL Parameter to set the meter All
temperature. The value should
be in Fahrenheit for US unit and
in Celcius for Metric unit.
TempLoLo REAL This is the LoLo limit for meter All
temperature. The value should
be in Fahrenheit for US unit and
in Celcius for Metric unit.
TempLo REAL This is the Lo limit for meter All
207
Chapter 6 - API 21.2
Data
Input Parameter Description Apply to
types
temperature. The value should
be in Fahrenheit for US unit and
in Celcius for Metric unit.
TempHi REAL This is the Hi limit for meter All
temperature. The value should
be in Fahrenheit for US unit and
in Celcius for Metric unit.
TempHiHi REAL This is the HiHi limit for meter All
temperature. The value should
be in Fahrenheit for US unit and
in Celcius for Metric unit.
TempIOSelection Integer I/O selection for meter All
temperature. The value should
ne 1 for Live or 2 for Keypad
value.
TempStsStatus USINT Analog input channel status for All
meter temperature. The value
should be 0 for good or any
positive integer for bad status.
TempKeypadVal REAL Keypad value for meter All
temperature. The value that
should be used when the meter
temperature status is bad.
Pressure REAL Parameter to set the meter All
pressure. The value should be in
Psig for US unit and in Kpag for
Metric unit.
PressureLoLo REAL This is the LoLo limit for meter All
pressure. The value should be in
Psig for US unit and in Kpag for
Metric unit.
PressureLo REAL This is the LoLo limit for meter All
pressure. The value should be in
Psig for US unit and in Kpag for
Metric unit.
PressureHi REAL This is the Hi limit for meter All
208
Chapter 6 - API 21.2
Data
Input Parameter Description Apply to
types
pressure.The value should be in
Psig for US unit and in Kpag for
Metric unit.
PressureHiHi REAL This is the HiHi limit for meter All
pressure. The value should be in
Psig for US unit and in Kpag for
Metric unit.
PressureIOSelection Integer I/O selection for meter pressure. All
The value should ne 1 for Live
or 2 for Keypad value.
PressureStsStatus USINT Analog input channel status for All
meter pressure. The value
should be 0 for good status or
any positive integer for bad
status.
PressureKeypadVal REAL Keypad value for meter pressure. All
The value that should be used
when the meter pressure status
is bad.
PulseOrAnalogInput Integer Parameter to set the flow type. All
The value should be 0 for Pulse
and 1 for Analog.
IOType Interger Parameter to set the I/O type for All
Pulse input. The value should be
1 for ST103A (3rd party
hardware) and 2 for Native I/O.
LowPulseCutoff UINT Low pulse cutoff value checks All
the no flow condition in the
calculations. If the Pulse
increment is less than this
number, it will be considered as
no flow condition.
Pulse UDINT The pulse counter value. All
STMsgId UDINT Message ID from the ST103A All
device. This will be used as
heartbeat to know whether
209
Chapter 6 - API 21.2
Data
Input Parameter Description Apply to
types
ST103A is live and
communicating with
ControlEdge RTU. MessageID
will increment 2 in 1 seconds.
STWDWaitTime UINT Maximum wait time in seconds All
for the ST103A to restore the
connection after connection
failure with ControlEdge RTU.
Beyond this limit, pulse
increments will not be utliized in
volume calculations. The status
for hourly/daily/Batch totals will
be set to 1, i.e. the totals are
suspicious.
MaxPulseIncrement UDINT Maximum pulse increment limit. All
If the pulse increment is beyond
this limit, an alarm will be
generated.
Analog REAL Value of analog input if flow All
type is qual to Analog. The value
should be in lb^3/hr for US unit
or m^3/hr for Metric unit.
AnalogLoLo REAL This is the LoLo limit for analog All
input. The value should be in
lb^3/hr for US unit or m^3/hr for
Metric unit.
AnalogLo REAL This is the Lo limit for analog All
input. The value should be in
lb^3/hr for US unit or m^3/hr for
Metric unit
AnalogHi REAL This is the Hi limit for analog All
input. The value should be in
lb^3/hr for US unit or m^3/hr for
Metric unit.
AnalogHiHi REAL This is the HiHi limit for analog All
input. The value should be in
lb^3/hr for US unit or m^3/hr for
Metric unit.
210
Chapter 6 - API 21.2
Data
Input Parameter Description Apply to
types
AveragingVariable Integer Parameter to set the variable All
used for flow weighted
averaging. The value should be
0 for Gross Volume or 1 for
Mass. For Liquid EFM, the
averaging is based on flow
weighted.
ContractHour Integer Parameter represents the time All
of daily QTR generation, as the
day roll over to next day. Its
value should be from 0 to 23.
This has to be set according to
the contract.
OperationType Integer Parameter to set the type of All
Operation. The value should be
1 for Continuous or 2 for Batch.
When the operation type is
equal to Batch, by default batch
reporting and hourly reporting
within batch will be configured
automatically. When the mode is
continuous, hourly and daily
reports will be configured by
default.
MaintMode Integer Parameter to Start or Stop the All
Maintenance Mode. The value
should be either 0 for
Maintenance end or 1 for
Maintenance Start. When
Maintenance mode is started,
an independent totalizer will be
started and accumulate all the
flow until the maintenance
mode is stopped. During this
period, non-resettable totals,
hourly/daily/batch totals will be
not incremented.
BatchIdentifier Integer Identifier for a Batch operation. All
This number will be incremented
211
Chapter 6 - API 21.2
Data
Input Parameter Description Apply to
types
for every batch.
RetroKfactor Integer Parameter to set for All
recalculation of totals if proving
happens during a batch process
and totals are adjusted with new
Meter K factor. By default this
parameter is set enabled.
WaterAndSedMeasAvbl Integer Parameter to set whether the Liq_CrudeOil
Water and Sediments is
available for the Crude Oil. The
value should be 1 if available
otherwise 0.
WaterAndSediments REAL Parameter to set the percentage Liq_CrudeOil
of Water and Sediments present
in the Crude Oil.
WaterAndSedIOSel Integer I/O selection for Water and Liq_CrudeOil
Sediments value. The value
should be 1 for Live or 2 for
Keypad value.
WaterAndSedStatus USINT Analog input channel status for Liq_CrudeOil
Water and Sediments.The value
should be 0 for good status or
any positive integer for bad
status.
WaterAndSedKeypad REAL Keypad value in percentage for Liq_CrudeOil
Water and Sediments. The value
that should be used when the
Water and Sediments status is
bad.
CPLCalcType Integer CPL Calculation Type. The value Liq_NaturalGas
should be 1 for None or 2 for
API21.2 or 3 for API21.2M.
ConverCriteria REAL IP2 Convergence limit. Default Liq_NaturalGas
value is 0.001.
MaxIterations Integer IP2 Max loop limit. Default value Liq_NaturalGas
is 50.
212
Chapter 6 - API 21.2
Data
Input Parameter Description Apply to
types
IterationMethod Integer Main calculation method. The Liq_NaturalGas
value should be either 1 for
ASTM or 2 for IP2
VapourPrInput REAL Parameter to set the user Liq_NaturalGas
observed Vapour Pressure Input.
VapourPrCalcMethod Integer Vapour Pressure calculation Liq_NaturalGas
options. The value should be 1
for None, 2 for User Observed or
3 for API 11.2.5.
Lowflowcutoff REAL Low flow cutoff value checks the All liquid types
no flow condition in the function blocks
calculations. If the flow is s less in API21.2_V2
than this number, it will be library.
considered as no flow condition.
Unit is m3/hr for Metric unit,
ft3/hr for US unit.
Output
Data Apply
Input Parameter Description
types to
Out_Code Integer This out parameter returns success or fail All
code. The value will be 0 for success or -1
for Exception or +ve value for Error codes.
BaseDensityComputed LREAL Density at Base conditions. The value will be All
in lb/ft^3 for US unit and in kg/m^3 for
Metric unit.
MeterDensity LREAL Density at measurement or metering All
conditions. The value will be in lb/ft^3 for
US unit and in kg/m^3 for Metric unit.
ObservedDensity LREAL Observed Density or measured density. The All
value will be in lb/ft^3 for US unit and in
kg/m^3 for Metric unit.
NetStdVolume LREAL This parameter is Net Standard volume All
increment. It is in ft^3/sec for US unit
system and in m^3/sec for Metric unit
213
Chapter 6 - API 21.2
Data Apply
Input Parameter Description
types to
system.
GrossStdVolume LREAL This parameter is Gross Standard volume All
increment. It is in ft^3/sec for US unit
system and in m^3/sec for Metric unit
system.
SedAndWaterVolume LREAL This parameter is Sediment And Water All
volume increment. It is in ft^3/sec for US
unit system and in m^3/sec for Metric unit
system.
CTL LREAL Correction factor for effects of temperature All
on the liquid.
CPL LREAL Correction factor for effects of pressure on All
the liquid.
Mass LREAL This parameter is mass increment. It is in All
lb/sec for US unit system and in kg/sec for
Metric unit system.
AvgCTLLH LREAL Average CTL for the previous hour. All
AvgCTLLDOrBat LREAL Average CTL for the previous day or Batch. All
AvgCPLLH LREAL Average CPL for the previous hour. All
AvgCPLLDOrBat LREAL Average CTL for the previous day or Batch. All
AvgObsDenLH LREAL Average Observed Density for the previous All
hour.
AvgObsDenLDOrBat LREAL Average Observed Density for the previous All
day or Batch.
AvgTempLH LREAL Average Temperature for the previous hour. All
AvgTempLDOrBat LREAL Average Temperature for the previous day or All
Batch.
AvgPressLH LREAL Average Pressure for the previous hour. All
AvgPressLDOrBat LREAL Average Pressure for the previous day or All
Batch.
AvgBaseDenLH LREAL Average Base Density for the previous hour. All
AvgBaseDenLDOrBat LREAL Average Base Density for the previous day or All
214
Chapter 6 - API 21.2
Data Apply
Input Parameter Description
types to
Batch.
SwVTH LREAL Sediments And Water volume total for this All
hour.
SwVLH LREAL Sediment And Water volume total for last All
hour.
SwVTDOrBat LREAL Sediment And Water volume total for this All
day or Batch.
SwVLDOrBat LREAL Sediment And Water volume total for last All
day or Batch.
NSVTH LREAL Net Standard volume total for this hour. All
NSVLH LREAL Net Standard volume total for last hour. All
NSVTDOrBat LREAL Net Standard volume total for this day or All
Batch
NSVLDOrBat LREAL Net Standard volume total for last day or All
Batch
MassTH LREAL Mass total for this hour. All
MassLH LREAL Mass total for last hour. All
MassTDOrBat LREAL Mass total for this day or batch. All
MassLDOrBat LREAL Mass total for last day or batch. All
GSVTH LREAL Gross Standard volume total for this hour. All
GSVLH LREAL Gross Standard volume total for last hour. All
GSVTDOrBat LREAL Gross Standard volume total for this day or All
Batch.
GSVLDOrBat LREAL Gross Standard volume total for last day or All
Batch.
SwVMaint LREAL Sediments And Water volume total for this All
hour in Maintenance mode.
NSVMaint LREAL Net Standard volume total in Maintenance All
mode.
MassMaint LREAL Mass total in Maintenance mode. All
215
Chapter 6 - API 21.2
Data Apply
Input Parameter Description
types to
GSVMaint LREAL Gross Standard volume total in All
Maintenance mode.
SwVNR LREAL Non-Resettable Sediment And Water All
volume total.
NSVNR LREAL Non-Resettable Net Standard volume total. All
MassNR LREAL Non-Resettable Mass total. All
GSVNR LREAL Non-Resettable Gross Standard volume All
total.
SwVNRRollover Integer Rollover flag for Non-Resettable Sediments All
And Water volume total. The value 1
indicates Rollover otherwise 0. The value for
roll-over is 999,999,999. The rollover flag
will be on 5 times interval time.
NSVNRRollover Integer Rollover flag for Non-Resettable Net All
Standard volume total. The value 1 indicates
Rollover otherwise 0. The value for roll-over
is 999,999,999. The rollover flag will be on 5
times interval time.
MassNRRollover Integer Rollover flag for Non-ResettableMass total. All
The value 1 indicates Rollover otherwise 0.
The value for roll-over is 999,999,999. The
rollover flag will be on 5 times interval time.
GSVNRRollover Integer Rollover flag for Non-ResettableGross All
Standard volume total. The value 1 indicates
Rollover otherwise 0. The value for roll-over
is 999,999,999. The rollover flag will be on 5
times interval time.
StatusTH Integer Status of the period total for the this hour. All
The value will be 0 for good status or 1 for
bad status.
StatusTD Integer Status of the period total for the this day. All
The value will be 0 for good status or 1 for
bad status.
STIOReset Integer This parameter indicates whether the All
ST103A is restarted or not. The value will be
216
Chapter 6 - API 21.2
Data Apply
Input Parameter Description
types to
0 for false or 1 for true. The reset flag will be
on for 5 times of interval time.
NOTE: If the flow type Input is Analog, operation type Batch is not
supported.
Data type
See the following data types for detailed information:
217
Chapter 6 - API 21.2
PULSE_INPUT_TYPE_DUAL :
STRUCT
GOOD_PULSE : UDINT; (* Good Pulse*)
END_STRUCT;
END_TYPE
FREQUENCY_INPUT_TYPE TYPE
FREQUENCY_INPUT_TYPE :
STRUCT
STS : USINT; (*Status*)
PV : REAL; (* Frequency *)
END_STRUCT;
END_TYPE
ANALOG_INPUT_TYPE _TP TYPE
ANALOG_INPUT_TYPE _TP :
STRUCT
STS : USINT; (*Status*)
PV : REAL; (* Value *)
EUHI:REAL(* Range Hi *)
EULO: REAL (*Range Low *)
EUHIEX:REAL (*Range Hi Extended *)
EULOEX:REAL (*Range Low Extended
*)
218
Chapter 6 - API 21.2
BATCH_TOTALISE_STRUCT :
STRUCT
BATCHMODE :INT;
END_STRUCT;
END_TYPE
Error Codes
See the following table for error codes for the function blocks Liq_
CrudeOil , Liq_RefinedProducts,Liq_LubricatingOil and Liq_
SpecialProducts :
See the following table for error codes for the function block LIQ_
Naturalgas:
219
Chapter 6 - API 21.2
220
Chapter 6 - API 21.2
LiquidStationTotalizer
Description
The LiquidStationTotalizer function block calculates the meter station
totals for the multiple streams connected to the Station. The Station
totals are calculated by adding relevant individual totals from each
stream and totalizing them to create Station totals. Station totalizer by
default totalizes gross standard volume, net standard volume, mass
and water and sediments volume. The station totalizer by default
generates hourly and daily QTR similar to any other meter runs.
221
Chapter 6 - API 21.2
Input
Input Data
Description
Parameter Type
MeterRunID INT Identifier for the configured Meter Run.
MeterType INT Type of the meter. The value should be {5} for Station
Totalizer.
ContractHour INT This value represents the hour on which a day roll over for
reporting. Its value should be from 0 to 23.
SwVTH1 LREAL Sediments And Water volume total for this hour for the first
meter run.
SwVTDOrBat1 LREAL Sediment And Water volume total for this day or Batch for the
first meter run.
SwVNR1 LREAL Non-Resettable Sediment And Water volume total for the first
meter run.
NSVTH1 LREAL Net Standard volume total for this hour for the first meter run.
NSVTDOrBat1 LREAL Net Standard volume total for this day or Batch for the first
meter run.
NSVNR1 LREAL Non-Resettable Net Standard volume total for the first meter
run.
MassTH1 LREAL Mass total for this hour for the first meter run.
MassTDOrBat1 LREAL Mass total for this day or batch for the first meter run.
MassNR1 LREAL Non-Resettable Mass total for the first meter run.
GSVTH1 LREAL Gross Standard volume total for this hour for the first meter
run.
GSVTDOrBat1 LREAL Gross Standard volume total for this day or Batch for the first
meter run.
GSVNR1 LREAL Non-Resettable Gross Standard volume total for the first
meter run.
StatusTH1 INT Status of the calculation for this hour for the first meter run.
The value will be {0} for Status good or {1} for bad status.
StatusTD1 INT Status of the calculation for the this day for the first meter
run. The value will be {0} for Status good or {1} for bad status.
SwVTH2 LREAL Sediments And Water volume total for this hour for the
second meter run.
222
Chapter 6 - API 21.2
Input Data
Description
Parameter Type
SwVTDOrBat2 LREAL Sediment And Water volume total for this day or Batch for the
second meter run.
SwVNR2 LREAL Non-Resettable Sediment And Water volume total for the
second meter run.
NSVTH2 LREAL Net Standard volume total for this hour for the second meter
run.
NSVTDOrBat2 LREAL Net Standard volume total for this day or Batch for the
second meter run.
NSVNR2 LREAL Non-Resettable Net Standard volume total for the second
meter run.
MassTH2 LREAL Mass total for this hour for the second meter run.
MassTDOrBat2 LREAL Mass total for this day or batch for the second meter run.
MassNR2 LREAL Non-Resettable Mass total for the second meter run.
GSVTH2 LREAL Gross Standard volume total for this hour for the second
meter run.
GSVTDOrBat2 LREAL Gross Standard volume total for this day or Batch for the
second meter run.
GSVNR2 LREAL Non-Resettable Gross Standard volume total for the second
meter run.
StatusTH2 INT Status of the calculation for this hour for the second meter
run. The value will be {0} for Status good or {1} for bad status.
StatusTD2 INT Status of the calculation for the this day for the second meter
run. The value will be {0} for Status good or {1} for bad status.
SwVTH3 LREAL Sediments And Water volume total for this hour for the third
meter run.
SwVTDOrBat3 LREAL Sediment And Water volume total for this day or Batch for the
third meter run.
SwVNR3 LREAL Non-Resettable Sediment And Water volume total for the
third meter run.
NSVTH3 LREAL Net Standard volume total for this hour for the third meter
run.
223
Chapter 6 - API 21.2
Input Data
Description
Parameter Type
NSVTDOrBat3 LREAL Net Standard volume total for this day or Batch for the third
meter run.
NSVNR3 LREAL Non-Resettable Net Standard volume total for the third meter
run.
MassTH3 LREAL Mass total for this hour for the third meter run.
MassTDOrBat3 LREAL Mass total for this day or batch for the third meter run.
MassNR3 LREAL Non-Resettable Mass total for the third meter run.
GSVTH3 LREAL Gross Standard volume total for this hour for the third meter
run.
GSVTDOrBat3 LREAL Gross Standard volume total for this day or Batch for the
third meter run.
GSVNR3 LREAL Non-Resettable Gross Standard volume total for the third
meter run.
StatusTH3 INT Status of the calculation for this hour for the third meter run.
The value will be {0} for Status good or {1} for bad status.
StatusTD3 INT Status of the calculation for the this day for the third meter
run. The value will be {0} for Status good or {1} for bad status.
SwVTH4 LREAL Sediments And Water volume total for this hour for the fourth
meter run.
SwVTDOrBat4 LREAL Sediment And Water volume total for this day or Batch for the
fourth meter run.
SwVNR4 LREAL Non-Resettable Sediment And Water volume total for the
fourth meter run.
NSVTH4 LREAL Net Standard volume total for this hour for the fourth meter
run.
NSVTDOrBat4 LREAL Net Standard volume total for this day or Batch for the fourth
meter run.
NSVNR4 LREAL Non-Resettable Net Standard volume total for the fourth
meter run.
MassTH4 LREAL Mass total for this hour for the fourth meter run.
MassTDOrBat4 LREAL Mass total for this day or batch for the fourth meter run.
224
Chapter 6 - API 21.2
Input Data
Description
Parameter Type
MassNR4 LREAL Non-Resettable Mass total for the fourth meter run.
GSVTH4 LREAL Gross Standard volume total for this hour for the fourth meter
run.
GSVTDOrBat4 LREAL Gross Standard volume total for this day or Batch for the
fourth meter run.
GSVNR4 LREAL Non-Resettable Gross Standard volume total for the fourth
meter run.
StatusTH4 INT Status of the calculation for this hour for the fourth meter
run. The value will be {0} for Status good or {1} for bad status.
StatusTD4 INT Status of the calculation for the this day for the fourth meter
run. The value will be {0} for Status good or {1} for bad status.
Output
Output
Description Description
Parameter
Out_Code INT This out parameter returns success or fail code. The value
wll be {0} for success or {1} for Exception or {+ve value}
for Error codes.
SwVTH LREAL Sum of Sediments And Water volume total for this hour
for meter runs configured for station total.
SwVTDOrBat LREAL Sum of Sediment And Water volume total for this day or
Batch for station total.
SwVNR LREAL Sum of Non-Resettable Sediment And Water volume total
for station total.
NSVTH LREAL Sum of Net Standard volume total for this hour for station
total.
NSVTDOrBat LREAL Sum of Net Standard volume total for this day or Batch
for station total.
NSVNR LREAL Sum of Non-Resettable Net Standard volume total for
station total.
MassTH LREAL Sum of Mass total for this hour for station total.
MassTDOrBat LREAL Sum of Mass total for this day or batch for station total.
225
Chapter 6 - API 21.2
Output
Description Description
Parameter
MassNR LREAL Sum of Non-Resettable Mass total for station total.
GSVTH LREAL Sum of Gross Standard volume total for this hour for
station total.
GSVTDOrBat LREAL Sum of Gross Standard volume total for this day or Batch
for station total.
GSVNR LREAL Sum of Non-Resettable Gross Standard volume total for
station total.
StatusTH INT Overall status of the calculation for this hour for station
total. The value will be {0} for Status good or {1} for bad
status.
StatusTD INT Overall status of the calculation for the this day for station
total. The value will be {0} for Status good or {1} for bad
status.
Analog_AI_Process
Description
Function block to preprocess the data from the analog input channel
of the ST103A device before the data is used with API21.2 function
blocks. The general preprocessing includes scaling and analog input
status determination.
Input
Input Data
Description
Parameter Type
AI REAL Value read from analog input channel of ST103A device.
EUHi REAL This is the Hi limit for analog input in Engineering units.
EULo REAL This is the Lo limit for analog input in Engineering units.
EUHiHi REAL This is the HiHi limit for analog input in Engineering units.
EULoLo REAL This is the LoLo limit for analog input in Engineering units.
ST103Status INT Status of ST103A device. The value will be {0} for status good or
{1} for communication with ST103A is lost.
226
Chapter 6 - API 21.2
Output
Output Data
Description
Parameter Type
PV REAL Process value of the specific analog input channel in scaled to
engineering units.
Status USINT Status of the analog input channel.
Possible values:
0-Channel is good.
12- The value is higher than the high range value but lower than
the extended high range value.
13- The value is lower than the low range value but higher than
the extended low range value.
14- The value is lower than than the extended low range value.
ST103A_Process
Description
Function block to check the connection status of the ST103A device
before the data is used with API21.2 function blocks.
Input
Input Parameter Data Type Description
STMsgld UDINT Message ID from ST103A device
227
Chapter 6 - API 21.2
Output
Output Parameter Data Type Description
Status USINT Status of the ST103A device
Possible values:
0-Good status
Volume_Correction_FB
Description
This function block computes the corrected Volume for the given CTL
and CPL.
Input
Parameter Data type Description
CTL LREAL Correction factor for effects of temperature on the liquid.
CPL LREAL Correction factor for effects of pressure on the liquid.
MeteredVol LREAL Recorded metered volume by the master meter.
Output
Parameter Data type Description
CorrVol_AtCtlCpl LREAL The corrected volume at this CTL and CPL.
228
Chapter 6 - API 21.2
Flowrate_Calc
Description
Function block to compute the flow rate.
Input
Data
Parameter Description
Type
IncCalcVal LREAL The incremental calculated volume or mass to compute the
flow rate.
ExecTime INT Execution time in seconds.
Output
Parameter Data Type Description
Flowrate LREAL Flow rate computed in m^3/hr.
229
Chapter 6 - API 21.2
230
CHAPTER
7 CRC
Description
This function block is used to calculate CRC-16.
Input
Parameter Data type Description
ENABLE BOOL Enable: If TRUE, the function block is enabled and
workable.
INPUT Array of USINT, User defined data type. The size of the array
UINT, UDINT, depends on the number of the registers to read.
LINT, REAL or The end user should define a data type as shown
LREAL; below:
TYPE
VariableName: array[1..LENGTH] of
USINT/UINT/UDINT/LINT/REAL/LREAL;
END_TYPE
CRC-START-16: 0x0000
CRC-START-MODBUS: 0xFFFF
231
Chapter 7 - CRC
CRC-START-CCITT-1D0F: 0x1D0F
CRC-START-CCITT-FFFF: 0xFFFF
CRC-START-KERMIT: 0x0000
CRC-START-SICK: 0x0000
CRC-START-DNP: 0x0000
POLYNOMIALS UINT Define the polynomials for some well known CRC
calculations.
CRC-CCITT: 0x1021
CRC-DNP: 0xA6BC
CRC-KERMIT: 0x8408
CRC-SICK: 0x8005
Output
Parameter Data type Description
CRC_HIGH USINT CTC value high position
CRC_LOW USINT CTC value low postion
ERR_FLAG BOOL It would be set true if there is an error.
GEN_ERR USINT 0: Communication succeeded
232
CHAPTER
8 ETHERNETIP
limitation for using the function blocks:
n Up to ten IP addresses
n Read: 65 arrays; 400 single variables
n Write: 65 arrays; 135 single variables
The following function blocks and items are available:
Function
Short Description
Blocks
ETHERNETIP_ It is used to read a variable value from a peer to peer controller
RD through the tag name.
ETHERNETIP_ It is used to write a value to a peer to peer controller through the tag
WR name.
Related Topics:
Error Code See EtherNet/IP Function Block Error Codes for more information.
ETHERNETIP_RD
Description
This function block reads a variable value from a peer-to-peer
controller by the tag name.
Input
Data
Parameter Description
type
ENABLE BOOL Enable: If it is set to TRUE, the function block is enabled.
TAG STRING The name of the variable that the function block will read from
the target controller.
233
Chapter 8 - EtherNetIP
Data
Parameter Description
type
ELE_NUM USINT Number of elements for array type variable.
DATATYPE_SINT (0x02)
DATATYPE_INT (0x03)
DATATYPE_DINT (0x04)
DATATYPE_USINT (0x05)
DATATYPE_UINT (0x06)
DATATYPE_UDINT (0x07)
DATATYPE_REAL (0x08)
IP_ADDR STRING The IP address of the target controller or adapter which
connects with PLC.
SLOT USINT The slot number of the rack which inserted the target controller
via an adapter.
SEND_ BOOL Set it as true and when RDY_FLAG is true, the function block will
FLAG send the request to read.
Output
Data
Parameter Description
types
RDY_ BOOL True: last communication is finished. The function block is ready
FLAG for the next communication.
234
Chapter 8 - EtherNetIP
Data
Parameter Description
types
False: command request is being sent or received.
DONE BOOL It indicates that the response data is received successfully and
usable.
ERR_ BOOL True: there is an error.
FLAG
False: there is no error.
GEN_STS USINT General status and vendor's status
EXT_STS UINT Vendor's external status
GEN_ERR USINT General errors. See EtherNet/IP Function Block Error Codes for
more information.
See the follow table for the size of each data type:
235
Chapter 8 - EtherNetIP
DATA_TYPE
TYPE (* Array data type for tag data read/write *)
EIP_TAG_DATA: ARRAY[1..512] of BYTE;
END_TYPE
Programming Example
Use this function block to read Tag name to target Controller. At the
same time, use Function block HW_BITS_TO_SINT to transfer the data
type which can be used.
236
Chapter 8 - EtherNetIP
Select the Name, Data Type and Usage from the list. for each of the
Input pin.
2. Drag the pin from SEND_FLAG to RDY_FLAG and drag pin from
Done to REQ of BUF_TO_SINT.
3. Click OK .
4. Click Make from the toolbar to compile the programs.
5. Click Download from the toolbar to download the compiled
programs of HART to the controller.
ETHERNETIP_WR
Description
This function block writes a variable value of a peer-to-peer controller
by the tag name.
Input
Data
Parameter Description
types
ENABLE BOOL Enable: If it is set to TRUE, the function block is enabled.
TAG STRING The name of the variable that the function block will write from
of target controller.
DATATYPE_SINT (0x02)
DATATYPE_INT (0x03)
237
Chapter 8 - EtherNetIP
Data
Parameter Description
types
DATATYPE_DINT (0x04)
DATATYPE_USINT (0x05)
DATATYPE_UINT (0x06)
DATATYPE_UDINT (0x07)
DATATYPE_REAL (0x08)
IP_ADDR STRING The IP address of the target controller or adapter which
connects with PLC.
SLOT USINT The slot number of the rack which inserted the target controller
via an adapter.
SEND_ BOOL Set it as true and when RDY_FLAG is true, the function block will
FLAG send the request to write.
Output
Data
Parameter Description
types
RDY_ BOOL True: last communication is finished. The function block is ready
FLAG for the next communication.
238
Chapter 8 - EtherNetIP
See the follow table for the size of each data type:
Programming Example
Use this function block to write Tag name to target Controller. At the
same time, use Function block HW_SINT_TO_BUF to transfer the data
type which can be used.
239
Chapter 8 - EtherNetIP
240
Chapter 8 - EtherNetIP
241
Chapter 8 - EtherNetIP
242
CHAPTER
9 HWFBLIB
The following HWFWLib function blocks are available:
243
Chapter 9 - HWFBLib
244
Chapter 9 - HWFBLib
HWAI
Description
Analog input channel block used to initialize analog data type for use
in control function blocks.
245
Chapter 9 - HWFBLib
Input
Data
Parameter Description
type
AI REAL Analog Input value from analog input channel
AI_O BOOL Analog Input channel Overrange status
EUHI REAL PV High Range (Only used to replicate range from the builder)
EULO REAL PV Low Range (Only used to replicate range from the builder)
EUHIEX REAL PV High Extended Range (Only used to replicate range from the
builder)
EULOEX REAL PV Low Extended Range (Only used to replicate range from the
builder)
Output
Parameter
Data type Description
HW_BITS_TO_BYTE
Description
This function block creates a byte from 8 individual bits.
Input
Parameter Data type Description
B(0-7) BOOL Bit (0-7) of a byte
Output
Parameter Data type Description
OUT BYTE Byte created by 8 individual bits
246
Chapter 9 - HWFBLib
HW_BITS_TO_SINT
Description
This function block creates a SINT from 8 individual bits .
Input
Parameter Data type Description
B(0-7) BOOL Bit (0-7) of a sint
Output
Parameter Data type Description
OUT SINT SINT created by eight individual bits
HW_BITS_TO_USINT
Description
This function block creates a USINT from 8 individual bits .
Input
Parameter Data type Description
B (0-7) BOOL Bit (0-7) of a usint
Output
Parameter Data type Description
OUT USINT USINT created by eight individual bits
247
Chapter 9 - HWFBLib
HW_BYTE_TO_BITS
Description
This function block extracts 8 individual bits from a byte.
Input
Parameter Data type Description
IN BYTE Raw value to be extracted
Output
Parameter Data type Description
B (0-7) BOOL Bit (0-7) of a byte
HW_BYTES_TO_DINT
Description
This function block creates a DINT from four individual bytes.
Input
Parameter Data type Description
B (0-3) BYTE Byte (0-3) of DINT
Output
Parameter Data type Description
OUT DINT DINT created by four individual bytes
248
Chapter 9 - HWFBLib
HW_BYTES_OF_INT
Description
This function block creates an INT from two individual bytes.
Input
Parameter Data type Description
B (0-1) BYTE Byte (0-1) of INT
Output
Parameter Data type Description
OUT INT INT created by two individual bytes
HW_BYTES_OF_UDINT
Description
This function block creates a UDINT from four individual bytes.
Input
Parameter Data type Description
B (0-3) BYTE Byte (0-3) of UDINT
Output
Parameter Data type Description
OUT UDINT UDINT created by four individual bytes
249
Chapter 9 - HWFBLib
HW_BYTES_OF_UINT
Description
This function block creates a uint from two individual bytes.
Input
Parameter Data type Description
B (0-1) BYTE Byte (0-1) of UINT
Output
Parameter Data type Description
OUT UINT UINT created by two individual bytes
HW_BYTES_TO_DWORD
Description
This function block creates a DWORD from four individual bytes.
Input
Parameter Data type Description
B (0-3) BYTE Byte (0-3) of DWORD
Output
Parameter Data type Description
OUT DWORD DWORD created by four individual bytes
250
Chapter 9 - HWFBLib
HW_BYTES_TO_WORD
Description
This function block creates a WORD from two individual bytes.
Input
Parameter Data type Description
B (0-1) BYTE Byte (0-1) of WORD
Output
Parameter Data type Description
OUT WORD WORD created by four individual bytes
HW_BYTE_OF_DINT
Description
This function block extracts a single byte from DINT with the position.
Input
Parameter Data type Description
IN DINT Raw value to be extracted
N BYTE The position to be extracted, start from 0.
Output
Parameter Data type Description
OUT BYTE Extracted byte
251
Chapter 9 - HWFBLib
HW_BYTE_OF_INT
Description
This function block extracts a single byte from int with the position.
Input
Parameter Data type Description
IN INT Raw value to be extracted
N BYTE The position to be extracted, start from 0.
Output
Parameter Data type Description
OUT BYTE Extracted byte
HW_BYTE_OF_DWORD
Description
This function block extracts a single byte from dword with the
position.
Input
Parameter Data type Description
IN DWORD Raw value to be extracted
N BYTE The position to be extracted, start from 0.
Output
Parameter Data type Description
OUT BYTE Extracted byte
252
Chapter 9 - HWFBLib
HW_BYTE_OF_UDINT
Description
This function block extracts a single byte from udint with the position.
Input
Parameter Data type Description
IN UDINT Raw value to be extracted
N BYTE The position to be extracted, start from 0.
Output
Parameter Data type Description
OUT BYTE Extracted byte
HW_BYTE_OF_UINT
Description
This function block extracts a single byte from uint with the position.
Input
Parameter Data type Description
IN UINT Raw value to be extracted
N BYTE The position to be extracted, start from 0.
Output
Parameter Data type Description
OUT BYTE Extracted byte
253
Chapter 9 - HWFBLib
HW_BYTE_OF_WORD
Description
This function block extracts a single byte from word with the position.
Input
Parameter Data type Description
IN WORD Raw value to be extracted
N BYTE The position to be extracted, start from 0.
Output
Parameter Data type Description
OUT BYTE Extracted byte
HW_SINT_TO_BITS
Description
This function block extracts 8 bits from a sint.
Input
Parameter Data type Description
IN SINT Raw value to be extracted
Output
Parameter Data type Description
B(0-7) BOOL Bit (0-7) of a sint
254
Chapter 9 - HWFBLib
HW_SINT_OF_DINT
Description
This function block extracts a single sint from dint with the position.
Input
Parameter Data type Description
IN DINT Raw value to be extracted
N BYTE The position to be extracted
Output
Parameter Data type Description
OUT SINT Extracted sint
HW_SINT_OF_DWORD
Description
This function block extracts a single sint from dword with the position.
Input
Parameter Data type Description
IN DWORD Raw value to be extracted
N BYTE The position to be extracted
Output
Parameter Data type Description
OUT SINT Extracted sint
255
Chapter 9 - HWFBLib
HW_SINT_OF_INT
Description
This function block extracts a single sint from int with the position.
Input
Parameter Data type Description
Output
Parameter Data type Description
OUT SINT Extracted sint
HW_SINT_OF_UDINT
Description
This function block extracts a single sint from udint with the position.
Input
Parameter Data type Description
IN UDINT Raw value to be extracted
N BYTE The position to be extracted
Output
Parameter Data type Description
OUT SINT Extracted sint
256
Chapter 9 - HWFBLib
HW_SINT_OF_UINT
Description
This function block extracts a single int from uint with the position.
Input
Parameter Data type Description
IN UINT Raw value to be extracted
N BYTE The position to be extracted
Output
Parameter Data type Description
OUT SINT Extracted sint
HW_SINT_OF_WORD
Description
This function block extracts a single sint from word with the position.
Input
Parameter Data type Description
IN WORD Raw value to be extracted
N BYTE The position to be extracted
Output
Parameter Data type Description
OUT SINT Extracted sint
257
Chapter 9 - HWFBLib
HW_SINTS_TO_DINT
Description
This function block creates a dint from four individual sints.
Input
Parameter Data type Description
B (0-3) SINT Byte (0-3) of DINT
Output
Parameter Data type Description
OUT DINT DINT created by four individual sints
HW_SINTS_TO_DWORD
Description
This function block creates a dword from four individual sints.
Input
Parameter Data type Description
B (0-3) SINT Byte (0-3) of DWORD
Output
Parameter Data type Description
OUT DWORD DWORD created by four individual sints
258
Chapter 9 - HWFBLib
HW_SINTS_TO_INT
Description
This function block creates an int from two individual sints.
Input
Parameter Data type Description
B (0-1) SINT Byte (0-1) of INT
Output
Parameter Data type Description
OUT INT INT created by two individual sints
HW_SINTS_TO_UDINT
Description
This function block creates a udint from four individual sints.
Input
Parameter Data type Description
B (0-3) SINT Byte (0-3) of UDINT
Output
Parameter Data type Description
OUT UDINT UDINT created by four individual sints
259
Chapter 9 - HWFBLib
HW_SINTS_TO_UINT
Description
This function block creates a uint from two individual sints.
Input
Parameter Data type Description
B (0-1) SINT Byte (0-1) of UINT
Output
Parameter Data type Description
OUT UINT UINT created by two individual sints
HW_SINTS_TO_WORD
Description
This function block creates a word from two individual sints.
Input
Parameter Data type Description
B (0-1) SINT Byte (0-1) of WORD
Output
Parameter Data type Description
OUT WORD WORD created by two individual sints
260
Chapter 9 - HWFBLib
HW_USINT_OF_INT
Description
This function block extracts a single usint from int with the position.
Input
Parameter Data type Description
IN INT Raw value to be extracted
N BYTE The position to be extracted
Output
Parameter Data type Description
OUT USINT Extracted usint
HW_USINT_OF_UDINT
Description
This function block extracts a single usint from udint with the
position.
Input
Parameter Data type Description
IN UDINT Raw value to be extracted
N BYTE The position to be extracted
Output
Parameter Data type Description
OUT USINT Extracted usint
261
Chapter 9 - HWFBLib
HW_USINT_OF_DINT
Description
This function block extracts a single usint from dint with the position.
Input
Parameter Data type Description
IN DINT Raw value to be extracted
N BYTE The position to be extracted
Output
Parameter Data type Description
OUT USINT Extracted usint
HW_USINT_OF_DWORD
Description
This function block extracts a single usint from dword with the
position.
Input
Parameter Data type Description
IN DWORD Raw value to be extracted
N BYTE The position to be extracted
Output
Parameter Data type Description
OUT USINT Extracted usint
262
Chapter 9 - HWFBLib
HW_USINT_OF_UINT
Description
This function block extracts a single usint from uint with the position.
Input
Parameter Data type Description
IN UINT Raw value to be extracted
N BYTE The position to be extracted
Output
Parameter Data type Description
OUT USINT Extracted usint
HW_USINT_OF_WORD
Description
This function block extracts a single usint from word with the position.
Input
Parameter Data type Description
IN WORD Raw value to be extracted
N BYTE The position to be extracted
Output
Parameter Data type Description
OUT USINT Extracted usint
263
Chapter 9 - HWFBLib
HW_USINT_TO_BITS
Description
This function block extracts 8 bits from a usint.
Input
Parameter Data type Description
IN USINT Raw value to be extracted
Output
Parameter Data type Description
B(0-7) BOOL Bit (0-7) of a usint
HW_USINTS_TO_DINT
Description
This function block creates a dint from four individual usints.
Input
Parameter Data type Description
B (0-3) USINT Byte (0-3) of DINT
Output
Parameter Data type Description
OUT DINT DINT created by four individual usints
264
Chapter 9 - HWFBLib
HW_USINTS_TO_DWORD
Description
This function block creates a dword from four individual usints.
Input
Parameter Data type Description
B (0-3) USINT Byte (0-3) of DWORD
Output
Parameter Data type Description
OUT DWORD DWORD created by four individual usints
HW_USINTS_TO_INT
Description
This function block creates an int from two individual usints.
Input
Parameter Data type Description
B (0-1) USINT Byte (0-1) of INT
Output
Parameter Data type Description
OUT INT INT created by two individual usints
265
Chapter 9 - HWFBLib
HW_USINTS_TO_UDINT
Description
This function block creates a udint from four individual usints.
Input
Parameter Data type Description
B (0-3) USINT Byte (0-3) of UDINT
Output
Parameter Data type Description
OUT UDINT UDINT created by four individual usints
HW_USINTS_TO_UINT
Description
This function block creates a uint from two individual usints.
Input
Parameter Data type Description
B (0-1) USINT Byte (0-1) of UINT
Output
Parameter Data type Description
OUT UINT UINT created by two individual usints
266
Chapter 9 - HWFBLib
HW_USINTS_TO_WORD
Description
This function block creates a word from two individual usints.
Input
Parameter Data type Description
B (0-1) USINT Byte (0-1) of WORD
Output
Parameter Data type Description
OUT WORD WORD created by two individual usints
HWAI2PV
Description
Analog input channel block used to convert from analog_input_type
to analog_type for regulatory control function blocks. This is a
replacement for HWAI function block from ControlEdge RTU R110
onwards. If additional analog processing is required such as filtering,
rescaling or analog alarming, the HWDACA function block can be
used instead of HWAI2PV.
267
Chapter 9 - HWFBLib
Input
Parameter Data Type Description
AI Analog_Input_Type Analog Input value from analog input channel
Output
Data
Parameter Description
Type
PV Analog_ Process variable analog data used to connect to regulatory
Type control function blocks such as HWPID.
PVEU REAL PV value from analog input.
AISTS STRING Analog Input Channel status message
HWAO
Description
Analog output channel block used to connect control blocks to an
analog output and provide back initialization to connected control
block.
268
Chapter 9 - HWFBLib
Ouput
Data Type
Parameter Description
269
Chapter 9 - HWFBLib
HWAUTOMAN
Description
It is used to define user-specified gain and bias as well as a calculated
bias to the output. It provides control initialization and override
feedback processing.
Input
0 - Manual OUT = OP
270
Chapter 9 - HWFBLib
0. No Shed
1. Shed Hold
2. Shed Low
3. Shed High
4. Shed Safe OP
GAIN REAL OUT= GAIN * IN + BIAS
BIAS REAL OUT= GAIN * IN + BIAS
ROCLM REAL Maximum rate of change of Control Variable output in %/min
0. No Shed
1. Shed Hold
271
Chapter 9 - HWFBLib
3. Shed High
4. Shed Safe OP
BCIN BackCalc_ Back Calculation Input. This comes from Back Calculation
Type Output of downstream block
Output
272
Chapter 9 - HWFBLib
273
Chapter 9 - HWFBLib
Mode Operation
The function block has modes Manual (MD=0) and Cascade (MD=2).
There is no Auto mode.
In Manual Mode, the Control Variable will track the SCADA OP value
entered by an operator.
In Cascade mode, the Control Variable will be calculated from input
X1 as follows:
CV = GAIN * X1 + BIAS + BIAS_FLOAT
Where BIAS_FLOAT is calculated internally on mode transition from
Manual to Cascade to ensure a bumpless transfer of CV. BIASRATE
determines how fast the BIAS_FLOAT is reduced to zero. If no floating
bias is required, BIASRATE should be set to zero.
274
Chapter 9 - HWFBLib
275
Chapter 9 - HWFBLib
HWCV2AO
Description
Analog output channel block used to connect regulatory control
blocks such as HWPID or HWAUTOMAN to an analog output and
provide back initialization to connected control block.
Input
Parameter Data Type Description
CV Analog_Type Control Analog data from Control Block such as
HWPID or HWAUTOMAN
AO_RB Analog_Output_ Analog Output Readback connection.
Readback_Type
Output
Data Type
Parameter Description
276
Chapter 9 - HWFBLib
Data Type
Parameter Description
HWDACA
Description
The Data Acquisition function block provides alarming, scaling,
filtering and low cutoff processing. Typically, this function block will
be connected to an analog input channel to provide these additional
functions if required. The PV output can be connected to regulatory
control function blocks such as HWPID as shown below.
277
Chapter 9 - HWFBLib
Input
Parameter Data Type Description
AI Analog_Input_ Analog input channel
Type
PVCHAR INT PV Characterisation
278
Chapter 9 - HWFBLib
Ouput
279
Chapter 9 - HWFBLib
PVCHAR Characterisation
The characterisation determines how the analog input is scaled.
PVCHAR has the following values
0. No scaling of the PV is done. The PV will be scaled per the analog
input channel scaling configuration
1. Linear. The PV will be rescaled to the range defined by EUHI and
EULO. This feature can be used where a template program is
developed with all analog inputs scaled generically to 0-100% and
engineering unit scaling is configured on the DACA function block.
2. Square Root Scaling. The PV will be rescaled to range defined by
EUHI and EULO with a square root characterisation.
The parameter FILTER is used to set the time constant in minutes of a
1st order filter of the analog input value. The filter equation is
PV = AI (1 – e(-FILTER/t))
280
Chapter 9 - HWFBLib
Where
FILTER = Time Constant (minutes)
t = time (minutes)
For a step change in AI, after time
1 x FILTER Minutes : PV = 63.2 % AI
2 x FILTER Minutes : PV = 86.5 % AI
3 x FILTER Minutes : PV = 95.0 % AI
PV Alarming
Analog alarm trip points can be configured as follows
Low Cut-Off
When Low cut off enable (LCOENB) is set to true, the PV will be
clamped to 0.0 for analog input values less than low cut off value
(LCOVAL). This feature is commonly used for differential pressure
inputs for flow calculations to prevent negative values.
PV Values
The output PVEU reflects the unfiltered scaled value of the analog
input. PVFILT is filtered value of PVEU. For a FILTER value of 0.0,
these will be the same.
281
Chapter 9 - HWFBLib
AI Status
The output AISTS will display a string description of the status of the
analog input channel.
HWFANOUT
Description
This function shall be used to provide one input and up to four
initializable outputs. Shall allow separate gain and bias for each
output. Typical use is for split range outputs. An AUTOMAN FB should
be used between the output of the FANOUT and final Analog Output.
Input
Parameter Data Type Description
X1 Analog_ Process variable input. AI_Type contains value and quality
Type flags. Generally this is connected to the CV of a regulatory
function block such as PID.
282
Chapter 9 - HWFBLib
BCIN1 to BackCalc_ Back Calculation Input. This comes from Back Calculation
4 Type Output of downstream block connected to each output.
Output
Parameter Data Type Description
OP11 to 4 Analog_ Output that is normally used to drive the analog output to a
Type control device.
BCOUT BackCalc_ Back Calculation Output. This goes to Back Calculation Input
Type of upstream block.
283
Chapter 9 - HWFBLib
284
Chapter 9 - HWFBLib
Mode Operation
The HWFANOUT function block has no operational parameters that
need to be monitored or changed during runtime.
Mode control, manual output, rate of change and output limiting
control is set by the AUTOMAN function block on each individual
control output. These AUTOMAN function blocks can be interfaced to
SCADA if required.
285
Chapter 9 - HWFBLib
286
Chapter 9 - HWFBLib
HWIOSTS
Description
This function block is used to decode I/O channel status value (STS
member of I/O datatypes) and provide an I/O channel Bad flag for
alarming and logic and a status message.
Below is an example for each I/O channel data type. Note that the
channel status information is carried by the READBACK data for
digital and analog outputs.
Input
Parameter Data Type Description
STS USINT This is connected to the STS member of any I/O data type.
287
Chapter 9 - HWFBLib
Output
Data
Parameter Description
Type
Msg STRING Status Message
0 False Good
1 True Offline
11 True ORHIEX
12 False ORHI
13 False URLO
14 True URLOEX
15 False No Cal
HWMCC
The HWFBLib contains a group of related device control function
blocks for digital control of valves and motors as shown below.
288
Chapter 9 - HWFBLib
Description
The HWMCC function block is applicable to motor control. This
function block can command a motor to run for single output or to
command a motor in forward and reverse direction for dual output.
The outputs of function block are latched. If a pulsed output to Motor
controller is required, a rising edge trigger can be used before digital
output.
Input
Data
Parameter Description
Type
ZSF BOOL Forward (or Run) indication from field.
289
Chapter 9 - HWFBLib
Data
Parameter Description
Type
ZSR BOOL Reverse indication from field. Not connected for simple Stop/Run
applications.
0 – Stop
1 – Forward (Run)
2 – Reverse
MD BOOL Mode control.
0 – Stop
1 – Forward (Run)
2 – Reverse
RDY BOOL Motor controller Ready input to indicate control is available from
MCC. Normally wired to DI from MCC.
PIF BOOL Forward (run) permissive. Must be true to permit forward (run)
command. SI will override.
PIR BOOL Reverse permissive. Must be true to permit reverse command. SI
will override.
SI BOOL Safety override interlock enforced if True
0 – Stop
1 – Forward (Run)
2 – Reverse
290
Chapter 9 - HWFBLib
Data
Parameter Description
Type
LOCAL BOOL Local = True. When in local OP commands will track the valve state.
OP commands will not be accepted from SCADA or HS regardless
of MD. Normally LOCAL is a digital input from MCC.
FR BOOL Forward/Reverse transition allowed.
Output
Data
Parameter Description
Type
XYF BOOL Output command to Forward/Run DO. This output is latched
XYR BOOL Output command to Reverse DO. This output is latched
PVST STRING Description of valve state used for monitoring in IEC
Programming Workspace debug mode. Note that if PV = CfgErr
then the settings of INBET, CLOSE, OPEN, BAD are inconsistent,
that is values are outside of range 0 to 3 and/or there are
duplicate values.
PV INT Valve state as an integer
0 – Stop
1 – Run/Fwd
291
Chapter 9 - HWFBLib
Data
Parameter Description
Type
2 – Rev
OPST STRING Description of valve output command used for monitoring in IEC
Programming Workspace debug mode.
ILK BOOL Interlock Override active
CMF BOOL Motor failed to match commanded state within TT time. This
alarm is inhibited when in LOCAL
UNC BOOL Uncommanded change of state alarm if motor state changes
from commanded state. This alarm is inhibited when in LOCAL
ZA BOOL Common alarm.
Implementation Example
A typical example is shown below with the main configuration areas
highlighted.
292
Chapter 9 - HWFBLib
293
Chapter 9 - HWFBLib
Mode Operation
The function block has modes Manual (MD=False) and Auto
(MD=True).
In Manual Mode, the outputs XYF/R tracks OP set from SCADA such
that
OP = 0 (Stop), Then XYF = False, XYR = False
OP = 1 (Run/Fwd), Then XYF = True, XYR = False
294
Chapter 9 - HWFBLib
Local/Remote
This input is normally connected to Hand/Off/Auto switch. When the
LOCAL input is true, OP will track the PV state of valve and control of
valve will be via a local control panel. While in LOCAL, commands will
not be accepted from SCADA OP or Logic controlled HS regardless of
MD setting.
Ready Indication
A ready input from motor controller or logic is available to indicate if
motor control is allowed.
Forward/Reverse Configuration
The MCC function has options to determine if change in direction is
allowed.
If FR = False, then the MCC must be commanded to stop before a
change in direction can be commanded.
If FR = True, then the MCC can be commanded to change direction
from Fwd to Rev or Rev to Fwd without stopping first. If this
configuration is selected, a further setting, Forced Stop FS determines
if MCC function block performs the Stop command before changing
direction and Stop Time ST determines how long Stop state should be
held before changing direction.
295
Chapter 9 - HWFBLib
HWMLV
The HWFBLib contains a group of related device control function
blocks for digital control of valves and motors as shown below.
Description
The HWMLV function block is like the motor operated valves except
that it is driven by a pulsed command from SCADA/Logic rather than
a latched command. These devices are characterised by dual outputs
to drive a valve open or closed. The output will be energised until the
valve meets its command position. And optional extra seating time
can be used to ensure valve is firmly seated after it meets the
commanded position. These valves will fail in last commanded
position.
296
Chapter 9 - HWFBLib
Input
Data
Parameter Description
Type
ZSC BOOL Close Limit Switch Input from DI
297
Chapter 9 - HWFBLib
Data
Parameter Description
Type
True – Auto – Commands come from HS input. OP tracks HS.
OPDSTCLS BOOL Accepts pulsed command from SCADA to close valve when MD is
in Manual. This will typically be used for the SCADA close
command destination address.
OPDSTOPN BOOL Accepts pulsed command from SCADA to open valve when MD is
in Manual. This will typically be used for the SCADA open
command destination address.
HSCLS BOOL Hand Switch pulsed command from logic to close valve when MD
is Auto
HSOPN BOOL Hand Switch pulsed command from logic to open valve when MD
is Auto
PIC BOOL Close permissive. Must be true to permit close command. SI will
override.
PIO BOOL Open permissive. Must be true to permit close command. SI will
override.
SI BOOL Safety override interlock enforced if True
False – Close
True - Open
LOCAL BOOL Local = True. When in local OP commands will track the valve
state. OP commands will not be accepted from SCADA or HS
regardless of MD. Normally LOCAL is a digital input from device.
INBET INT Range 0 – 3, Value of in between or travel state. This value is
calculated by evaluating ZSC + 2 x ZSO when valve in this state
CLOSE INT Range 0 – 3, Value of Close state. This value is calculated by
evaluating ZSC + 2 x ZSO when valve in this state
OPEN INT Range 0 – 3, Value of Open state. This value is calculated by
evaluating ZSC + 2 x ZSO when valve in this state
BAD INT Range 0 – 3, Value of bad or inconsitent state. This value is
calculated by evaluating ZSC + 2 x ZSO when valve in this state.
This will usually be the remaining state after INBET, OPEN and
CLOSE states have been determined.
298
Chapter 9 - HWFBLib
Data
Parameter Description
Type
TT TIME Maximum travel time to open or close valve. This is used for fail
to open and fail to close alarms.
RT TIME Run on time once valve has reached commanded state. The run
on time can be used to seal or seat valve.
LVC BOOL When set to TRUE, OPSRCCLS and OPSRCOPN will indicate last
valid or successful command. When set to False, OPSRCCLS and
OPSRCOPN will indicate last command issued.
Output
Data
Parameter Description
Type
ZIC, ZIO BOOL Normalised Close and Open limits with the following truth table
F F Inbet or Travel
T F Closed
F T Open
T T Bad
299
Chapter 9 - HWFBLib
Data
Parameter Description
Type
run on time RT or travel time TT expires.
XYO BOOL Output command to Open DO. This output is energised for
duration of open command until valve reaches open state plus
run on time RT or travel time TT expires.
PV INT Valve state as an integer
0 – Travel
1 – Closed
2 – Open
3 - Bad
PVST STRING Description of valve state used for monitoring in IEC
Programming Workspace debug mode. Note that if PV = CfgErr
then the settings of INBET, CLOSE, OPEN, BAD are
inconsistent, that is values are outside of range 0 to 3 and/or
there are duplicate values.
OPST STRING Description of valve output command used for monitoring in
IEC Programming Workspace debug mode.
ILK BOOL Interlock Override active
FTC BOOL Fail to close alarm raised if valve fails to close within TT. This
alarm is inhibited when in LOCAL
FTO BOOL Fail to open alarm raised if valve fails to open within TT. This
alarm is inhibited when in LOCAL
UNC BOOL Uncommanded change of state alarm if valve moves from
commended state. This alarm is inhibited when in LOCAL
ZA BOOL Common alarm.
NOTE: Block can be used for single limit switch valve state
indication by using only single limit connected to either ZSC or
ZSO and configuring INBET, CLOSE, OPEN and BAD. For
example, single limit switch indication
300
Chapter 9 - HWFBLib
Implementation Example
A typical example is shown below with the main configuration areas
highlighted.
301
Chapter 9 - HWFBLib
302
Chapter 9 - HWFBLib
Limit Mapping
The limit mapping inputs INBET, CLOSE, OPEN and BAD provide a
means to standardize valve indication ZIC, ZIO in SCADA and for all
downstream logic operations. The standardized indication is based on
positive logic as shown below.
303
Chapter 9 - HWFBLib
The operation of the actual valve limit indications may vary from the
above due to actual configuration of limits on valves. In many cases,
these differences are discovered during commissioning. The limit
table provides a single place to rationalize limits to above table so that
any impacts to downstream configuration of SCADA and logic are not
impacted during commissioning.
The mapping value for a state is calculated by the formula
ZSC + 2 x ZSO
For example, if the valve is physically in the OPEN state and the open
limit ZSO is On and the close limit ZSC is On then
OPEN = 1 + 2 x 1 = 3
Following are some examples typically encountered.
304
Chapter 9 - HWFBLib
305
Chapter 9 - HWFBLib
306
Chapter 9 - HWFBLib
Mode Operation
The function block has modes Manual (MD=False) and Auto
(MD=True).
In Manual Mode, the output XYC/XYO tracks OP set from SCADA.
In Auto Mode, the output XYC/XYO tracks HSCLS/HSOPN which is
driven by program logic. When in Auto, OP will track HSCLS/HSOPN
so that Mode change from Auto to Manual is bumpless.
Local/Remote
This input is normally connected to Hand/Off/Auto switch. When the
LOCAL input is true, OP will track the PV state of valve and control of
valve will be via a local control panel. While in LOCAL, commands will
not be accepted from SCADA OP or Logic controlled HS regardless of
MD setting.
HWMOV
The HWFBLib contains a group of related device control function
blocks for digital control of valves and motors as shown below.
307
Chapter 9 - HWFBLib
Description
The HWMOV function block is applicable to motor operated valves.
These devices are characterize by dual outputs to drive a valve open
or closed via motor operation. The output will be energized until the
valve meets its command position. And optional extra seating time
can be used to ensure valve is firmly seated after it meets the
commanded position. These valves will fail in last commanded
position.
308
Chapter 9 - HWFBLib
Input
Data
Parameter Description
Type
ZSC BOOL Close Limit Switch Input from DI
False – Close
True – Open
MD BOOL Mode control.
False – Close
True - Open
LOCAL BOOL Local = True. When in local OP commands will track the valve state.
OP commands will not be accepted from SCADA or HS regardless
of MD. Normally LOCAL is a digital input from device.
INBET INT Range 0 – 3, Value of in between or travel state. This value is
calculated by evaluating ZSC + 2 x ZSO when valve in this state
309
Chapter 9 - HWFBLib
Data
Parameter Description
Type
CLOSE INT Range 0 – 3, Value of Close state. This value is calculated by
evaluating ZSC + 2 x ZSO when valve in this state
OPEN INT Range 0 – 3, Value of Open state. This value is calculated by
evaluating ZSC + 2 x ZSO when valve in this state
BAD INT Range 0 – 3, Value of bad or inconsitent state. This value is
calculated by evaluating ZSC + 2 x ZSO when valve in this state.
This will usually be the remaining state after INBET, OPEN and
CLOSE states have been determined.
TT TIME Maximum travel time to open or close valve. This is used for fail to
open and fail to close alarms.
RT TIME Run on time once valve has reached commanded state. The run on
time can be used to seal or seat valve.
Output
Data
Parameter Description
Type
ZIC, ZIO BOOL Normalised Close and Open limits with the following truth table
F F Inbet or Travel
T F Closed
F T Open
T T Bad
Note SCADA can use these for PV for consistency across all
valves or can address ZSC and ZSO based on implementers
preferences.
XYC BOOL Output command to Close DO. This output is energised for
duration of close command until valve reaches close state plus
run on time RT or travel time TT expires.
XYO BOOL Output command to Open DO. This output is energised for
duration of open command until valve reaches open state plus
run on time RT or travel time TT expires.
310
Chapter 9 - HWFBLib
Data
Parameter Description
Type
PV INT Valve state as an integer
0 – Travel
1 – Closed
2 – Open
3 - Bad
PVST STRING Description of valve state used for monitoring in IEC
Programming Workspace debug mode. Note that if PV = CfgErr
then the settings of INBET, CLOSE, OPEN, BAD are inconsistent,
that is values are outside of range 0 to 3 and/or there are
duplicate values.
OPST STRING Description of valve output command used for monitoring in IEC
Programming Workspace debug mode.
ILK BOOL Interlock Override active
FTC BOOL Fail to close alarm raised if valve fails to close within TT. This
alarm is inhibited when in LOCAL
FTO BOOL Fail to open alarm raised if valve fails to open within TT. This
alarm is inhibited when in LOCAL
UNC BOOL Uncommanded change of state alarm if valve moves from
commended state. This alarm is inhibited when in LOCAL
ZA BOOL Common alarm.
NOTE: Block can be used for single limit switch valve state
indication by using only single limit connected to either ZSC or
ZSO and configuring INBET, CLOSE, OPEN and BAD. For
example, single limit switch indication
311
Chapter 9 - HWFBLib
OPEN 0
BAD 3 (don’t care)
Implementation Example
A typical example is shown below with the main configuration areas
highlighted.
312
Chapter 9 - HWFBLib
313
Chapter 9 - HWFBLib
Limit Mapping
The limit mapping inputs INBET, CLOSE, OPEN and BAD provide a
means to standardize valve indication ZIC, ZIO in SCADA and for all
downstream logic operations. The standardized indication is based on
positive logic as shown below.
The operation of the actual valve limit indications may vary from the
above due to actual configuration of limits on valves. In many cases,
these differences are discovered during commissioning. The limit
table provides a single place to rationalize limits to above table so that
any impacts to downstream configuration of SCADA and logic are not
impacted during commissioning.
The mapping value for a state is calculated by the formula
ZSC + 2 x ZSO
314
Chapter 9 - HWFBLib
For example, if the valve is physically in the OPEN state and the open
limit ZSO is On and the close limit ZSC is On then
OPEN = 1 + 2 x 1 = 3
Following are some examples typically encountered.
315
Chapter 9 - HWFBLib
316
Chapter 9 - HWFBLib
Mode Operation
The function block has modes Manual (MD=False) and Auto
(MD=True).
317
Chapter 9 - HWFBLib
Local/Remote
This input is normally connected to Hand/Off/Auto switch. When the
LOCAL input is true, OP will track the PV state of valve and control of
valve will be via a local control panel. While in LOCAL, commands will
not be accepted from SCADA OP or Logic controlled HS regardless of
MD setting.
HWNOMINATION
Description
TThis function block is used for nomination control where a fixed
amount of product is delivered over a day. The nomination function
block continually calculates a set point based on remaining
nomination, remaining time in the day and amount already delivered
as calculated from a totalizer function block. The calculated set point
is used to provide a remote set point to a flow control PID in cascade
mode. The nomination function block can be configured with a week
of nomination values. The figure bellows shows how the nomination
function block is integrated with a totalizer and PID controller to
provide a complete nomination control solution.
318
Chapter 9 - HWFBLib
Input
Parameter Data Type Description
PV Analog_ Flow Process variable input. AI_Type contains value and
Type quality flags
Mode INT Sets Mode.
319
Chapter 9 - HWFBLib
SF REAL Scale factor between flow units and nomination Units. For
example if nomination is in energy and flow is in volumetric
units, Scale Factor would be the Heating Value.
TB INT Time Base of flow rate units
0 – Seconds
1 – Minutes
2 – Hours
3 – Days
HOLDEOD DINT Time period to hold SP at end of gas day in seconds. This is to
prevent OP swinging wildly as time remaining approaches 0.
HOLDSOD DINT Time period to hold OP at beginning of gas day in seconds.
This is to prevent OP swing wildly if accumulation today rolls
over just after start of gas day. This may happen if daily
accumulation is read from a separate flow computer. Note that
if the Nomination is 0.0, this hold will be overridden and OP
will immediately go to 0.0.
320
Chapter 9 - HWFBLib
Output
Data
Parameter Description
Type
CV Analog_ Control Variable that is normally used to drive the analog
Type output to a control device or as a remote SP to a PID block for
flow control.
NOMDAY INT Current Nomination Day index (0-Sun..6-Sat)
NOMDSTR STRING Current Nomination Day
NOMZERO BOOL Nomination is 0.0. This can be used to force a control valve to
0.0 if desired.
NOMCDNT DINT Number of seconds remaining in contract day
321
Chapter 9 - HWFBLib
1. The input is a flow rate either from an analog input or from a flow
calculation such as AGA for gas or API for hydrocarbon liquids.
The Totaliser function block is used to totalize the flow to provide
the amount of flow accumulated in the current day. The totalizer
can also be used for all other totals. (See HWTOTALISER help for
further details). Note that the flowrate value needs to be converted
to a LREAL data type. To ensure maximum accuracy of the
nomination controller, the Totaliser should be executed before the
Nomination function block.
2. The same flow rate input used by the Totaliser provides the PV for
the Nomination and the flow control PID function blocks.
322
Chapter 9 - HWFBLib
Modes of Operation
The Nomination function block has three modes of operation.
n Manual Mode. In this mode, the flow rate can be set manually by
the output (OP) of the nomination control
n Fixed Nomination Mode. In this mode, the Nomination can be set
in the set point (SP) of the nomination control.
n Scheduled Nomination Mode. In this mode, the nomination set
point (SP) is automatically updated at the start of the current day
(defined by SOGD_Hr and SOGD_Min) with the corresponding
nomination day value defined by SUN, MON, TUE, WED, THU, FRI
and SAT.
323
Chapter 9 - HWFBLib
324
Chapter 9 - HWFBLib
n Scale Factor (SF) Scale factor between flow rate units and
nomination units.
n Time Base (TB) sets the time base used for calculated flow rate
units. TB can have the following values
0. Seconds (Default)
1. Minutes
2. Hours
3. Days
For example, if the nomination values are in ksm3 and flow rate units
are in sm3/hr the following values will be used
SF = 1000.0
TB = 2
Nomination Status
The nomination function block has several outputs for monitoring the
status of calculation.
325
Chapter 9 - HWFBLib
HWOVERSEL
Description
This function shall be used to provide override select of either the
maximum or minimum of up to four initializable inputs.
Input
Parameter Data Type Description
MODE BOOL False – OUT is the Minimum of IN1 to 4
326
Chapter 9 - HWFBLib
Output
327
Chapter 9 - HWFBLib
328
Chapter 9 - HWFBLib
following information.
l Anti-Reset Windup Status (ARWHI, ARWLO): Indicates if the
HWAUTOMAN is at its high or low limit.
l Initialization Request Flag (INITMAN): Used to request
initialization. If the flag is set by AUTOMAN, the selected PID
block initializes itself
l Initialization Value (INITVAL): Used for initialization when
INITMAN true.
4. Use the BCOUT1..BCOUT4 connections to carry secondary data
from the HWAUTOMAN block to the respective PID block BCIN
pin. In addition to the initialisation data described in point 3 above,
the HWORDSEL function block sets the following data .
Override Status (ORFBSTS): This flag indicates whether this PID
input is the selected control strategy. If the block is in an
unselected strategy, it uses Override Feedback Value (ORFBVAL) to
initialize Control value; this is calculated to prevent “wind-up” if
this PID block input is unselected.
5. The MODE determines whether the Minimum (MODE=False) or
Maximum (MODE=True) of X1..X4 is selected for the output OP.
6. The SELECTED output indicates which input is currently selected
for control. This can be indicated on SCADA.
7. These pins can be used to bypass any of the inputs. When a bypass
is active, the associated PID input will be set to INITMAN and its
control variable will track the selected output.
Operation
Only Bypass control is available for the OVRDSEL function block.
When a Bypass input is set to True, the PID input associated with the
bypass will be set to INITMAN and its Control Variable will track the
selected OP of the OVRDSEL function block until the Bypass input is
returned to False.
Overall Mode control, manual output, rate of change and output
limiting control is set by the AUTOMAN function block. In a typical
override strategy, the AUTOMAN function block is interfaced to
SCADA. Additionally, the OVRDSEL output pin, SELXINP can be used
to display which PID control is active.
329
Chapter 9 - HWFBLib
HWTOTALISER
Description
It is used to accumulate flows. Shall periodically integrate or
accumulate an input value to a totalised value and shall set status
flags to indicate when accumulator value has reached the user
specified target value.
330
Chapter 9 - HWFBLib
Input
Deta
Parameter Description
Type
IN REAL Input value. For accumulation modes, this will be a delta value
derived from a pulse input type device, for example AGA7. For
integration modes, this will be rate value that is integrated over
time.
RST BOOL Resets accumulation on a rising edge.
MODE INT Totaliser Mode
0 – Seconds
1 – Minutes
2 – Hours
331
Chapter 9 - HWFBLib
Deta
Parameter Description
Type
3 – Days
SFR REAL Rate Multiplier when in accumulation modes (for example if IN is
in litres and rate is in kilolitres/hr, SFR = 0.001)
FILT REAL Rate filter time constant in seconds. Filtering is based on a first
order filter function that behaves like an RC filter rather than an
averaging filter.
CUST_P INT Custom totalisation period in minutes
Output
Data
Parameter Description
Type
RATE REAL Rate of change of totaliser when in accumulation modes as
defined by TB, SFR and FILT. This is used for determining say flow
rate from a pulse input turbine meter. When in integration modes,
RATE = IN.
VRATE REAL Rate of change of totaliser when in validation mode.
VACC REAL Accumulation while in validation mode
Q_Tot LREAL Total non resetting value
332
Chapter 9 - HWFBLib
Data
Parameter Description
Type
General Notes:
n All internal calculations use 64-bit floats and the Kahan
summation technique to minimize accumulation errors.
n Integration modes use trapezoidal rule.
n Filtering uses a simple first order filter and is only applicable to
accumulation modes when using pulse input type applications.
The HWTOTALISER function block is used to accumulate totals by
periodically integrating or accumulating an input value to totalised
values of hourly, daily, monthly and user defined periods. The example
below shows the main configuration groups.
333
Chapter 9 - HWFBLib
334
Chapter 9 - HWFBLib
Modes of Operation
The mode of operation will be determined by the physical type of
measurement represented by the IN value. If the IN value represents a
flow or rate value in Units/Time, integration modes 10 and 11 are
applicable. If the IN value represents a counter type value such as
meter pulses or motor starts, then accumulation modes 0 or 1 are
applicable.
335
Chapter 9 - HWFBLib
Total Reset
On a, rising edge of RST, all totaliser totals will be reset to zero.
Normally this function is only used in engineering mode within
control environment but it can be made available to SCADA if
required.
Validation Mode
These inputs can be used for meter validation functions. If this isn’t
required, these pins can be hidden.
When VMODE transitions to True, the current value of IN will be
frozen and totalisation will continue with this value. While VMODE is
true, changes to IN will not affect running totalisation and it will be
directed to the validation total VACC and validation calculated rate
VRATE.
While VMODE is true, when VALACC transitions to true, the validation
total output VACC will be reset to zero and validation totalisation will
start.
At the completion of validation VMODE and VALACC are set to False.
This will unfreeze IN value and totals will track live value.
The implementation of how these two flags are used will depend on
your validation procedures. For examples, in some applications,
validation cannot be performed until live flow has reduced to zero.
These details can be handled with external logic.
Configuration Parameters
The TOTALISER function block configuration parameters determine
how totals are calculated.
Rollover
This value represents the maximum value that a total can reach before
it is rolled over back to zero. This simulates the operation of a counter
or odometer. If left as zero or not connected, the total will keep
accumulating to the maximum value of a 64-bit float. If you can read
the 64-Bit Float value by SCADA this will not present a problem.
336
Chapter 9 - HWFBLib
Start of Day
SOGD_Hr and SOGD_Min specify the start of day for period total
rollover boundaries. For example, if SOGD_Hr = 8 and SOGD_Min =
30, then at 8:30 AM, the total for current day will be copied to
yesterday and current day total will be reset to start totalizing for new
day.
For hourly values, the hour rollover will occur at 30 minutes past the
hour.
Time Base
Time base (TB) sets the time base used for input rate in integration
modes 10 and 11 or the time base for RATE calculations in
accumulation modes 0 and 1. TB can have the following values
0. Seconds (Default)
1. Minutes
2. Hours
3. Days
337
Chapter 9 - HWFBLib
Totals
The totaliser function block provides a series of totals for current
period and the last period as follows.
338
Chapter 9 - HWFBLib
Totaliser Algorithms
All internal calculations of the totaliser function block use 64-bit
floating point. To minimise accumulation errors caused by adding
small numbers to large numbers, the Kahan summation technique is
used.
http://en.wikipedia.org/wiki/Kahan_summation_algorithm
Integration modes use the trapezoidal technique.
http://en.wikipedia.org/wiki/Trapezoidal_rule
HWPI
Description
This function block is connected to a pulse input channel and outputs
a delta pulse count suitable for metering calculations such as AGA7/9.
Input
Parameter Data Type Description
PI Pulse_ Connected to a pulse input channel
Input_Type
FILT REAL First order filter time constant in minutes for smoothing
calculated frequency output FREQ.
339
Chapter 9 - HWFBLib
Output
Data
Parameter Description
Type
DELTA LREAL Delta counts since last execution. This output can be connected
to meter calculations such as AGA7/9
FREQ REAL Calculated pulse frequency in Hz. This value is smoothed using
FILT setting
PISTS STRING Pulse input channel status message
1. Create a POU with program option with ST, and add the below
frequency estimation code.
340
Chapter 9 - HWFBLib
2. Associate the POU to the fastest cyclic task (20ms). The "freq"
parameter provides the frequency estimation.
Below is a typical example of how the HWPI function is used for a
metering application.
Frequency Calculation
In addition to providing the number of pulses counted in the last
execution cycle, the pulse rate or frequency is calculated in Hertz. If
the number of pulses sampled in an execution cycle is low, the FREQ
output can vary significantly from cycle to cycle. The FILT parameter
can be used to apply a filter to FREQ output to help smooth the
variations.
341
Chapter 9 - HWFBLib
HWPIACC
Description
This function block is an extension of the HWPI function block that
includes a local pulse accumulator register (ACCUM). This function
block is connected to a pulse input channel and outputs a delta pulse
count suitable for metering calculations such as AGA7/9 and has a
count accumulator that can be enabled and reset.
Input
Paramter Data Type Description
PI Pulse_ Connected to a pulse input channel
Input_Type
ENABLE BOOL Enables accumulation and delta/freq calculation when TRUE.
Output
Data
Parameter Description
Type
DELTA LREAL Delta counts since last execution. This output can be connected
to meter calculations such as AGA7/9.
ACCUM UDINT Accumulates pulses from pulse input when ENABLE is TRUE.
ACCUM range is
342
Chapter 9 - HWFBLib
Data
Parameter Description
Type
0- 4294967295
FREQ REAL Calculated pulse frequency in Hz. This value is smoothed using
FILT setting
PISTS STRING Pulse input channel status message
343
Chapter 9 - HWFBLib
Frequency Calculation
In addition to providing the number of pulses counted in the last
execution cycle, the pulse rate or frequency is calculated in Hertz. If
the number of pulses sampled in an execution cycle is low, the FREQ
output can vary significantly from cycle to cycle. The FILT parameter
can be used to apply a filter to FREQ output to help smooth the
variations.
Pulse Accumulation
The function block includes a local pulse accumulator. This operates
independently from the from the DELTA used for external
accumulation. The inputs ENABLE and RESET can be used to enable
and reset pulse accumulation stored in the output ACCUM. This
output can be used for operations such as calibration or validation
where a fixed number of pulses are injected into pulse input.
HWPID
Description
The HWPID block is a regulatory control block that operates as a
proportional-integral-derivative (PID) controller. It supports the Ideal
form of calculating the PID terms. The Ideal form is often called the
digital-computer version of the PID controller. This is the same form
used in the C300/C200 controller.
It supports PI, PD, PID algorithms as function. It accepts two analog
inputs- process variable (PV) and set point (SP) and produces output
calculated to reduce the difference between PV and SP.
The HWPID block has two principle inputs - a process variable (PV)
and a set point (SP). The difference between PV and SP is the error
and this block calculates a control output (CV) that should drive the
error to zero.
The following equations are supported:
344
Chapter 9 - HWFBLib
changes in PV
n Integral (I) on the error and Proportional and Derivative (PD) on
changes in PV
n Integral (I) only
The mode (Mode), set point (SP) and output (OP) are normally
mapped to SCADA for monitoring and control. The HWPID block may
be used in a single control loop or with multiple PIDs in a cascade
strategy using the Remote Set Point (RSP) to receive the CV from
another PID block.
Input
Parameter Data Type Description
PV Analog_ Process variable input. AI_Type contains value and quality
Type flags. This usually comes from a HWDACA block.
Mode INT Sets Mode or logic.
0- Manual
1- Automatic
2- Cascade
SP REAL Setpoint From SCADA or logic.
OP REAL Manual Output from SCADA or logic.
RSP Analog_ Remote setpoint from an upstream PID block’s CV for SCADA
Type operation.
CTLACTN BOOL False – Forward Acting (Default)
345
Chapter 9 - HWFBLib
0. No Shed
1. Shed Hold
2. Shed Low
3. Shed High
4. Shed Safe OP
SPTRACK BOOL False – No Tracking (Default)
Default – 100%
OPLOLM REAL Minimum output
Default – 0%
SI BOOL Safety Interlock.
0. No Shed
1. Shed Hold
346
Chapter 9 - HWFBLib
Output
Parameter Data Type Description
CV Analog_ Control Variable that is normally used to drive the analog
Type output to a control device.
BCOUT BackCalc_ Back Calculation Output. This goes to Back Calculation
Type Input of upstream block
INITMAN BOOL FB InitMan has been requested by downstream block
BADCTRL BOOL Bad Control Option is active
ARWHI BOOL FB is in high windup status
ARWLO BOOL FB is in low windup status
ORFBSTS BOOL FB is using Override Feedback value from OVRSEL
ARWNETHI BOOL Antireset Windup sent to upstream block via BCOUT
ARWNETLO BOOL Antireset Windup sent to upstream block via BCOUT
CV_CEE REAL Internal PID calculated variable before OP limiting. This can
be used as a diagnostic.
DELCV REAL Calculated change in control variable
DeLCp REAL Calculated change of Proportional Term
DelCi REAL Calculated change of Integral Term
DelCd REAL Calculated change of Derivative Term
347
Chapter 9 - HWFBLib
Simple Loop
The following figure shows a simple single loop controller using a
HWDACA block to connect the PV to an analog input channel and a
HWCV2AO block to connect the control output CV to an analog
output channel. If you do not need any alarming or filtering, the
HWAI2PV function block can be used instead of the HWDACA
function block.
348
Chapter 9 - HWFBLib
Cascade Loop
The following figure shows two PID controllers being used for simple
cascade. In this example, optional pins are hidden to help declutter
the view. If you do not need any alarming or filtering, the HWAI2PV
function block can be used instead of the HWDACA function block.
349
Chapter 9 - HWFBLib
350
Chapter 9 - HWFBLib
PID equations
The PID block provides four different equations for calculating the
PID - the CTLEQN parameter is used to specify the desired equation.
351
Chapter 9 - HWFBLib
Where:
CV output of PID (Equations A, B, C, D) in percent
K gain (proportional term)
L¯¹ inverse of the LaPlace transform
PV process input value in engineering units
PVP PV in percent
a 1/16 fixed rate amplitude
s La Place operator
SP set point value in engineering units
SPP SP in percent
T1 integral time constant in minutes
T2 derivative time constant in minutes
352
Chapter 9 - HWFBLib
Windup processing
The PID block maintains anti-reset windup status for its output
(ARWHI and ARWLO) and each of its initializable inputs (ARWNETHI
and ARWNETLO). The following table lists the possible values for
ARWHI/LO and ARWNETHI/LO parameters.
353
Chapter 9 - HWFBLib
ARWHI/LO computation
The ARWHI/LO indicates if the output (OP) can be raised or lowered.
The PID function blocks use ARWHI/LO to restrict integral control.
When either ARWHI or ARWLO is true, the PID block stops integral
control in the windup direction. Integral control continues in the
other direction, as does proportional and derivative control. But,
windup status has no impact on proportional and derivative control.
If a function block has a secondary, it fetches the secondary's windup
status via BCOUT/BCIN connection and recomputes its ARWHI/LO.
The conditions within the function block, such as output being at its
high limit, also affect the ARWHI/LO. The ARWHI/LO is computed as
follows, assuming the block has only one output or that it is not a
FANOUT block.
Then, ARWHI/LO
If Any of the floowing are ture
equals
A secondary exists and its windup state equals Hi and Lo HI and LO = True
This block is in initialization (INITMAN = On).
A secondary exists and it is requesting this block to
initialize.
A secondary exists and its windup state equals Hi. HI = True
This block's output is at its high limit OPHILM
354
Chapter 9 - HWFBLib
Then, ARWHI/LO
If Any of the floowing are ture
equals
A secondary exists and its windup state equals Lo. LO = True
ARWNETHI/LO computation
The only limiting anti-reset windup status ever does is to stop integral
action in one or both directions on PID blocks. For any other
regulatory control type block, ARWNETHI/LO is not used for any kind
of limiting. The ARWNETHI/LO is computed as follows, assuming the
block has only one output or that it is not a FANOUT block.
Then, ARWNET
If Any of the floowing are ture
equals
The ARWHI and ARWLO are True ARWNETHI =
True, ARWNETLO
= True
This block is in Manual mode (MODE = MAN).
355
Chapter 9 - HWFBLib
356
Chapter 9 - HWFBLib
HWRATIOCTL
Description
This function block calculates a target flow rate to maintain a
constant ratio between the controlled flow rate (X1) and an
uncontrolled flow rate (X2). A typical application for this function
block is continuous dosing control. The calculated flow rate is
normally connected to a flow control PID as a cascade set point as
shown below.
357
Chapter 9 - HWFBLib
Input
Parameter Data Type Description
X1 Analog_ Controlled flow variable input. AI_Type contains value and
Type quality flags
X2 Analog_ Uncontrolled flow variable input. AI_Type contains value and
Type quality flags
Mode BOOL Sets Mode.
0- Manual
1- Automatic
SP REAL Setpoint. From SCADA.
OP REAL Manual Output
CTLEQN INT Ratio Equation
0. PV = X1 / X2
1. PV = X2 / X1
2. PV = X1 / (X1 + X2)
358
Chapter 9 - HWFBLib
0. No Shed
1. Shed Hold
2. Shed Low
3. Shed High
4. Shed Safe OP
SPHILM REAL Maximum Setpoint Limit in EU
SPLOLM REAL Minimum Setpoint Limit in EU
OPROCLM REAL Maximum rate of change of Control Output in %/min
Default – 100%
OPLOLM REAL Minimum Output
Default – 0%
SI BOOL Safety Interlock.
0. No Shed
1. Shed Hold
2. Shed Low
359
Chapter 9 - HWFBLib
Output
Parameter Data Type Description
PV REAL Calculated ratio after applying X1 and X2 gain and bias
according to Equation selected.
CV Analog_ Control Variable that is normally used to drive the analog
Type output to a control device or as a remote SP to a PID block
BCOUT BackCalc_ Back Calculation Output. This goes to Back Calculation Input
Type of upstream block
INITMAN BOOL FB InitMan has been requested by downstream block
BADCTRL BOOL Bad Control Option is active
ARWHI BOOL FB is in high windup statu
ARWLO BOOL FB is in low windup status
ORFBSTS BOOL FB is using Override Feedback value from OVRSEL
360
Chapter 9 - HWFBLib
1. The controlled flow input is a flow rate either from an analog input
or from a flow calculation such as AGA for gas or API for
hydrocarbon liquids. This is the process feedback from the flow we
can control such as a dosing flow rate. This is connected to
Ratioctl (X1) and the flow control PID (PV).
2. The uncontrolled flow input is a flow rate either from an analog
input or from a flow calculation such as AGA for gas or API for
hydrocarbon liquids. This is the process indication from the flow
we are adding controlled flow dosing to.
3. The flow control PID is connected to controlled flow control
element via an analog output.
4. The calculated ratio control variable from the Ratioctl function
block is connected to the flow control PID remote set point for
cascade mode.
5. The BCOUT of the PID is connected to the BCIN of the ratioctl
function block to provide initialisation data for cascade
connection.
6. The Mode, Set Point and Output are typically interfaced to analog
SCADA points to provide SCADA monitoring and control of the
361
Chapter 9 - HWFBLib
Modes of Operation
The ration control function block has two modes of operation.
n PV = X1_SCALED / X2_SCALED
n CV = (X2_SCALED * SP – BIAS1) / GAIN1
CTLEQN = 1
n PV = X2_SCALED / X1_SCALED
n CV = (X2_SCALED / SP – BIAS1) / GAIN1
CTLEQN = 2
362
Chapter 9 - HWFBLib
363
Chapter 9 - HWFBLib
HWRETAIN
Description
364
Chapter 9 - HWFBLib
365
Chapter 9 - HWFBLib
HWSDV
The HWFBLib contains a group of related device control function
blocks for digital control of valves and motors as shown below.
Description
The HWSDV function block is applicable to solenoid operated valves
such as shutdown valves. These devices are characterised by a latched
digital output to an operating solenoid. The action of the de-energised
solenoid is specified by the failure mode of the valve.
366
Chapter 9 - HWFBLib
Input
Data
Parameter Description
Type
ZSC BOOL Close Limit Switch Input from DI
False – Close
True – Open
MD BOOL Mode control.
367
Chapter 9 - HWFBLib
Data
Parameter Description
Type
False – Manual – OP Can be commanded from SCADA OP
False – Close
True - Open
LOCAL BOOL Local = True. When in local OP commands will track the valve state.
OP commands will not be accepted from SCADA or HS regardless
of MD. Normally LOCAL is a digital input from device.
INBET INT Range 0 – 3, Value of in between or travel state. This value is
calculated by evaluating ZSC + 2 x ZSO when valve in this state
CLOSE INT Range 0 – 3, Value of Close state. This value is calculated by
evaluating ZSC + 2 x ZSO when valve in this state
OPEN INT Range 0 – 3, Value of Open state. This value is calculated by
evaluating ZSC + 2 x ZSO when valve in this state
BAD INT Range 0 – 3, Value of bad or inconsitent state. This value is
calculated by evaluating ZSC + 2 x ZSO when valve in this state.
This will usually be the remaining state after INBET, OPEN and
CLOSE states have been determined.
FO BOOL Failure mode.
368
Chapter 9 - HWFBLib
Data
Parameter Description
Type
Output
Data
Parameter Description
Type
ZIC, ZIO BOOL Normalised Close and Open limits with the following truth table
F F Inbet or Travel
T F Closed
F T Open
T T Bad
Note SCADA can use these for PV for consistency across all
valves or can address ZSC and ZSO based on implementers
preferences.
XY BOOL Output command to DO to control solenoid valve based on FO
value. See FO parameter
PV INT Valve state as an integer
0 – Travel
1 – Closed
2 – Open
3 - Bad
PVST STRING Description of valve state used for monitoring in IEC
Programming Workspace debug mode. Note that if PV = CfgErr
then the settings of INBET, CLOSE, OPEN, BAD are inconsistent,
that is values are outside of range 0 to 3 and/or there are
duplicate values.
OPST STRING Description of valve output command used for monitoring in IEC
Programming Workspace debug mode.
369
Chapter 9 - HWFBLib
Data
Parameter Description
Type
ILK BOOL Interlock Override active
FTC BOOL Fail to close alarm raised if valve fails to close within TT. This
alarm is inhibited when in LOCAL
FTO BOOL Fail to open alarm raised if valve fails to open within TT. This
alarm is inhibited when in LOCAL
UNC BOOL Uncommanded change of state alarm if valve moves from
commended state. This alarm is inhibited when in LOCAL
ZA BOOL Common alarm.
NOTE: Block can be used for single limit switch valve state
indication by using only single limit connected to either ZSC or
ZSO and configuring INBET, CLOSE, OPEN and BAD. For
example, single limit switch indication
Implementation Example
A typical example is shown below with the main configuration areas
highlighted.
370
Chapter 9 - HWFBLib
371
Chapter 9 - HWFBLib
372
Chapter 9 - HWFBLib
Limit Mapping
The limit mapping inputs INBET, CLOSE, OPEN and BAD provide a
means to standardize valve indication ZIC, ZIO in SCADA and for all
downstream logic operations. The standardized indication is based on
positive logic as shown below.
The operation of the actual valve limit indications may vary from the
above due to actual configuration of limits on valves. In many cases,
these differences are discovered during commissioning. The limit
table provides a single place to rationalize limits to above table so that
any impacts to downstream configuration of SCADA and logic are not
impacted during commissioning.
The mapping value for a state is calculated by the formula
ZSC + 2 x ZSO
For example, if the valve is physically in the OPEN state and the open
limit ZSO is On and the close limit ZSC is On then
OPEN = 1 + 2 x 1 = 3
Following are some examples typically encountered.
373
Chapter 9 - HWFBLib
374
Chapter 9 - HWFBLib
375
Chapter 9 - HWFBLib
Mode Operation
The function block has modes Manual (MD=False) and Auto
(MD=True).
In Manual Mode, the output XY tracks OP set from SCADA.
In Auto Mode, the output XY tracks HS which is driven by program
logic.
When in Auto, OP will track HS so that Mode change from Auto to
Manual is bumpless.
376
Chapter 9 - HWFBLib
Local/Remote
This input is normally connected to Hand/Off/Auto switch. When the
LOCAL input is true, OP will track the PV state of valve and control of
valve will be via a local control panel. While in LOCAL, commands will
not be accepted from SCADA OP or Logic controlled HS regardless of
MD setting.
HWSLEWRATE
Description
Slew Rate is the maximum rate of change required to drive the output
from full OFF (0%-typically 0 mA or 4 mA) to full ON (100%-typically
20 mA). The block will convert this to a maximum change of the
milliamp output per execution cycle of this block.
377
Chapter 9 - HWFBLib
Input
Data
Input Description
Type
CV Analog_ Control Analog data from Control Block such as HWPID or
Type HWAUTOMAN
T Time It is the maximum rate of change required to drive the output from full
OFF (0%-typically 0 mA or 4 mA) to full ON (100%-typically 20 mA).
Range from 0.00 to 99.00 s
0.00 indicates inactive state.
Output
Output Data Type Description
AO REAL Slew Rate result output
STS BOOL Analog output channel status
HWSPLITRNG
Description
The Split Range function block is used in conjunction with the
FANOUT function block. This block translates split range settings to
gain and bias settings suitable for FANOUT. Refer to help for the
HWFANOUT function block for a typical application example.
378
Chapter 9 - HWFBLib
Input
Parameter Data
Description
type
RNGHI1..4 REAL Low range value of input to fanout that corresponds to 0% of
corresponding OP of fanout.
RNGLO1..4 REAL High range value of input to fanout that corresponds to 100% of
corresponding OP of fanout.
Output
Parameter Data type Description
GAIN1..4 REAL Connected to corresponding GAIN inputs of Fanout
BIAS1..4 REAL Connected to corresponding BIAS inputs of Fanout
HWTOT_LREAL_TO_REAL
Description
This function block converts totaliser LREAL to Totaliser Real data.
379
Chapter 9 - HWFBLib
380
CHAPTER
10 FUNCLIB
Function
Short Description
Blocks
ANNUC Accepts boolean inputs and shall provide one alarm output in case of
abnormal input
GAINOFF Provides linear characterization.
GENLIN Provides a linearized PV (in engineering units) for a sensor with
nonlinear characteristics and characterization option for Linear or
Square Root conversion on the input, if required.
PULSE Provides a maximum time limit pulse, minimum time limit pulse and
fixed time limit pulse output each time when the input transitions from
OFF to ON.
SIGSEL Accepts as many as four input signals and select minimum value or
maximum value or median input or calculate the average of the inputs or
select an input based on the value of an external control signal.
SIGSEL
Description
The Signal Selector function block accepts as many as four input
signals and shall be able to select minimum value or maximum value
or median input or calculate the average of the inputs or select an
input based on the value of an external control signal.
381
Chapter 10 - Funclib
Input
Parameter Data type Description
IN1..IN6 REAL Up to 6 Input values
SELMETH INT Selection Method.
0- Average (Default)
1- Minimum
2- Maximum
3- Median
4- MUX
MUXSEL INT Input to select when SELMETH = 4 (MUX)
382
Chapter 10 - Funclib
Output
Parameter Data type Description
OUT REAL Select value based on selection method.
SELECTED INT Input Selected (only valid for Max, Min and MUX modes)
GENLIN
Description
Provides a linearized PV (in engineering units) for a sensor with
nonlinear characteristics. Shall provide characterization option for
Linear or Square Root conversion on the input, if required.
383
Chapter 10 - Funclib
Input
Parameter Data type Description
IN REAL Input value
MODE INT Sets conversion mode.
Gen_Lin
N1_IN to N13_IN REAL Node 1 to 13 input value
N1_OUT to N13_OUT REAL Node 1 to 13 output value
384
Chapter 10 - Funclib
Output
Parameter Data type Description
OUT REAL Converted input value
GAINOFF
Description
Provides linear characterization.
Input
Parameter Data type Description
IN REAL Input value
GAIN REAL Gain value
OFFSET REAL Offset value
Output
Parameter Data type Description
OUT REAL OUT = GAIN x IN + OFFSET
385
Chapter 10 - Funclib
PULSE
Description
Provides a maximum time limit pulse, minimum time limit pulse and
fixed time limit pulse output each time when the input transitions
from OFF to ON.
Input
Data
Parameter Description
type
IN BOOL Logic Input
386
Chapter 10 - Funclib
Data
Parameter Description
type
MODE INT Mode of pulse generation
1. MAX –If the input (IN) pulse time is less than or equal to the
specified PULSEWIDTH time, IN is assumed to equal one
output (OUT) pulse. If the IN pulse time is greater than the
specified PULSEWIDTH time, OUT pulse terminates at end of
specified PULSEWIDTH time.
2. MIN -If the input (IN) pulse time is less than or equal to the
specified PULSEWIDTH time, output (OUT) pulse width equals
the specified PULSEWIDTH time. If the IN pulse time is greater
than the specified PULSEWIDTH time, OUT pulse width tracks
IN pulse time, so OUT pulse exceeds specified PULSEWIDTH
time.
Output
Parameter Data type Description
OUT BOOL Output Pulse
ANNUC-Alarm Annunciator
Description
The Annunciator block function accepts Boolean inputs and shall
provide one alarm output in case of abnormal input.
387
Chapter 10 - Funclib
Input
Parameter Data type Description
IN BOOL Logic Input
OFFNORM BOOL Off Normal State
Output
Parameter Data type Description
OUT BOOL Set true if IN is equal to Off Normal state.
Structured Variables
This section details common structured variables.
Analog_Type
TYPE
ANALOG_TYPE :
STRUCT
END_STRUCT;
END_TYPE
BackCalc_Type
TYPE
BACKCALC_TYPE :
STRUCT
388
Chapter 10 - Funclib
END_STRUCT;
END_TYPE
DI_Type (HOLD)
TYPE
Analog_Type :
STRUCT
END_STRUCT;
END_TYPE
DO_Type (HOLD)
TYPE
Analog_Type :
STRUCT
389
Chapter 10 - Funclib
END_STRUCT;
END_TYPE
PI_Type (HOLD)
TYPE
Analog_Type :
STRUCT
END_STRUCT;
END_TYPE
390
CHAPTER
11 HART
HART_CMD3
Description
Reads up to four predefined Dynamic Variables.
The Response Data is truncated after the last Dynamic Variables
supported by each Device Type. For a given Device Type the number
of Response Data bytes must be fixed. In other words, a Device type
may not return PV, SV and TV in one operating mode and later( in a
different operating) only return PV and SV.
Input
Parameter Data
Description
type
ENABLE BOOL Enable: If TRUE, the HART function block is enabled and workable.
391
Chapter 11 - HART
Parameter Data
Description
type
Output
Parameter Data type Description
RDY_FLAG BOOL True: last communication is finished. FB is ready for the next
communication.
392
Chapter 11 - HART
Bit 8 = false:
0= No command-specific error
393
Chapter 11 - HART
2= Invalid selection
7= In write-protect mode
2 = response timeout
19 = device is offline.
HART_CMD48
Description
This command must be implemented by all HART devices.
394
Chapter 11 - HART
Input
Parameter Data
Description
type
EN BOOL Enable: If TRUE, the HART FB is enabled and workable.
IOM USINT I/O module number: 0: built in I/O; 1~255: remote I/O
CHN USINT Channel Number 1~255, currently the valid data is 1~10 for build
in I/O, AI 1~8, AO 9~10
SEND_ BOOL If SEND_FLAG is true and RDY_FLAG is true, HART_CMD48 would
FLAG send the request. RDY_FLAG is TRUE means last communication
is finished. Before last communication is finished, even if SEND_
FLAG is true the request won’t be sent.
Output
Command 48 response data can be maximum 25 bytes. Each byte is
bitwise meaningful. To make it easy to access these bits, user-defined
data type—ARRAY [1..n] of BOOL is used instead of Byte type.
395
Chapter 11 - HART
The way to access a specific bit is to use the suffix, e.g. the fifth bit of
STD_STATUS_0 is obtained by using HART_CMD48_DEV_INFO. STD_
STATUS_0 [5].
396
Chapter 11 - HART
Data
Parameter Description
type
RDY_FLAG BOOL True: last communication is finished. FB is ready for
the next communication.
0x08: N failure
397
Chapter 11 - HART
Data
Parameter Description
type
0x80: N device configuration locked
HART_CMD48_DEV_ Array Standardized status 1:
INFO.STD_STATUS_1 [1..8]of
BOOL Code | Map | Description
0x02: N reserved
398
Chapter 11 - HART
Data
Parameter Description
type
0x10: F radio failure
HART_CMD48_DEV_ Array Analog channel fixed:
INFO.ANALOG_CHN_ [1..8]of
FIXED BOOL Code | Map | Description
399
Chapter 11 - HART
Data
Parameter Description
type
DONE BOOL It Indicates that the response data is received
successfully and usable
ERR_FLAG BOOL It would be set true if there is an error
PROTOCOL_ERR USINT the response code received from HART device:
Bit 8 = true:
Bit 8 = false:
0= No command-specific error
1= (undefined)
2= Invalid selection
7= In write-protect mode
400
Chapter 11 - HART
Data
Parameter Description
type
17-127= Command Specific (see command)
2: Response timeout.
HART_CMDx
Description
It supports all HART commands with the command number no more
than 255, except Command 6 and commands relevant to “Burst”. The
end user needs to create a HART command request message for the
pin “IN”. If a command response is received, it would be put in the pin
“OUT” and the end user needs to parse it.
401
Chapter 11 - HART
Input
Parameter Data type Description
ENABLE BOOL Enable: If TRUE, the HART FB is enabled and workable.
RACK USINT Rack number: 0: local rack; 1~255: remote rack.(This pin is only
available for ControlEdge PLC, it should be not configured for
RTU)
IOM USINT I/O module number:
Output
Parameter Data type Description
RDY_FLAG BOOL True: last communication is finished. FB is ready for the
next communication.
402
Chapter 11 - HART
Bit 8 = false:
0= No command-specific error
1= (undefined)
2= Invalid selection
7= In write-protect mode
403
Chapter 11 - HART
2: Response timeout.
17: Invalid I/O card (the I/O card is not configured in the
system, or none of the I/O channels of this I/O card is
HART-enabled).
404
Chapter 11 - HART
OUT HART_ The “data” segment of the frame returned by the device
CMDx_ except for the first two bytes.
OUT
(ARRAY The data segment received from HART device is broken up
[1..255] of into three parts: PROTOCOL_ERR (the first byte of the data
BYTE) segment), GEN_DEV_STATUS (the second byte of the data
segment) and OUT (the rest bytes of the data segment).
To save the data of Pin “IN” and Pin “OUT”, user defined data
structures are created as follows:
TYPE
TYPE
Example
Use HART_CMDx and assign CMDx as Command 1 to read the
Primary Variable from HART device.
See the following table for Hart Command 1 Specification:
Request Data Byte-Input:
405
Chapter 11 - HART
406
Chapter 11 - HART
407
Chapter 11 - HART
408
CHAPTER
12 UNITCONVERSIONLIB
409
Chapter 12 - Unitconversionlib
APIGravity_TO_Density
Description
APIGravity_TO_Density function block converts API gravity to Density
of liquid.
410
Chapter 12 - Unitconversionlib
Input
Input Parameter Data types Description
API LREAL Input value of API Gravity
Output
Output Parameter Data types Description
KGPERM3 LREAL Output value of density. It is in Kg/cubic meter.
BAR_TO_MPA
Description
AR_TO_MPA function block converts pressure from BAR to Mpa.
Input
Input Parameter Data types Description
Bar LREAL Input pressure in Bar.
Output
Output Parameter Data types Description
Mpa LREAL Output pressure in mega pascal
411
Chapter 12 - Unitconversionlib
BAR_TO_PSIA
Description
BAR_TO_PSIA function block converts pressure from BAR to PSIA.
Input
Input Parameter Data types Description
Bar LREAL Input pressure in Bar.
Output
Output Parameter Data types Description
Psia LREAL Output pressure in Psia.
BAR_TO_PSIG
Description
BAR_TO_PSIG function block converts pressure from BAR to PSIG.
412
Chapter 12 - Unitconversionlib
Input
Input Parameter Data types Description
Bar LREAL Input pressure in Bar.
Output
Output Parameter Data types Description
Psig LREAL Output pressure in Psig.
CELCIUS_TO_FAHRENHEIT
Description
ELCIUS_TO_FAHRENHEIT function block converts temperature from
Celcius to Fahrenheit.
Input
Input Parameter Data types Description
Celcius LREAL Input temperature in Celcius
Output
Output Parameter Data types Description
Fahrenheit LREAL Output temperature in Fahrenheit
413
Chapter 12 - Unitconversionlib
CELCIUS_TO_KELVIN
Description
CELCIUS_TO_KELVIN function block converts temperature from
Celcius to Kelvin.
Input
Input Parameter Data types Description
Celcius LREAL Input temperature in Celcius
Output
Output Parameter Data types Description
Kelvin LREAL Output temperature in Kelvin
CELCIUS_TO_RANKINE
Description
CELCIUS_TO_RANKINE function block converts temperature from
Celcius to Rankine.
414
Chapter 12 - Unitconversionlib
Input
Input Parameter Data types Description
Celcius LREAL Input temperature in Celcius
Output
Output Parameter Data types Description
Rankine LREAL Output temperature in Rankine
DENSITY_SI_TO_US
Description
ENSITY_SI_TO_US function block converts gas density from SI unit
system to US unit system.
Input
Input Parameter Data types Description
Density_SI LREAL Input value of gas density in SI unit.
Output
Output Parameter Data types Description
Density_US LREAL Output value of gas density in US unit.
415
Chapter 12 - Unitconversionlib
Density_TO_APIGravity
Description
Density_TO_APIGravity function block converts density of liquid to API
gravity.
Input
Input Parameter Data types Description
KGPERM3 LREAL Input value of density. It is in Kg/cubic meter.
Output
Output Parameter Data types Description
API LREAL Output value of API Gravity.
DIAMETER_MM_TO_INCHE
Description
DIAMETER_MM_TO_INCHE function block converts diameter from
millimeter to inches.
416
Chapter 12 - Unitconversionlib
Input
Input Parameter Data types Description
Milimeter LREAL Input value of diameter in Metric unit system.
Output
Output Parameter Data types Description
Inches LREAL Output value of diameter in US unit system.
FAHRENHEIT_TO_KELVIN
Description
FAHRENHEIT_TO_KELVIN function block converts temperature from
Fahrenheit to Kelvin.
Input
Input Parameter Data types Description
Fahrenheit LREAL Input temperature in Fahrenheit
Output
Output Parameter Data types Description
Kelvin LREAL Output temperature in Kelvin
417
Chapter 12 - Unitconversionlib
FAHRENHEIT_TO_RANKINE
Description
FAHRENHEIT_TO_RANKINE function block converts temperature
from Fahrenheit to Rankine.
Input
Input Parameter Data types Description
Fahrenheit LREAL Input temperature in Fahrenheit
Output
Output Parameter Data types Description
Rankine LREAL Output temperature in Rankine
FLOWRATE_US_TO_METRIC
Description
FLOWRATE_US_TO_METRIC function block converts volumetric flow
rate from US unit to Metric unit.
418
Chapter 12 - Unitconversionlib
Input
Input Parameter Data types Description
FlowRate_US LREAL Input value of flow rate in US unit system.
Output
Output Parameter Data types Description
FlowRate_Metric LREAL Output value of flow rate in Metric unit system.
HEATING_VALUE_US_TO_SI
Description
HEATING_VALUE_US_TO_SI function block converts gas heating
value from US unit system to SI unit system.
Input
Input Parameter Data types Description
HeatingValue_US LREAL Input value of gas heating value in US unit.
Output
Output Parameter Data types Description
HeatingValue_SI LREAL Output value of gas heating value in SI unit.
419
Chapter 12 - Unitconversionlib
INH2O_TO_MPA
Description
INH2O_TO_MPA function block converts differential pressure from
INH2O to MPA.
Input
Input Parameter Data types Description
InH2O LREAL Input differential pressure in InH2O.
Output
Output Parameter Data types Description
Mpa LREAL Output differential pressure in Mpa.
KGPERM_TO_REL_DENSITY
Description
GPERM_TO_REL_DENSITY function block converts density of the
liquid to relative density of liquid.
420
Chapter 12 - Unitconversionlib
Input
Input Parameter Data types Description
Density LREAL Input value of density. It is in kg/m³.
Output
Output Parameter Data types Description
RelativeDensity LREAL Output value of relative density.
KPA_TO_PSIG
Description
KPA_TO_PSIG function block converts pressure from KPA to PSIG.
Input
Input Parameter Data types Description
Kpa LREAL Input pressure in Kpa.
421
Chapter 12 - Unitconversionlib
Output
Output Parameter Data types Description
Psig LREAL Output pressure in Psig.
MASS_FLORATE_US_TO_MET
Description
MASS_FLORATE_US_TO_MET function block converts mass flow rate
from US unit to Metric unit.
Input
Input Parameter Data types Description
MassFlowRate_US LREAL Input value of mass flow rate in US unit system.
Output
Data types
Output Parameter Description
422
Chapter 12 - Unitconversionlib
MILIBAR_TO_INH2O
Description
MILIBAR_TO_MPA function block converts differential pressure from
Milibar to INH2O.
Input
Input Parameter Data types Description
miliBar LREAL Input differential pressure in Milibar.
Output
Output Parameter Data types Description
InH2O LREAL Output differential pressure in Inches of water.
MILIBAR_TO_MPA
Description
MILIBAR_TO_MPA function block converts differential pressure from
Milibar to MPA.
423
Chapter 12 - Unitconversionlib
Input
Input Parameter Data types Description
miliBar LREAL Input differential pressure in Milibar.
Output
Output Parameter Data types Description
Mpa LREAL Output differential pressure in Mpa.
PSIA_TO_MPA
Description
PSIA_TO_MPA function block converts pressure from PSIA to Mpa.
Input
Input Parameter Data types Description
Psia LREAL Input pressure in Psia.
424
Chapter 12 - Unitconversionlib
Output
Output Parameter Data types Description
Mpa LREAL Output pressure in mega pascal
RELATIVE_DENSITY_TO_KGPE
Description
Type topic text here. RELATIVE_DENSITY_TO_KGPE function block
converts relative density of liquid to density of the liquid.
Input
Input Parameter Data types Description
RelativeDensity LREAL Input value of relative density.
Output
Output Parameter Data types Description
Density LREAL Output value of density. It is in kg/m³.
THERMAL_EXPAN_CEL_TO_FEH
Description
HERMAL_EXPAN_CEL_TO_FEH function block converts the thermal
expansion factor from degree Celcius to degree Fahrenheit.
425
Chapter 12 - Unitconversionlib
Input
Input Parameter Data types Description
TE_C LREAL Input value of thermal expansion factor in °C-1.
Output
Output Parameter Data types Description
TE_F LREAL Output value of thermal expansion factor in °F-1.
THERMAL_EXPAN_FAH_TO_CEL
Description
THERMAL_EXPAN_FAH_TO_CEL function block converts the thermal
expansion factor from degree Fahrenheit to degree Celcius.
Input
Input Parameter Data types Description
TE_F LREAL Input value of thermal expansion factor in °F-1.
426
Chapter 12 - Unitconversionlib
Output
Output Parameter Data types Description
TE_C LREAL Output value of thermal expansion factor in °C-1.
VISCO_US_TO_CENTIPOISE
Description
VISCO_US_TO_CENTIPOISE function block converts viscosity from US
unit to Centipoise.
Input
Input Parameter Data types Description
Viscosity_US LREAL Input value of viscosity in US unit system.
Output
Output Parameter Data types Description
Viscosity_Centipoise LREAL Output value of viscosity in Centipoise.
427
Chapter 12 - Unitconversionlib
428
CHAPTER
13 UTILITYLIB
Get RTC Read out the current time and date from the real-time clock and
presents them as the parameters.
EPOCH_TO_DATE Converts the EPOCH time to local timestamp value.
DATE_TO_EPOCH Converts local timestamp value to the EPOCH time.
GetMicroTickCount Returns tick count in microseconds.
SafeMove Guarantee the consistence of the value.
DATE_TO_EPOCH
Description
This function Libraries converts local timestamp value to the EPOCH
time.
429
Chapter 13 - UtilityLib
INPUT
SECOND: Second
MINUTES: Minute
HOUR: Hour
DAY: Day
MONTH: Month
YEAR: year number, valid range: 0~37 (2000-2037)
OUTPUT
EPOCH_TIME: ( also known as POSIX time or Unix time ) is a system
for describing instants in time, defined as the number of seconds that
have elapsed since 00:00:00 Coordinated Universal Time (UTC),
Thursday, 1 January 1970, not counting leap seconds.
Error Message
ERROR_NUM: Error code Description
0 no error
1 wrong second, valid range: 0 to 59
2 wrong minute, valid range: 0 to 59
3 wrong hour, valid range: 0 to 23
4 wrong day, valid range: 1 to 31
5 wrong month, valid range: 1 to 12
6 wrong year, valid range: 0 to 37
8 Fail to read RTC
9 Fail to write RTC
10 Fail to convert between date and EPOCH time
430
Chapter 13 - UtilityLib
EPOCH_TO_DATE
Description
This function Libraries converts the EPOCH time to local timestamp
value.
INPUT
EPOCH_TIME: ( also known as POSIX time or Unix time ) is a system
for describing instants in time, defined as the number of seconds that
have elapsed since 00:00:00 Coordinated Universal Time (UTC),
Thursday, 1 January 1970, not counting leap seconds
OUTPUT
SECOND: Second
MINUTE: Minute
HOUR: Hour
DAY: Day
MONTH: Month
YEAR: year number, range from 0 to 37 (2000~2037), or from 70 to
99 (1970~1999)
ERROR: True or False
ERROR_NUM: Error code 10, fail to convert between date and EPOCH
time or EPOCH_TIME is negative, which is invalid.
431
Chapter 13 - UtilityLib
GetMicroTickCount
Description
GetMicroTickCount function returns tick count in microseconds. The
Output type is UDINT. That means the tick count would roll over every
4294 seconds.
Input
N/A
Output
Micro Tick Count (UDINT)
432
Chapter 13 - UtilityLib
NOTE: Get RTC - This function block shall return the controller
Real Time Clock (RTC) as a UTC or GMT timestamp value.
Input
ENABLE: Enable for accepting the applied values
Output
SECOND: Second
MINUTE: Minute
HOUR: Hour
WEEKDAY: Weekday, range from 0 to 6 (0=Sunday)
DAY: Day
MONTH: Month
YEAR: current year number (2-figures)
EPOCH_TIME: ( also known as POSIX time or Unix time ) is a system
for describing instants in time, defined as the number of seconds that
have elapsed since 00:00:00 Coordinated Universal Time (UTC),
Thursday, 1 January 1970, not counting leap seconds.
ERROR: True or False
ERROR_NUM: Error code
433
Chapter 13 - UtilityLib
SafeMove
Description
If a global variable is used in multiple tasks, in order to guarantee the
consistence of the value, this function block is used.
434
Chapter 13 - UtilityLib
Input
ENABLE: Enable for accepting the applied values, rising edge.
SECOND: Second
MINUTES: Minute
HOUR: Hour
DAY: Day
MONTH: Month
YEAR: year number, valid range from 0 to 37(2000 to 2037)
Output
ERROR: Error message
ERROR_NUM: Error code
435
Chapter 13 - UtilityLib
436
CHAPTER
14 APINGLLIB
Function
Short description
block
API NGL API NGL Block calculates:
Block
Base density using API Chapter 11, Section 2, Part 4 in conjunction with
either API Chapter 11.2.2 or Chapter 11.2.2M.
The basic function of API NGL block when set for line to base
operation is to calculate standard density and associated volume
correction factor from an observed density, temperature and pressure
with an option to either calculate a vapor pressure or use an operator
entered value.
437
Chapter 14 - APINGLLIB
The basic function of API NGL block when set for base to line
operation is to calculate meter density and associated volume
correction factor from an observed density, temperature and pressure
with an option to either calculate a vapor pressure or use an operator
entered value.
API NGL block solves either a line to base or base to line correction
but not both.
It is possible, however, to connect the resulting standard density from
a line to base block to the input of a base to line block.
Input
Data
Input Parameter Description
types
APITables INT This can be from one of the following standards:
relative density)
4 - API1122M
ConverCriteria LREAL IP2 Convergence limit. Reserved for future use.
Set to 0.001
438
Chapter 14 - APINGLLIB
Data
Input Parameter Description
types
MaxIterations INT IP2 Max loop limit. Reserved for future use. Preset to
Set to 50.
DensityInput LREAL Density Input
DensityUnits INT This can be from one of the following options:
0 - Kg/m3
1 - RD
2 - Degrees API
IterationMethod INT Main calculation method such as ASTM and IP2
0 - ASTM
1 - IP2
PressureInput LREAL Pressure Input.
PressureUnits INT 0 - PSIA
1 - PSIG
2 - Kpa
3 - Bar
4 - BarG
EquilibPressureInput LREAL Operator Entered or Observed Vapor Pressure Input
PECalcType INT Vapor Pressure Options.
following values:
Temperature.)
439
Chapter 14 - APINGLLIB
Data
Input Parameter Description
types
ReferanceTemperature LREAL Reference Temperature. This is only used by T59E
and T60E. The usual value is 20. 0 degC.
Rounding INT 0 – Rounding Disabled
2 – Rounding Enabled
1 – Deg C
Output
Data
Output Parameter Description
types
CPL LREAL Correction factor for effects of pressure on the
liquid
CTL LREAL Correction factor for effects of temperature on the
liquid
CTPL LREAL Correction factor for effects of temperature and
pressure on the liquid
AFactor LREAL CPL calculation interim result
BFactor LREAL CPL calculation interim result
EquilibriumPressureOut LREAL Calculated (or used) Vapor Pressure
Relative Density LREAL Relative Density Corrected
CorrectedDensity LREAL Calculated Density in kg/m3 units
CorrectedDensityAPI LREAL Calculated Density in degrees API
ErrorCode INT Critical error code
WarningCode INT Warning code
440
Chapter 14 - APINGLLIB
Operating Limits:
The API 11 Chapter 11 methods are derived from correlations of
density versus physical conditions of liquids. As such they are only
valid over certain operating ranges. To allow flexibility, especially with
the IP2 iteration method where compressibility and temperature
correction calculation results interact, the limits are set as follows:
441
Chapter 14 - APINGLLIB
Warning codes
Code Description
1 Density input is out of range (all calculations)
2 Temperature input is out of range (all calculations)
3 Pressure input is out of range (all calculations)
4 Calculation combination is invalid (all calculations)
5 Reserved
442
Chapter 14 - APINGLLIB
Code Description
6 Reserved
7 Reserved
8 Reserved
9 Reserved
10 Reserved
11 Reserved
12 Reserved
13 Reserved
14 API.11.2.4: Alpha error
15 API.11.2.4: Interpolation variable error
16 API.11.2.4: TC error
17 API.11.2.4: TRX error
18 API.11.2.4: H2 error
19 API.11.2.4: Saturated density error
20 API.11.2.4: Interpolation factor error
21 API.11.2.4: Step 4-5 error
22 API.11.2.4: Fluid 2 relative density low error
23 API.11.2.4: Step 6 TC2_TC1 error
24 API.11.2.4: RD X < Lower Limit
25 API.11.2.4: RD 60 Mid error
26 API.11.2.4: Step 9 Phi error
27 API.11.2.4: Step 9 A error
28 API.11.2.4: Step 9 B error
29 API.11.2.4: Step 9 RD 60 Trial error
30 API.11.2.4: Iteration Fail error
31 API.11.2.4: CTL range error
32 API.11.2.4: T60 Step 6 density error
443
Chapter 14 - APINGLLIB
Code Description
101 API.11.2.4: Density conversion error
102 API.11.2.4: Rounding error
103 API.11.2.4: Reserved
104 API.11.2.4: CTL range error
105 API.11.2.4: CPL range error
106 API.11.2.4: Reserved
107 API.11.2.4: Reserved
108 API.11.2.4: Calculated density range error
109 API.11.2.4: Density units conversion error
110 API.11.2.4: Pressure units conversion error
111 API.11.2.4: CTPL range error
211 API 1122 and API1122M: TR > Max error
212 API 1122 and API1122M: Factor error
301 Ch.11.2.5: relative density out of range
302 Ch.11.2.5: Temperature out of range
444
CHAPTER
15 ISO5167DUALLIB
Function
Short Description
Block
See ISO ISO 5167 Dual function block calculates:
5167Dual for
more Mass flow to the 1991, 1997 and 2003 versions of ISO 5167.Calorific
information. value on a superior and inferior basis
ISO 5167Dual
ISO 5167 is an international standard covering the measurement of
fluid flow by means of pressure differential devices such as orifice
plates and venturis. When some parameters are known, ISO 5167
allows other variables to be calculated. The most common usage is to
calculate mass flow rate from differential pressure, static pressure
and density. ISO 5167 is widely used in most areas of the world except
North America.
The basic function of the ISO 5167 block is to calculate mass flow
rate from primary element DP and other required inputs. This block
supports the 1991, 1997 and 2003 versions of the ISO 5167 standard.
These versions differ in small but significant ways.
445
Chapter 15 - ISO5167DualLIB
energy flow.
n Calculation of fully-recovered downstream pressure (see section
9).
n Dual density inputs with automatic fail-over and deviation
checking (see section 5.4).
n Calculation of upstream density from a downstream measurement
(see section 11.2). Each density measurement input can be
configured upstream or downstream independently.
n Calculation of upstream temperature from a downstream
measurement (see section 11.1).
n Temperature compensation of primary element and pipe.
n Gauge or absolute static pressure transmitters located upstream
or downstream.
n Automatic selection of DP from up to three DP transmitters (see
section 0).
n Orifice plates with all three tapping types (corner, D and D/2 and
flange).
n Classical ventures of all three construction types: as-cast,
machined and rough-welded.
n Externally calculated viscosity and isentropic exponent or constant
values.
n Incompressible fluids (liquids) or compressible ones (gases).
n UK DTI limits on beta and Reynolds No for fiscal purposes.
Input
Data
Input Parameter Description
types
CalorificValue LREAL Calorific value in MJ/Sm3
ISO5167Version INT ISO5167Version:
0 = version 1991;
1 = version 1997;
2 = version 2003
FluidType INT 0 = Compressible;
446
Chapter 15 - ISO5167DualLIB
Data
Input Parameter Description
types
1 = Uncompressible
DensityFromBlockPin BOOL 1: RHOTP from block pin;
0: constant value
ConstantDensity LREAL Const Density
DensityInput1 LREAL Density Input 1
DensityInput2 LREAL Density Input 1
ViscosityFromBlockPin BOOL 1: VISC from block pin;
0: constant value
ViscosityOfFluid LREAL DP transmitter input - range 1 (in selected
DP units)
ISEN_EXPFromBlockPin BOOL true: ISEN_EXP from block pin;
1 = kg/min;
2 = kg/hour;
3 = tonne/min;
4 = tonne/hour
MassFlowScaling LREAL mass flow scaling factor
QVComputation BOOL true = computation for Volume Flow
VolumeFlowUnit INT 0 = m3/sec;
1 = m3/min;
2 = m3/hour;
4 = km3/hour
VolumeFlowScaling LREAL Volume flow scaling factor
QSComputation BOOL true = Standard Volume Flow Computation
447
Chapter 15 - ISO5167DualLIB
Data
Input Parameter Description
types
1 = Sm3/min;
2 = Sm3/hour;
4 = kSm3/hour
StdVolumeFlowScaling LREAL Standard volume flow scaling factor
QHComputation BOOL true = Energy Flow
EnergyFlowUnit INT 0 = KJ/sec;
1 = MJ/sec;
2 = MJ/min;
3 = MJ/hour;
4 = GJ/hour
EnergyFlowScaling LREAL Energy flow scaling factor
InitialCValue LREAL initial C value
MaxItrations INT max number of iterations
PrecisionLimit LREAL Precision Limits
FiscalMetering BOOL Fiscal Metering 1 = YES , 0 =NO
PrmiaryElementType INT 0 = Orifice Plate;
1 = Classical Venturi
OrificeTapType INT 0 = Corner;
1 = Flange;
2 = D&D/2
VenturiType INT 0 = As-Cast;
1 = Machined;
2 = Roughwelded
448
Chapter 15 - ISO5167DualLIB
Data
Input Parameter Description
types
AllowanceForExp BOOL true = allowance for expansion
PipeRefTemperature LREAL pipe reference temperature (deg C)
PipeCoefficient LREAL pipe coefficient of expansion (mm/mm/deg
C)
ElementRefTemperature LREAL primary element reference temperature (deg
C)
ElementCoefficient LREAL primary element coefficient of expansion
(mm/mm/deg C)
PipeReferenceBore LREAL pipe reference bore (mm)
ElementReferenceBore LREAL primary element reference bore (mm)
PermLossA LREAL venturi permanent pressure loss(%DP) for
coefficients A
PermLossB LREAL venturi permanent pressure loss(%DP) for
coefficients B
StaticPressMeasurementPos INT static pressure measurement position
(0 = Upstream, 1 = Downstream)
StaticPressUnit INT 0 = KPa;
1 = MPa;
2 = bar
StaticPressBasis INT 0 = Gauge;
1 = Absolute
AtmosphericPress LREAL Atmospheric Pressure
AtmosphericPressUnit INT atmospheric pressure measurement unit, 0 =
KPa abs, 1 = MPa abs, 2 = bara
DiffPressUnit INT diffrential pressure measurement unit, 0 =
KPa, 1 = MPa, 2 = bar, 3 = mbar
TempMeasurePosition INT temperature measurement position at 0 =
Upstream, 1= Downstream
DiffPressureTxNumber INT 1 = 1 transmitter;
449
Chapter 15 - ISO5167DualLIB
Data
Input Parameter Description
types
2 = 2 transmitter;
3 = 3 transmitter
HiLimDP1 LREAL hight limit value of transition 1-2
HiLimDP2 LREAL hight limit value of transition 2-3
DeadbandValueDP1 LREAL deadband value of transition 1-2
DeadbandValueDP2 LREAL deadband value of transition 2-3
NoOfDensityInputs INT Number of density inputs
DensityInputSelection INT Density input selection
DensityMeasurPosition1 INT density measurement position for input1
(0 = Upstream, 1 = Downstream)
DensityMeasurPosition2 INT density measurement position for input2
(0 = Upstream, 1 = Downstream)
DensityInputComparDB LREAL Density inputs 1 and 2 comparison
deadband
DensityInputComparTimeDelay INT Density inputs 1 and 2 comparison time
delay
CalorificValue LREAL Calorific Value
DiffPressInputRange1 LREAL Diff Pressure Transmitter input range1
DiffPressInputRange2 LREAL Diff Pressure Transmitter input range2
DiffPressInputRange3 LREAL Diff Pressure Transmitter input range3
DiffPressureStatus1 BOOL Diff Pressure Transmitter 1 status; 0=OK,
1=fault
DiffPressureStatus2 BOOL Diff Pressure Transmitter 2 status; 0=OK,
1=fault
DiffPressureStatus3 BOOL Diff Pressure Transmitter 3 status; 0=OK,
1=fault
DPPVEUHI1 LREAL DP transmitter x EUHI
DPPVEUHI2 LREAL DP transmitter x EUHI
450
Chapter 15 - ISO5167DualLIB
Data
Input Parameter Description
types
RhoInputSelStatus1 BOOL RhoInputSel Input Status 1
RhoInputSelStatus2 BOOL RhoInputSel Input Status 2
StaticPressure LREAL Static Pressure
StandardDensity LREAL Standard density
Temperature LREAL Temperature
Output
451
Chapter 15 - ISO5167DualLIB
452
Chapter 15 - ISO5167DualLIB
453
Chapter 15 - ISO5167DualLIB
Warning codes
Code Description
1 For a compressible fluid, P2/P1 ratio is too low.
2 Element bore is too small.
3 Pipe size is out of range for an orifice plate.
4 Pipe size is out of range for a venturi.
5 Orifice beta ratio is outside fiscal limits.
6 Orifice beta ratio is outside limits.
7 Venturi beta ratio is outside limits.
8 Orifice plate is outside Reynolds No limits.
9 Orifice plate is above fiscal Reynolds No limit.
10 Venturi is outside Reynolds No limits.
11 For dual density inputs, input 1 is invalid.
12 For dual density inputs, input 2 is invalid.
13 For dual density inputs, the deviation between the inputs is greater than the
deadband.
454
CHAPTER
16 ISO5167DUALJTLIB
Function
Short description
block
ISO 5167 ISO 5167 Dual JT Block calculates
DUAL JT
1. Mass flow to the 1991, 1997 and 2003 versions of ISO 5167.Calorific
value on a superior and inferior basis
The basic function of the ISO 5167 block is to calculate mass flow
rate from primary element DP and other required inputs. This block
supports the 1991, 1997 and 2003 versions of the ISO 5167 standard.
These versions differ in small but significant ways.
The basic functions supported are listed below
455
Chapter 16 - ISO5167DualJTLib
Input
Data
Parameter Description
type
CalorificValue LREAL Calorific value in MJ/Sm3
ISO5167Version INT ISO5167Version:
0 = 1991;
1 = 1997;
2 = 2003
456
Chapter 16 - ISO5167DualJTLib
Data
Parameter Description
type
FluidType INT 0 = Compressible;
1 = Uncompressible
DensityFromBlockPin BOOL 1: RHOTP from block pin;
0: constant value
ConstantDensity LREAL Const Density
DensityInput1 LREAL Density Input 1
DensityInput2 LREAL Density Input 1
ViscosityFromBlockPin BOOL 1: VISC from block pin;
0: constant value
ViscosityOfFluid LREAL DP transmitter input - range 1 (in selected
DP units)
ISEN_EXPFromBlockPin BOOL 1 : ISEN_EXP from block pin;
0: constant value
IsentropicExponent LREAL Isentropic Exponent
MassFlowUnit INT 0 = kg/sec;
1 = kg/min;
2 = kg/hour;
3 = tonne/min;
4 = tonne/hour
MassFlowScaling LREAL mass flow scaling factor
QVComputation BOOL true = computation for Volume Flow
VolumeFlowUnit INT 0 = m3/sec;
1 = m3/min;
2 = m3/hour;
4 = km3/hour
VolumeFlowScaling LREAL Volume flow scaling factor
457
Chapter 16 - ISO5167DualJTLib
Data
Parameter Description
type
QSComputation BOOL true = Standard Volume Flow Computation
StdVolumeFlowUnit INT 0 = Sm3/sec;
1 = Sm3/min;
2 = Sm3/hour;
4 = kSm3/hour
StdVolumeFlowScaling LREAL Standard volume flow scaling factor
QHComputation BOOL Energy Flow computation
1 = enable;
0 = disable
EnergyFlowUnit INt 0 = KJ/sec;
1 = MJ/sec;
2 = MJ/min;
3 = MJ/hour;
4 = GJ/hour
EnergyFlowScaling LREAL Energy flow scaling factor
InitialCValue LREAL initial C value
MaxItrations INT max number of iterations
PrecisionLimit LREAL Precision Limits
FiscalMetering BOOL Fiscal Metering:
1= Yes;
0 =No
PrmiaryElementType INT 0 = Orifice Plate;
1 = Classical Venturi
OrificeTapType INT 0 = Corner;
1 = Flange;
2 = D&D/2
458
Chapter 16 - ISO5167DualJTLib
Data
Parameter Description
type
VenturiType INT 0 = As-Cast;
1 = Machined;
2 = Roughwelded
AllowanceForExp BOOL allowance for expansion:
1 = Yes;
0 = No
PipeRefTemperature LREAL pipe reference temperature (deg C)
PipeCoefficient LREAL pipe coefficient of expansion
(mm/mm/deg C)
ElementRefTemperature LREAL primary element reference temperature
(deg C)
ElementCoefficient LREAL primary element coefficient of expansion
(mm/mm/deg C)
PipeReferenceBore LREAL pipe reference bore (mm)
ElementReferenceBore LREAL primary element reference bore (mm)
PermLossA LREAL venturi permanent pressure loss(%DP) for
coefficients A
PermLossB LREAL venturi permanent pressure loss(%DP) for
coefficients B
StaticPressMeasurementPos INT static pressure measurement position at
(0 = Upstream, 1 = Downstream)
StaticPressUnit INT 0 = KPa;
1 = MPa;
2 = bar
StaticPressBasis INT 0 = Gauge;
1 = Absolute
AtmosphericPress LREAL Atmospheric Pressure
AtmosphericPressUnit INT atmospheric pressure measurement unit:
459
Chapter 16 - ISO5167DualJTLib
Data
Parameter Description
type
0 = KPa abs;
1 = MPa abs;
2 = bara
DiffPressUnit INT diffrential pressure measurement unit:
0 = KPa;
1 = MPa;
2 = bar;
3 = mbar
TempMeasurePosition INT temperature measurement position at
(0 = Upstream, 1 = Downstream)
DiffPressureTxNumber INT 1 = 1 transmitter;
2 = 2 transmitter;
3 = 3 transmitter
HiLimDP1 LREAL hight limit value of transition 1-2
HiLimDP2 LREAL hight limit value of transition 2-3
DeadbandValueDP1 LREAL deadband value of transition 1-2
DeadbandValueDP2 LREAL deadband value of transition 2-3
NoOfDensityInputs INT Number of density inputs
DensityInputSelection INT Density input selection
DensityMeasurPosition1 INT density measurement position for input1
(0 = Upstream, 1 = Downstream)
DensityMeasurPosition2 INT density measurement position for input2
(0 = Upstream, 1 = Downstream)
DensityInputComparDB LREAL Density inputs 1 and 2 comparison
deadband
DensityInputComparTimeDelay INT Density inputs 1 and 2 comparison time
delay
460
Chapter 16 - ISO5167DualJTLib
Data
Parameter Description
type
CalorificValue LREAL Calorific Value
DiffPressInputRange1 LREAL Diff Pressure Transmitter input range1
DiffPressInputRange2 LREAL Diff Pressure Transmitter input range2
DiffPressInputRange3 LREAL Diff Pressure Transmitter input range3
DiffPressureStatus1 BOOL Diff Pressure Transmitter 1 status; 0=OK,
1=fault
DiffPressureStatus2 BOOL Diff Pressure Transmitter 2 status; 0=OK,
1=fault
DiffPressureStatus3 BOOL Diff Pressure Transmitter 3 status; 0=OK,
1=fault
DPPVEUHI1 LREAL DP transmitter x EUHI
DPPVEUHI2 LREAL DP transmitter x EUHI
RhoInputSelStatus1 BOOL RhoInputSel Input Status 1
RhoInputSelStatus2 BOOL RhoInputSel Input Status 2
StaticPressure LREAL Static Pressure
StandardDensity LREAL Standard density
Temperature LREAL Temperature
ZP1T1 LREAL Compressibility at P1, T1 line conditions.
ZP2T3 LREAL Compressibility at P2, T3 line conditions.
Output
Data
Output Parameter Description
types
BetaRatio LREAL Beta ratio (d/D) at flowing conditions
ElementActualBore LREAL Corrected bore/throat size
CValue LREAL Coefficient of discharge
SelectedDiffPressure LREAL Selected differential pressure
DiffTxInuse INT In-use DP transmitter
461
Chapter 16 - ISO5167DualJTLib
Data
Output Parameter Description
types
ExpFactor LREAL Expansibility factor
Pressure1Abs LREAL Upstream absolute pressure in Pa
Pressure1Guage LREAL Upstream gauge pressure
Pressure3Abs LREAL Fully recovered downstream absolute press
Pressure3Guage LREAL Fully recovered downstream gauge press
PipeActBore LREAL Corrected pipe size
Qh LREAL Energy flow
Qm LREAL Mass flow
Qs LREAL Standard volume flow
Qv LREAL Volume flow
Red LREAL Reynolds Number
RHO1 LREAL In-use Upstream density
RHO1_1 LREAL Upstream density derived from RHOTP1
RHO1_2 LREAL Upstream density derived from RHOTP2
Temperature1 LREAL Upstream temperature
VelApproachFactor LREAL Velocity of Approach factor
NumberIterations LREAL Number of Iterations for the last scan
ErrorCode INT Critital Error Code
WarningCode INT Warning Code
JT_COEFF LREAL Joule-Thomson coefficient in K/bar. If Version < 2003
Or Fluid is incompressible, value = NaN.
Information:
Compared with ISO5167_DUAL, ISO5167_DUAL_JT function block
have another two extra pin inputs, ZP1T1 and ZP2T3, based on these
two inputs, ISO5167_DUAL_JT adopts different algorithm to calculate
RHO1_1 and RHO1_2.
In addition, ISO5167_DUAL_JT calculate T1 based on Joule-Thomson
coefficient, finally flow rate can be figured out via ISO5167_DUAL_JT
Function Block.
462
Chapter 16 - ISO5167DualJTLib
463
Chapter 16 - ISO5167DualJTLib
464
Chapter 16 - ISO5167DualJTLib
Warning codes
Code Description
1 For a compressible fluid, P2/P1 ratio is too low.
2 Element bore is too small.
3 Pipe size is out of range for an orifice plate.
4 Pipe size is out of range for a venturi.
5 Orifice beta ratio is outside fiscal limits.
6 Orifice beta ratio is outside limits.
7 Venturi beta ratio is outside limits.
8 Orifice plate is outside Reynolds No limits.
9 Orifice plate is above fiscal Reynolds No limit.
10 Venturi is outside Reynolds No limits.
11 For dual density inputs, input 1 is invalid.
12 For dual density inputs, input 2 is invalid.
13 For dual density inputs, the deviation between the inputs is greater than the
deadband.
465
Chapter 16 - ISO5167DualJTLib
466
Chapter 16 - ISO5167DualJTLib
Warning codes
Code Description
1 For a compressible fluid, P2/P1 ratio is too low.
2 Element bore is too small.
3 Pipe size is out of range for an orifice plate.
4 Pipe size is out of range for a venturi.
5 Orifice beta ratio is outside fiscal limits.
6 Orifice beta ratio is outside limits.
7 Venturi beta ratio is outside limits.
8 Orifice plate is outside Reynolds No limits.
9 Orifice plate is above fiscal Reynolds No limit.
10 Venturi is outside Reynolds No limits.
11 For dual density inputs, input 1 is invalid.
12 For dual density inputs, input 2 is invalid.
13 For dual density inputs, the deviation between the inputs is greater than the
deadband.
467
Chapter 16 - ISO5167DualJTLib
468
CHAPTER
17 ISO6976LIB
ISO 6976
ISO 6976:1995 is an international standard covering the calculation
for natural gas of calorific value, density, relative density and Wobbe
Index from its composition. ISO 6976 is widely used in most areas of
the world except North America.
Description
The basic function of this block is to calculate the following values
using gas composition and the ISO 6976 definitive methods:
n Molar mass
n Ideal relative density
n Real relative density at 1.01325 bara and selected metering
temperature.
n Ideal density at 1.01325 bara and selected metering temperature.
n Ideal density at 1.01325 bara and 15 deg C.
n Real density at 1.01325 bara and selected metering temperature.
n Real density at 1.01325 bara and 15 deg C.
n Compressibility at 1.01325 bara and 15 deg C.
469
Chapter 17 - ISO6976lib
470
Chapter 17 - ISO6976lib
ISO6976 Components
ISO 6976 defines 58 components and provides complete or partial
constant data for them. This function block input shows the name of
the real components as seen in the below table. The mol fractions of
the non-exposed components and indexes should be forced to 0.0.
Input
Data
Input Parameter Description
types
Methane LREAL Input mol fractions or mol percentage
Ethane LREAL Input mol fractions or mol percentage
Propane LREAL Input mol fractions or mol percentage
n_Butane LREAL Input mol fractions or mol percentage
i_Butane LREAL Input mol fractions or mol percentage
n_Pentane LREAL Input mol fractions or mol percentage
i_Pentane LREAL Input mol fractions or mol percentage
neo_Pentane LREAL Input mol fractions or mol percentage
n_Hexane LREAL Input mol fractions or mol percentage
Methylpentane_2 LREAL Input mol fractions or mol percentage
Methylpentane_3 LREAL Input mol fractions or mol percentage
Dimethylbutane_2_2 LREAL Input mol fractions or mol percentage
Dimethylbutane_2_3 LREAL Input mol fractions or mol percentage
n_Heptane LREAL Input mol fractions or mol percentage
471
Chapter 17 - ISO6976lib
Data
Input Parameter Description
types
n_Octane LREAL Input mol fractions or mol percentage
n_Nonane LREAL Input mol fractions or mol percentage
n_Decane LREAL Input mol fractions or mol percentage
Ethylene LREAL Input mol fractions or mol percentage
Propylene LREAL Input mol fractions or mol percentage
Butene1 LREAL Input mol fractions or mol percentage
cis_2_Butene LREAL Input mol fractions or mol percentage
trans_2_Butene LREAL Input mol fractions or mol percentage
2-Methylpropene LREAL Input mol fractions or mol percentage
Pentene_1 LREAL Input mol fractions or mol percentage
Propadiene LREAL Input mol fractions or mol percentage
Butadiene_1_2 LREAL Input mol fractions or mol percentage
Butadiene_1_3 LREAL Input mol fractions or mol percentage
Acetylene LREAL Input mol fractions or mol percentage
Cyclopentane LREAL Input mol fractions or mol percentage
Methylcyclopentane LREAL Input mol fractions or mol percentage
Ethylcyclopentane LREAL Input mol fractions or mol percentage
Cyclohexane LREAL Input mol fractions or mol percentage
Methylcyclohexane LREAL Input mol fractions or mol percentage
Ethylcyclohexane LREAL Input mol fractions or mol percentage
Benzene LREAL Input mol fractions or mol percentage
Toluene LREAL Input mol fractions or mol percentage
Ethylbenzene LREAL Input mol fractions or mol percentage
o_Xylene LREAL Input mol fractions or mol percentage
Methano LREAL Input mol fractions or mol percentage
Methanethiol LREAL Input mol fractions or mol percentage
Hydrogen LREAL Input mol fractions or mol percentage
472
Chapter 17 - ISO6976lib
Data
Input Parameter Description
types
Water LREAL Input mol fractions or mol percentage
Hydrogensulphide LREAL Input mol fractions or mol percentage
Ammonia LREAL Input mol fractions or mol percentage
Hydrogencyanide LREAL Input mol fractions or mol percentage
Carbonmonoxide LREAL Input mol fractions or mol percentage
Carbonyldisulphide LREAL Input mol fractions or mol percentage
Carbondisulphide LREAL Input mol fractions or mol percentage
Helium LREAL Input mol fractions or mol percentage
Neon LREAL Input mol fractions or mol percentage
Argon LREAL Input mol fractions or mol percentage
Nitrogen LREAL Input mol fractions or mol percentage
Oxygen LREAL Input mol fractions or mol percentage
Carbondioxide LREAL Input mol fractions or mol percentage
Sulphurdioxide LREAL Input mol fractions or mol percentage
Dinitrogenmonoxide LREAL Input mol fractions or mol percentage
Krypton LREAL Input mol fractions or mol percentage
Xenon LREAL Input mol fractions or mol percentage
MeteringTemperature INT The possible combinations are:
25 = 25/20
InferiorCV_Values INT If inferior values are required, this needs to be set to 1
DensityScalingFactor LREAL The function block only calculates density in units of
kg/Sm3. However, it is possible to use it for alternative
metric units or non- metric units by scaling the output
using the scale factor. For instance from, say, kg/Sm3
to lbs/Scuf.
473
Chapter 17 - ISO6976lib
Data
Input Parameter Description
types
CV_ LREAL The function block only calculates CV on a molar basis
MolarScalingFactor in units of KJ/mol. However, it is possible to use it for
alternative metric units or non- metric units by scaling
the output using the scale factor. For instance from,
say, KJ/mol to BTU/mol.
0 = fraction , 1 = percent.
CV_ INT If mass based CV is required, this must be set to 1.
onMassBasisMode
CV_ LREAL The function block only calculates CV on a mass basis
MassScalingFactor in units of MJ/kg. However, it is possible to use it for
alternative metric units or non- metric units by scaling
the output using the scale factor. For instance from,
say, MJ/kg to BTU/lb.
Output
Data
Output Parameter Description
types
ErrorCode INT Critical error code
CV_MolarBasisSuperior LREAL Calorific value on a molar basis, superior (KJ/mol)
474
Chapter 17 - ISO6976lib
Data
Output Parameter Description
types
CV_MolarBasisInferior LREAL Calorific value on a molar basis, inferior (KJ/mol)
CV_MassBasisSuperior LREAL Calorific value on a mass basis,superior (MJ/kg)
CV_MassBasisInferior LREAL Calorific value on a mass basis,inferior (MJ/kg)
CVIdeal_ LREAL Ideal calorific value on a volumetric basis, superior
VolBasisSuperior (MJ/Sm3)
CVReal_ LREAL Real calorific value on a volumetric basis, superior
VolBasisSuperior (MJ/Sm3)
CVIdeal_ LREAL Ideal calorific value on a volumetric basis, inferior
VolBasisInferior (MJ/Sm3)
CVReal_VolBasisInferior LREAL Real calorific value on a volumetric basis, inferior
(MJ/Sm3)
MolarMass LREAL Molar mass
ComponentCount INT Number of components
RelativeDensityIdeal LREAL Relative density - ideal
RelativeDensityReal LREAL Relative density - real
ReferenceDensityIdeal LREAL Density at metering conditions – ideal (kg/Sm3)
ReferenceDensityReal LREAL Density at metering conditions – real (kg/Sm3)
StandardDensityIdeal LREAL Standard density - ideal (kg/Sm3)
StandardDensityReal LREAL Standard density - real (kg/Sm3)
SumOfComponentFracs LREAL Sum of component fractions
475
Chapter 17 - ISO6976lib
Information
ISO 6976 defines 58 components and provides complete or partial
constant data for them.
This data is used in the calculation of molar mass, CV etc. Each
component has an index number (1-58) and this index will be used to
refer to the particular component. These same index numbers are
also used to point at elements in data arrays. The relationship of
indexes and component names is as follows:
476
Chapter 17 - ISO6976lib
477
Chapter 17 - ISO6976lib
478
Chapter 17 - ISO6976lib
Warning codes
Code Description
1 Inputs do not sum to 1.0 +/- 0.0001.
2 Ethane mol fraction is > 0.15.
3 Water mol fraction is > 0.00005.
4 Nitrogen mol fraction is > 0.3.
5 Carbon dioxide mol fraction is > 0.15.
6 General component mol fraction is > 0.05.
7 Methane mol fraction is < 0.5.
479
Chapter 17 - ISO6976lib
480
CHAPTER
18 MODBUS MASTER
With these function blocks, you can read and write single coil,
multiple coils, single discrete input, multiple discrete inputs, single
input register, multiple input registers, single holding register, etc., as
per Modbus protocol.
Related topics:
n Description of CONFIG_INFO
n Description of Input and Output Data Type
n Modbus Protocol Error Codes
n Endian Mode
481
Chapter 18 - Modbus Master
Description
It is used to read a single coil.
Input
Data
Parameter Description
type
ENABLE BOOL Enable: If TRUE, the FB is enabled and workable.
CONFIG_ User This is a structure provided by Honeywell. Modbus related
INFO defined information is included. See Description of CONFIG_INFO for
data more information.
type
START_ UINT The first Modbus register address to read. Function code is not
ADDR included in the address.
SEND_ BOOL If SEND_FLAG is true and RDY_FLAG is true, function blocks will
FLAG send the request. RDY_FLAG is TRUE means last communication
is finished. Before the last communication is finished, even if the
SEND_FLAG is true, the request won’t be sent.
482
Chapter 18 - Modbus Master
Output
Data
Parameter Description
type
RDY_FLAG BOOL True: last communication is finished. FB is ready for the next
communication.
0: Communication succeeded.
2: Response timeout
4: Invalid request
483
Chapter 18 - Modbus Master
Description
It is used to read single discrete input.
Input
Data
Parameter Description
type
ENABLE BOOL Enable: If TRUE, the FB is enabled and workable.
CONFIG_ User This is a structure provided by Honeywell. Modbus related
INFO defined information is included. See Description of CONFIG_INFO for
data more information.
type
START_ UINT The first Modbus register address to read. Function code is not
ADDR included in the address.
SEND_ BOOL If SEND_FLAG is true and RDY_FLAG is true, function blocks will
FLAG send the request. RDY_FLAG is TRUE means last communication
is finished. Before last communication is finished, even if SEND_
FLAG is true the request won’t be sent.
Output
Data
Parameter Description
type
RDY_FLAG BOOL True: last communication is finished. FB is ready for the next
communication.
484
Chapter 18 - Modbus Master
Data
Parameter Description
type
ERR Protocol Error Codes for more information.
GEN_ERR USINT General error code:
0: Communication succeeded.
2: Response timeout
4: Invalid request
Description
It is used to read a single holding register.
Input
Data
Parameter Description
type
ENABLE BOOL Enable: If TRUE, the FB is enabled and workable.
485
Chapter 18 - Modbus Master
Data
Parameter Description
type
CONFIG_ User This is a structure provided by Honeywell. Modbus related
INFO defined information is included. See Description of CONFIG_INFO for
data more information.
type
START_ UINT The Modbus register address to read. Function code is not
ADDR included in the address.
SEND_ BOOL If SEND_FLAG is true and RDY_FLAG is true, function blocks
FLAG would send the request. RDY_FLAG is TRUE means the last
communication is finished. Before the last communication is
finished, even if the SEND_FLAG is true the request won’t be
sent.
Output
Data
Parameter Description
type
RDY_FLAG BOOL True: last communication is finished. FB is ready for the next
communication.
0: Communication succeeded.
2: Response timeout
4: Invalid request
486
Chapter 18 - Modbus Master
Description
It is used to read single input register.
Input
Data
Parameter Description
type
ENABLE BOOL Enable: If TRUE, the FB is enabled and workable.
CONFIG_ User This is a structure provided by Honeywell. Modbus related
INFO defined information is included. See Description of CONFIG_INFO for
data more information.
type
START_ UINT The Modbus register address to read. Function code is not
ADDR included in the address.
SEND_ BOOL If SEND_FLAG is true and RDY_FLAG is true, function blocks
FLAG would send the request. RDY_FLAG is TRUE means the last
communication is finished. Before last communication is
finished, even if SEND_FLAG is true, the request won’t be sent.
487
Chapter 18 - Modbus Master
Output
Data
Parameter Description
type
RDY_FLAG BOOL True: last communication is finished. FB is ready for the next
communication.
0: Communication succeeded.
2: Response timeout
4: Invalid request
488
Chapter 18 - Modbus Master
Description
It is used to read multiple coils.
Input
Data
Parameter Description
type
ENABLE BOOL Enable: If TRUE, the FB is enabled and workable.
CONFIG_ User This is a structure provided by Honeywell. Modbus related
INFO defined information is included. See Description of CONFIG_INFO for
data more information.
type
START_ UINT The first Modbus register address to read. Function code is not
ADDR included in the address.
LENGTH UINT The number of registers to read, ranging from 1 to 2000.
SEND_ BOOL If SEND_FLAG is true and RDY_FLAG is true, function blocks will
FLAG send the request. RDY_FLAG is TRUE means the last
communication finished. Before the last communication is
finished, even if SEND_FLAG is true, the request won’t be sent.
489
Chapter 18 - Modbus Master
Output
Data
Parameter Description
type
RDY_FLAG BOOL True: last communication is finished. FB is ready for the next
communication.
TYPE
Variable Name: array[1..LENGTH] of
BOOL;
END_TYPE
DONE BOOL Indicates that the response is received from a slave device.
ERR_FLG BOOL Will be set to TRUE if there is either a general error or a protocol
error.
PROTOCO USIN Error numbers defined by Modbus protocol. See Modbus
L_ERR T Protocol Error Codes for more information.
GEN_ERR USIN General error code:
T
0: Communication succeeded.
2: Response timeout
4: Invalid request
490
Chapter 18 - Modbus Master
Description
It is used to read multiple discrete inputs.
Input
Data
Parameter Description
type
ENABLE BOOL Enable: If TRUE, the FB is enabled and workable.
CONFIG_ User This is a structure provided by Honeywell. Modbus related
INFO defined information is included. See Description of CONFIG_INFO for
data more information.
type
START_ UINT The first Modbus register address to read. Function code is not
ADDR included in the address.
LENGTH UINT The number of registers to read, ranging from 1 to 2000.
SEND_ BOOL If SEND_FLAG is true and RDY_FLAG is true, function blocks will
FLAG send the request. RDY_FLAG is TRUE means the last
communication is finished. Before the last communication is
finished, even if SEND_FLAG is true, the request won’t be sent.
491
Chapter 18 - Modbus Master
Output
Data
Parameter Description
type
RDY_FLAG BOOL True: last communication is finished. FB is ready for the next
communication.
TYPE
Variable Name: array[1..LENGTH] of
BOOL;
END_TYPE
DONE BOOL Indicates that the response is received from a slave device.
ERR_FLG BOOL Will be set to TRUE if there is either a general error or a protocol
error.
PROTOCO USIN Error numbers defined by Modbus protocol. See Modbus
L_ERR T Protocol Error Codes for more information.
GEN_ERR USIN General error code:
T
0: Communication succeeded.
2: Response timeout
4: Invalid request
492
Chapter 18 - Modbus Master
Description
It is used to read multiple holding registers.
Input
Data
Parameter Description
type
ENABLE BOOL Enable: If TRUE, the FB is enabled and workable.
CONFIG_ User This is a structure provided by Honeywell. Modbus related
INFO defined information is included. See Description of CONFIG_INFO for
data more information.
type
START_ UINT The first Modbus register address to read. Function code is not
ADDR included in the address.
LENGTH UINT The number of registers to read, ranging from 1 to 125.
SEND_ BOOL If SEND_FLAG is true and RDY_FLAG is true, function blocks
FLAG would send the request. RDY_FLAG is TRUE means the last
communication is finished. Before the last communication is
finished, even if the SEND_FLAG is true, the request won’t be
sent.
493
Chapter 18 - Modbus Master
Output
Dat
Parame
a Description
ter
type
RDY_ BO True: last communication is finished. FB is ready for the next
FLAG OL communication.
ENDIA USI Endian mode is required for reading/writing 32bit and 64 bit variables.
N_ NT As Modbus always use big Endian to transceive data, there is no need
MODE to set the Endian mode for 16-bit data.
494
Chapter 18 - Modbus Master
Dat
Parame
a Description
ter
type
DONE BO Indicates that the response is received from slave device.
OL
ERR_ BO Will be set to TRUE if there is either a general error or a protocol error.
FLG OL
PROTO USI Error numbers defined by Modbus protocol. See Modbus Protocol
COL_ NT Error Codes for more information.
ERR
GEN_ USI General error code:
ERR NT
0: Communication succeeded.
2: Response timeout
4: Invalid request
Description
It is used to read multiple input registers.
495
Chapter 18 - Modbus Master
Input
Data
Parameter Description
type
ENABLE BOOL Enable: If TRUE, the FB is enabled and workable.
CONFIG_ User This is a structure provided by Honeywell. Modbus related
INFO defined information is included. See Description of CONFIG_INFO for
data more information.
type
START_ UINT The first Modbus register address to read. Function code is not
ADDR included in the address.
LENGTH UINT The number of registers to read, ranging from 1 to 125.
SEND_ BOOL If SEND_FLAG is true and RDY_FLAG is true, function blocks
FLAG would send the request. RDY_FLAG is TRUE means the last
communication is finished. Before the last communication is
finished, even if the SEND_FLAG is true, the request won’t be
sent.
Output
Paramet Data
Description
er type
RDY_ BOO True: last communication is finished. FB is ready for the next
FLAG L communication.
496
Chapter 18 - Modbus Master
Paramet Data
Description
er type
ENDIAN_ USIN Endian mode is required for reading/writing 32bit and 64 bit
MODE T variables. As Modbus always use big Endian to transceive data, there
is no need to set the Endian mode for 16-bit data.
2: Response timeout
4: Invalid request
497
Chapter 18 - Modbus Master
Description
It is used to write a single coil.
Input
Data
Parameter Description
type
ENABLE BOOL Enable: If TRUE, the FB is enabled and workable.
CONFIG_ User This is a structure provided by Honeywell. Modbus related
INFO defined information is included. See Description of CONFIG_INFO for
data more information.
type
START_ UINT The Modbus register address to read. Function code is not
ADDR included in the address.
SEND_ BOOL If SEND_FLAG is true and RDY_FLAG is true, function blocks
FLAG would send the request. RDY_FLAG is TRUE means the last
communication is finished. Before the last communication is
finished, even if the SEND_FLAG is true, the request won’t be
sent.
INPUT BOOL 1: ON
0: OFF
498
Chapter 18 - Modbus Master
Output
Data
Parameter Description
type
RDY_FLAG BOOL True: last communication is finished. FB is ready for the next
communication.
0: Communication succeeded.
2: Response timeout
4: Invalid request
499
Chapter 18 - Modbus Master
Description
It is used to write single holding register.
Input
Data
Parameter Description
type
ENABLE BOOL Enable: If TRUE, the FB is enabled and workable.
CONFIG_ User This is a structure provided by Honeywell. Modbus related
INFO defined information is included. See Description of CONFIG_INFO for
data more information.
type
START_ UINT The Modbus register address to read. Function code is not
ADDR included in the address.
SEND_ BOOL If SEND_FLAG is true and RDY_FLAG is true, function blocks
FLAG would send the request. RDY_FLAG is TRUE means the last
communication is finished. Before the last communication is
finished, even if the SEND_FLAG is true, the request won’t be
sent.
INPUT UINT 16 bit input data of START_ADDR register
Output
Data
Parameter Description
type
RDY_FLAG BOOL True: last communication is finished. FB is ready for the next
communication.
500
Chapter 18 - Modbus Master
Data
Parameter Description
type
0: Communication succeeded.
2: Response timeout
4: Invalid request
Description
It is used to write multiple coils.
Input
Paramete Data
Description
r type
ENABLE BOOL Enable: If TRUE, the FB is enabled and workable.
CONFIG_ User This is a structure provided by Honeywell. Modbus related
INFO define information is included. See Description of CONFIG_INFO for
d data more information.
type
501
Chapter 18 - Modbus Master
Paramete Data
Description
r type
START_ UINT The first Modbus register address to read. Function code is not
ADDR included in the address.
LENGTH UINT The number of registers to write, ranging from 1 to 1968.
SEND_ BOOL If SEND_FLAG is TRUE and RDY_FLAG is true, function blocks
FLAG would send the request. RDY_FLAG is TRUE means the last
communication is finished. Before the last communication is
finished, even if the SEND_FLAG is true, the request won’t be sent.
INPUT Array User defined data type: array of bool. The size of the array should
of be equal to the number of the registers to read. The end user
BOOL should define a data type as shown here:
TYPE
Variable Name: array[1..LENGTH] of
BOOL;
END_TYPE
Use the suffix to set the status of a specific register.
Output
Data
Parameter Description
type
RDY_FLAG BOOL True: last communication is finished. FB is ready for the next
communication.
0: Communication succeeded.
2: Response timeout
502
Chapter 18 - Modbus Master
Data
Parameter Description
type
3: Controller internal time out (IPC timeout).
4: Invalid request
Description
It is used to write multiple holding registers.
Input
Param Data
Description
eter type
ENAB BOO Enable: If TRUE, the function block is enabled and workable.
LE L
CONFI User This is a structure provided by Honeywell. Modbus related information
G_ defi is included. See Description of CONFIG_INFO for more information.
INFO ned
data
type
STAR UIN The first Modbus register address to read. Function code is not
503
Chapter 18 - Modbus Master
Param Data
Description
eter type
T_ T included in the address.
ADDR
LENG UIN The number of registers to write, ranging from 1 to 123.
TH T
SEND_ BOO If SEND_FLAG is true and RDY_FLAG is true, function blocks would
FLAG L send the request. RDY_FLAG is TRUE means the last communication is
finished. Before the last communication is finished, even if the SEND_
FLAG is true, the request won’t be sent.
INPUT Arra User defined data type. The size of the array depends on the number of
y of the registers to write:
INT,
UIN Size of (array) * size of (element of array) / size of (UINT) = LENGTH.
T, The end user should define a data type as shown here:
DIN
T, TYPE
UDI Variable Name: array[1..LENGTH] of
NT, INT/UINT/DINT/UDINT/LINT/REAL/LREAL;
LIN END_TYPE
T,
REA Use the suffix to read the data of a specific register.
L, or
LRE
AL
Output
Data
Parameter Description
type
RDY_FLAG BOOL True: last communication is finished. The function block is ready
for the next communication.
504
Chapter 18 - Modbus Master
Data
Parameter Description
type
2: byte-swapped little Endian mode for 32 bit data
0: Communication succeeded.
2: Response timeout
4: Invalid request
Description of CONFIG_INFO
The CONFIG_INFO pin defined in the function blocks is to input all the
configuration information for the Modbus master.
There are three types of communication between Modbus master and
Modbus slave: serial communication of ControlEdge 2020 controllers
using RS232 or RS485, Ethernet communication and serial
communication of ControlEdge 900 Controllers. Accordingly three
types of data structures are defined for CONFIG_INFO.
505
Chapter 18 - Modbus Master
TYPE
MB_CONFIG_INFO_COM:
STRUCT
MB_SLAVE_ID: USINT;
PORT_NUM: USINT;
RETRIES: USINT;
TIMEOUT: UDINT;
END_STRUCT;
END_TYPE
TYPE
MB_CONFIG_INFO_ETH:
STRUCT
MB_SLAVE_ID: USINT;
PORT_NUM:
USINT;
RETRIES:
USINT;
TIMEOUT:
UDINT;
TCP_PORT_NUM: UINT;
IP_ADDR:
STRING;
END_STRUCT;
END_TYPE
TYPE
MB_CONFIG_INFO_ECOM:
STRUCT
MB_SLAVE_ID: USINT;
PORT_NUM: USINT;
RETRIES: USINT;
TIMEOUT: UDINT;
RACK_NUM: UDINT;
SLOT_NUM: UDINT;
END_STRUCT;
END_TYPE
See the following table for the parameter descriptions:
506
Chapter 18 - Modbus Master
Data
Parameter Description
type
MB_ USINT Modbus slave ID: valid arrange: 1~247.
SLAVE_ID
PORT_ USINT The physical interface of serial port:
NUM
1. RS232 port 1
2. RS232 port 2
3. RS485 port 1
4. RS485 port 2
5. reserved
6. reserved
The physical interface of Ethernet port:
1. Ethernet port 1
2. Ethernet port 2
3. reserved
4. reserved
RETRIES USINT Retry times before it is failed.
TIMEOUT UDINT Timeout unit: millisecond.
507
Chapter 18 - Modbus Master
Data
Parameter Description
type
SLOT_ UDINT The slot number of the serial port, 1 to 12 are available
NUM
n For reading and writing coils and discrete inputs, array of BOOL is
defined.
Set or retrieve the data value by using the suffix. For example:
there are 10 coils to read, the output array COIL_OUT can be
defined as array [1...10] of BOOL, reading the status of the fifth
register could be COIL_OUT [5].
Error
Item Description
Code
0 success N/A
69 Connection Signals that the TCP/IP connection is closed by the remote peer
broken or broken.
129 checksum N/A
error
130 invalid frame Signals that a received frame does not correspond either by
error structure or content to the specification or does not match a
508
Chapter 18 - Modbus Master
Error
Item Description
Code
previously sent query frame. A poor data link typically causes this
error.
131 Invalid reply Signals that a received reply does not correspond to the
error specification
132 reply timeout Signals that a fieldbus data transfer timed out. This can occur if
error the slave device does not reply in time or does not reply at all. A
wrong unit address will also cause this error. On some occasions,
this exception is also produced if the characters received don't
constitute a complete frame.
133 send timeout Signals that a fieldbus data send timed out. This can only occur
error if the handshake lines are not properly set.
161 illegal Signals that an illegal Function exception response was received.
function This exception response is sent by a slave device instead of a
response normal response message if a master sent a Modbus function
not supported by the slave device.
162 illegal Signals that an illegal Data Address exception response was
address received. This exception response is sent by a slave device
response instead of a normal response message if a master queried an
invalid or non-existing data address.
163 illegal value Signals that an illegal Value exception response was received.
response This exception response is sent by a slave device instead of a
normal response message if a master sent a data value that is
not an allowed value for the slave device.
164 failure Signals that a Slave Device Failure exception response (code 04)
response was received. This exception response is sent by a slave device
instead of a normal response message if an unrecoverable error
occurred while processing the requested action. This response is
also sent if the request would generate a response whose size
exceeds the allowable data size.
165 Acknowledge Slave has accepted request and is processing it, but a long
duration of time is required. This response is returned to prevent
a timeout error from occurring in the master. Master can next
issue a Poll Program Complete message to determine whether
processing is completed.
166 Slave Device Slave is engaged in processing a long-duration command.
Busy Master should retry later.
509
Chapter 18 - Modbus Master
Error
Item Description
Code
167 Negative Slave cannot perform the programming functions. Master should
Acknowledge request diagnostic or error information from slave.
168 Memory Slave detected a parity error in memory. Master can retry the
Parity Error request, but service may be required on the slave device.
170 Gateway Specialized for Modbus gateways. Indicates a misconfigured
Path gateway.
Unavailable
171 Gateway Specialized for Modbus gateways. Sent when slave fails to
Target respond.
Device
Failed to
Respond
Endian Mode
Modbus protocol supports 16bit data only. If there are 32bit or 64bit
variables, 2 or 4 consecutive registers should be used to read the data
value. In these cases, the Endian mode may be involved due to the
different Endian modes in Modbus slave devices.
See the following table for the concept of Endian modes used in
Modbus function blocks:
Endian
Description
mode
Little Lower registers contain lower bits and higher registers contain higher bits.
endian The order is on a register basis. Inside each register, the more significant
byte is always at the first place as defined by the Modbus protocol.
Big Lower registers contain higher bits and higher registers contain lower bits.
endian The order is on a register basis. Inside each register, the more significant
byte is always at the first place as defined by the Modbus protocol.
Byte- The two bytes inside each register would be swapped.
swapped
510
Chapter 18 - Modbus Master
511
Chapter 18 - Modbus Master
512
CHAPTER
Function
Short Description
Block
COM_RECV This function block is used to received user defined data from the
target device.
COM_SEND This function block is used to send user defined data to the target
device.
Related topics:
COM_SEND
This function block is used to send user defined data to the target
device.
513
Chapter 19 - User Defined Protocol
Input
Parameter Data type Description
ENABLE BOOL Enable: If TRUE, the function block is enabled and workable.
RACK USINT Rack number of expanded communication module. Default
as 0.
l 0: Local rack
l 1~99: Remote rack.
1. RS232 port 1
2. RS232 port 2
3. RS485 port 1
4. RS485 port 2
5. reserved
6. reserved
IOM USINT Module number of expanded communication module.
Default as 0.
l 0: Controller;
l 1~30: Expanded communication module;
For Control Edge PLC: 1 to 12 are available.
SEND_ BOOL If SEND_FLAG is true and RDY_FLAG is true, the function
FLAG block would send the request. RDY_FLAG is TRUE means
last communication is finished. Before last communication
is finished, even if SEND_FLAG is true the request won’t be
sent.
DATA Array of User defined data type. The size of the array depends on the
USINT,UINT, number of the registers to read. the end user should define a
UDINT, data type as shown below: TYPE VariableName: array
LINT, REAL [1..LENGTH] of UINT/USINT/UDINT/LINT/REAL/LREAL;
514
Chapter 19 - User Defined Protocol
Output
Data
Parameter Description
type
RDY_FLAG BOOL True: last communication is finished.The Function Block is ready
for the next communication.
For other errors, see User Defined Protocol Error Codes for more
information.
GEN_ERR USINT 0: Communication succeeded
For other errors, see User Defined Protocol Error Codes for more
information.
COM_RECV
This function block is used to receive user defined data from the
target device.
515
Chapter 19 - User Defined Protocol
Input
Data
Parameter Description
type
ENABLE BOOL Enable: If TRUE, the function block is enabled and workable.
0: local rack;
l 0: Controller;
l 1~30: Expanded communication module;
For ControlEdge PLC: 1 to 12 are available.
PORT USINT The physical interface of serial port:
1. RS232 port 1
2. RS232 port 2
3. RS485 port 1
4. RS485 port 2
5. reserved
6. reserved
MAXLENGTH UINT Used to define the size of receiving buffer. The maximum size is
1024 bytes.
516
Chapter 19 - User Defined Protocol
Output
Data
Parameter Description
type
RDY_FLAG BOOL True: last communication is finished.The Function Block is ready
for the next communication.
For other errors, see User Defined Protocol Error Codes for more
information.
GEN_ERR USINT 0: Communication succeeded
For other errors, see User Defined Protocol Error Codes for more
information.
LENGTH UINT Maximum number of bytes to be received. The DATA parameter
determines the length of the data to be received.
517
Chapter 19 - User Defined Protocol
Protocol Errors:
518
CHAPTER
20 OPC UA
519
Chapter 20 - OPC UA
Related Topics:
The_Block_Diagram
OPCUA_Function_Block__Data_Type_Reference
OPCUA_Function_Block_Error_Code_Reference
520
Chapter 20 - OPC UA
UaConnect
Description
This Function Block is used to create a (optional secure) transport
connection and an OPC-UA session. The connection shall be
terminated by calling the UA_Disconnect after establishing the
connection.
Input
Data
Parameter Description
type
Excute BOOL On rising edge connection is started.
ServerEndPointUrl STRING URL
SessionConnectInfo STRUCT See the information below
Timeout TIME Maximum time to establish the connection.
521
Chapter 20 - OPC UA
SessionConnectInfo
UASessionConnectInfo DataType Description
SessionName STRING Defines the name of the session
assigned by the client. The name is
shown in the diagnostics
information of the server. In case of
empty string the server will generate
a session name.
ApplicationName STRING Defines the readable name of the
OPC UA client application. The
string can be empty.
SecurityMsgMode UASecurityMsgMode See UASecurityMsgMode section
below.
SecurityPolicy UASecurityPolicy See UASecurityPolicy section below.
CertificateStore STRING Defines the location of the
certificate store used for the
application certificates and trust
lists. The structure of the certificate
store is vendor specific. In case of
empty string the default certificate
store is used.
ClientCertificateName STRING Defines the name of the client
certificate and private key in the
certificate store. In case of empty
string the default client application
certificate is used. Implementation
note: The ApplicationURI will be
extracted from the certificate.
ServerUri STRING Defines the URI of the server.
CheckServerCertificate BOOL Flag indicating if the server
certificate should be checked with
the trust list of the client application.
TransportProfile UATransportProfile See UATransportProfile section
below.
UserIdentityToken UAUserIdentityToken See UAUserIdentityToken section
below.
VendorSpecificParameter STRING Vendor may define specific
522
Chapter 20 - OPC UA
Output
Data
Parameter Description
type
ConnectionHdl DWORD Connection handle – is valid until UA_Disconnect is called.
Done BOOL Signals a connection has been initially established.
Busy BOOL The FB is not finished and new output values are to be
expected.
Error BOOL Signals that an error has occurred within the FB.
ErrorID DWORD Error code.
UASecurityMsgMode
Value UASecurityMsgMode Description
0 UASecurityMsgMode_ Best available message security mode to the UA server.
BestAvailable The client receives the available message security from
the server and selects the best. This could also result in
level “none security”.
1 UASecurityMsgMode_ No security is applied.
523
Chapter 20 - OPC UA
UASecurityPolicy.
Value UASecurityPolicy Description
0 UASecurityPolicy_ Provides the best available security connection to the UA
BestAvailable server. The client receives the available policies from the
server and selects the best. This can also result in level
“none security”.
1 UASecurityPolicy_ See OPC UA Part 7 Chapter SecurityPolicy-None.
None
2 UASecurityPolicy_ See OPC UA Part 7 Chapter SecurityPolicy- Basic128Rsa15
Basic128Rsa15
3 UASecurityPolicy_ See OPC UA Part 7 Chapter Securitypolicy-Basic256
Basic256
4 UASecurityPolicy_ See OPC UA Part 7 Chapter Securitypolicy-
Basic256Sha256 Basic256Sha256
UATransportProfile
Value UATransportProfile Description
1 UATP_UATcp See OPC UA Part 7 Chapter UA-TCP UA-SC UA Binary
2 UATP_WSHttpBinary See OPC UA Part 7 Chapter SOAP-HTTP WS-SC UA
Binary
3 UATP_ See OPC UA Part 7 Chapter SOAP-HTTP WS-SC UA
WSHttpXmlOrBinary XML-UA Binary
4 UATP_WSHttpXml See OPC UA Part 7 Chapter SOAP-HTTP WS-SC UA
XML
524
Chapter 20 - OPC UA
UAUserIdentityToken
UAUserIdentityTok
DataType Description
en
UserIdentityTokenT UAUserIdentityTokenT Defines the identity Token to
ype ype authenticate a user during the creation of
a Session.
UAUserIdentityTokenType:
525
Chapter 20 - OPC UA
UAUserIdentityTok
DataType Description
en
526
Chapter 20 - OPC UA
UaDisconnect
Description
This Function Block is used to close a transport connection and an
OPC-UA session.
Input
Data
Parameter Description
type
Execute BOOL On rising edge connection is terminated.
ConnectionHdl DWORD Connection handle of connection to be closed.
Timeout TIME Maximum time to close the connection. If the time to close
the connection takes longer than the Timeout, the Error
output variable will be set TRUE and ErrorID will be set to
error code 0x800A0000 (OpcUa_BadTimeout)"
527
Chapter 20 - OPC UA
Output
Data
Parameter Description
type
Done BOOL The function block has completed its task.
Busy BOOL The function block is not finished and new output values are to
be expected.
Error BOOL Signals that an error has occurred within the function block.
ErrorID DWORD Error code.
UaNamespaceGetIndex
Description
This Function Block is used to get the namespace-index of a
namespace-URI.
528
Chapter 20 - OPC UA
Input
Data
Parameter Description
type
ConnectionHdl DWORD Connection handle.
NamespaceUri STRING Namespace URI.
Timeout TIME Maximum time to response. If the response takes longer
than the Timeout, the Error output variable will be set TRUE
and ErrorID will be set to error code 0x800A0000 (OpcUa_
BadTimeout)"
Output
Data
Parameter Description
type
Done BOOL The function block has completed its task.
Busy BOOL The function block is not finished and new output values are to
be expected.
Error BOOL Signals that an error has occurred within the function block.
ErrorID DWORD Error code.
529
Chapter 20 - OPC UA
UaTranslatePath
Description
This Function Block is used to get the node parameters of a node
using path of the node.
Input
Data
Parameter Description
type
Execute BOOL The function block performs its task on rising edge on this
input.
ConnectionHdl DWORD Connection handle.
StartNodeID STRUCT See UANodeID. Structure UANodeID with node parameters
below for starting node.
RelativePath STRING Path of the Target node; BNF of RelativePath is defined in
the OPC UA specification Part 4.
530
Chapter 20 - OPC UA
Data
Parameter Description
type
Timeout TIME Maximum time to response. If the response takes longer
than the Timeout, the Error output variable will be set TRUE
and ErrorID will be set to error code 0x800A0000 (OpcUa_
BadTimeout).
Output
Data
Parameter Description
type
TargetNodeID STRUCT See UANodeID. Structure UANodeID below with node
parameters. For target node mentioned by RelativePath at
the input of this function block.
Done BOOL The function block has completed its task.
Busy BOOL The function block is not finished and new output values are
to be expected.
Error BOOL Signals that an error has occurred within the function block.
ErrorID DWORD Error code.
UANodeID
UANodeID DataType Description
NamespaceIndex UINT
Identifier STRING In case of IdentifierType GUID the format is like
00000316-0000-0000-C000-000001000046
531
Chapter 20 - OPC UA
The relative path to node "Output" from starting node "Boiler #1"
would be: "/4:Drum1001/4:LIX001/4:Output". Assume that the
naming authority responsible for components "Drum1001", "LIX001"
and "Output" is located in the server's namespace table at index 4.See
inserted text above which explains where the '4' comes from.
For background on the purpose of this function block refer to the
OPC UA specification (OPC UA Part 4 – Services).
532
Chapter 20 - OPC UA
UaTranslatePaths
Description
This Function Block is used to get the node parameters of a node
using path of the node.
Input
Data
Parameter Description
type
Execute BOOL The function block performs its task on rising edge on this
input.
ConnectionHdl DWORD Connection handle.
533
Chapter 20 - OPC UA
Data
Parameter Description
type
StartNodeID STRUCT See UANodeID section beolw. Structure UANodeID with
node parameters for starting node.
RelativePaths Array of Paths of the Target nodes; BNF of RelativePath is defined in
STRING the OPC UA specification Part 4.
Timeout TIME Maximum time to response. If the response takes longer
than the Timeout, the Error output variable will be set TRUE
and ErrorID will be set to error code 0x800A0000 (OpcUa_
BadTimeout)
Output
Data
Parameter Description
type
TargetNodeID STRUCT See UANodeID section below. Structure UANodeID with
node parameters. For target node mentioned by
RelativePath at the input of this FB.
Done BOOL The function block has completed its task.
Busy BOOL The function block is not finished and new output values are
to be expected.
Error BOOL Signals that an error has occurred within the function block.
ErrorID DWORD Error code.
TargetErrorIDs ARRAY Array of DWORD. Contains an error code corresponding to
OF each element in the RelativePaths array. Max length of the
DWORD array is defined by the vendor and shall be the same length
as the RelativePaths array length.
UANodeID
534
Chapter 20 - OPC UA
UaNodeGetHandle
Description
This Function Block is used to get the node handle.
Input
Data
Parameter Description
type
Execute BOOL The function block performs its task on rising edge on this
input.
535
Chapter 20 - OPC UA
Data
Parameter Description
type
ConnectionHdl DWORD Connection handle.
NodeID STRUCT See UANodeID section below.
Timeout TIME Time to response. If the response takes longer than the
Timeout, the Error output variable will be set TRUE and
ErrorID will be set to error code 0x800A0000 (OpcUa_
BadTimeout)"
Output
Data
Parameter Description
type
NodeHdl DWORD Node handle.
Done BOOL The function block has completed its task.
Busy BOOL The function block is not finished and new output values are to
be expected.
Error BOOL Signals that an error has occurred within the function block.
ErrorID DWORD Error code.
UANodeID
UANodeID DataType Description
NamespaceIndex UINT
Identifier STRING In case of IdentifierType GUID the format is
like 00000316-0000-0000-C000-
000001000046
536
Chapter 20 - OPC UA
GUID
4 UAIdentifierType_
Opaque
537
Chapter 20 - OPC UA
UaNodeGetHandleList
Description
This Function Block is used to get node handles for multiple nodes.
Input
Data
Parameter Description
type
Execute BOOL The function block performs its task on rising edge on this
input.
ConnectionHdl DWORD Connection handle.
NodeIDCount UINT Number of NodeIDs in Array of NodeIDs. The maximum
value for this input variable is 20.
NodeIDs ARRAY See UANodeID section below. Max length of array is to be
538
Chapter 20 - OPC UA
Data
Parameter Description
type
OF defined by the vendor. Array length of NodeIDs and
STRUCT NodeHdls must be same.
Timeout TIME Maximum time to response. If the response takes longer
than the Timeout, the Error output variable will be set TRUE
and ErrorID will be set to error code 0x800A0000 (OpcUa_
BadTimeout).
Output
Data
Parameter Description
type
NodeHdls ARRAY Array of Node Handles. Max length of array is to be defined
OF by the vendor. Array length of NodeIDs and NodeHdls must
DWORD be same.
Done BOOL The function block has completed its task.
Busy BOOL The function block is not finished and new output values are
to be expected.
Error BOOL Signals that an error has occurred within the function block.
Set to true if either ErrorID or any of the NodeErrorIDs
indicates an error.
ErrorID DWORD Error code.
NodeErrorIDs ARRAY Array of NodeErrorIDs. Contains an error code for each valid
OF element of the NodeIds array. Max length of array is to be
DWORD defined by the vendor and shall be same size like the
NodesIDs array length.
539
Chapter 20 - OPC UA
UANodeID
UANodeID DataType Description
NamespaceIndex UINT
Identifier STRING In case of IdentifierType GUID the format is like
00000316-0000-0000-C000-000001000046
UaNodeReleaseHandle
Description
This Function Block is used to release the node handle.
540
Chapter 20 - OPC UA
Input
Data
Parameter Description
type
Execute BOOL The function block performs its task on rising edge on this
input.
ConnectionHdl DWORD Connection handle.
NodeHdl DWORD Node handle to be released.
Timeout TIME Maximum time to response. If the response takes longer
than the Timeout, the Error output variable will be set TRUE
and ErrorID will be set to error code 0x800A0000 (OpcUa_
BadTimeout).
Output
Data
Parameter Description
type
Done BOOL The function block has completed its task.
Busy BOOL The function block is not finished and new output values are to
be expected.
Error BOOL Signals that an error has occurred within the function block.
ErrorID DWORD Error code.
541
Chapter 20 - OPC UA
UaNodeReleaseHandleList
Description
This Function Block is used to release a set of node handles.
Input
Data
Parameter Description
type
Execute BOOL The function block performs its task on rising edge on this
input.
ConnectionHdl DWORD Connection handle.
NodeHdlCount UINT Number of Nodes in NodeHdls Array. The maximum value
for this input variable is 20.
NodeHdls ARRAY Array of Node handles to be released. Max length of array is
OF to be defined by the vendor. NULL is not a valid handle.
DWORD
TIP: "NodeHdls" has a pre-defined type
"UaDWORDList" which can be found in OpcUa_
DataTypes type library.
542
Chapter 20 - OPC UA
Data
Parameter Description
type
and ErrorID will be set to error code 0x800A0000 (OpcUa_
BadTimeout).
Output
Data
Parameter Description
type
Done BOOL The function block has completed its task.
Busy BOOL The function block is not finished and new output values are
to be expected.
Error BOOL Signals that an error has occurred within the function block.
Set to true if either ErrorID or any of the NodeErrorIDs
indicates an error.
ErrorID DWORD Error code.
NodeErrorIDs ARRAY Array of DWORD. Contains an error code for each valid
OF element of the NodeHdls array. Max length of array is to be
DWORD defined by the vendor and shall be same size like the
NodeHdls array length.
543
Chapter 20 - OPC UA
UaMethodCall
Description
This Function Block is used to call a method routine.
Input
Data
Parameter Description
type
Execute BOOL The function block performs its task on rising edge on this
input.
ConnectionHdl DWORD Connection handle.
MethodHdl DWORD Method handle.
544
Chapter 20 - OPC UA
Data
Parameter Description
type
Timeout TIME Maximum time to response. If the response takes longer
than the Timeout, the Error output variable will be set TRUE
and ErrorID will be set to error code 0x800A0000 (OpcUa_
BadTimeout).
Output
Data
Parameter Description
type
Busy BOOL The function block is not finished and new output values are to
be expected.
Error BOOL Signals that an error has occurred within the function block.
ErrorID DWORD Error code.
UaMethodReleaseHandle
545
Chapter 20 - OPC UA
Description
This Function Block is used to release the method handle.
Input
Data
Parameter Description
type
ConnectionHdl DWORD Connection handle.
MethodHdl DWORD Method handle to be released.
Timeout TIME Maximum time to response. If the response takes longer
than the Timeout, the Error output variable will be set TRUE
and ErrorID will be set to error code 0x800A0000 (OpcUa_
BadTimeout).
Output
Data
Parameter Description
type
Busy BOOL The function block is not finished and new output values are to
be expected.
Error BOOL Signals that an error has occurred within the function block.
ErrorID DWORD Error code
546
Chapter 20 - OPC UA
UaMethodGetHandle
Description
This Function Block is used to get the method handle for a method
call.
Input
Data
Parameter Description
type
ConnectionHdl DWORD Connection handle.
ObjectNodeID STRUCT See UANodeID section below.
MethodNodeID STRUCT See UANodeID section below.
Timeout TIME Maximum time to response. If the response takes longer
than the Timeout, the Error output variable will be set TRUE
and ErrorID will be set to error code 0x800A0000 (OpcUa_
BadTimeout).
547
Chapter 20 - OPC UA
Output
Data
Parameter Description
type
MethodHdl DWORD Method handle.
Done BOOL The function block has completed its task.
Busy BOOL The function block is not finished and new output values are to
be expected.
Error BOOL Signals that an error has occurred within the function block.
ErrorID DWORD Error code.
UANodeID
UANodeID DataType Description
NamespaceIn UINT
dex
Identifier STRING In case of IdentifierType GUID the format is like
00000316-0000-0000-C000-000001000046
548
Chapter 20 - OPC UA
UaRead
Description
This Function Block is used to read the value of a single node.
Input
Data
Parameter Description
type
Execute BOOL On rising edge node information will be read.
ConnectionHdl DWORD Connection handle.
NodeHdl DWORD Node handle.
NodeAddInfo STRUCT See UANodeAdditionalInfo. Specifies the attribute and
IndexRange below.
Timeout TIME Maximum time to response. If the response takes longer
549
Chapter 20 - OPC UA
Data
Parameter Description
type
than the Timeout, the Error output variable will be set TRUE
and ErrorID will be set to error code 0x800A0000 (OpcUa_
BadTimeout)
550
Chapter 20 - OPC UA
UANodeAdditionalInfo
ANodeAdditionalInfo DataType Description
AttributeID UAAttributeID Selects the attribute to be accessed. The
default AttributeID is eUAAI_Value (13).
TIP:
IndexRange can be defined as follows:
551
Chapter 20 - OPC UA
Output
Data
Parameter Description
type
Done BOOL The function block has completed its task.
Busy BOOL The function block is not finished and new output values are to
be expected.
Error BOOL Signals that an error has occurred within the function block.
ErrorID DWORD Error code.
TimeStamp DT TimeStamp.
UaReadList
552
Chapter 20 - OPC UA
Description
This Function Block is used to read values of multiple nodes using a
list of node handles.
Input
Data
Parameter Description
type
Execute BOOL On rising edge node information will be read.
ConnectionHdl DWORD Connection handle.
NodeHdlCount UINT Number of valid elements in the array to read. The maximum
value for this input variable is 20.
NodeHdls ARRAY Array of Node Handles. Max length of array is to be defined
OF by the vendor and shall be same size like the Variables array
DWORD length.
Output
Data
Parameter Description
type
Done BOOL The function block has completed its task.
Busy BOOL The function block is not finished and new output values are
to be expected.
553
Chapter 20 - OPC UA
Data
Parameter Description
type
Error BOOL Signals that an error has occurred within the function block.
Set to true if either ErrorID or any of the NodeErrorIDs
indicates an error.
ErrorID DWORD Error code for the OPC UA service call.
NodeErrorIDs ARRAY Array of DWORD. Contains an error code for each valid
OF element of the Variables array. Max length of array is to be
DWORD defined by the vendor and shall be same size like the
Variables array length.
TimeStamps ARRAY Contains a TimeStamp for each valid element of the Variables
OF DT array. Max length of array is to be defined by the vendor and
shall be same size like the Variables array length.
UANodeAdditionalInfo
TIP:
IndexRange can be defined as follows:
554
Chapter 20 - OPC UA
555
Chapter 20 - OPC UA
UaWrite
Description
This Function Block is used to write a value to a single node.
Input
Data
Parameter Description
type
Execute BOOL On rising edge node information will be written.
ConnectionHdl DWORD Connection handle.
NodeHdl DWORD Node handle.
NodeAddInfo STRUCT See UANodeAdditionalInfo. Specifies the attribute and
IndexRange below.
Timeout TIME Maximum time to response. If the response takes longer
than the Timeout, the Error output variable will be set TRUE
and ErrorID will be set to error code 0x800A0000 (OpcUa_
556
Chapter 20 - OPC UA
Data
Parameter Description
type
BadTimeout).
Output
Data
Parameter Description
type
Done BOOL The function block has completed its task.
Busy BOOL The function block is not finished and new output values are to
be expected.
Error BOOL Signals that an error has occurred within the function block.
ErrorID DWORD Error code.
UANodeAdditionalInfo
NodeAdditionalInfo DataType Description
AttributeID UAAttributeID Selects the attribute to be accessed. The default
AttributeID is eUAAI_Value (13).
TIP:
IndexRange can be defined as follows:
557
Chapter 20 - OPC UA
EndIndex.
3. To access all the elements in a
Dimension it’s a must to assign
StartIndex and EndIndex
depending on the number of total
Elements in the Dimension.
4. A single element in a Dimension
can be selected by specifying the
same StartIndex and EndIndex.
558
Chapter 20 - OPC UA
UaWriteList
Description
This Function Block is used to write values to multiple nodes using a
list of node handles.
Input
Data
Parameter Description
type
Execute BOOL On rising edge node values will be written.
ConnectionHdl DWORD Connection handle.
559
Chapter 20 - OPC UA
Data
Parameter Description
type
NodeHdlCount UINT Number of valid elements in the array to write. The
maximum value for this input variable is 20.
NodeHdls ARRAY Array of Node Handles.
OF
DWORD Max length of array is to be defined by the vendor and shall
be same size like the Variables array length.
Output
Data
Parameter Description
type
Done BOOL The function block has completed its task.
Busy BOOL The function block is not finished and new output values are
to be expected.
Error BOOL Signals that an error has occurred within the function block.
Set to true if either ErrorID or any of the NodeErrorIDs
indicates an error.
ErrorID DWORD Error code for the OPC UA service call.
NodeErrorIDs ARRAY Array of DWORD. Contains an error code for each valid
OF element of the Variables array.
DWORD
Max length of array is to be defined by the vendor and shall
be same size like the Variables array length.
560
Chapter 20 - OPC UA
Data
Parameter Description
type
UANodeAdditionalInfo
ANodeAdditionalInfo DataType Description
AttributeID UAAttributeID Selects the attribute to be accessed. The
default AttributeID is eUAAI_Value (13).
TIP:
IndexRange can be defined as follows:
561
Chapter 20 - OPC UA
UA_MonitoredItemAdd
This Function Block can be used to add handle that values are
updated by subscription.
Input
Data
Parameter Description
type
Execute BOOL On rising edge monitored item will be added to a
subscription.
SubscriptionHdl DWORD Subscription handle.
NodeHdl DWORD Node handle.
NodeAddInfo DWORD See 3.2.8 UANodeAdditionalInfo. Specifies the attribute
and IndexRange.
Timeout TIME Time to response
Output
Data
Parameter Description
type
MonitoredItemHdl DWORD Monitored item handle.
Done BOOL The function block has completed its task.
Busy BOOL The function block is not finished and new output values
are to be expected.
Error BOOL Signals that an error has occurred within the function
block.
ErrorID DWORD Error code.
562
Chapter 20 - OPC UA
563
Chapter 20 - OPC UA
UAMonitoredItemRemove
This Function Block can be used to remove a handle from a
subscription.
Input
Data
Parameter Description
type
Execute BOOL On rising edge monitored item will be added to a
subscription.
SubscriptionHdl DWORD Subscription handle.
Timeout TIME Time to response
Output
Data
Parameter Description
type
Done BOOL The function block has completed its task.
Busy BOOL The function block is not finished and new output values are to
be expected.
Error BOOL Signals that an error has occurred within the function block.
ErrorID DWORD Error code.
564
Chapter 20 - OPC UA
UASubscriptionCreate
This Function Block can be used to create a subscription.
Input
Data
Parameter Description
type
Execute BOOL On rising edge subscription will be created.
ConnectionHdl DWORD Connection handle.
PublishingEnable BOOL Activate the publishing.
Priority BYTE Priority of the Subscription in the server relative to the
other Subscriptions created by this client.
Timeout TIME Maximum time to response.
Output
Data
Parameter Description
type
SubscriptionHdl DWORD Subscription handle.
Done BOOL The function block has completed its task.
Busy BOOL The function block is not finished and new output values
are to be expected.
Error BOOL Signals that an error has occurred within the function
block.
ErrorID DWORD Error code.
565
Chapter 20 - OPC UA
UA_SubscriptionDelete
This Function Block can be used to delete a subscription.
Input
Parameter Data type Description
Variable Type Description
Execute BOOL On rising edge subscription will be created.
SubscriptionHdl DWORD Subscription handle.
Timeout TIME Maximum time to response.
Output
Data
Parameter Description
type
Variable Type Description
566
Chapter 20 - OPC UA
Data
Parameter Description
type
Done BOOL The function block has completed its task.
Busy BOOL The function block is not finished and new output values are to
be expected.
Error BOOL Signals that an error has occurred within the function block.
ErrorID DWORD Error code.
UASubscriptionOperate
This Function Block is designed to be optionally called -even
cyclically- to check if the variables have been published and to check
and modify publishing parameters (enable / interval).
Input
Data
Parameter Description
type
Execute BOOL On rising edge subscription will be created.
SubscriptionHdl DWORD Subscription handle.
PublishingEnable BOOL Activate the publishing.
Priority BYTE Priority of the Subscription in the server relative to the
other Subscriptions created by this client.
Timeout TIME Time to response.
Output
Data
Parameter Description
type
Published BOOL Indicates, that variables have been published since the previous
call.
Done BOOL FB has completed its task.
Busy BOOL The FB is not finished and new output values are to be
expected.
567
Chapter 20 - OPC UA
Data
Parameter Description
type
Error BOOL Signals that an error has occurred within the FB.
ErrorID DWORD Error code.
568
Chapter 20 - OPC UA
Calling Methods
The appropriate sequence for calling methods is shown below. A valid
method handle is necessary to call a method.
Successful call of UA_MethodGetHandle will deliver a valid
MethodHdl.
Please release the method handle before you disconnect.
569
Chapter 20 - OPC UA
string255List
TYPE
string255List : ARRAY [1..20] OF string255;
END_TYPE
UaUserIdentityToken
TYPE
UaUserIdentityToken :
STRUCT
UAUserIdentityTokenType: INT;
TokenParam1: STRING;
TokenParam2: STRING;
END_STRUCT;
END_TYPE
UaLocaleIdList
TYPE
UaLocaleIdList : ARRAY [1..5] OF STRING;
END_TYPE
UASessionConnectInfo
TYPE
570
Chapter 20 - OPC UA
UASessionConnectInfo :
STRUCT
SessionName : STRING;
ApplicationName: STRING;
SecurityMsgMode: INT;
SecurityPolicy: INT;
CertificateStore: STRING;
ClientCertificateName: STRING;
ServerUri: STRING;
CheckServerCertificate: BOOL;
TransportProfile: INT;
UserIdentityToken: UaUserIdentityToken;
VendorSpecificParameter: STRING;
SessionTimeout: TIME;
MonitorConnection: TIME;
LocaleIDs: UaLocaleIdList;
END_STRUCT;
END_TYPE
UANodeID
TYPE
UANodeID :
STRUCT
NamespaceIndex : UINT;
IdentifierType : INT;
Identifier : string255;
END_STRUCT;
END_TYPE
UaNodeIDList
571
Chapter 20 - OPC UA
TYPE
UaNodeIDList : ARRAY [1..20] OF UANodeID;
END_TYPE
UAIndexRange
TYPE
UAIndexRange :
STRUCT
StartIndex : UINT;
EndIndex : UINT;
END_STRUCT;
END_TYPE
UAIndexRangeList
TYPE
UAIndexRangeList : ARRAY [1..20] OF UAIndexRange;
END_TYPE
UANodeAdditionalInfo
TYPE
UANodeAdditionalInfo :
STRUCT
AttributeID : INT;
IndexRangeCount : UINT;
IndexRangeList : UAIndexRangeList;
END_STRUCT;
END_TYPE
UaNodeAddInfoList
TYPE
572
Chapter 20 - OPC UA
UAVariant
TYPE
UAVariant :
STRUCT
VariantType : INT;
value_bool : BOOL; (* VariantType = 1 *)
value_sbyte : SINT; (* VariantType = 2 *)
value_byte : USINT; (* VariantType = 3 *)
value_int16 : INT; (* VariantType = 4 *)
value_uint16: UINT; (* VariantType = 5 *)
value_int32 : DINT; (* VariantType = 6 *)
value_uint32: UDINT; (* VariantType = 7 *)
value_int64 : LINT; (* VariantType = 8 *)
(* value_uint64: ULINT;*) (* ULINT Not Yet Available *)
value_real : REAL; (* VariantType = 10 *)
value_lReal : LREAL; (* VariantType = 11 *)
value_string: string255; (* VariantType = 12 *)
END_STRUCT;
END_TYPE
UAVariantList
TYPE
UAVariantList : ARRAY [1..20] OF UAVariant;
END_TYPE
UADateTime
TYPE
573
Chapter 20 - OPC UA
UADateTime :
STRUCT
LowDateTime : UDINT;
HighDateTime : UDINT;
END_STRUCT;
END_TYPE
UaDateTimeList
TYPE
UaDateTimeList : ARRAY [1..20] OF UADateTime;
END_TYPE
UADataValue
TYPE
UADataValue :
STRUCT
Value : UAVariant;
StatusCode : UDINT;
SourceTimeStamp : UADateTime;
ServerTimeStamp : UADateTime;
END_STRUCT;
END_TYPE
UaDataValueList
TYPE
UaDataValueList : ARRAY [1..20] OF UADataValue;
END_TYPE
UaDWORDList
TYPE
574
Chapter 20 - OPC UA
UAMonitoringSettings
TYPE
UAMonitoringSettings :
STRUCT
DeadbandType : INT;
Deadband : REAL;
SamplingInterval : TIME;
END_STRUCT;
END_TYPE
UADataChangeNotification
TYPE
UADataChangeNotification :
STRUCT
SubscriptionHdl : UDINT;
NodeHdl : DWORD;
Count : UINT;
DataValues : UADataValueList;
END_STRUCT;
END_TYPE
575
Chapter 20 - OPC UA
576
Chapter 20 - OPC UA
577
Chapter 20 - OPC UA
578
Chapter 20 - OPC UA
579
Chapter 20 - OPC UA
580
Chapter 20 - OPC UA
581
Chapter 20 - OPC UA
582
Chapter 20 - OPC UA
583
Chapter 20 - OPC UA
584
Chapter 20 - OPC UA
585
Chapter 20 - OPC UA
586
Chapter 20 - OPC UA
587
Chapter 20 - OPC UA
588
Chapter 20 - OPC UA
589
Chapter 20 - OPC UA
590
Chapter 20 - OPC UA
591
Chapter 20 - OPC UA
592
Chapter 20 - OPC UA
593
Chapter 20 - OPC UA
594
Chapter 20 - OPC UA
595
Chapter 20 - OPC UA
596
CHAPTER
21 HONUAFBHELPERS
HonUaCallMethod
VAR_INPUT
Parameter Data type Description
ConnectionHandle DWORD Connection handle obtained from Connection
block (e.g., “Connect_SecurityNone” above)
NodeIdentifierObject UaNodeID Node ID of the object node whose method is to
be called by this block
NodeIdentifierMethod UaNodeID Node ID of the method node to be called by
this block
InputArguments UAVariantList Input arguments for this method. Note that
some methods may not require any input
arguments.
Done BOOL Flag indicating that the method call has
completed. This flag will be reset FALSE the
next time ExecuteCall is set TRUE.
VAR_OUTPUT
Parameter Data type Description
ErrorID DWORD Error ID if any, returned by the server when
attempting to invoke the Call service.
Error BOOL If set, signals that an error occurred when
attempting to invoke the Call service
OutputArguments UAVariantList Output arguments returned by this method. Note
that some methods may not return output
arguments
InputArgResults UaDWORDList Status code associated with each argument in the
InputArguments.
597
Chapter 21 - HonUAFbHelpers
VAR_IN_OUT
Data
Parameter Description
type
ExecuteCall BOOL When set TRUE, invokes the method call. Upon completion of 1
method call attempt (successful or unsuccessful) will
automatically reset to FALSE.
HonUaConnectSecurityNone
VAR_INPUT
Data
Parameter Description
type
ServerEndpointURL STRING e.g., “opc.tcp://192.168.1.30:51210/UA/SampleServer”
SessionName STRING Each time Connect executes a new session is created
on the server. This name will be associated with that
session
VAR_OUTPUT
Data
Parameter Description
type
ConnectionHandle DWORD The handle associated with this connection. Handle is
valid until Disconnect or DisconnectAll are set.
ErrorID DWORD Error ID if any, returned by the server
Error BOOL If set, signals that an error occurred when attempting to
connect
VAR_IN_OUT
Data
Parameter Description
type
Connect BOOL When set TRUE and if ConnectionHandle is zero, initiates a new
connection. Upon completion of 1 connection attempt
(successful or unsuccessful) will automatically reset to FALSE
598
Chapter 21 - HonUAFbHelpers
Data
Parameter Description
type
Disconnect BOOL When set TRUE initiates a disconnect of the current
ConnectionHandle (as indicated by ConnectionHandle). Upon
completion of 1 disconnect attempt (successful or unsuccessful)
will automatically reset to FALSE.
HonUaHandleDetector
VAR_INPUT
Data
Parameter Description
type
Enable BOOL When set TRUE enables the block functionality. When set FALSE
disables the block functionality.
DWORDIn DWORD When Enable is set TRUE, the block will monitor DWORDIn for
change to 0. If this occurs then SignalOut will be set TRUE.
VAR_OUTPUT
Parameter Data type Description
SignalOut BOOL See DWORDIn above.
HonUaManageSubscription
VAR_INPUT
Data
Parameter Description
type
ConnectionHandle DWORD Connection handle obtained from Connection block
(e.g., “Connect_SecurityNone” above)
PublishingInterval TIME The publishing interval that should be applied to the
subscription.
599
Chapter 21 - HonUAFbHelpers
VAR_OUTPUT
Data
Parameter Description
type
SubscriptionHdl DWORD Subscription Handle generated after successful
execution of the block where CreateSubscription is set
TRUE.
SubscriptionEnabled BOOL A flag indicating that the subscription is currently
enabled.
ErrorID DWORD Error ID if any, returned by the server when attempting
to invoke the subscription or monitored item service.
Error BOOL If set, signals that an error occurred when attempting
to invoke the subscription or monitored item service.
VAR_IN_OUT
Data
Parameter Description
type
CreateSubscription BOOL Set to TRUE to create a new subscription. Successful
execution will result in non-zero SubscriptionHdl.
DeleteSubscription BOOL Set to TRUE to delete an existing subscription.
SubscriptionHdl will be set to zero.
EnableSubscription BOOL Set the subscription enabled.
DisableSubscription BOOL Set the subscription disabled.
HonUaReadNode
VAR_INPUT
Parameter Data type Description
ConnectionHandle DWORD Connection handle obtained from Connection block
(e.g., “Connect_SecurityNone” above)
NodeIdRead UaNodeID Node ID whose data value is to be read
IsArray BOOL Flag indicating whether or not the NodeIdRead data
value is an array
ArrayIndex UINT If IsArray is TRUE then this identifies the array index to
600
Chapter 21 - HonUAFbHelpers
VAR_OUTPUT
Parameter Data type Description
DataStatus UDINT Status code associated with the DataValueOut
DataValueOut UAVariant Value of the node (attribute 13)
TimeStamp UADateTime Source timestamp associated with DataValueOut
ErrorID DWORD Error ID if any, returned by the server when attempting to
invoke the Read service.
Error BOOL If set, signals that an error occurred when attempting to
invoke the Read service
ReadEnabled BOOL When set, indicates that block is enabled and read
service will be called with each task cycle.
VAR_IN_OUT
Data
Parameter Description
type
EnableRead BOOL When set TRUE, enables this read block. Read service will be
called with each task cycle. See ReadEnabled above to verify that
block is enabled.
DisableRead BOOL When set TRUE, disables this read block. Read service will not be
called with each task cycle. See ReadEnabled above to verify that
block is disabled.
HonUaReadNodeList
VAR_INPUT
Parameter Data type Description
ConnectionHandle DWORD Connection handle obtained from Connection
block (e.g., “Connect_SecurityNone” above)
601
Chapter 21 - HonUAFbHelpers
VAR_OUTPUT
Parameter Data type Description
ErrorID DWORD Error ID if any, returned by the server when
attempting to invoke the Read service.
Error BOOL If set, signals that an error occurred when
attempting to invoke the Read service
ReadEnabled BOOL When set, indicates that block is enabled and the
Read service will be called with each task cycle.
DataStatusList UaDWORDList Status code associated with corresponding value
of the DataValueOutList
DataValueOutList UAVariantList Value of each node (attribute 13)
VAR_IN_OUT
Data
Parameter Description
type
EnableReadList BOOL When set TRUE, enables this read block. Read service will be
602
Chapter 21 - HonUAFbHelpers
Data
Parameter Description
type
called with each task cycle. See ReadEnabled above to verify
that block is enabled.
DisableReadList BOOL When set TRUE, disables this read block. Read service will
not be called with each task cycle. See ReadEnabled above
to verify that block is disabled.
HonUaStateDetector
VAR_INPUT
Data
Parameter Description
type
Enable BOOL When set TRUE enables the block functionality. When set FALSE
disables the block functionality.
BOOLIn BOOL When Enable is set TRUE, the block will monitor BOOLIn for
change to FALSE. If this occurs then SignalOut will be set TRUE.
VAR_OUTPUT
Parameter Data type Description
SignalOut BOOL See BOOLIn above
HonUaSubscribeNode
VAR_INPUT
Parameter Data type Description
ConnectionHandle DWORD Connection handle obtained from Connection block
(e.g., “Connect_SecurityNone” above)
NodeIdSubscribe UaNodeID The NodeId of the data variable node which will be
added as monitored item to the subscription.
IsArray BOOL Flag indicating whether or not the NodeIdSubscribe
603
Chapter 21 - HonUAFbHelpers
VAR_OUTPUT
Parameter Data type Description
ErrorID DWORD Error ID if any, returned by the
server when attempting to
invoke the subscription or
monitored item service.
Error BOOL If set, signals that an error
occurred when attempting to
invoke the subscription or
monitored item service.
SubscriptionEnabled BOOL A flag indicating that the
subscription is currently
enabled.
DataChangeNotification UaDataChangeNotification Notifications for the subscribed
node. A notification will occur
when the value or the status of
the variable changes.
VAR_IN_OUT
HonUaTranslatePathList
VAR_INPUT
Parameter Data type Description
ConnectionHandle DWORD Connection handle obtained from Connection
block (e.g., “Connect_SecurityNone” above)
NodeIdStartNode UaNodeID The RelativePathList is evaluated using this node
as a starting point
604
Chapter 21 - HonUAFbHelpers
VAR_OUTPUT
VAR_IN_OUT
605
Chapter 21 - HonUAFbHelpers
Data
Parameter Description
type
ExecuteTranslate BOOL When set TRUE, initiates the relative path to NodeID
translation. Upon completion of 1 such attempt (successful
or unsuccessful) will automatically reset to FALSE.
HonUaVariantToString
VAR_INPUT
Parameter Data type Description
VariantIn UAVariant Variant value (i.e., as returned from the function block
“ReadNode”)
VAR_OUTPUT
Parameter Data type Description
StringOut STRING String representation of VariantIn
HonUaWriteNode
VAR_INPUT
Parameter Data type Description
ConnectionHandle DWORD Connection handle obtained from Connection block
(e.g., “Connect_SecurityNone” above)
NodeIdWrite UaNodeID Node ID whose data value is to be written
IsArray BOOL Flag indicating whether or not the NodeIdWrite data
value is an array
ArrayIndex UINT If IsArray is TRUE then this identifies the array index to
write.
DataValue UAVariant Value to be written (attribute 13)
606
Chapter 21 - HonUAFbHelpers
VAR_OUTPUT
Data
Parameter Description
type
ErrorID DWORD Error ID if any, returned by the server when attempting to
invoke the Write service.
Error BOOL If set, signals that an error occurred when attempting to
invoke the Write service
WriteEnabled BOOL When set, indicates that block is enabled and write service will
be called with each task cycle.
VAR_IN_OUT
Data
Parameter Description
type
EnableWrite BOOL When set TRUE, enables this write block. Write service will be
called with each task cycle. See WriteEnabled above to verify that
block is enabled.
DisableWrite BOOL When set TRUE, disables this write block. Write service will not be
called with each task cycle. See WriteEnabled above to verify that
block is disabled.
HonUaWriteNodeList
VAR_INPUT
Parameter Data type Description
ConnectionHandle DWORD Connection handle obtained from Connection
block (e.g., “Connect_SecurityNone” above)
NodeIdCount UINT The number of Node IDs in NodeIdWriteList
NodeIdWriteList UaNodeIDList Node identifiers of the nodes whose values are to
be written by this block (max 20 identifiers).
IsArray BOOL Flag indicating whether or not the
NodeIdWriteList data values are arrays
ArrayIndices UINTList If IsArray is TRUE then this identifies the array
607
Chapter 21 - HonUAFbHelpers
VAR_OUTPUT
Parameter Data type Description
ErrorID DWORD Error ID if any, returned by the server when
attempting to invoke the Write service.
Error BOOL If set, signals that an error occurred when attempting
to invoke the Write service
WriteEnabled BOOL When set, indicates that block is enabled and the
Write service will be called with each task cycle.
NodeErrorIdList UaDWORDList Error ID associated with corresponding value of the
DataValueList when attempting to write the
value. Note that ErrorID above will be set if any
element of this list has a status other than good.
VAR_IN_OUT
Data
Parameter Description
type
EnableWriteList BOOL When set TRUE, enables this write block. Write service will be
called with each task cycle. See WriteEnabled above to verify
that block is enabled.
DisableWriteList BOOL When set TRUE, disables this write block. Write service will
not be called with each task cycle. See WriteEnabled above
to verify that block is disabled.
608
CHAPTER
22 MDIS
The MDIS library has a set of OPC UA function blocks representing all
the MDIS OPC UA object types as defined in the MDIS OPC UA
Companion Specification V1.2. The MDIS OPC UA Object function
blocks are used to obtain data from MDIS OPC UA compliant Servers.
For each MDIS object type, the specification identifies a set of data
variables as well as method definitions. The MDIS function block
library incorporates the data variables into each block as function
block parameters or ‘pins’. Separate method function blocks are
provided for each of the methods defined in the specification.
Below is an example architecture with Experion and C300s. Note that
ControlEdge PLC with MDIS can be used independent of C300s.
609
Chapter 22 - MDIS
There are five MDIS object function blocks. They are Choke, Valve,
Instrument, Digital Instrument, and Discrete Instrument. In addition,
there are several associated function blocks that enable method
invocation on the five MDIS object function blocks. The method
invocation function blocks and associated object function blocks are
listed below.
610
Chapter 22 - MDIS
Object Function
MDIS Object Associated Method(s) Method Function Block
Block
Instrument MDISInstrObj Enable-Disable MDISObjEnableDisable
Move MDISValveMove
Choke MDISChokeObj Enable-Disable MDISObjEnableDisable
Move MDISChokeMove
Step MDISChokeStep
All MDIS Object function blocks require a subscription and all MDIS
Method Invocation blocks require a connection. Connections and
subscriptions are created using function blocks from the OPC UA
function block library or optionally from the OPC UA “Helper Block”
library. MDIS object and Method Invocation blocks can share a
common connection and subscription. Multiple connections are
required in the case of multiple target OPC UA servers. Multiple
subscriptions may be required depending on project implementation
strategies. For example, a subset of MDIS object blocks may have a
data freshness requirement of 500ms, others 1000ms and still others
2000ms. In this case, one technique would be to create three
subscriptions each with a different publishing interval (i.e., 500ms,
1000ms and 2000ms). The MDIS blocks which require 500ms
freshness would then be assigned the 500ms subscription and so on.
611
Chapter 22 - MDIS
612
Chapter 22 - MDIS
MDISDiscreteInstrObj
Description
This function block is used to create an instance of a Discrete
Instrument object.
613
Chapter 22 - MDIS
Input
Data
Parameter Description
type
Excute BOOL When the execute flag is first set and the rising edge is
detected, all the defined data variables for the object are
added to the subscription. Thereafter, each subsequent
rising edge will copy the latest pushed value for all the
variables into the output pin representing the variable.
SubscriptionHdl DWORD Subscription handle
NodeID STRUCT NodeID of Discrete Instrument object. (See UANodeID for
STRUCT description)
Output
Data
Parameter Description
type
Done BOOL The function block has completed its task.
Busy BOOL The function block is not finished and is waiting for data
value updates.
Error BOOL Signals that an error has occurred within the function block.
Set to true when ErrorID indicates an error.
ErrorID DWORD Error ID if any, returned by the server when monitoring the
object.
Fault BOOL The status of the object, true if any fault exists.
Warning BOOL The status of the object, true if any warning exists.
Enabled BOOL Set as true when object is enabled.
TagId STRING Unique equipment identifier for the object.
FaultCode DWORD Vendor specific fault code. Zero indicates no fault.
WarningCode DWORD Vendor specific warning code. Zero indicates no fault.
State DWORD State of the Discrete Instrument object.
614
Chapter 22 - MDIS
4 TagId Optional
5 FaultCode Optional
6 WarningCode Optional
7 State Mandatory
615
Chapter 22 - MDIS
Implementation Example
616
Chapter 22 - MDIS
MDISDigitalInstrObj
Description
This function block is used to create an instance of a Digital
Instrument object.
Input
Data
Parameter Description
type
Excute BOOL When the execute flag is first set and the rising edge is
detected, all the defined data variables for the object are
617
Chapter 22 - MDIS
Data
Parameter Description
type
added to the subscription. Thereafter, each subsequent
rising edge will copy the latest pushed value for all the
variables into the output pin representing the variable.
SubscriptionHdl DWORD Subscription handle
NodeID STRUCT NodeID of Digital Instrument object. (See UANodeID for
STRUCT description)
Output
Data
Parameter Description
type
Done BOOL The function block has completed its task.
Busy BOOL The function block is not finished and is waiting for data
value updates.
Error BOOL Signals that an error has occurred within the function block.
Set to true when ErrorID indicates an error.
ErrorID DWORD Error ID if any, returned by the server when monitoring the
object.
Fault BOOL The status of the object, true if any fault exists.
Warning BOOL The status of the object, true if any warning exists.
Enabled BOOL Set as true when object is enabled.
TagId STRING Unique equipment identifier for the object.
FaultCode DWORD Vendor specific fault code. Zero indicates no fault.
WarningCode DWORD Vendor specific warning code. Zero indicates no fault.
State BOOL State of the Digital Instrument object.
618
Chapter 22 - MDIS
Data
Parameter Description
type
ErrorIDs ARRAY Array of DWORD. Contains an error code for each
OF variable listed below:
DWORD
Index Varaible name Mandatory/Optional
1 Fault Mandatory
2 Warning Optional
3 Enabled Optional
4 TagId Optional
5 FaultCode Optional
6 WarningCode Optional
7 State Mandatory
619
Chapter 22 - MDIS
Implementation Example
620
Chapter 22 - MDIS
MDISInstrObj
621
Chapter 22 - MDIS
Description
This function block is used to create an instance of a Instrument
object.
Input
Data
Parameter Description
type
Excute BOOL When the execute flag is first set and the rising edge is
detected, all the defined data variables for the object are
added to the subscription. Thereafter, each subsequent
rising edge will copy the latest pushed value for all the
variables into the output pin representing the variable.
SubscriptionHdl DWORD Subscription handle
NodeID STRUCT NodeID of Instrument object. (See UANodeID for STRUCT
description)
Output
Data
Parameter Description
type
Done BOOL The function block has completed its task.
Busy BOOL The function block is not finished and is waiting for data
value updates.
Error BOOL Signals that an error has occurred within the function
block. Set to true when ErrorID indicates an error.
ErrorID DWORD Error ID if any, returned by the server when monitoring the
object.
Fault BOOL The status of the object, true if any fault exists.
Warning BOOL The status of the object, true if any warning exists.
Enabled BOOL Set as true when object is enabled.
TagId STRING Unique equipment identifier for the object.
FaultCode DWORD Vendor specific fault code. Zero indicates no fault.
WarningCode DWORD Vendor specific warning code. Zero indicates no fault.
622
Chapter 22 - MDIS
Data
Parameter Description
type
ProcessVariable REAL Value of the Instrument.
HHlimit BOOL HH state of the Instrument.
Hlimit BOOL H state of the Instrument.
Llimit BOOL L state of the Instrument.
LLlimit BOOL LL state of the Instrument.
HHSetPoint REAL HHSetPoint value
HSetPoint REAL HSetPoint value
LSetPoint REAL LSetPoint value
LLSetPoint REAL LLSetPoint value
623
Chapter 22 - MDIS
Data
Parameter Description
type
Implementation Example
624
Chapter 22 - MDIS
MDISChokeObj
Description
This function block is used to create an instance of a Choke object.
625
Chapter 22 - MDIS
Input
Data
Parameter Description
type
Excute BOOL When the execute flag is first set and the rising edge is
detected, all the defined data variables for the object are
added to the subscription. Thereafter, each subsequent
rising edge will copy the latest pushed value for all the
variables into the output pin representing the variable.
SubscriptionHdl DWORD Subscription handle
NodeID STRUCT NodeID of Choke object. (See UANodeID for STRUCT
description)
Output
Data
Parameter Description
type
Done BOOL The function block has completed its task.
Busy BOOL The function block is not finished and is
waiting for data value updates.
Error BOOL Signals that an error has occurred within the
function block. Set to true when ErrorID
indicates an error.
ErrorID DWORD Error ID if any, returned by the server when
monitoring the object.
Fault BOOL The status of the object, true if any fault
exists.
Warning BOOL The status of the object, true if any warning
exists.
Enabled BOOL Set as true when object is enabled.
TagId STRING Unique equipment identifier for the object.
FaultCode DWORD Vendor specific fault code. Zero indicates no
fault.
WarningCode DWORD Vendor specific warning code. Zero indicates
no fault.
CalculatedPosition REAL A floating-point number that represents the
626
Chapter 22 - MDIS
Data
Parameter Description
type
estimated percent open of the choke.
PositionInSteps INT An int16 that represents position in steps for
the choke.
Moving DINT An enumeration indicating the confirmed
operation of the choke. Possible status is 1
(Moving) and 2(Stopped).
CommandRejected BOOL A flag that, if set to True, indicates that the
choke has rejected the last command issued
to it.
NonDefeatableOpenInterlock BOOL If set to TRUE, open choke command is
interlocked and cannot be overridden.
DefeatableOpenInterlock BOOL If set to TRUE, open choke command is
interlocked and can be overridden.
NonDefeatableCloseInterlock BOOL If set to TRUE, close choke command is
interlocked and cannot be overridden.
DefeatableCloseInterlock BOOL If set to TRUE, close choke command is
interlocked and can be overridden.
StepDurationOpen LREAL This is the time in milliseconds for the choke
to open one step.
StepDurationClose LREAL This is the time in milliseconds for the choke
to close one step.
TotalSteps WORD Max steps of a choke.
627
Chapter 22 - MDIS
Data
Parameter Description
type
Inde Mandatory/Option
Variable name
x al
1 Fault Mandatory
2 Warning Optional
3 Enabled Optional
4 TagId Optional
5 FaultCode Optional
6 WarningCode Optional
7 CalculatedPosition Mandatory
8 PositionInSteps Optional
9 Moving Mandatory
10 CommandRejected Optional
11 NonDefeatableOpenInterlo Optional
ck
12 DefeatableOpenInterlock Optional
13 NonDefeatableCloseInterlo Optional
ck
14 DefeatableCloseInterlock Optional
15 StepDurationOpen Optional
16 StepDurationClose Optional
17 TotalSteps Optional
628
Chapter 22 - MDIS
Implementation Example
629
Chapter 22 - MDIS
MDISValveObj
Description
This function block is used to create an instance of a Valve object.
630
Chapter 22 - MDIS
Input
Data
Parameter Description
type
Excute BOOL When the execute flag is first set and the rising edge is
detected, all the defined data variables for the object are
added to the subscription. Thereafter, each subsequent
rising edge will copy the latest pushed value for all the
variables into the output pin representing the variable.
SubscriptionHdl DWORD Subscription handle
NodeID STRUCT NodeID of Valve object. (See UANodeID for STRUCT
description)
Output
Data
Parameter Description
type
Done BOOL The function block has completed its task.
Busy BOOL The function block is not finished and is
waiting for data value updates.
Error BOOL Signals that an error has occurred within the
function block. Set to true when ErrorID
indicates an error.
ErrorID DWORD Error ID if any, returned by the server when
monitoring the object.
Fault BOOL The status of the object, true if any fault
exists.
Warning BOOL The status of the object, true if any warning
exists.
Enabled BOOL Set as true when object is enabled.
TagId STRING Unique equipment identifier for the object.
FaultCode DWORD Vendor specific fault code. Zero indicates no
fault.
WarningCode DWORD Vendor specific warning code. Zero indicates
no fault.
631
Chapter 22 - MDIS
Data
Parameter Description
type
Position DINT Current position of the valve.
Value Description
1 The Valve is Closed.
2 The Valve is Open.
4 The Valve is Moving.
8 The Valve is in an unknown state.
This value can be used when a
subsea vendor does not have any
last command information and does
not know the state of the valve.
Value Description
1 Valve Close command
2 Valve Open command
4 No known command has been sent
to the valve. The initial setting on
start-up of a server.
632
Chapter 22 - MDIS
Data
Parameter Description
type
CloseTimeDuration LREAL This is the estimated time in milliseconds to
travel to close position.
633
Chapter 22 - MDIS
Data
Parameter Description
type
Inde Mandatory/Option
Variable name
x al
15 OpenTimeDuration Optional
16 CloseTimeDuration Optional
Implementation Example
634
Chapter 22 - MDIS
MDISObjEnableDisable
Description
This function block is used to invoke the EnableDisable method on an
object. An instance of this function block must be added for every
object that should be enabled or disabled. The function block accepts
the NodeID of the object to be enabled (or disabled) as input.
Input
Data
Parameter Description
type
Excute BOOL The function block performs its task on rising edge.
ConnectionHdl DWORD Connection handle obtained by calling UaConnect
NodeID STRUCT NodeID of MDIS object to enable or disable. (See
UANodeID for STRUCT description)
Enable BOOL Set to true to Enable
635
Chapter 22 - MDIS
Output
Data
Parameter Description
type
Done BOOL The function block has completed its task.
Busy BOOL The function block is not finished.
Error BOOL Signals that an error has occurred. Set to true when ErrorID
indicates an error.
ErrorID DWORD Error ID if any, returned by the server when EnableDisable
method is called.
MDISDiscrtInstrWriteVal
Description
This function block is used to change the value of the 'State' variable
on a Discrete Instrument object by invoking the WriteValue Method.
Input
Data
Parameter Description
type
Excute BOOL The function block performs its task on rising edge.
636
Chapter 22 - MDIS
Data
Parameter Description
type
ConnectionHdl DWORD Connection handle obtained by calling UaConnect
NodeID STRUCT NodeID of Discrete Instrument object. (See UANodeID for
STRUCT description)
State DWORD Value to write to the 'State' variable
Output
Data
Parameter Description
type
Done BOOL The function block has completed its task.
Busy BOOL The function block is not finished.
Error BOOL Signals that an error has occurred. Set to true when ErrorID
indicates an error.
ErrorID DWORD Error ID if any, returned by the server when WriteValue method is
called.
MDISDigInstrWriteState
637
Chapter 22 - MDIS
Description
This function block is used to change the value of the 'State' variable
on a Digital Instrument object by invoking the WriteState Method.
Input
Data
Parameter Description
type
Excute BOOL The function block performs its task on rising edge.
ConnectionHdl DWORD Connection handle obtained by calling UaConnect
NodeID STRUCT NodeID of Digital Instrument object. (See UANodeID for
STRUCT description)
State BOOL Value to write to the 'State' variable
Output
Data
Parameter Description
type
Done BOOL The function block has completed its task.
Busy BOOL The function block is not finished.
Error BOOL Signals that an error has occurred. Set to true when ErrorID
indicates an error.
ErrorID DWORD Error ID if any, returned by the server when WriteState method is
called.
638
Chapter 22 - MDIS
MDISInstrWriteValue
Description
This function block is used to change the value of the
'ProcessVariable' on an Instrument by invoking the WriteValue
Method.
Input
Data
Parameter Description
type
Excute BOOL The function block performs its task on rising edge.
ConnectionHdl DWORD Connection handle obtained by calling UaConnect
NodeID STRUCT NodeID of Instrument object. (See UANodeID for STRUCT
description)
Value REAL Value to write to the 'ProcessVariable'
Output
Data
Parameter Description
type
Done BOOL The function block has completed its task.
639
Chapter 22 - MDIS
Data
Parameter Description
type
Busy BOOL The function block is not finished.
Error BOOL Signals that an error has occurred. Set to true when ErrorID
indicates an error.
ErrorID DWORD Error ID if any, returned by the server when WriteValue method is
called.
MDISChokeMove
Description
This function block is used to adjust the opening on a Choke by
invoking the Move method.
640
Chapter 22 - MDIS
Input
Data
Parameter Description
type
Excute BOOL The function block performs its task on rising edge.
ConnectionHdl DWORD Connection handle obtained by calling UaConnect
NodeID STRUCT NodeID of the Choke object. (See UANodeID for STRUCT
description)
Position REAL A number indicating the percent by which to move the
choke.
OverrideInterlocks BOOL If set to ‘True’, overrides any defeatable interlocks
SEM DINT SEM to which command is sent.
Output
Data
Parameter Description
type
Done BOOL The function block has completed its task.
Busy BOOL The function block is not finished.
Error BOOL Signals that an error has occurred. Set to true when ErrorID
indicates an error.
ErrorID DWORD Error ID if any, returned by the server when Move method is
called.
641
Chapter 22 - MDIS
MDISChokeStep
Description
This function block is used to adjust the opening on a Choke by
invoking the Step method.
Input
Data
Parameter Description
type
Excute BOOL The function block performs its task on rising edge.
ConnectionHdl DWORD Connection handle obtained by calling UaConnect
NodeID STRUCT NodeID of the Choke object. (See UANodeID for STRUCT
description)
Direction DINT Open or close command:
1 (Close), 2(Open)
642
Chapter 22 - MDIS
Data
Parameter Description
type
Steps UINT Number of steps to open or close the choke
OverrideInterlocks BOOL If set to ‘True’, overrides any defeatable interlocks
SEM DINT SEM to which command is sent.
Output
Data
Parameter Description
type
Done BOOL The function block has completed its task.
Busy BOOL The function block is not finished.
Error BOOL Signals that an error has occurred. Set to true when ErrorID
indicates an error.
ErrorID DWORD Error ID if any, returned by the server when Step method is
called.
MDISChokeAbort
643
Chapter 22 - MDIS
Description
This function block is used to cancel any active Choke Move or Step
command by invoking the Abort method.
Input
Data
Parameter Description
type
Excute BOOL The function block performs its task on rising edge.
ConnectionHdl DWORD Connection handle obtained by calling UaConnect
NodeID STRUCT NodeID of the Choke object. (See UANodeID for STRUCT
description)
Output
Data
Parameter Description
type
Done BOOL The function block has completed its task.
Busy BOOL The function block is not finished.
Error BOOL Signals that an error has occurred. Set to true when ErrorID
indicates an error.
ErrorID DWORD Error ID if any, returned by the server when Abort method is
called.
644
Chapter 22 - MDIS
MDISChokeSetCalcPos
Description
This function block is used to overwrite the CalculatedPosition on a
Choke by invoking the SetCalculatedPosition method.
Input
Data
Parameter Description
type
Excute BOOL The function block performs its task on rising edge.
ConnectionHdl DWORD Connection handle obtained by calling UaConnect
NodeID STRUCT NodeID of the Choke object. (See UANodeID for
STRUCT description)
CalculatedPosition REAL Value to write to ‘CalculatedPosition’ variable.
Output
Data
Parameter Description
type
Done BOOL The function block has completed its task.
645
Chapter 22 - MDIS
Data
Parameter Description
type
Busy BOOL The function block is not finished.
Error BOOL Signals that an error has occurred. Set to true when ErrorID
indicates an error.
ErrorID DWORD Error ID if any, returned by the server when
SetCalculatedPosition method is called.
MDISValveMove
Description
This function block is used to open or close a Valve by invoking the
Move method.
646
Chapter 22 - MDIS
Input
Data
Parameter Description
type
Excute BOOL The function block performs its task on rising edge.
ConnectionHdl DWORD Connection handle obtained by calling UaConnect
NodeID STRUCT NodeID of the Valve object. (See UANodeID for STRUCT
description)
Direction DINT Open or close command.
1 (Close), 2(Open).
OverrideInterlocks BOOL If set to ‘True’, overrides any defeatable interlocks
SEM DINT SEM to which command is sent.
Output
Data
Parameter Description
type
Done BOOL The function block has completed its task.
Busy BOOL The function block is not finished.
Error BOOL Signals that an error has occurred. Set to true when ErrorID
indicates an error.
ErrorID DWORD Error ID if any, returned by the server when Move method is
called.
647
Chapter 22 - MDIS
648
CHAPTER
23 ELEPIU_MUX
Description
This function block is used to connect to the ELEPIU MUX board and
provides the temperatures in a data structure for SCADA or PCDI
connections.
Input
Parameter Data Type Description
Box_Type INT Specifies the type of MUX box:
0 - Not Used
1 - Therocouple
2 - RTD
649
Chapter 23 - ELEPIU_MUX
Use 1.
Retries INT Number of retries when communication fails.
Timeout INT Time out value before a retry.
Value is in milliseconds.
Units INT Specifies the temperature units:
0 - DegC
1 - DegF
2 - DegK
3 - DegR
Chn01..Chn16 INT Temperature Element Type:
1 - Type B
2 - Type E
3 - Type J
4 - Type K
5 - Type N
6 - Type R
7 - Type S
8 - Type T
10 - PT390 RTD
11 - PT385 RTD
BURNOUT REAL Burnout Value
Default is 850.0
650
Chapter 23 - ELEPIU_MUX
Output
Parameter Data Type Description
CFG_Err BOOL MUX Function Block is not configured correctly.
COM_Err BOOL Communication error to MUX board has occurred.
Err_Msg STRING Plain text error message
Req UDINT Total number of requests made to MUX board
Err UDINT Total number of errors
DATA MUX_ Data structure used as a rollup for interface to supervisory
DATA systems
T01..T16 REAL Channel Temperatures
Bulb_CJC REAL Temperature value of the thermocouple termination board CJC
resistor
Dig_CJC REAL Onboard CJC
Board REAL MUX Board Type read from MUX Board:
2 - Thermocouple
4 - RTD
Example Usage
The following is a completed block. Parameters are defined in global
variables. The Modbus Mapping file which maps to MUX_DATA has
been provided in the library path. Additionally an example project has
been provided as a starting point with 16 MUX boards built.
651
Chapter 23 - ELEPIU_MUX
652
CHAPTER
24 DNP3 MASTER
With these function blocks, you can read and write the following types
of DNP3 points:
n Description of CONFIG_INFO
n Description of Input and Output Data Type
n DNP3 Master Protocol Error Codes
653
Chapter 24 - DNP3 Master
DNP3_RD
Description
It is used to read the following types of DNP3 points from outstation.
Input
Data
Parameter Description
type
ENABLE BOOL Enable: If TRUE, the FB is enabled and workable.
CONFIG_ DNP3_ This is a structure provided by Honeywell. DNP3 Master related
INFO CONFIG_ information is included. See Description of CONFIG_INFO for
INFO more information.
654
Chapter 24 - DNP3 Master
Data
Parameter Description
type
POINT_ UINT The start point address you want to read from outstation.
ADDR
POINT_ UINT The length of the points you want to read from outstation. The
LEN maximum length is 100 points.
OBJECT_ USINT DNP3 data object you want to read from outstation.
TYPE
This parameter can be set to the following values:
kDnp3BinaryInput = 0;
kDnp3BinaryOutputStatus = 1;
kDnp3AnalogInput16 = 2;
kDnp3AnalogInput16_NoFlag = 3;
kDnp3AnalogOutput16Status = 4;
kDnp3AnalogInput32 = 5;
kDnp3AnalogInput32_NoFlag = 6;
kDnp3AnalogOutput32Status = 7;
kDnp3AnalogInputFloat = 8;
kDnp3AnalogOutputFloatStatus = 9;
kDnp3OctetStringRD = 10;
kDnp3DoubleBitBinaryInput = 11;
kDnp3Counter16 = 12;
kDnp3Counter16_NoFlag = 13;
kDnp3Counter32 = 14;
kDnp3Counter32_NoFlag = 15;
kDnp3FrozenCounter16 = 16;
kDnp3FrozenCounter16_NoFlag = 17;
kDnp3FrozenCounter32 = 18;
kDnp3FrozenCounter32_NoFlag = 19;
655
Chapter 24 - DNP3 Master
Data
Parameter Description
type
SEND_ BOOL If SEND_FLAG is true and RDY_FLAG is true, function blocks
FLAG will send the request. RDY_FLAG is TRUE means last
communication is finished. Before last communication is
finished, even if SEND_ FLAG is true the request won’t be sent.
Output
Data
Parameter Description
type
RDY_FLAG BOOL True: last communication is finished. FB is ready for the next
communication.
0: Communication succeeded.
2: Response timeout
4: Invalid request
656
Chapter 24 - DNP3 Master
657
Chapter 24 - DNP3 Master
Example
658
Chapter 24 - DNP3 Master
DNP3_WR
Description
It is used to write the following types of DNP3 points from outstation.
Input
Data
Parameter Description
type
ENABLE BOOL Enable: If TRUE, the FB is enabled and workable.
CONFIG_ DNP3_ This is a structure provided by Honeywell. DNP3 Master related
INFO CONFIG_ information is included. See Description of CONFIG_INFO for
659
Chapter 24 - DNP3 Master
Data
Parameter Description
type
INFO more information.
POINT_ UINT The start point address you want to read from outstation.
ADDR
POINT_ UINT The length of the points you want to read from outstation. The
LEN maximum length is 100 points.
OBJECT_ USINT DNP3 data object you want to read from outstation.
TYPE
This parameter can be set to the following values:
kDnp3OctetStringWR = 20;
kDnp3CROB_SelOp = 21;
kDnp3CROB_DirOp = 22;
kDnp3CROB_DONA = 23;
kDnp3AnalogOutput16_SelOp = 24;
kDnp3AnalogOutput16_DirOp = 25;
kDnp3AnalogOutput16_DONA = 26;
kDnp3AnalogOutput32_SelOp = 27;
kDnp3AnalogOutput32_DirOp = 28;
kDnp3AnalogOutput32_DONA = 29;
kDnp3AnalogOutputFloat_SelOp = 30;
kDnp3AnalogOutputFloat_DirOp = 31;
kDnp3AnalogOutputFloat_DONA = 32;
SEND_ BOOL If SEND_FLAG is true and RDY_FLAG is true, function blocks
FLAG will send the request. RDY_FLAG is TRUE means last
communication is finished. Before last communication is
finished, even if SEND_ FLAG is true the request won’t be sent.
660
Chapter 24 - DNP3 Master
Output
Data
Parameter Description
type
RDY_FLAG BOOL True: last communication is finished. FB is ready for the next
communication.
0: Communication succeeded.
2: Response timeout
4: Invalid request
661
Chapter 24 - DNP3 Master
662
Chapter 24 - DNP3 Master
Example
Description of CONFIG_INFO
The CONFIG_INFO pin defined in the function blocks is to input all the
configuration information for the DNP3 Master.
TYPE
DNP3_CONFIG_INFO:
STRUCT
PORT_NUM: UDINT;
663
Chapter 24 - DNP3 Master
TCP_PORT_NUM: UDINT;
MASTER_ADDR: UDINT;
OUTSTATION_ADDR:UDINT;
IP_ADDR: STRING;
END_STRUCT;
Data
Parameter Description
type
PORT_NUM UDINT The physical interface of Ethernet port:
1. Ethernet port 1
2. Ethernet port 2
TCP_PORT_ UDINT TCP/IP port number of the DNP3 Master device
NUM
MASTER_ADDR UDINT The address of the DNP3 master
OUTSTATION_ UDINT The address of the DNP3 outstation
ADDR
IP_ADDR STRING The IP address of the DNP3 outstation device. Example:
‘192.168.0.100’
664
Chapter 24 - DNP3 Master
Error
Item Description
Code
0 SUCCESS This indicates the request has completed successfully.
1 INTERMEDIATE This indicates a response was received but the requested
command is not yet complete. This could mean the response
is part of a multi-fragment response and did not have the
FINAL bit set. Or this could be a request such as a select
operate that requires multiple requests and responses.
2 FAILURE This indicates that the transmission of the request failed.
3 MISMATCH The response to a select or an execute did not echo the
request.
4 STATUSCODE The response to a select or an execute echoed the request,
except the status code was different indicating a failure.
5 IIN The response to the request had IIN bits set indicating the
command failed.
6 TIMEOUT This indicates that the request has timed out. This could
either be an incremental timeout indicating we received no
link layer frame from the device in the specified time, or an
application response timeout indicating this particular
request did not complete in the specified time.
7 CANCELED This indicates either that the user asked that the request be
canceled by calling dnpchnl_cancel Fragment or that a
second duplicate request has been made and therefore this
first one is canceled.
665
Notices
NOTICES
Trademarks
Experion® is a registered trademark of Honeywell International, Inc.
ControlEdge™ is a trademark of Honeywell International, Inc.
OneWireless™ is a trademark of Honeywell International, Inc.
Other trademarks
Microsoft and SQL Server are either registered trademarks or
trademarks of Microsoft Corporation in the United States and/or
other countries.
Trademarks that appear in this document are used only to the benefit
of the trademark owner, with no intention of trademark infringement.
Third-party licenses
This product may contain or be derived from materials, including
software, of third parties. The third party materials may be subject to
licenses, notices, restrictions and obligations imposed by the licensor.
The licenses, notices, restrictions and obligations, if any, may be found
in the materials accompanying the product, in the documents or files
accompanying such third party materials, in a file named third_party_
licenses on the media containing the product, or at
http://www.honeywell.com/en-us/privacy-statement.
Documentation feedback
You can find the most up-to-date documents on the Honeywell
Process Solutions Support website at:
http://www.honeywellprocess.com/support
If you have comments about Honeywell Process Solutions
documentation, send your feedback to: [email protected]
Use this email address to provide feedback, or to report errors and
omissions in the documentation. For immediate help with a technical
problem, contact HPS Technical Support through your local
Customer Contact Center, or by raising a support request on the
Honeywell Process Solutions Support website.
666
Notices
Support
For support, contact your local Honeywell Process Solutions
Customer Contact Center (CCC). To find your local CCC visit the
website, https://www.honeywellprocess.com/en-US/contact-
us/customer-support-contacts/Pages/default.aspx.
Training classes
Honeywell holds technical training classes that are taught by process
control systems experts. For more information about these classes,
contact your Honeywell representative, or see
http://www.automationcollege.com.
667
Notices
668