28. PLC Data Communication

• We need to be able to connect computers to transfer information.

• Basic Communication Categories

Interface to Sensors and Actuators

Uses readings from sensors to control devices in the environment
very simple protocols, but often requires specialized hardware and software.

Interface to computers

uses machine to machine connection for direct communication
can appear to be like a local area network
low speeds (eg. 300 baud, 1.2, 2.4 9.2 Kbaud)

Local Area Computer Networks

measured in distances from meters to kilometers
speed measured in Megabits/sec
medium includes, wire, fibre-optics, radio frequency
commonly available in all forms
inexpensive

Wide Area Computer Networks

from city wide, to global
speed measured in Kilobytes/second
medium includes, wire, fibre optics, satellite, microwave
access is costly (some mix of initial and variable costs), and geared to large corporations, or special applications.

• Classification of Interconnected processors (by Physical Size)

Table 1:

Inter-processor Distance

Processors Located in Same

Example

0.1 m

Circuit Board

Data flow machine

1 m

System

Multi-

processor

10 m

Room

Local

network

100 m

Building

1 km

Campus

10 km

City

Long haul network

100 km

Country

1000 km

Continent

Inter-

connection of long haul networks

10000 km

Planet

28.1 The History

Late 50’s

Bell introduces data communication networks
Texaco uses remote monitoring and control for automating polymerization plant.

Early 60’s

World wide use of data phone system to link airports for maintenance
Many uses of terminals for inputting and displaying data.

Mid 60’s

Uses of computer for large scale test monitoring
NC part programming being done remotely on time sharing mainframes.

70’s

Advent of Mini computers made it possible for companies to have multiple computers which had to communicate.

80’s

Microprocessor drops cost of computers dramatically, and automated machines become very common
Personal computers, and automated machinery start a trend to network small computers networked with large computers
28.2 PLC Communication

• Interfacing describes a broad group of methods that allow us to pass data between computers and other devices.

• To connect PLCs for communication, we first need connecting wires. This is the followed by a communication protocol.

 

• There are a few common methods of interfacing,

serial: a single point to point connection allows data communication over a small number of wires (eg. RS-232)

parallel: multiple wires are used for data communication. This is only common for older data bus designs such as printer parallel port and GPIB buses.

network: networks allow multiple connections to pass data. These actually are built upon the basics of serial and parallel communications

28.3 Serial Communications

• Serial communication channels send data one bit at a time.

• These techniques are often slower, but are essential when transmitting using radio waves, telephone lines, or similar media.

• Serial lines have become one of the most common methods for transmitting data to instruments, and most personal computers now have two serial ports.

• Serial data can be transmitted two ways,

synchronous: all of the data bits are timed between sender and receiver.

asynchronous: the data bits arrive unannounced, without any coordination between sender and receiver. (this is the most common)

RS-232/RS-232C: the most common standard using voltage levels
RS-422a/423a/449: a current loop standard well suited to noisy conditions
RS-485: allows multiple talkers and listeners on one serial line (this can be the basis for a network)

• A typical data byte looks like the one below. The voltage/current on the line is turned on/off. The width of the bits determines the possible bits per second (bps). The value shown before is used to transmit a single byte.

 

• The bits shown correspond to,

before: this is a period where no bit is being sent and the line is high

start: a single bit to help get the systems synchronized

data: this byte could be 7 or 8 bits, but is almost always 8 now. The value shown here is 01001000 binary.

parity: this lets us check to see if the byte was sent properly. The most common choices here are no parity bit (just drop it out), or even parity, or odd parity. In this case there are two bits set. If we are using even parity the bit would be set. If we are using odd parity the bit would be off

stop: the stop bits allow form a natural pause at the end of the data.

after: a period of time where the line is high before the next byte.

• Typical electrical connections look like,

 

28.3.1 RS-232

• This standard is based on a high being +3 to +15V, and an off being -3 to -15V (+/-12V is commonly used).

• The typical connection scheme is shown below. notice that the lines are crossed between connectors. Also note that in some cases the dsr/dtr lines are not used. (Note: these are the lines used when connecting to a modem)

 

 

