Ilovepdf Merged
Ilovepdf Merged
Ilovepdf Merged
Introduction
Introduction
• Modbus is a serial communications protocol originally published
by Modicon (now Schneider Electric) in 1979 for use with its
programmable logic controllers (PLCs).
• Simple and robust, it has since become a de facto standard
communication protocol, and it is now a commonly available
means of connecting industrial electronic devices.
Its Application ?
• Used to establish master-slave/client-server communication between
intelligent devices
• Modbus ASCII
• Modbus RTU (Remote Terminal Unit)
– Modbus RTU uses RS-485 or RS-232
• Modbus TCP/IP
– Modbus TCP uses Ethernet
• Modbus ASCII and Modbus RTU are simple serial protocols that use RS-232 or RS-
485 to transmit data packets.
• Modbus TCP/IP follows the OSI Network Model and can be used in an ordinary
Ethernet network
• Modbus RTU (Remote Terminal
Unit) and ACSII
Communication between MODBUS devices
• MODBUS devices communicate using a master-slave technique in
which only one device (the master) can initiate transactions (called
queries).
Basic Modbus
Transaction
Modbus frames:
• The messages exchanged between the master and the slave are called
frames.
• There are two types of Modbus frames: Protocol Data Unit (PDU) and
Application Data Unit (ADU).
• The FC -> action to perform and the data -> information to be used for
this action.
How is data stored in Standard Modbus?
• The master must routinely poll each field device, and look for changes
in the data.
• Source :http://stackoverflow.com/questions/22523716/modbus-slave-count-
limitation
• Source : http://www.control.com/thread/1369186948
(Modbus Over Serial Line V1.02", page 8, Section 2.2 Modbus Addressing
rules, "from 248 to 255: Reserved“)
Accessing The Data
• 16-bit Unsigned Registers And Single-bit Coils
• Input Registers And Holding Registers
• Input Coils And Status Coils
• Response
• 11 01 05 CD6BB20E1B 45E6
• 11: The Slave Address (11 hex = address17 )
01: The Function Code 1 (read Coil Status)
05: The number of data bytes to follow (37 Coils / 8 bits per byte = 5 bytes)
CD: Coils 27 - 20 (1100 1101)
6B: Coils 35 - 28 (0110 1011)
B2: Coils 43 - 36 (1011 0010)
0E: Coils 51 - 44 (0000 1110)
1B: 3 space holders & Coils 56 - 52 (0001 1011)
45E6: The CRC (cyclic redundancy check).
• Read Holding Registers (FC=03)
• Request
• This command is requesting the content of analog output holding registers # 40108
to 40110 from the slave device with address 17.
• Response
• 11 03 06 AE41 5652 4340 49AD
• 11: The Slave Address (11 hex = address17 )
03: The Function Code 3 (read Analog Output Holding Registers)
06: The number of data bytes to follow (3 registers x 2 bytes each = 6 bytes)
AE41: The contents of register 40108
5652: The contents of register 40109
4340: The contents of register 40110
49AD: The CRC (cyclic redundancy check).
MODBUS Transmission Mode
•Any delay between bytes will cause Modbus RTU to interpret it as the start of a
new message.
• Modbus ASCII marks the start of each message with a colon character " : " i.e.,
(hex 3A).
• The end of each message is terminated with the carriage return and line feed
characters (hex 0D and 0A). The only allowable characters for all other fields are
hexadecimal 0-9 & A-F.
• One should be aware that all nodes within one MODBUS network must be of the
same transmission mode, meaning MODBUS ASCII cannot communicate with
MODBUS RTU and vice versa.
Modbus ASCII vs Modbus RTU
ModBus RTU Frame Format
MODBUS PROTOCOL ON OSI
MODEL
Application Modbus Application Layer
Presentation
Session
Transport
Modbus Messaging on
TCP/IP
Network TCP
IP
Rx Tx
Tx Rx
GND GND
Electrical Signals
•Half Duplex
Master Slave A
Rx
Tx
Rx
Slave B
Rx
Tx
Master / Slaves State Diagrams
After sending
a request, the Master leaves the "Idle" state, and cannot
send a second request at the same time
Processing
reply
When a unicast request is sent to a slave, the master goes into "Waiting
for reply" state, and a “Response Time-out” is started.
Presentation
Session
Transport
Modbus Messaging on
TCP/IP
Network TCP
IP
In general, Modbus TCP/IP uses TCP/IP and Ethernet to carry the data
of the Modbus message structure between compatible devices.
Modbus TCP/IP Client/Server Model
· MODBUS Request,
· MODBUS Confirmation,
· MODBUS Indication,
· MODBUS Response
Modbus TCP/IP Client/Server Model
Request Indication
MODBUS
MODBUS Client Server
Confirmation Response
•Transaction identifier is supplied by the client is used to keep track of specific request.
•The server is to send back the same identifier in its response.
•Length field identify length of all remaining fields including PDU.
•Unit identifier provides address of the Modbus serial line slave that must be accessed
through gateway.
The Modbus commands and user data are encapsulated into the data container
of a TCP/IP telegram without being modified in any way.
Modbus TCP/IP Data Frame
Modbus
Length
Function
Data
TCP/IP
Protocol Unit ID
Transaction
Identifier
Identifier Field
Code
Frame
The Modbus error checking field (checksum) is not used, as the standard Ethernet
TCP/IP link layer checksum methods are used.
The Modbus Address field is replaced by the unit identifier in Modbus TCP/IP,
Modbus TCP/IP Data Frame
MBAP
Modbus
Function
Data TCP/IP
Protocol Length Unit ID Code
Transaction
Identifier
Identifier Field Frame
This is important because, in MODBUS TCP, the server can handle many requests
at the same time. This is not possible in MODBUS Serial.
Request
MODBUS Client
(Initialized by the MODBUS Server
Client)
Transaction
Transaction Identifier
Identifier
Modbus TCP/IP Data Frame
MBAP
Modbus
Function
Data TCP/IP
Protocol Length Unit ID Code
Transaction
Identifier
Identifier Field Frame
Protocol Identifier – This field is always 0 for Modbus services and other values
are reserved for future extensions
Modbus TCP/IP Data Frame
MBAP
Modbus
Function
Data TCP/IP
Protocol Length Unit ID Code
Transaction
Identifier
Identifier Field Frame
Length - The length field is the size of the following fields, including the Unit
Identifier ,Function Code , data fields.
Modbus TCP/IP Data Frame
MBAP
Modbus
Function
Data TCP/IP
Protocol Length Unit ID Code
Transaction
Identifier
Identifier Field Frame
Each layer on the sending stack communicates with the corresponding layer
of the receiving stack through information stored in headers
As you move the data down the stack of the sender, each stack layer adds its
own header to message
The higher layers are encapsulated by the lower layers
Application User
Data (ADU) IP
Network
Application User
Data (ADU) Ethernet
Data Link
Physical
PROFINET
ECCE5231 2
PROFINET- Introduction
• PROFINET is 100% Ethernet-compatible as defined in IEEE Standards. With
PROFINET, the following minimum data communication requirements are
automatically established:
• 100 Mbps data communication with copper or fiber optic transmission (100 Base TX
and 100 Base FX)
• Full duplex transmission
• Switched Ethernet
• Auto-negotiation (negotiating of transmission parameters)
• Auto-crossover (sending and receiving lines are crossed in the switch)
• Wireless communication (WLAN and Bluetooth)
• PROFINET uses UDP/IP as the higher-level protocol for demand-oriented
data exchange
ECCE5231 3
PROFINET- Introduction
• The four key functions of PROFINET are:
• Performance: automation in real time
• Safety: safety-related communication with PROFIsafe
• Diagnostics: high plant availability due to fast commissioning and
efficient troubleshooting
• Investment protection: seamless integration of fieldbus systems
ECCE5231 4
PROFINET Communication Channels
• There are three Communication Channels in
PROFINET: Real-Time (RT), Non-Real-Time (NRT),
and Isochronous Real-Time (IRT).
• There are two main problems using the entire
OSI stack for all communications:
1. Each layer of the stack means extra work has
to be done to pack and unpack the
PROFINET data at the source and destination
2. Using the Network Layer adds some
transmission delay between the sender and
receiver,
• Both of these issues add to delays called
“latency” (lag) and “jitter” on the network.
ECCE5231 5
• Latency is a predictable delay between a transmitter and receiver. On large networks, it may be on the
order of 10 – 100 ms.
• Jitter is the variance in latency from one packet to the next
ECCE5231 6
Real Time (RT) Channel
• Latency and jitter are bad news for a “real time” industrial
automation protocol. So PROFINET designed the “Real Time”
channel to try to reduce both of those values.
• The RT channel skips the encapsulation steps in the Network,
Transport and Session layers. This means that the frames
exchanged over the RT channel have both low latency and low
jitter, but there’s a real drawback, too: there’s no IP address. And
that means that RT frames can’t be routed between LANs.
ECCE5231 7
Non Real Time (NRT) Channel
ECCE5231 9
Isochronous Real-Time (IRT) Communication
Each switch on the network requires two things to create the time slices and work in an IRT domain:
1. A shared and extremely accurate clock to determine when to enter the IRT time slice and when to
return to normal Ethernet operation.
2. Additional circuitry in the network switch to buffer and hold any stray Ethernet traffic that is received
on other ports during the IRT time slice.
The shared clock is provided by an IEEE standard, known as IEEE 1588v2 (or IEEE 1588-2008). This standard
defines the Precision Time Protocol (PTP), and PROFINET extends PTP in a wrapper protocol called the
Precision Transparent Clock Protocol (PTCP). PTCP is used to not only share a common real-time clock
across the network, but is also used to compute the delays inherent in both the network switches and the
cabling between them. IRT devices are capable of calculating those delays down to the nanosecond, and
that accuracy is what allows all of the switches in the IRT network to enter and exit the IRT time slice at
exactly the same time. ECCE5231 10
Conformance Classes
CC-C describes the basic functions for devices with hardware-supported bandwidth
reservation and synchronization (IRT communication) and is thus the basis for
isochronous applications
ECCE5231 11
Conformance Classes
CC-A CC-B CC-C
Functionality Real-Time Real-Time Real-Time
Cyclic IO Cyclic IO Cyclic IO
Parameter Parameter Parameter
Alarms Alarms Alarms
Network diagnostics Networkdiagnostics
Topology information Topologyinformation
System redundancy Reserved bandwidth
Synchronization
Certification Controller Controller Controller
Devices Devices Devices
Infrastructure Infrastructure
Cabling Copper Copper Copper
Fiberoptics Fiberoptics Fiberoptics
Wireless
Typical Applications Infrastructure Factory Automation Motion Control
Building Automation Process Automation
ECCE5231 12
Real Time Classes
• Real-time frames are automatically prioritized in PROFINET compared to UDP/IP
frames. This is necessary in order to prioritize the transmission of data in switches
to prevent RT frames from being delayed by UDP/IP frames.
• PROFINET IO differentiates the following classes for RT communication.
• RT_CLASS_1 = Unsynchronized RT communication within a subnet (for CC-A and CC-B).
Industrial standard switches can be used in this RT class.
• RT_CLASS_2 = frames can be transmitted via synchronized IRT or unsynchronized RT
communication (depreciated and not used today) Ethernet controller/switch with support of
isochronous operation is required in this RT class.
• RT_CLASS_3 = IRT Synchronized IRT communication within a subnet (used when motion or
high speed applications are necessary, CC-C). Ethernet controller/switch with support of
isochronous operation is required in this RT class
• RT_CLASS_UDP = The unsynchronized RT cross-subnet communication between different
subnets over UDP/IP (with this RT can be sent via a router, not used much up to now).
Industrial standard switches can be used in this RT class.
ECCE5231 13
PROFINET Node Roles
Controllers and Supervisors sit closer to an operator and aggregate information from Devices. Supervisors only
interact with controllers or devices when directed to by a user application. On the other hand, controllers interact
with devices on a regular basis as part of their normal operation.
ECCE5231 14
PROFINET Node Roles
• Devices are stand-alone units designed to communicate real-time information to
a Controller. They don’t don’t try to communicate with other devices directly.
Instead, they report their real-time (cyclic) data directly to a Controller and may
send some alarm or diagnostic (acyclic) data to a Supervisor.
• Controllers are aggregators for real-time (cyclic) data sent by one or more
Devices. They keep up not only with a device’s real-time data, but they collect
information about each device’s maintenance status, collect alarm messages, and
make all of that information available to an end-user. Controllers are typically
PLCs, PC software applications, or high-end HMIs.
• Supervisors are similar to Controllers, but they don’t have access to the real-time
data from any Device. Supervisors are not part of the daily operation of a
PROFINET network. Instead, end users may use a Supervisor to do things like read
diagnostic information from a Device, assign IP addresses or DCP station names,
or troubleshoot a problematic network connection.
ECCE5231 15
PROFINET Supervisors and Supervisor
Takeover
ECCE5231 16
IO-Device
An IO-Device is composed of slots and subslots. The modules located in the slot or subslot can have one or
several channels. The channel defines the amount of input and output data to be transmitted.
ECCE5231 17
What is a GSD file?
• A PROFINET General Station Description (GSD) file is a description of an IO
device provided by the device manufacturer. The contents of the GSD consists
of configuration information, parameters, modules, diagnostic and alarms,
and vendor and device identification
• The GSD file is a standardized way of describing the device information to the
engineering tool and the IO controller (PLC/PAC/DCS) and can work across a
variety of engineering tools as a standard set of device information.
ECCE5231 18
PROFINET Device Parameters
• Standard Parameters
• F-Parameters (Failsafe Parameters)
• Dynamic Parameters ( iParameters)
• iPar-Server
ECCE5231 19
Topology
• PROFINET supports the following topologies for Ethernet
communication:
• Line topology, which primarily connects terminals with integrated switches in
the field .
• Star topology, which requires a central switch located preferably in the control
cabinet.
• Ring topology, in which a line is closed to form a ring in order to achieve
media redundancy.
• Tree topology, in which the topologies indicated above are combined.
ECCE5231 20
Addressing
ECCE5231 21
Addressing
Name
• Each PROFINET device has a name associated with it. The name is normally used to describe its position or
purpose in the process.
• PROFINET names are similar to DNS names in that the name is broken into components, each separated by a
period.
• Assigning names to the devices either using a tool with an “Assign name” function or from the PLC options (if
automatic PLC name assignment is supported) is a must.
• Below are the name restrictions.
• Limit of a total of 240 characters (letters "a" to "z", numbers "0" to "9", hyphens, periods).
• A name component within the device name, a character string between two periods, for example, must not be longer than 63
characters. A name cannot use more that 63 characters without using a period.
• No special characters like umlauts, parentheses, underscore, slash, space etc. The hyphen “-” is the only special characters
allowed.
• The device name must not contain uppercase letters.
• The device name must not begin nor end with the "-" or "." character.
• The device name must not begin with a number.
• The device name must not have the form "n.n.n.n" (n = 0...999). Specifically, do not use an IP address in the name.
• The device name must not begin with the character string "port-xyz-" (where x,y,z = 0...9).
ECCE5231 22
DCP (D iscovery and basic Configuration Protocol)
• It is a Data Link Layer based protocol used by the engineering tool and controller to discover
devices, identify device information, and configure device names and IP addresses. It is restricted
to one subnet and mainly used in small and medium applications without an installed DHCP
server.
• PROFINET DCP offers following services as the main functions
• Identify All
• Identify
• Set
• Set – Flash
• Set – Reset to Factory
• Get
• Hello
• Some of these services use a multicast message which means it goes to a group of PN devices and
some use a unicast message which goes only to a specific device.
• DCP services are integrated into PROFINET engineering tools, diagnostic tools, controllers, and
devices.
ECCE5231 23
DCP (D iscovery and basic Configuration Protocol)
ECCE5231 24
DCP (D iscovery and basic Configuration Protocol)
ECCE5231 25
DCP (D iscovery and basic Configuration Protocol)
ECCE5231 26
Link Layer Discovery Protocol (LLDP)
• A device which supports LLDP will send a message to their
neighbor stations on each switch port every few seconds to
identify itself and give network related information. This is
then stored in a data table known as the
Discovery Management Information Base (MIB).
• Discover, check, and maintain the topology of the PROFINET
network and obtain diagnostics if something changes.
• Easy device commissioning when setting up the network
• Simple device replacement in case any device fails.
• Share network line and switch delays for high speed motion
applications.
ECCE5231 27
SNMP(Simple Network Management Protocol)
• SNMP(Simple Network Management Protocol) has established itself as the de
facto standard for maintenance and monitoring of network components and their
functions.
• SNMP can read-access network components, in order to read out statistical data
pertaining to the network as well as port-specific data and information for
neighborhood detection.
• In order to monitor PROFINET devices with an established management system,
implementation of SNMP is mandatory for devices of Conformance Classes B and
C.
ECCE5231 28
Sources
• https://profinetuniversity.com/
• https://www.felser.ch/profinet-manual/conformance.html
ECCE5231 29