31 August 2012

Modbus data packet size

reference used.. http://langhofer.at/fileadmin/downloads/sineaxcam/Modbus_Basics.pdf

Modbus RTU packet..

Modbus TCP packet...





Byte and Word swap when dealing with 32 bits (4 Bytes) Modbus data


Note 1 – Article used as reference


Note 2 - Software used as reference

FPconverter from http://www.61131.com

Modbus protocol was designed based on devices with a 16-bit register length. Consequently, special considerations were required when implementing 32-bit data elements. This implementation settled on using two consecutive 16-bit registers to represent 32 bits of data or essentially 4 bytes of data.

Big-Endian is the most commonly used format for network protocols – so common, in fact, that it is also referred to as ‘network order’.

As a rule of thumb, the family of a device’s microprocessor determines its endianness. Typically, the big-Endian style (the high-order byte is stored first, followed by the low-order byte) is generally found in CPUs designed with a Motorola processor. The little-Endian style (the low-order byte is stored first, followed by the high-order byte) is generally found in CPUs using the Intel architecture.

System integrator has to be very careful when dealing with 32 bits Modbus data. Various manufacturers may implement various data swapping techniques as described in table below:

Swap Mode
Source Bytes
Target Bytes
None
AB
CD
AB
CD
Byte and Word swap
AB
CD
DC
BA
Byte swap
AB
CD
BA
DC
Word swap
AB
CD
CD
AB


24 August 2012

RS485 2-wire connection diagram

taken from...

http://www.bb-elec.com/tech_articles/485_2wire_connection_illustration.asp

this is the most common wiring diagram for serial connection to field instruments especially for Modbus RTU purposes..


21 August 2012

Calculation methods of compressibility factor for natural gas


Taken from...


Calculation methods of compressibility factor
  • AGA 8 Detailed Characterization Method - Required parameters are:
    1. Pressure
    2. Temperature
    3. Gas mixture components fractions or percentages
Reference: American Gas Association Report No. 8, "Compressibility Factor of Natural Gas and Other Related Hydrocarbon Gases", Second Edition, November 1992, 2nd printing July 1994. Detail Characterization Method.
  • AGA 8 Gross Characterization Methods
    1. Method 1 - Required parameters are:
    1. Pressure
    2. Temperature
    3. Gross caloric (heating) value
    4. Relative density (specific gravity)
    5. Fraction or percentage of carbon dioxide
Reference: American Gas Association Report No. 8, "Compressibility Factor of Natural Gas and Other Related Hydrocarbon Gases", Second Edition, November 1992, 2nd printing July 1994. Gross Characterization Method-1.
    1. Method 2
    1. Pressure
    2. Temperature
    3. Relative density (specific gravity)
    4. Fraction or percentage of carbon dioxide and nitrogen
Reference: American Gas Association Report No. 8, "Compressibility Factor of Natural Gas and Other Related Hydrocarbon Gases", Second Edition, November 1992, 2nd printing July 1994. Gross Characterization Method-2.
  • NX19 mod. - Required parameters are:
    1. Pressure
    2. Temperature
    3. Relative density (specific gravity)
    4. Fraction or percentage of carbon dioxide or nitrogen
Reference: VDI/VDE 2040, part 2, 1987. Calculation principals for measurement of fluid flow using orifice plates, nozzles and ventury tubes. Equation and formulas.
  • GERG-91 mod. - Required parameters are:
    1. Pressure
    2. Temperature
    3. Relative density (specific gravity)
    4. Fraction or percentage of carbon dioxide or nitrogen
Reference: ICO/TC 193 SCI No. 63. Natural gas - calculation of compression factor. Part 3: Calculation using measured physical properties.
  • GPSA - Required parameters are:
    1. Pressure
    2. Temperature
    3. Relative density (specific gravity)
Reference: Gas Processors Suppliers Association, Engineering data book, 1998

11 August 2012

Modbus Serial vs TCP and DNP3 Serial vs TCP


Difference between Modbus Serial and Modbus TCP and DNP 3.0 Serial vs DNP 3.0 TCP... very straight forward explanation..

taken from...

http://controltoolbox.com/blog/2009/03/why_dnp_over_ip_is_smarter_tha.html

There are many aspects of DNP3 protocol that are superior compared with Modbus. However, I like to talk about DNP/IP and Modbus TCP specifically. Like Modbus, DNP was originally designed to cover a serial link. As IP becomes more popular, both DNP and Modbus add IP option to the core protocol. What DNP designers did was to just simply embed the DNP traffic in an IP envelop. Modbus designer modified the header and removed the CRC of the traditional Modbus message to migrate to Modbus TCP.  I think they did that because they were thinking that TCP header already has a CRC and keeping the Modbus CRC is kind of redundancy.

Now, here is the problem with Modbus TCP. Lots of people have Modbus TCP masters and legacy Modbus devices. For them, connecting the master to the device requires more than a simple terminal server that converts IP traffic to serial. The reason is there would be a need for a gateway that can adjust the protocol from serial version to TCP version and vice versa. That’s why you see many manufacturers making devices called Modbus gateway. The situation with DNP is much simpler. Since the DNP packets in IP and serial version are the same, a simple terminal server can do the job. Terminal server gets the IP traffic and sends the DNP payload on the serial side. Conversely, it gets the DNP packets on the serial link and embeds in the IP envelopes to transmit over the IP link.

Successful Modbus TCP Simulation (Master and Slave) using Modpoll + KepserverEx + Mod_RSsim

had a chance to play with a powerful Modbus TCP/RTU simulator from Mod_RSsim.. the Mod_RSsim acts as Modbus TCP Master while Modpoll DOS application acts as Modbus TCP Client. I further tested with KepserverEx and manage to get the Modbust TCP OPC Server up and running !! Screenshots below for your reference...