Haimo Modbus Protocol 2.
0
1 Introduction
Haimo DAU connects the client control system through COM2 with the protocol RS485
(MODBUS RTU) to receive control commands from DCS and transfer test data to DCS.
Following is the haimo standard modbus prototol for haimo system and clients control system.
2 Standard Modbus Protocol
Communication mode: Modbus RS485 RTU mode
Serial Port Set up
Baud Rates Number of data bits Stop bits Parity bits
9600 8 1 None
Transmission distance for RS485 port: Max. 1200 meters.
When DCS system connects with several MPFM systems, MPFM identifies the command
package by Device ID (from 1 to 8) and register address of each MPFM begins from 40001.
The holding registers defined in this system are as following:
Type Unit Address Description
Well No. Int 40001
0: Start Testing
1: Stop Testing
Command Int 40002
2: Stop purging
3: Abort
Start testing immediately if “0”
Set Purging time Long Second 40003
is input
“0” means continuous testing
Set Test time Long Second 40005 until “Stop” command is
received.
0: Actual condition
Condition for results transition Int 40007
1: Standard condition
1: D.C
Temperature unit Int 40008
2: F
1: kPa
2: MPa
3: bar
Pressure unit Int 40009
4: inHg
5: inH2O
6: Psi
1: m3/d or m3
Liquid unit Int 40010 2: ft3/d or ft3
3: bbl/d or bbl
1: m3/d or m3
2: ft3/d or ft3
Gas unit Int 40011
3: MSCFD or MSCF
4 :MMSCFD or MMSCF
Time synchronization Long 40012 time in second since 1/1/1970
1) Above commands are the sent by DCS to MPFM.
2) When restart is necessary after the testing has been started, a “Stop” command should be sent to
the MPFM first.
Following is the data sent to master by MFM
Instantaneous Value:
Well No. Int 40014
0: testing 1: Stop
Meter status Int 40015
2: purging 3: Abort
Purging time to go Long Second 40016
Testing time to go Long Second 40018
Refer to section 3 Software
Diagnostic Alarm Int 40020
Alarm Code.
Test start time Long Second 40021 time in second since 1/1/1970
Test end time Long Second 40023 time in second since 1/1/1970
Test duration since started Long Second 40025
Liquid flow rate Float 40027 Refresh per minute
Water flow rate Float 40029 Refresh per minute
Oil flow rate Float Depend on 40010 40031 Refresh per minute
Gas flow rate Float Depend on 40011 40033 Refresh per minute
GVF Float % 40035 Refresh per minute
Temperature Float Depend on 40008 40037 Refresh per minute
Pressure Float Depend on 40009 40039 Refresh per minute
Water Cut Float % 40041 Refresh per minute
Following is the Averaged/Accumulated result from the beginning to current time
Accumulated liquid flow rate Float Depend on 40010 40043 Refresh per minute
Accumulated water flow rate Float Depend on 40010 40045 Refresh per minute
Accumulated oil flow rate Float Depend on 40010 40047 Refresh per minute
Accumulated gas flow rate Float Depend on 40011 40049 Refresh per minute
Well No. Int 40051
Test tart time Long Second 40052 time in second since 1/1/1970
Test end time Long Second 40054 time in second since 1/1/1970
Test duration since started Long Second 40056
Average liquid flow rate Float Depend on 40010 40058 Refresh per minute
Average water flow rate Float Depend on 40010 40060 Refresh per minute
Average oil flow rate Float Depend on 40010 40062 Refresh per minute
Average gas flow rate Float Depend on 40011 40064 Refresh per minute
Average Water Cut Float % 40066 Refresh per minute
Average GVF Float % 40068 Refresh per minute
Average Temperature Float Depend on 40008 40070 Refresh per minute
Average Pressure Float Depend on 40009 40072 Refresh per minute
Inlet Pressure Float Depend on 40009 40074 Refresh per minute
Outlet Pressure Float Depend on 40009 40076 Refresh per minute
GOR Float m3/m3 40078
2 / 4
3 System Alarm Code
DAU alarms are defined as an integer number, occupying of 2 Bytes that total of 16 bits. Each bit is on
behalf of an alarm and the assignment of 1 for abnormality and 0 for normal. The details are described as
follows:
Alarm code Parameter Description
Alarm for gamma ray counts If single or high/low energy counts are abnormal for
1 abnormality 5 minutes continuously, alarm is reported.
GVF2 Alarm Alarm for gas hold up beyond limit at dual gamma
2 sensor
SGM Card Alarm Alarm for SGM(single gamma meter) card
3 abnormality
4 DGM Card Alarm Alarm for DGM(dual gamma meter) card abnormality
If current working temperature transmitter A/D
Temperature alarm conversion value is not within the reasonable range
5 for 5 minutes continuously, alarm is reported.
If current working pressure transmitter A/D
Pressure alarm conversion value is not within the reasonable range
6 for 5 minutes continuously, alarm is reported.
If current working differential pressure transmitter
Differential pressure alarm A/D conversion value is not within the reasonable
7 range for 5 minutes continuously, alarm is reported.
This alarm means no flow rate pass though the
Zero Flow rate Alarm
8 MPFM.
If flow rate is lower or higher than user’s setting
Flow rate alarm
9 value for 5 minutes continuously, alarm is reported.
If water cut is higher than user’s setting value for 5
Water cut alarm
10 minutes continuously, alarm is reported.
11 Reservation
Alarm for pressure over upper If liquid leg pressure is higher than user’s setting
12 limitation value for 5 minutes continuously, alarm is reported.
If corresponding well ID cannot be found in DOC,
Alarm for well ID absence
13 alarm is reported to indicate test fail.
14 - 15 Reservation
Alarm parameter finally is reported as an integer, but it needs to be converted into a binary digit for
analysis. For example, alarm parameter 73 is 0000000001001001 when converted into a binary digit.
According to the alarm code table above, it represents 3 alarms, with corresponding alarm codes 1, 4 and
7, respectively meaning gamma ray counts abnormality, Reservation and differential pressure alarm.
3 / 4
4 DCS Configuration Sequence
4.1 START/Stop Testing Sequence
Steps Commands Write value address Function code
1 Stop testing 1 40002 0x06
2 Set well ID e.g. 2 40001 0x06
3 Set purge time e.g. 86400 40003&40004 0x10
4 Set test time e.g. 604800 40005&40006 0x10
5 Set condition e.g. 1 40007 0x06
6 Set T unit e.g. 2 40008 0x06
7 Set P unit e.g. 3 40009 0x06
8 Set L unit e.g. 3 40010 0x06
9 Set G unit e.g. 3 40011 0x06
10 Start testing 0 40002 0x06
Purging is beginning…
11 Stop purge 2 40002 0x06
Testing is beginning…
12 Stop test or Abort test 1 or 3 40002 0x06
If you want to start a well testing, you must send a serial of commands as following:
1) send stop testing command(function code:6),set register 40002 as 1
2) send set well ID command(function code:6),set register 40001 as a well ID e.g. 2
3) send set purge time command(function code:0x10),set register 40003&40004 as a time interval
value by second, e.g. 86400
4) send set test time command(function code:0x10), set register 40005&40006 as a time interval value
by seconds, e.g. 604800
5) send set condition command(function code:6), set register 40007 as 1 if you want to get standard
condition results or set 40007 as 0 if you want to get actual condition results
6) Send set temperature unit command (function code: 6), set register 40008 as the unit you want. e.g.
2(Fahrenheit Degree)
7) Send set pressure unit command (function code: 6), set register 40009 as the unit you want. e.g.
1(kPa)
8) Send set liquid flow rate unit command (function code: 6), set register 40010 as the unit you want.
e.g. 1(m3/d)
9) Send set gas flow rate unit command (function code: 6), set register 40011 as the unit you want. e.g.
3(bbl/d)
10) Send start testing command (function code: 6), set register 40002 as 0, then purging will start.
11) When system is purging, if you want to start test immediately, you can send stop purge command
(function code: 6), set 40002 as 2, then testing will start. If you don’t send any command, when
purge time elapse, testing will start automatically
12) When test is running, if you want to stop or abort test, you can send stop test or abort test command
(function code: 6), set 40002 as 1 or 3, then testing will stop or abort. If you don’t send any
command, when test time elapse, testing will stop automatically.
4.2 Time SYNCHRONIZATION SEQUENCE
Steps Commands Write value address Function code
1 Stop testing 1 40002 0x06
2 Set time synchronization e.g. 1219647187 40012&40013 0x10
If you want to synchronize DAU system time, you must send a serial of commands as following:
1) Send stop testing command(function code:6),set register 40002 as 1
2) Send time synchronization command (function code: 16), set register 40012&40013 as a time in
second since 1/1/1970 midnight (GMT). If success, register will remain the value you set, else
the register 40012&40013 will show 0.
4 / 4