1、Industrial Ethernet2nd EditionIndustrial Ethernet2nd EditionHow to Plan, Install, and Maintain TCP/IP Ethernet Networks: The Basic Reference Guide for Automation and Process Control EngineersBy Perry S. Marshalland John S. RinaldiCopyright 2005 ISAThe Instrumentation, Systems, and Automation Society
2、All rights reserved. Printed in the United States of America. 10 9 8 7 6 5 4 3ISBN 1-55617-892-1No part of this work may be reproduced, stored in a retrieval system, or transmitted inany form or by any means, electronic, mechanical, photocopying, recording or other-wise, without the prior written pe
3、rmission of the publisher.ISA67 Alexander DriveP.O. Box 12277Research Triangle Park, NC 27709www.isa.orgLibrary of Congress Cataloging-in-Publication DataNoticeThe information presented in this publication is for the general education of the reader. Because neither the author nor the publisher have
4、any control over the use of the information by the reader, both the author and the publisher disclaim any and all liability of any kind arising out of such use. The reader is expected to exercise sound professional judgment in using any of the information presented in a particular applica-tion.Addit
5、ionally, neither the author nor the publisher have investigated or considered the affect of any patents on the ability of the reader to use any of the information in a particular application. The reader is responsible for reviewing any possible patents that may affect any particular use of the infor
6、mation presented.Any references to commercial products in the work are cited as examples only. Nei-ther the author nor the publisher endorse any referenced commercial product. Any trademarks or tradenames referenced belong to the respective owner of the mark or name. Neither the author nor the publi
7、sher make any representation regarding the availability of any referenced commercial product at any time. The manufacturers instructions on use of any commercial product must be followed at all times, even if in conflict with the information in this publication.This book is dedicated to the Master E
8、ngineer, whose works inspire and challenge all designers. His creations are beautiful, adaptable, robust, and supremely equipped for their purpose.TABLE OF CONTENTS viiTable of ContentsAbout the Authors .ixChapter 1.0 What Is Industrial Ethernet?11.1 Introduction11.2 A Very, Very Short History of Et
9、hernet and TCP/IP .3Chapter 2.0 A Brief Tutorial on Digital Communication52.1 Digital Communication Terminology.62.2 Whats the Difference Between a Protocoland a Network? .92.3 Basic Topologies .112.4 Arbitration Mechanisms.152.5 LAN vs. WAN vs. VPN 15Chapter 3.0 Ethernet Hardware Basics.173.1 Ether
10、net Terminology 173.2 Ethernet Hardware LEDs263.3 Physical/Embedded Components: MAC, PHY, and Magnetics .273.4 Auto-Negotiation283.5 Network Collisions and Arbitration: An Analogy 303.6 How the CSMA/CD Protocol Works .313.7 The Basic “Ethernet Design Rules”333.8 “Would Somebody Please Explain This 7
11、-Layer Networking Model?” .333.9 Connectors363.10 Pinouts.38Chapter 4.0 Ethernet Protocol 0s are rep-resented by an upward swing from V-to V+. There is ALWAYS a transition, regardless of the actual bit sequence. Advantage: The receiver and transmitter clocks are always synchronized. Disadvan-tage: T
12、his scheme uses twice as many transitions as bits.RZ (Return to Zero): The signal state is determined by the voltage during the first half of each bit, and the signal returns to a resting state (“zero”) during the second half of each bit.NRZ (Non Return to Zero): This is simply a direct, intuitive,
13、“1 = high, 0 = low” designation with no further coding.MLT-3: A three-level algorithm (i.e., high, zero, and low voltages) that changes levels only when a 1 occurs. Not self-clocking.Differential Manchester: Bit value is determined by the presence or absence of a transition at the beginning of a bit
14、 interval; clocking is provided via a mid-interval transition.8 A BRIEF TUTORIAL ON DIGITAL COMMUNICATION4B/5B (4 bit/5 bit): Every four bits is represented as a 5-bit code that never has more than three 0s in a row. This prevents long sequences of 0s or 1s with only a 25% penalty in bandwidth, in c
15、ontrast to the 100% penalty of Manchester.Signaling TypesThe rubber meets the road in an Industrial Ethernet Network when the data from a device is transferred to the communication media. The pro-cess of transferring data to the wire is called signaling and there are two basic types: baseband and br
16、oadband.Baseband signaling is digital. The 1s and 0s of a message are transmit-ted over the media as a sequence of voltage pulses. If you remember the old time westerns, the clerk in the telegraph office would tap out a tele-gram using digital signaling. The major limitation to digital signaling is
17、that only a single message can be transmitted at a time. If there are two clerks in that telegraph office, the second clerk must wait for the first clerk to finish before sending the next message. A second limitation is that the digital voltages are easily attenuated as the distance increases. Commu
18、nication over very large distances requires repeaters and is almost impractical due to the number of repeaters required. Broadband signaling doesnt have this restriction. Broadband signaling uses analog carrier to transport data. Multiple carriers each containing data is analogous to a cable-TV syst
19、em. The cable carries many televi-sion programs all on the same wire; all at the same time. You select a different carrier and a different data stream (a television program) by switching from Channel 9 to Channel 10. BASEBAND BROADBANDDigital Signaling Analog SignalingLimited Distance Long Distances
20、Bus-Oriented Applications such as RS-232 and Controller Area Net-working (CAN)Used for both Bus and Tree Topolo-gies such as Token Ring and Ether-netBi-directional Uni-directionalSingle Message Oriented Multiple carrier signals with multi-ple independent data streamsOften uses Manchester Encoding No
21、 Encoding of digital signalsA BRIEF TUTORIAL ON DIGITAL COMMUNICATION 9Error DetectionThe simplest mode of error detection is “echoing back” the message just sent. However this consumes double bandwidth. Plus if theres an error, its impossible to tell whether it was the original or the copy that was
22、 corrupted.ChecksumThe checksum calculation is effective for small amounts of data. An algo-rithm converts the data to bits that are appended to the data and trans-mitted. The receiver does the same calculation on the same data, if its own result does not match the original checksum, a retransmit re
23、quest is submitted. For a single byte of data, a 1-bit checksum (parity bit) is suf-ficient.Cyclic Redundancy CheckLong messages require a more sophisticated, more accurate detection method. Cyclic Redundancy Check (CRC) views the entire message block as a binary number, which it divides by a specia
24、l polynomial. The result is a remainder, appended to the message just like a checksum. CRC cal-culation is performed in real time by logic gates at the hardware level.Not only are the above mechanisms employed in hardware, they are also employed in higher-level protocols. TCP/IP employs its own erro
25、r-detection mechanisms to further guarantee successful message delivery.2.2 Whats the Difference Between a Protocol and a Network?The distinction between the physical network itself and the protocol that runs on that network is sometimes blurred. Its important to clar-ify: The network itself consist
26、s of the physical components and mes-sage-transmission hardware. Protocols are binary “languages” that run on the networks.Strictly speaking, the terms Ethernet, RS-232, RS-422, and RS-485, for example, refer to the network physical wiring and message-transmission components only (see layers 1 and 2
27、 of the ISO/OSI model in Chapter 3).Many different protocols are used on Ethernet. TCP/IP, FTP, HTTP, NetBEUI, AppleTalk, and Modbus are protocols only; they can run on many different physical networks.10 A BRIEF TUTORIAL ON DIGITAL COMMUNICATIONTransmission/Reception of MessagesSimplex. Simplex is
28、one-way communication via a single channel. A radio or TV tower is a simplex transmitter; a radio or TV is a simplex receiver.Duplex. Duplex is two-way communication.Half Duplex. Half-duplex communication is when both stations (e.g., Walkie-Talkie or CB radio) can transmit and receive but they canno
29、t do it simultaneously.In half-duplex communication, only one party can have control of the channel at any one time. This necessitates an arbitration mechanism to determine who has control of the channel. This is called contention.Full Duplex. Full duplex is two-way communication with two communica-
30、tions channels so that both stations can receive and transmit simulta-neously. A telephone is full duplex because it allows both parties to talk and listen at the same time.Figure 1 Simplex Communication.Figure 2 Half Duplex Communication.TRANSMITTER RECEIVERA BRIEF TUTORIAL ON DIGITAL COMMUNICATION
31、 11Figure 3 Telephone conversation is full duplex (at least to the extent that a person can talk and listen at the same time).In Ethernet, half-duplex communication requires the use of CSMA/CD arbitration; full duplex eliminates collisions altogether but requires separate transmit and receive paths
32、between each device. Ethernet always has separate Tx/Rx paths. Full Duplex in Ethernet requires not only separate paths, but only 2 nodes in a collision domain.2.3 Basic TopologiesTopology is a very important choice in system design. It dictates what kind of physical arrangement of devices is possib
33、le. Figures 5 through 9 show what topologies are supported by each flavor of Ethernet.Figure 4 As bit rate increases, the physical length of each bit decreases.TRANSMITTERRECEIVER TRANSMITTERRECEIVER12 A BRIEF TUTORIAL ON DIGITAL COMMUNICATIONA network is an electrical transmission line. At high spe
34、eds, each bit is short compared with the network length. If you could physically see the packets traveling across the wire, each bit would have a length, similar to the wavelength of sound or light. Data propagates on wire at about 2/3 the speed of light.When a wave reaches the end of a medium, it i
35、s reflected, transmitted, and/or absorbed. The shorter the bits in relation to the network, the more likely that reflections will cause errors.For high-speed networks, the simplest way to minimize reflections is to have only one node at each end of a wire, with proper impedance termi-nation (wave ab
36、sorption) at each end. If each node has terminating resistors matching the cable impedance, reflections are minimized.Hub/Spoke or Star TopologyA hub/spoke or star topology, where every segment has dedicated transmit-ters and receivers, offers high performance because reflections and impedance misma
37、tches are minimal. This is the topology used by all of the Ethernet formats except 10BASE2 and 10BASE5.Figure 5 Star topology.Network speed 10 Mbps 100 Mbps 1 GbpsDistance signal travels in the dura-tion of 1 bit time 20 m 2 m 0.2 mA BRIEF TUTORIAL ON DIGITAL COMMUNICATION 13Ring TopologyRing topolo
38、gy could be looked at as a variation on hub/spoke. It is simi-lar in the sense that each segment has dedicated transmitters and receiv-ers. However, the data itself is passed around in a circle, and it is stored and forwarded by each node an important distinction.Figure 6 Ring topology.Mesh Topology
39、Mesh topology is point-to-point like star and ring, but has a minimum of two paths to and from each network node. This provides redundancy but introduces significant cost and installation effort.Figure 7 Mesh topology.14 A BRIEF TUTORIAL ON DIGITAL COMMUNICATIONTrunk/Drop (Bus) TopologyTrunk/drop to
40、pology, also known as Bus or Multidrop topology, puts multi-ple nodes along the distance of the cable, with spurs or “Tees” inserted wherever a node is needed. Each spur introduces some reflections, and there are rules governing the maximum length of any spur and the total length of all spurs. 10BAS
41、E5 is a trunk/drop implementation of Ether-net.Figure 8 Bus topology.Daisy Chain TopologyA variation on trunk/drop is the daisy chain, where spur length is reduced to zero. High bandwidth signals have fewer problems in a daisy chain than trunk/drop because of fewer reflections. RS-485 is an exam-ple
42、 of a daisy chain; Controller Area Networks (CANs) like DeviceNet use trunk/drop. 10BASE2 is a daisy chain implementation of Ethernet; the drop length is effectively zero.Star topologies have a nice advantage over trunk/drop: Errors are easier to assign to a single segment or device. The disadvantag
43、e is that some physical layouts (e.g., long conveyor system with evenly spaced nodes) are difficult to implement on a star; trunk/drop or daisy chain are better for that.Figure 9 Daisy chain topology.A BRIEF TUTORIAL ON DIGITAL COMMUNICATION 152.4 Arbitration MechanismsThere are three basic methods
44、of arbitrating between competing mes-sage sources:ContentionContention is similar to a group of people having a conversation where all are listening, one can speak at any given time, and when there is silence another can speak up. Two or more may interrupt the silence and then all but one must back
45、off and wait their turn.TokenToken messaging is when each device receives some sort of token or “turn to speak” and can transmit only while it is in possession of that token. The token is then passed to someone else who now can transmit. Since Ethernet is not token-based, not much space will be give
46、n to this topic. There are many possible rules for passing the token, but often it is passed in a cyclic fashion from one device to the next.PollingPolling is when one device is “in charge” and asks each device to surren-der its data in turn. Polling systems are often deterministic but do not allow
47、urgent messages to be prioritized over other messages.2.5 LAN vs. WAN vs. VPNLocal area networks (LANs) transmit data at high speed over a limited area. A single Ethernet system on 10BASE-T or 100BASE-T is a very typical LAN architecture. Such a system is limited in geography by the maximum number o
48、f hubs/switches (see Chapter 3), and propagation delays are in the 1-ms range and below.Wide area networks (WANs) link LANs together over large distances. WANs usually use publicly available communication links from tele-communication providers. These links might consist of combinations of fiber, te
49、lephone, radio, and satellite links. Within a WAN, gateways often buffer packets until messages are complete, then forward them to the receiving computer. This causes propagation delays, and WANs are often unsuitable for real-time applications.Virtual Private Networks (VPNs) link LANs via the Internet. Since data is then visible to others, data encryption is used to keep messages pri-16 A BRIEF TUTORIAL ON DIGITAL COMMUNICATIONvate. VPNs are extremely popular in companies with facilities in multi-ple locations and in companies that have remote or traveli