• The line names are,

TXD/RXD: (transmit data, receive data) these lines pass data one way from sender to receiver.

DSR/DTR: (data set ready, data terminal ready) these handshaking lines indicate when the remote machine is ready to receive data.

COM: a common ground to keep things from blowing up, etc.

• A cable that emulates a modem connection between two devices is shown below and is called a null modem cable.

 

• There are typically two connectors used for these devices. (Note: the connectors have very fine numbers on them)

 

• The main pin assignments for the DB-25 are,

Commonly used pins

1: GND (chassis ground)

2: TXD (transmit data)

3: RXD (receive data)

4: RTS (request to send)

5: CTS (clear to send)

6: DSR (data set ready)

7: COM (common)

8: DCD ()

20: DTR (data terminal ready)

Other pins

9: Positive Voltage

10: Negative Voltage

11: not used

12: Secondary Received Line Signal Detector

13: Secondary Clear to Send

14: Secondary Transmitted Data

15: Transmission Signal Element Timing (DCE)

16: Secondary Received Data

17: Receiver Signal Element Timing (DCE)

18: not used

19: Secondary Request to Send

21: Signal Quality Detector

22: Ring Indicator (RI)

23: Data Signal Rate Selector (DTE/DCE)

24: Transmit Signal Element Timing (DTE)

25: Busy

• The pin assignments for the DB-9 are,

1: DCD

2: RXD

3: TXD

4: DTR

5: COM

6: DSR

7: RTS

8: CTS

9: RI

• There are other settings such as half/full duplex.

• When communicating between two devices the setting must agree baud rate, stop bits, parity, data bits, full/half duplex, etc.

• The figure below shows a PLC connected to a data terminal with a serial line. This is followed by ladder logic to use the serial connection.

 

 

 

28.3.1.1 - ASCII Functions

• ASCII functions can be used to interpret and manipulate strings in PLCs.

• These functions include,

ABL(channel, control, )- reports the number of ASCII characters including line endings

ACB(channel, control, ): reports the numbers of ASCII characters in buffer

ACI(string, dest): convert ASCII string to integer

ACN(string, string,dest): concatenate strings

AEX(string, start, length, dest): this will cut a segment of a string out of a larger string

AIC(integer, string): convert an integer to a string

AHL(channel, mask, mask, control): does data handshaking

ARD(channel, dest, control, length): will get characters from the ASCII buffer

ARL(channel, dest, control, length): will get characters from an ASCII buffer

ASC(string, start, string, result): this will look for one string inside another

AWT(channel, string, control, length): will write characters to an ASCII output

Problem 28.1 Add the following numbers and store the results in ST10:2

ST10:0 “100”

ST10:1 “10”

ST10:2

28.3.2 American Standard Code for Information Interchange - ASCII

• While numbers are well suited binary, characters don’t naturally correspond to numbers. To overcome this a standard set of characters and controls were assigned to numbers. As a result, the letter ‘A’ is readily recognized by most computers world-wide when they see the number 65.

 

 

 

28.4 Parallel Interfaces

• This I/O port uses multiple data lines (one for each bit) and extra lines for handshaking.

• These cables can permit very high data transfer rates.

• Because of the extra conductors the cables are large, most costly, length limited and much less flexible

28.5 Networks for Communication

• A Network is a way of connecting different computers to allow data and message passing, and resource sharing.

• Early communication techniques included telegraphs (with morris code), telephones and teletypes.

• Advantages

allows shared computers and peripherals

provides communication and cooperation tools for people and computers

increases reliability by having alternate computers available

decreases isolation of many computers

• Disadvantages

more sophisticated hardware and knowledge required

additional costs

• Applications,

allows remote access to databases and libraries

electronic mail

distributed computational facilities

remote control of applications

28.5.1 Introduction

• The relationship between various network types is shown below

• The Star Network topology uses many connections to a central server

• When all computers are connected to the same network cable, there are a number of structures which may be used. The bus topology below is simpler, and the tree topology is more flexible and versatile. This approach uses a single cable which is easy to add to

• The ring topology below shows a closed loop of cable which can be simple to implement, but limited in capabilities

