Protocols and Networks - Device Bus -
- Field Bus -
- Data Bus -
- Data Bus -
Recall
MODBUS protocol is a messaging structure used to set up
master/client type communications with slaves/servers between intelligent devices
It is a protocol with one master and no direct communication from slave to slave
slave to slave
MODBUS PLUS is an industrial networking system that uses token- passing peer-to-peer communications at data transfer rates of one megabits per second;
megabits per second;
It uses the MODBUS messaging structure to establish multi-master communication.
communication.
Modbus TCP/IP
MODBUS TCP/IP uses TCP/IP and Ethernet up to 1 Gbits/s to carry the MODBUS messaging structure.
the MODBUS messaging structure.
APPLICATION
7 Modbus
PRESENTATION
SESSION 6
5
EMPTY
EMPTY SESSION
TRANSPORT 5
4
EMPTY
TCP
NETWORK
LINK = LLC + MAC 3
2 CSMA/CD
IP
LINK = LLC + MAC
PHYSICAL 2
1
CSMA/CD
Ethernet V2 or 802.3
OSI Correspondence to the TCP/IP Layer Model
Few working networks are implemented on the OSI Model
TCP/IP Layer Model – Developed
OSI Model Application
TCP/IP Layer Model – Developed before the OSI
It’s simpler and has fewer layers
Application Service Layer
TCP/IP Model Application
Presentation Session
The TCP/IP Layer model:
Application Service Layer – Provides the functionality of the
Service Layer Service Provider Layer (Host-to-Host)
Internetwork Layer
Session Transport
Network
Provides the functionality of the
Application, Presentation and Session layers
Service Provider – Matches the Transport Layer. Called “Transport
Layer
Subnetwork Layer
(Network Access Layer)
Data-Link Physical Physical
Transport Layer. Called “Transport Layer.”
Internetwork Layer – Matches the OSI Network Layer. Called the
“Network Layer”.
“Network Layer”.
Subnetwork Layer – Includes the OSI Data Link and Physical Layers
Data Movement
User application requests information from a PLC
A Modbus message is formed
A Modbus message is formed in the “Modbus” layer
Starting register, block length ….
Message is encoded, sent
Application PLC
Message is encoded, sent
received and passed to the PLC
Information is sent back to application following the same
Modbus
Service Provider
TCP
Modbus
Service Provider application following the same procedure
Service Provider Layer (Host-to-Host)
Internetwork Layer
Subnetwork Layer
TCP IP
Service Provider Layer (Host-to-Host)
Internetwork Layer
Subnetwork Layer Subnetwork Layer
(Network Access Layer)
Modbus TCP/IP
Subnetwork Layer
(Network Access Layer)
Modbus TCP/IP
Modbus TCP/IP Network Media - Coaxial Cable
Coaxial Cable - Two types used
Coaxial Cable - Two types used
Thin – 10Base2 networks
Thick 10Base5 networks
Point to Point - If a single connection
Point to Point - If a single connection fails, the entire network fails
Thin coaxial cable is known as RG58 It is used in thin ethernet (10Base2) installations 185 metres maximum segment length
50 centimetres minimum distance between connection points
Thin Coax 185 metres maximum segment length between connection points
Maximum 30 connections per segment 5 centimetres minimum bend radius Uses BNC (Bayonet-Neil Concelman)
connectors External diameter of +/- 4.9 millimetres
Thick coaxial cable is known as RG8 It is used in thick ethernet (10Base5) installations 2.5 metres minimum distance between
Thin Coax
500 metres maximum segment length
2.5 metres minimum distance between connection points
Maximum 100 connections per segment 25 centimetres minimum bend radius Uses a viper tap to connect backbone to
network interface card External diameter of +/- 10.29 millimetres
Thick Coax
Modbus TCP/IP Network Media - Twisted Pair
Used increasingly, even at 100 Mbps
UTP - Insulated pairs of copper wires twisted together Multiple colour-coded pairs enclosed in a plastic sleeve Faster than coaxial cable
STP - Indivisible pairs enclosed in a shielding with aluminium foil
Category 5 (Cat 5) – The most common for IT networks Cat 5 = 100 Mbps (specification pending)
Cat 3 = 10 Mbps Uses RJ45 connector
Unshielded twisted pair is known as UTP It is currently available in 5 different categories (Cat 1 to 5) Cat 5 UTP is used in 10BaseT, 100BaseT,
Uses RJ45 connector
Cat 5 UTP is used in 10BaseT, 100BaseT,
gigabit and token ring Cat5 is the most popular installation choice presently Cat6 is being developed for the next
generation of installations 100 meteres maximum segment length Uses RJ45 plugs and sockets
Overbending the cable increases cross-talk between the 8 wires
Uses RJ45 plugs and sockets the 8 wires
Modbus TCP/IP Network Media - Optical Fibres
Three component parts:
Core
– Carries the light beam (glass or plastic)Cladding
– Glass tube which reflects any interference light in the coreCladding
– Glass tube which reflects any interference light in the coreCoating –
Protects the core and the optical claddingMultimode fibre is the most popular type as it is the least expensive and easier to use.
Optical Fibres
Single-mode fiber is a higher performance, longer distance and more expensive technology than multimode fiber.
Multi-mode fiber is generally limited to one or two kilometers in length, depending on the application.
Fibre Optic Connectors
ST Connector
• Industrial equipment uses both ST an SC type
both ST an SC type connectors
• ST connectors have a bayonet type lock
SC Connector SC Connector
Transmission media
Ethernet is available on three types of medium:
Name Description Speed Max. Max. no. of Name Description Speed Max.
length
Max. no. of stations/segment 10 base 5 Thick Ethernet 10 Mbps 500 m 100
Coaxial cable cable
10 base 2 Thin Ethernet 10 Mbps 185 m 30 10 base T Twisted pair 10 Mbps 100 m 1024 Shielded
twisted twisted
pair 100 base TX Twisted pair cat. 5 100 Mbps 100 m ? ? ? 10 base F 2 fibres 10 Mbps 2000 m 1024 Optical
fibre fibre
100 base FX 2 fibres 100 Mbps 2000 m ? ? ? Radio wireless
Modbus TCP/IP Physical Layer
Topology: Free
Bus, star, tree or ring Bus, star, tree or ring
Maximum distance : Depends on medium and speed Minimum: 200 m on 100 base TX
Maximum: 40,000 m on 10 base F
Speed: 10 Mbps - 100 Mbps - 10 Gbps 10 Gbps in office automation
Max. no. of devices: Depends on medium
Minimum: 30 per segment on 10 base 2
Minimum: 30 per segment on 10 base 2
Maximum: 1024 on 10 base T or 10 base F
Transport network link layers
Medium access method: CSMA/CD
(Carrier Sense Multiple Access with Collision Detection)Collision Detection)
The stations listen to the transmission medium and wait until it is free to send.
If a collision is detected, each station continues to send in order that the collision is If a collision is detected, each station continues to send in order that the collision is seen by the entire network.
The stations resend their message after a random period of time has elapsed.
Modbus TCP Application Layer - Frame
ADU (Application Data Unit)
Address Function Data Checksum Modbus frame
PDU (Protocol Data Unit)
Address Function Data Checksum
Modbus TCP frame
ADU (Application Data Unit)MBAP Function Data
PDU (Protocol Data Unit) MODBUS Application Protocol Header
Frame Identifier Protocol Identifier Size Unit Identifier
2 bytes 2 bytes 2 bytes 1 byte
Modbus = 0 Modbus Address
Modbus = 0 Modbus Address
Modbus TCP Application Layer - Conformance Class
Class 0
read multiple registers (#03)
write multiple registers (#16)
Machine/vendor/network specific functions
write multiple registers (#16)
Class 1
read coils (#01)
diagnostics (#08)
program (484) (#09)
poll (484) (#10)
get comm event counters (Modbus) (#11)
read input discretes (#02)
read input registers (#04)
write coil (#05)
write single register (#06)
get comm event counters (Modbus) (#11)
get comm event log (Modbus) (#12)
program (584/984) (#13)
poll (584/984) (#14) report slave ID (f#17)
write single register (#06)
read exception status (#07)
Class 2
force multiple coils (#15)
report slave ID (f#17)
program (884/u84) (#18)
reset comm link (884/u84) (#19)
program (ConCept) (#40)
force multiple coils (#15)
read general reference (#020)
write general reference (#021)
mask write register (#022)
program (ConCept) (#40)
firmware replacement (#125)
program (584/984) (#126)
report local address (Modbus) (#127)
mask write register (#022)
read/write registers (#023)
Modbus TCP/IP-ETHERNET DATA PACKET
Modbus TCP Application Layer – Frame (example)
Protocol PPP (Point-to-Point Protocol, RFC 1661) can be used to transfer data – other protocol frames - inside the PPP pocket
other protocol frames - inside the PPP pocket
Frame PPP Frame PPP
Frame IP
Frame TCP Frame TCP
Frame Modbus
Modbus TCP Application Layer – Frame (example)
IP Protocol ID
|0||21|
|45||0||0||34||0||7d||40||0||80||6||40||1d||a||74||11||bb||d9||62||c4||98|
Ver|
IHL TOS
Size ID Flags|o ffset TTL
TCP Protocol
Check-
sum Source Addres
Dest.
Addres
|45||0||0||34||0||7d||40||0||80||6||40||1d||a||74||11||bb||d9||62||c4||98|
Port 502
TOS Protocol
ID
Source Port
Dest.
Port
Sequence no
Ack. no
Header size| Flags
Window
Data index
PPP pocket IP
TCP
|16||2e||1||f6||c||d||a||c||30||80||4b||be||50||18||ff||ff||49||45||0||0|
Sequence no Window size
Check sum Frame ID
Protocol
Size Start Address
Size
TCP pocket
Modbus pocket
|0||1||0||0||0||6||1||3||0||c7||0||5|
FCS Protocol
ID
Unit ID Function
Address
|cb||9b|
FCS
MBAP First word
address = 199 Function
code = 3
Number of words to read = 5
7 bytes 1 byte 2 bytes 2 bytes
address = 199
code = 3 words to read = 5
Ports & Sockets
TCP multiplexes multiple connections to a single host using sockets and ports
Network Device single host using sockets and ports
Each computer interface is divided into 65536 ports.
Incoming packets know the address (IP) and the port
Ports
Network Device (IP address: a.b.c.d)
and the port
Destination port is part of the TCP protocol field
Ports are numbered and are like a pigeon hole mail
80
502 hole mail
Mail for a specific person is only delivered to a single hole
SMTP (Simple Mail Transfer Protocol) goes to port 25
25 goes to port 25
HTTP goes to port 80
Modbus TCP -> port 502
Sockets – The combination of an IP address and a port number
HTTP
25
Modbus TCP
and a port number SMTP
Ports & Sockets
21TCP File Transfer - FTP control
22TCP SSH Remote Login Protocol 22UDP pcAnywhere
22UDP pcAnywhere
23TCP Telnet
25TCP Simple Mail Transfer Protocol (SMTP) RFC 821.
37TCP UDP Time Protocol RFC 868.
37TCP UDP Time Protocol RFC 868.
53TCP UDP Domain Name Server (DNS)
67TCP UDP Bootstrap Protocol Server
68TCP UDP Bootstrap Protocol Client (BOOTP) RFC 951.
68TCP UDP Bootstrap Protocol Client (BOOTP) RFC 951.
80TCP Hypertext Transfer Protocol (HTTP) RFC 2616.
110TCP UDP Post Office Protocol (POP) Version 3 RFC 1939.
137TCP UDP NetBIOS Name Service
137TCP UDP NetBIOS Name Service
138TCP UDP NetBIOS Datagram Service
139TCP UDP NETBIOS (Session Service) Windows file and printer sharing.
143TCP UDP Internet Message Access Protocol (IMAP) Mail Server IMAP
143TCP UDP Internet Message Access Protocol (IMAP) Mail Server IMAP
161TCP UDP Simple Network Management Protocol (SNMP)
162TCP UDP SNMPTRAP
Modbus TCP/IP - summary
Medium access method: CSMA/CD
Determinism: Resolved using segmentation Load factor < 10%
Transmission method: In packets
or IP datagrams, 64 to 1500 bytes
Max. size of useful data: 1442 bytes per packet (APDU) Transmission security: CRC32 at link layer level
Transmission security: CRC32 at link layer level
Acknowledgement at TCP link level
Response at application level
(Modbus)Example of Architecture
Redundant optical ring 200 Mbps full duplex
Switch Switch Switch
Premium Transceiver
Quantum
Optical loop
Hub Transceiver
Optical fibre
Optical loop
Hub
Quantum Momentum Magelis Momentum Altivar 58 Altistart 48 Altivar 38 Momentum Altivar 58
Example of Architecture
I/O scanning on Momentum CPU
16 distributed I/O modules I/O modules
Example of Architecture
Modbus TCP/ Modbus RTU Brigde (Gateway)
About 250 power meters and controllers on modbus RTU