modbus protocol - wayne state universityhzhang/courses/8260/lectures/chapter 10 - modbus... · •...

44
Modbus Protocol Chapters 10 in the Textbook Professor: HONGWEI ZHANG CSC8260 Winter’2016 Presented By: Priyank Baxi (fr0630) [email protected]

Upload: lethien

Post on 15-Oct-2018

286 views

Category:

Documents


4 download

TRANSCRIPT

Modbus Protocol

Chapters 10 in the Textbook

Professor: HONGWEI ZHANGCSC8260 Winter’2016

Presented By: Priyank Baxi (fr0630)[email protected]

Outline

• Overview• Modbus Protocol• Modbus over Serial line• Modbus/TCP• Gateway and Similar Devices• Modbus as Part of the CIP Stack in ODVA• Modbus on other Stack

Outline

• Overview• Modbus Protocol• Modbus over Serial line• Modbus /TCP• Gateway and Similar Devices• Modbus as Part of the CIP Stack in ODVA• Modbus on other Stack

History of Modbus Protocol

• The Modbus protocol was created in 1978 by Modicon Inc. as a simple way for communicating control data between controllers and sensors using an RS232 port.

• The protocol became widely adopted, quickly reaching the status of de facto standard in the industrial automation field.

Modbus Communication Stack

Example of Modbus Network

Features

• Simple to implement• Small footprint• Scalable in complexity, scope, and range• It is simple to administer and enhance• Open and low cost• Connectivity• Installed base, experience, and tools

Outline

• Overview• Modbus Protocol• Modbus over Serial line• Modbus/TCP• Gateway and Similar Devices• Modbus as Part of the CIP Stack in ODVA• Modbus on other Stack

Modbus Protocol

• The transfer of information between a Modbus client and a Modbus server is initiated when the client sends a request to the server to transfer information, to execute a command, or to perform one of many other possible functions.

• After the server receives the request, it executes the command and/or prepares the required data. The server then responds to the client by acknowledging that the command is complete and/or providing the requested data.

Client-Server Messaging

APDU

• APDU stands for Application Protocol Data Unit

Client Server Interaction

• The interactions can be of two types:1. Broadcast (unconfirmed)2. Unicast (confirmed)

Broadcast

Unicast with Normal Response

Unicast with Exception Response

State Machine

Client State Machine

Server State Machine

Data Types

• Discrete• Coil• Input Register• Holding Register

Function CodesService identifiers:• Publicly assigned function codes. These function codes are either

assigned to a standard service or reserved for future assignment. The function codes currently assigned to a standard service

• User-definable function codes. These function codes can be used for experimentation in a controlled laboratory environment. They must not be used in an open environment. There are two ranges: FC 65 (0x41) to 72 (0x48) included and 100 (0x64) to 110 (0x6E) included.

• Reserved function codes. These function codes are currently used by some companies for legacy products and are not available for public use.

Outline

• Overview• Modbus Protocol• Modbus over Serial line• Modbus /TCP• Gateway and Similar Devices• Modbus as Part of the CIP Stack in ODVA• Modbus on other Stack

Modbus over Serial line

OSI Layer for Serial line

Modbus Serial line PDU

Modbus Message RTU Framing

• A Modbus message is placed by the transmitting device into a frame that has a known beginning and ending point. This allows devices that receive a new frame to begin at the start of the message and to know when the message is completed. Partial messages must be detected and errors must be set as a result.

ASCII Transmission Mode

• When devices communicate on a Modbus serial line using the ASCII mode, each application message octet is sent as two ASCII characters on the wire, that is, it will require two characters on the wire.

• This mode is used when the capabilities of the device do not allow the conformance with RTU mode requirements regarding timers’ management.

• This mode is less efficient than RTU since each application message octet needs two characters on the wire.

Outline

• Overview• Modbus Protocol• Modbus over Serial line• Modbus /TCP• Gateway and Similar Devices• Modbus as Part of the CIP Stack in ODVA• Modbus on other Stack

Modbus TCP Stack

TCP/IP Encapsulation

Role of Transaction ID• A client requests a service on the set of its addressable

servers with the help of the transaction ID,managed(created and destroyed) by the client.

• The transaction mechanism is exposed at the application layer due to the client/server possibility of having more than one outstanding request at a time, with the consequent need to properly associate requests and confirmations. It also controls the maximum number of such requests, which could be 1.

• The capabilities of a client/server application layer client depend on lower layers and on the particular implementation; these factors are captured in the configuration of the transaction mechanism allowing programmatic adaptation.

Unit ID and Gateways

• On TCP/IP, when no gateways or IP collocated application entities are involved, the client and the server are the intended end points of the connection, and they are fully identified using the IP address.

• In this case, the unit ID may be ignored by the server, and the client should set it to the value of 255.

TCP as a Streaming Protocol

• The streaming nature of the TCP protocol allows for cases where the server received only a partial transaction, according to a valid length. The server must be able to buffer the partial transaction and wait for the remaining payload. The server may implement mechanisms, for example, via a timer, to reclaim resources if the wait exceeds a configured time.

Modbus /TCP request in Client Flowchart

Modbus /TCP request in Client Flowchart

Outline

• Overview• Modbus Protocol• Modbus over Serial line• Modbus /TCP• Gateway and Similar Devices• Modbus as Part of the CIP Stack in ODVA• Modbus on other Stack

Gateway and Similar Devices

• Gateways involving Modbus have been around for a very long time, and new ones keep being developed, with Modbus being the common second protocol available side by side other protocols, or providing the gateways between different Modbus stacks.

• The gateway between Modbus serial and Modbus/TCP, a very successful one, enabled many legacy products to ride the TCP/IP wave without having to be replaced or left behind.

• Overview• Modbus Protocol• Modbus over Serial line• Modbus /TCP• Gateway and Similar Devices• Modbus as Part of the CIP Stack in ODVA• Modbus on other Stack

Modbus CIP Stack in ODVA

Outline

• Overview• Modbus Protocol• Modbus over Serial line• Modbus /TCP• Gateway and Similar Devices• Modbus as Part of the CIP Stack in ODVA• Modbus on other Stack

Modbus on other Stack

• Modbus has been architected and deployed on several stacks, like power line carrier stacks, many 802.15.4 stacks, and cellular.

THANK YOU