• An enhanced ring topology is pictured below

• Significant issues in networks are,

Network power: does the network distribute power, or does each station need to be separately powered.

Network tees: to tap into the network cable simple connections can be used, or the connection can have circuitry.

Transmission type: switched voltage levels (baseband), single band FSK (carrierband), multiple frequency FSK (broadband). The FSK methods allow much higher network speeds.

Bus access: When network nodes share the same wire they may try to talk at the same time (this is called a network collision). Different schemes for dealing with collisions include,

CSMA/CD (Collision Sense Multiple Access/Collision Detection): if two nodes start talking and detect a collision then they will stop, wait a random time, and then start again.

CSMA/BA (Collision Sense Multiple Access/Bitwise Arbitration): if two nodes start talking at the same time the will stop and use their node addresses to determine which one goes first.

Master-Slave: one device one the network is the master and is the only one that may start communication. slave devices will only respond to requests from the master.

Token Passing: A token, or permission to talk, is passed sequentially around a network so that only one station may talk at a time.

28.5.2 OSI Network Model

• Advantages

Computers not necessarily from the same manufacturer

Allow computers to communicate information.

Sharing of equipment such as printers, disks, etc.

Programs can run on multiple machines improving performance

Access to machines with better/different resources.

• General OSI Diagram contains seven layers

 

28.5.2.1 - Physical Layer

• Physical layer is concerned with transmission of raw bits over a physical circuit.

• Deals with voltages, timing, connections, etc.

• Responsible for bit synchronization and the identification of a signal element as either a 0 or a 1.

• Protocols: RS-232, RS-449, CCITT X.25 and X.21, IEEE 802

28.5.2.2 - Data Link Layer

• Data link layer breaks input data into “data frames” and processes acknowledgments.

• Object is to provide a error-free transmission line to the network layer.

• Responsible for the reliable delivery of information over a point-to-point or multipoint link.

• Supervises interchange of both link control data and user information

• Protocols: ANSI X3.28, HDLC, X.25, ISDN, IEEE 802

28.5.2.3 - Network Layer

• Network layer determines the interface between the computer and the intermediate system, how packets are routed.

• Chooses a route from the available data links that form the network.

• Object is to take messages, convert them to packets and send them towards the destination.

• Protocols: CCITT X.25, X.21, IP, CCITT Q.931, ISO 8473

28.5.2.4 - Transport Layer

• Transport layer takes data from the session layer, splits it up if necessary, and passes this to the network layer.

• Ensures that pieces all arrive correctly at the other end.

• Isolates the user from any concern for the actual movement of the information.

• Protocols: TCP, ISO 8073

28.5.2.5 - Session Layer

• Session layer defines a connection between users (presentation layer processes).

• Includes specification of the remote machine, authorization, options for the communication, and recovering from errors in broken transport connections.

• The set-up of communications is called binding.

• Protocols: ISO 8327, CCITT X.225, T.62, ECMA 75, NFS, RPC.

28.5.2.6 - Presentation Layer

• Ensures compatible syntax among the communicating processes by adjusting data structures, formats, and codes.

• Presentation layer is generally represented by library routines which the user accesses to perform network operations.

• This layer can also perform transformations such as compression and encryption.

• Protocols: DIS 8823, 8824, 8825, CCITT X.409, T.61

28.5.2.7 - Application Layer

• Application layer is written by the user, or is a program that performs some function for the user.

• Provides a window by which the user gains access to the communication services provided by the architecture.

• Protocols: DIS 8571, 8832, 9040

28.5.2.8 - Open Systems

 

• Open Systems Principles

Entity is a group of functions for a particular task. Accept input, and produce output.

Layer is a group of functions designed to provide a set of services related to the mission of that layer

Entities provide a set of services to the layer above. In doing this they use the services of the underlying layers.

Each layer isolates the layer above from the details of the underlying layers, and thus a lower layers characteristics can change without affecting the rest of the system.

Primitives control the layer’s services and data flow. Primitives fall into 4 groups: Request, Indicate, Response, and Confirm

• We can do a simple comparison of networking models

 

