PRD-0000022543 / Rev. 00D / FL / nb / Apr il 2008 MNKS008 0.0 (4/08)
The Most Trusted Name In Measurement
External Data Communication
External Data Communication, MPU Series B
Procedure
History
Revision Date Editor ECN Status Description
Rev. 03 / C 01.03.2007 xxx
Rev. 00D April 2008 NB
50000058026
20207
released
released
Take over from KOS SAP System
New Logo
Important
All information and technical specifications in this documentation have been carefully checked
and compiled by the author. However, we cannot completely exclude the possibility of errors.
Smith Meter GmbH is always grateful to be informed of any errors.
____________________________________________________________________
Page 2 of 28 PRD-0000022543 Rev .00D
This document contains a description of how to use the MPU
Series B ModBus interfaces. Both the serial interface and the
Ethernet interface is described.
1.2. References
Doc. No
1 USM-0000020565 MPU Series B User Manual: Operators
2 Andy Swales, Schneider Electric: Open
Title
Manual – Configuring the ModBus Serial
Ports.
ModBus/TCP Specification, Release 1.0 29
March 1999
1.3. Abbreviations
CP
DSP
cpBus Communications Processor Bus. Dedicated protocol used
Communications Processor
Digital Signal Processor
for transmitting messages between the internal modules of
the CP
1.4. Definitions
IP Internet Protocol
MPU MultiPath Ultrasonic
TCP Transport Control Protocol
For the Half Duplex RS-485 (2-wire) interface, the following
timing considerations must be taken into account by the software
on the ModBus master:
There must be at least a 20 mS "silent interval" from receiving a
ModBus reply from the MPU, before the next ModBus request
message issued by the master to the MPU. The software on the
ModBus master will typically need to follow this pattern of
communication:
Send a request message A to the MPU Read the reply message from the MPU
Wait for at least 20 mS
Send the next request message B to the MPU
...etc...
This will ensure that the MPU has sufficient amount of time to
change the driver direction before the master sends the next
request.
2.2. ModBus On TCP/IP
The MPU Series B ModBus on TCP/IP implementation conforms
to the definition in section 1.2 References [2].
The following requirements apply to the ModBus Application Protocol (MBAP) header used for TCP/IP:
Fields Length Client
Transaction Identifier 2 bytes Must be 0
Protocol Identifier 2 bytes Must be 0
Length 2 bytes Minimum 6
Unit Identifier 1 byte Must be 1
____________________________________________________________________
Page 8 of 28 PRD-0000022543 Rev .00D
The following registers are the results registers of the MPU Series B.
They are all 32-bit float values. They are updated on the completion of
every measurement cycle.
9 18 Accumulated time
10 20 Volume Increment
11 22 Increment Time Duration *5 sec
12 24 Used Line Pressure barA
13 26 Used Line Temperature Celsius
14 28 Measured Flow Velocity path 1 m/s
15 30 Measured Flow Velocity path 2 m/s
16 32 Measured Flow Velocity path 3 m/s
17 34 Measured Flow Velocity path 4 m/s
18 36 Measured Flow Velocity path 5 m/s
19 38 Measured Flow Velocity path 6 m/s
20 40 Measured Velocity of Sound path 1 m/s
21 42 Measured Velocity of Sound path 2 m/s
22 44 Measured Velocity of Sound path 3 m/s
23 46 Measured Velocity of Sound path 4 m/s
24 48 Measured Velocity of Sound path 5 m/s
25 50 Measured Velocity of Sound path 6 m/s
26 52 Percentage Of Signals Used Transducer 1A %
27 54 Percentage Of Bursts Used Transducer 2A %
28 56 Percentage Of Bursts Used Transducer 3A %
29 58 Percentage Of Bursts Used Transducer 4A %
30 60 Percentage Of Bursts Used Transducer 5A %
31 62 Percentage Of Bursts Used Transducer 6A %
32 64 Percentage Of Bursts Used Transducer 6B %
33 66 Percentage Of Bursts Used Transducer 5B %
34 68 Percentage Of Bursts Used Transducer 4B %
35 70 Percentage Of Bursts Used Transducer 3B %
36 72 Percentage Of Bursts Used Transducer 2B %
____________________________________________________________________
Page 10 of 28 PRD-0000022543 Rev .00D
37 74 Percentage Of Bursts Used Transducer 1B %
38 76 Gain Transducer 1A 39 78 Gain Transducer 2A 40 80 Gain Transducer 3A 41 82 Gain Transducer 4A 42 84 Gain Transducer 5A 43 86 Gain Transducer 6A 44 88 Gain Transducer 6B 45 90 Gain Transducer 5B 46 92 Gain Transducer 4B 47 94 Gain Transducer 3B 48 96 Gain Transducer 2B 49 98 Gain Transducer 1B -
*1
This is a counter that is incremented by one on the completion of every
measurement cycle.
*2
This is the MPU Series B alarm status word. A non-zero value here indicates
that one or more alarms have been raised on the MPU Series B. See chapter 4.1
for details.
*3
This is the elapsed time in seconds since the MPU Series B was powered-up
*4
This is the volume measured during the most recent measurement cycle.
*5
This is the time elapsed during the most recent measure m ent cycle
3.3. High Resolution Accumulators
In some cases the normal 32-bit floating point presentation of the
accumulated flow may not give enough resolution. The following
objects offer a high resolution view of the accumulator registers.
Figure 1 below describes the most common way to implement a
master application that is synchronised with the MPU Series B.
In this example, the master application running on an external flow
computer is responsible for writing the correct pressure and
temperature to the MPU Series B.
Start
Read object 0
Object 0
changed?
YES
Read objects of
interest from the
database
Store values
in flow computer
memory
Write pressure &
temperature to
objects 10000
and 10001
NO
Figure 1 - Flow Computer Application Example
4.1. The MPU Series B Alarm Status
The MPU Series B Alarm Status is a bit coded value indicating the
state of the MPU Series B alarms. To correctly interpret the bits, the
32-bit float value has to be converted into a 32-bit integer value. The
table below shows the alarm bits used and their interpretation.
Bit Value Alarm interpretation
0 1 High Flow Alarm
1 2 Hardware Error
2 4 Transducer Failure
3 8 Calculation Failure
4 16 Burst Percent Low
5 32 Gain Error
6 64 Velocity-of-sound difference too large
7 128 Flow corrections active
4.2. The ModBus Protocol – Message Exchange
Example
This chapter describes the exchange of messages taking place in a
typical Flow Computer - MPU communication.
4.2.1. Modbus Read Message Example
In the following example the flow computer performs the following
task:
- Read temperature and pressure from the MPU Series B
The database objects used for pressure and temperature from an
external source are object numbers 10000 and 10001. These have the
ModBus addresses 20000 and 20002. These registers are read with
ONE message with function code 3. Figure 2 below shows the
contents of this message.
Node
no.
Function
code
1st register
address
Number of
16-bit values
01034E200004
Figure 2 - ModBus Read Message Example
Note: All bytes are shown in hexadecimal format.
The reply from the MPU Series B will be on the format described in
Figure 3 below.
Node
Function
no.
code
count
01030842C800
Pres sure - 100 ba rAByte
Temp - 37.5 barA
00421600
00
Figure 3 - ModBus Read Reply Message Examp le
The message contains the content of database objects 10000 (pressure)
and 10001 (temperature) represented as two 32-bit real values (least
significant byte first).
____________________________________________________________________
Page 14 of 28 PRD-0000022543 Rev .00D
In this example the flow computer performs the following task:
- Write temperature and pressure from the MPU Series B
The database objects used for pressure and temperature from an
external source are object numbers 10000 and 10001. These have the
ModBus addresses 20000 and 20002. These registers are written with
ONE message with function code 16. Figure 4 below shows the
contents of this message.
Node
no.
Function
code
address
Number of
16-bit values
Byte
Count
Pressure - 100 barA1st register
Temp - 37.5 barA
01 104E 20 00 04
0842 C8 00
00
42 16 0000
Figure 4 - ModBus Write Message Example
The reply from the MPU Series B will be on the format described in
the figure below.
Node
Function
no.
code
01104E200004
1st register
address
Number of
16-bit values written
Figure 5 - ModBus Write Reply Message Example
The message contains a copy of the first 6 bytes of the request
message.
This communication link provides a fast and simple way of
communicating with the MPU Series B using the network
interface. The interface is based on a Microsoft Windows DLL.
This DLL encapsulate all the communication with the MPU Series
B, and offers a set of library functions that can be called from your
program. (DLLs are callable from most programming languages
including Microsoft visual C++, Microsoft Visual Basic, National
Instrument Lab View/Lab Windows, Office applications that can
be programmed with Visual Basic Macros i.e. Excel).
The PC to use this DLL has to have the following “pieces”:
1. Running Microsoft Windows 98/NT//2000 or later versions.
2. Ethernet network (or a Ethernet card in your computer)
3. TCP/IP protocol installed under Windows.
4. Application can then call a Windows DLL (Dynamic Link
Library). The DLL contains simple functions to read or write to
the MPU Series B database via the network.
6.1.1. Installation
The IP address of the MPU Series B must be defined in the host
file. For example:
128.1.221.121 MPUsn11
where ‘128.1.221.121’ is the IP address, and ‘MPUsn11’ is the
name the machine can be referenced by.
This file is usually found in directory
C:\WINNT\system32\drivers\etc\ on PCs running Windows NT,
and under C:\WINDOWS\…. on PCs running Windows 98.
The following files is included in the MPU Series B network
communication toolkit:
1. MPUBComm.dll - Callable library containing the
implementation of the communication system.
2.MPUBComm.lib - Linkable library for Microsoft visual C++.
3. DLLTester.exe – An executable test program with a simple user
4. SimpleTalk.cpp – A very simple working example program in
C showing the use of the DLL.
5. MPUBCommExample.exe - Executable of the above.
6. W95ws2setup.exe – Installation of windows socket version 2
for Windows 95.
Note: The library uses windows socket version 2. This
component is standard in Windows NT 4.0, and
Windows 98. Some versions of Windows 95 haven’t got
this component installed. If problems in Windows 95,
run the “W95ws2setup.exe” program. This installs
windows sockets version 2.
Warning: Do not run “W95ws2setup.exe” if you have Windows
NT 4.0, Windows 98 or later.
6.1.2. Running The Test Programs
Both test programs must be run from the same directory the
MPUBComm.dll file is located.
DLLTester.exe
This test program displays a simple dialog where the user can read
and write values to the MPU Series B database. This is shown in
Figure 6 below.
Figure 6 - DLLTester User Interface
SimpleTalk.exe
This is a simple console application that reads 5 values from the
MPU Series B database. It always reads the same 5 objects starting
from database object number 0.
Open a DOS window and enter the command:
SimpleTalk <machine name>
____________________________________________________________________
Page 22 of 28 PRD-0000022543 Rev .00D
The following functions are implemented in the DLL:
GetFloatValues
This functions reads object as float values from the MPU Series B
database.
int DLLAPI getFloatValues(
// Input
const char *lpszHost, //
Hostname to connect to (MPUsn11)
unsigned short nFirstObjectNumber, //
First database object to read
unsigned short nNOfObject, // The
number of objects to read
// Output
float *pfValueBuffer //
Buffer to store the values
);
Parameters :
LpszHost
Specifies the host to connect. The host must be defined in the
host file on your PC. The string must be null terminated.
Specifies the object number of the first database value to read.
These object numbers are defined in section 3.
NNOfObject
Specifies how many objects to read. This must be a number
between 1 and 64. The parameter must be a 16 bit integer.
PfValueBuffer
Specifies the memory address where the function will place the
read values. The parameter must be a pointer to an array of 32
bits single precision floating point values. The size of the array
must at least be nFirstObjectNumber * 4 bytes.
GetIntValues
This functions reads object as float values from the MPU Series B
database.
int DLLAPI getFloatValues(
// Input
const char *lpszHost, //
Hostname to connect to (MPUsn11)
unsigned short nFirstObjectNumber, //
First database object to read
unsigned short nNOfObject, // The
number of objects to read
// Output
int *pnValueBuffer //
Buffer to store the values
);
Parameters :
LpszHost
Specifies the host to connect. The host must be defined in the
host file on your PC. The string must be null terminated.
NFirstObjectNumber
Specifies the object number of the first database value to read.
These object numbers are defined in section 3.
NNOfObject
Specifies how many objects to read. This must be a number
between 1 and 64. The parameter must be a 16 bit integer.
____________________________________________________________________
Page 24 of 28 PRD-0000022543 Rev .00D
Specifies the memory address where the function will place the
read values. The parameter must be a pointer to an array of 64
bits integer values. The size of the array must at least be
nFirstObjectNumber * 8 bytes.
SetFloatValues:
This function writes floating point values to the MPU Series B
database.
int DLLAPI setFloatValues(
// Input
const char *lpszHost, //
Hostname to connect to (MPUsn11)
unsigned short nFirstObjectNumber, //
First database object to read
unsigned short nNOfObject, // The
number of objects to read
float *pfValueBuffer //
Buffer with the values
);
Parameters :
LpszHost
Specifies the host to connect. The host must be defined in the
host file on your PC. The string must be null terminated.
NFirstObjectNumber
Specifies the object number of the first database value to write.
These object numbers are defined in section 3.
NNOfObject
Specifies how many objects to write. This must be a number
between 1 and 64. The parameter must be a 16 bit integer.
PfValueBuffer
Specifies the memory address where the values to write are
fetched from. The parameter must be a pointer to an array of 32
bits single precision values. The size of the array must at least
be nFirstObjectNumber * 4 bytes.
This function writes integer values to the MPU Series B database.
int DLLAPI setIntValues(
// Input
const char *lpszHost, //
Hostname to connect to (MPUsn11)
unsigned short nFirstObjectNumber, //
First database object to read
unsigned short nNOfObject, //
The number of objects to read
int *pnValueBuffer //
Buffer with the values
);
Parameters :
LpszHost
Specifies the host to connect. The host must be defined in the
host file on your PC. The string must be null terminated.
NFirstObjectNumber
Specifies the object number of the first database value to write.
These object numbers are defined in section 3.
NNOfObject
Specifies how many objects to write. This must be a number
between 1 and 64. The parameter must be a 16 bit integer.
PnValueBuffer
Specifies the memory address where the values to write are
fetched from. The parameter must be a pointer to an array of 64
bits integer values. The size of the array must at least be
nFirstObjectNumber * 8 bytes.
____________________________________________________________________
Page 26 of 28 PRD-0000022543 Rev .00D
The functions implemented in DLL return a single status code upon
return. The code is returned as a 64-bit integer.
The table below shows the valid return values.
Return
Code
0 The function call succeeded
1 The function call failed
2 The connection attempt to the MPU Series B failed
3 The specified database address was invalid
Description
6.2. MPU Series B WinScreen
The MPU Series B WinScreen is a stand-alone application for
communicating with the MPU Series B. It can be used with both
the TCP/IP and the serial ModBus interface. Refer to
PRD-0000020565 “User Manual, MPU Series B” for more details.
The specifications contained herein are subject to change without notice and any user of said specificati ons should verify from th e m anuf a ctu r er t hat th e
specifications are currently in effect. Otherwise, the manufacturer assumes no responsibility for the use of specifications which may have been change d
and are no longer in effect.
Headquarters:
500 North Sam Houston Parkway West, Suite 100 Houston, TX 77067 USA, Phone: 281/260-2190, Fax: 281/260-2191
Gas Measurement Products:
Houston, TX USA
Thetford, England
Kongsberg, Norway
Buenos Aires, Argentina
Integrated Measurement Systems:
Corpus Christi, TX USA
Kongsberg, Norway
San Juan, Puerto Rico
United Arab Emirates, Dubai
____________________________________________________________________ Page 28 of 28 PRD-0000022543 Rev .00D
Visit our website at www.fmctechnologies.com/measurementsolutions