28.5.2.9 - Networking Hardware

• A number of basic components are required for networks

• Computer (or dedicated computing equipment)

An obvious must. Without the computer there is no need for networking

Approximate cost $500 to $1,000,000

• Network Interface Hardware

Some computers come with built in network interfaces, If these are for the wrong network types, or there is no network interface, a networking interface must be purchased.

examples are ethernet, latticenet, fibre, etc.

Approximate Cost $30.00 and up

• The Media,

This is the cabling which will connect the computers

10base2 (thin wire) is thin shielded coaxial cable with BNC connectors

10baseF (fiber optic) is costly, but signal transmission and noise properties are very good.

10baseT (twisted pair) is the most popular. It is a pair of twisted copper wires terminated with an RJ-45 connector.

Approximate cost for thick net $40 + $5/station, for thin net $10 + $1/station

10base2

• Transceiver

A device which is sometimes included between the network media, and the network interface hardware.

Allows easy changes to media type.

Not used for thin cable computer interfaces.

Approximate costs $100 to $200

• Hub/Concentrator

Connects separate wires and will route local traffic to local wires and remote through external connections.

approximate cost $50/wire

• Bridges, (Data link layer)

Used when hooking one network type to another, or isolating one part of a network from another.

A bridge can be used for hooking an ethernet cable to an optical backbone cable.

Has one input, one output, and will only handle sorting by network address (like ethernet address of machine).

Approximate cost $2,000 to $5,000

Same functionality as router.

• Routers, (Network Layer)

When there are too many networks on the same network, a router can be used to isolate small loops of the network from traffic which does not involve it.

More intelligent than a bridge, multiple inputs/outputs.

Sorts Network packets by IP address.

Approximate cost $5,000 to $10,000.

• Repeaters, (Physical Layer)

If network cables are too long, the repeaters will boost the signal strength so that it may complete it’s journey.

Also allows media to be changed

• Networking Software / Networking Management Software

Handles networking interface control for,

receiving / sending data or files
electronic mail tools
messaging systems
etc

Examples of this are NFS (Network File Server), SNMP (Simple Network Management Protocol)

Approximate costs >$1,000, unless provided with system

• Gateways (Application, Presentation, Session and Transport layers)

• An example of a micro computer with a networked interface

 

• Basic network hardware can be described with the 7-layer ISO model,

 

28.6 Bus Types

• Low level busses,

RS-485

Bitbus

CAN bus

Lonworks

Arcnet

• General open buses,

ASI

Devicenet

Interbus-S

Profibus

Smart Distributed System (SDS)

Seriplex

• Specialty buses,

Genius I/O

Sensoplex

28.6.1 Devicenet

• Devicenet is meant as a noise resistant, robust, shop floor network.

• The main change that the user will notice is that a rack of a PLC can be broken up and CPU, I/O, etc. are now connected by Devicenet.

• Devicenet is an open standard, so components can come from a variety of suppliers.

• Based on the CANbus (Controller Area Network) protocol.

• Some advantages,

open system is not tied to a single vendor

diagnosis of devices is possible

wiring becomes easier (no long wire runs)

complex devices are easy to connect

possibility of using a PC based control package

multiple controllers can share the net

• Basic features

up to 64 nodes on the network

lengths of 500m/250m/100m for speeds of 125kbps/250kbps/500kbps respectively

data packet size of 0-8 bytes

power and signal in the same cable

single bus cable

addressing includes peer-to-peer, multicast, master/slave, polling or change of state

devices can be added/removed while power is on

• Devicenet is a layer 7: application protocol (Note that CANbus is level 2)

• A typical structure for Devicenet is shown below,

 

• There are two types of wire used,

Thick trunk: carries up to 8A for power up to 500m

Thin trunk: up to 3A for power up to 100m

 

• Power supplies are directly connected to the cable to supply power.

• The drop lengths are limited

total length/speed 156m/78m/39m are 125Kbps/250Kbps/500Kbps respectively

a single drop is limited to 6m

• The wiring can come in a form of end/connectors,

bare wires

unsealed screw connector

sealed mini connector

sealed micro connector

vampire taps

• Devices may have a red/green status light for the network status.

• Devicenet used the CANbus indentifier to specify,

message types (5 bits)

node number (6 bits) up to 64 nodes on the net

• On a PLC-5 rack you would need a devicenet interface and could use the instructions below.

 

• On a Softlogix PLC the I/O will be copied into blocks of integer memory. These blocks are selected by the user in the setup of the software. Here the inputs are copied into N9 integer memory, and the outputs are set by copying the N10 block of memory back to the outputs.

 

28.6.2 CANbus

• The CANbus (Controller Area Network) uses bit wise resolution for collisions on the network (i.e., the lower the network identifier, the higher the priority for sending)

• A data frame for the CANbus is shown below,

 

• Each device listens to the frame it sent to ensure proper communication.

28.6.3 Controlnet

• This is intended for communication between controllers, and permits more complex messages than Devicenet.

28.6.4 Profibus

• A control network that is popular overseas, and primarily pushed by Siemens.

• General features include,

A token passing between up to three masters

maximum of 126 nodes

straight bus topology

length from 9600m/9.6Kbps with 7 repeaters to 500m/12Mbps with 4 repeaters

2 data lines and shield

power needed at each station

uses RS-485

2048 bits of I/O per network frame

28.6.5 Proprietary Networks

28.6.5.1 - Data Highway

• Major features of the DH+ network,

up to 64 nodes

peer to peer with token passing

uses shielded twisted pair cables

data rates of 57.6Kbps, 230 Kbps

• The basic data frame looks like,

 

• The data packet looks like that shown below (but it will vary depending upon the requested command).

 

• Some command examples include,

 

• Example for the Allen-Bradley PLC-5 Data Highway Network Connection

 

28.6.6 Other Network Types

• PROFIBUS (Professional Field Bus) is an emerging standard for PLC communication that Siemens has incorporated into its product line with the “SINEC L2” bus. Companies such as Festo have agreed to follow the bus standard.

28.7 Design Cases

28.7.1 PLC Interface To Robots And NC Machines

• Most robots have inputs and outputs that can be connected directly to sensors, actuators, PLCs, etc.

• Consider a case where a PLC controls a press and a robot unloads it.

 

28.8 Problems

Problem 28.2 Explain why networks are important in manufacturing controls.

Answer 28.2 These networks allow us to pass data between devices so that individually controlled systems can be integrated into a more complex manufacturing facility. An example might be a serial connection to a PLC so that SPC data can be collected as product is made, or recipes downloaded as they are needed.

Problem 28.3 We will use a PLC to control a cereal box filling machine. For single runs the quantities of cereal types are controlled using timers. There are 6 different timers that control flow, and these result in different ratios of product. The values for the timer presets will be downloaded from another PLC using the DH+ network. Write the ladder logic for the PLC.

Answer 28.3

Problem 28.4 a) We are developing ladder logic for an oven to be used in a baking facility. A PLC is controlling the temperature of an oven using an analog voltage output. The oven must be started with a push button and can be stopped at any time with a stop push button. A recipe is used to control the times at each temperature (this is written into the PLC memory by another PLC). When idle, the output voltage should be 0V, and during heating the output voltages, in sequence, are 5V, 7.5V, 9V. The timer preset values, in sequence, are in N7:0, N7:1, N7:2. When the oven is on, a value of 1 should be stored in N7:3, and when the oven is off, a value of 0 should be stored in N7:3. Draw a state diagram and write the ladder logic for this station.

b) We are using a PLC as a master controller in a baking facility. It will update recipes in remote PLCs using DH+. The master station is #1, the remote stations are #2 and #3. When an operator pushes one of three buttons, it will change the recipes in two remote PLCs if both of the remote PLCs are idle. While the remote PLCs are running they will change words in their internal memories (N7:3=0 means idle and N7:3=1 means active). The new recipe values will be written to the remote PLCs using DH+. The table below shows the values for each PLC. Write the ladder logic for the master controller.

Problem 28.5 Describe what the bits would be when an ‘A’ (ASCII 65) is transmitted in an RS-232 interface with 8 data bits, even parity and 1 stop bit.