Download DATA TRANSMISSIONS IN INDUSTRIAL AUTOMATION SYSTEMS

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Heterodyne wikipedia , lookup

Telecommunications engineering wikipedia , lookup

Pulse-width modulation wikipedia , lookup

Opto-isolator wikipedia , lookup

Multidimensional empirical mode decomposition wikipedia , lookup

Immunity-aware programming wikipedia , lookup

Transcript
DATA TRANSMISSIONS
IN INDUSTRIAL AUTOMATION SYSTEMS
(Reading for “Elements of Industrial Automation” at ELDE)
1. Signals...................................................................................................... 1
2. Modulation of signals................................................................................ 3
3. Serial communications.............................................................................. 5
3.1. RS232 and RS485 serial communication standards................. 6
3.2. I2C serial interface.................................................................... 10
3.3. Serial Synchronous Interface (SSI) ......................................... 10
4. Parallel interfaces..................................................................................... 12
Electrical systems utilize varying currents, voltages (eg. varying electromagnetic
fields) to exchange and store information. Industrial Control Systems transport information from point to point (unicast) or point to multi-point (multicast) using links and
networks
Data and messages are transmitted via different media as:
• copper wire (twisted pairs, coaxial cables...);
• microwave (wireless);
• optical fiber.
1. Signals
Signals are variables, which carry information. In technical systems, data is
transmitted using two main types of using electrical signals - analogue and digital. They
both use electrical voltage to carry their signals, but in different ways.
Analogue (continuous-time CT) signals
Analogue data transmission has been used in
telecommunications for over 100 years. It can work with any
voltage and has many possible ways it can be encoded.
Analogue signals are prone to errors of all kinds. Noise,
which is caused from an outside source is a problem for
analogue signals. Attenuation (which is degradation in quality over distance) is another
1
big problem with analogue signals because the amplitude of the wave naturally changes
over distance. Analogue signals are perfect for carrying data, which has a lot of little
subtleties, such as voice or sound. Compare your voice to that of a "machine like" voice.
Digital (discrete-time DT) signals
Digital signals can be represented by graph similar
to a bar graph. A signal in digital format has precise
voltages that are not affected by noise or attenuation as
easily as analog signals are. The two possible values for
a normal digital signal are 1 or 0, e.g. when the signal is
at a high point it's value is 1, and it's value is 0 when it is low.
When the limit of a signal is reached, the signal is no longer strong enough to
transfer the data accurately. A signal can be "repeated", which will amplify the signal so
that it can travel further. This brings us to a major difference in the two methods.
Differences when repeated (amplified)
Analogue signals - The problem of distance is always a major one in networking.
The further you can go from a point and still get an
accurate signal the better. This is where digital signals
are a key. The repeater (amplifier) is used to extent the
signal further. It will increase the signal so that it can
carry on to its destination. The problem lays in analog
signals not being exact. The wave shape of an
analogue signal makes it so the repeater cannot correct the signal when it is amplified.
Instead the repeater both amplifies the signal and amplifies the noise:
Digital signals - Digital signals are different.
Since they are exact in value (not wave like analog)
the repeaters can determine and correct the signal
when it is amplified. This makes a digital signal “like
new” after it has been repeated. The only time this isn't
true is when so much noise is present that the
repeater is unable to determine if the value is 1 or 0 (up or down). The figure here
shows a digital signal being repeated.
2
2. Modulation of signals
For information to be transferred, signals are adapted to the transmission and
medium by modulation and coding (adaptation to physical transmission). Modulation is
widely used to encode a signal so as to more effectively utilize it. Modulation is
fundamental to electronic communication systems, radio, TV, satellite communications,
cell phones, etc.
Modulation can involve varying some feature of a continuous-time (CT) signal to
encode the signal. The signal of interest "modulates" a special signal called "carrier" by
modifying one of its parameters. The carrier signal is transmitted further and carries the
information from the original signal.
2.1. Analogue (wave- parameter) modulation
Varying the amplitude of a sinusoid (amplitude modulation or AM) or its frequency
(frequency modulation or FM) in proportion to a signal is called wave- parameter
modulation. Consider the carrier signal being a sinusoidal oscillation with amplitude U,
frequency ω, and phase shift φ: u ( t ) = U sin (ωt + ϕ ) . If the input signal x(t) alters the
U = k[x ( t )] we have Amplitude Modulation (AM). If the
frequency is modified by ω = k[x ( t )], this is Frequency Modulation (FM) and if the
phase shift is modified by ϕ = k[x ( t )] - this is called Phase Modulation (PM).
amplitude of the carrier by
2.2. Pulse (pulse- parameter) modulation
Modulation can also encode the CT signal with the parameters of pulses called
pulse-parameter modulation. In this case the carrier signal is a sequence of pulses. A
number of different pulse-parameter modulation schemes are shown below. In Pulse
Width Modulation (PWM), the width of pulses encodes the amplitude of the CT signal. In
Pulse Amplitude Modulation (PAM) the amplitude of pulses encodes the CT signal. In
Pulse Code Modulation (PCM) the amplitude of the quantized CT signal is encoded as a
binary number that is represented by a pulse code.
3
Figure 2. Examples of amplitude, frequency and phase modulation.
4
3. Serial Communications
Fundamentals of serial data transmission
Consider a parallel port with 8 data lines. It can send/receive 8 bits in parallel
(simultaneously). In contrast, a serial port only needs one data line to transmit the 8-bit
byte. To do this the byte is transmitted bit by bit, in a serial manner. There are two serial
data transfer schemes: synchronous and asynchronous transmissions.
In the synchronous data transfer scheme, additional lines are required to transmit
handshake or timing signals along with the data line to indicate when the next bit is to
be transmitted on the line. The advantage of this data transfer is that the receiver is able
to respond to the clock rate of the transmitter automatically. For asynchronous data
transfer, the transmitted data themselves contain the information required for
synchronization and neither handshake nor clock signals are needed. The transmitted
serial data comprises a Start Bit, which indicates the beginning of a data transmission. It
is followed by Serial Data Bits and then Stop Bits indicating the end of the transmission.
An optional Parity Bit can be added between the Serial Data Bits and the Stop Bit for
parity checking. The receiver device detects the start bit and receives the subsequent
data bits. This data transfer requires that the transmitter and the receiver must have the
same clock frequency.
Asynchronous data transmission is used in most personal computers. In practice,
the asynchronous communication is facilitated by a family of industrial standard
computer peripheral ICs known as the UARTs (Universal Asynchronous Receivers &
Transmitters).
Serial data format
The format of the serial data transmission generated by UARTS consists of 4
parts: a start bit, the up to eight data bits, one parity bit, and at least one stop bit.
When no data is sent, the transmitting data line is at high state (2V-5V TTL level).
The beginning of a data transmission is indicated by the line going low (0-0.8V TTL
level) for 1 bit time. This bit is the Start Bit. The Data Bits are then sent out one after
another with the least significant bit sent first. The length of the data bit can be 6, 7 or 8.
Following the data bits is the Parity Bit which is used to check for errors occurring in the
data transmission. The last bits are the Stop Bits. The data line goes to high for at lease
1 bit time to identify the end of the data transmission. The stop bit can be 1, 1.5 and 2
bit length.
The rate at which data bits are sent is measured by Baud Rate. It is defined as
1/(the time between the shortest signal transition period T. For example, the standard
baud rates for RS232 serial port are 110, 150, 300, 600, 1200, 2400, 4800, 9600 and
19200 bits/s. Knowing the Baud Rate, the number of characters (or bytes) to be
transmitted per second can be calculated. For example, if the serial data transmission
has 8 data bits, one parity bit and 1 stop bit, the total length of serial data bits is 11. The
transfer rate for characters is the Baud Rate divided by 11, i.e. a Baud Rate of 9600 will
transfer 870 characters per second.
5
Parity check can be ODD, EVEN or NONE. The odd and even parity checks
indicate that the total number of ones (`1') in the transmitted serial data is an odd
number or even one. This method is the simplest way for checking errors during data
transmission. However, it is only reliable to detect single-bit errors. Errors with several
bits can not be detected this way. The parity bit is generated by the electronic circuit of
the transmitting UART in such a way that the number of ones (`1') in the data bits plus
the parity bit is odd or even as declared.
3.1. RS232 and RS485 serial communication standards
RS stands for “Recommended Standards” for serial communications. Even
though RS232 and RS485 are not standards like IEEE-1284 and IEEE-1394, they are
good enough to allow for reliable implementation.
RS232 in its simplest form is a three-wire interface with common ground and
separate Receive and Transmit wires. Because of the separate Receive and Transmit
wires, RS232 can operate in “Full Duplex” mode (simultaneous receive and transmit).
RS485 is also a three-wire interface, except that the two signal wires work as
“Balanced” lines where both wires are used during transmit or receive. Because of this,
RS485 can only operate in “Half Duplex” mode (either receive or transmit).
RS232 implementation
ASCII is a human-readable to computer-readable translation code. (i.e. each
letter/number is translated to 1's and 0's) It's a 7-bit (a bit is a 1 or a 0) code, so we can
translate 128 characters. (2^7 is 128) Character sets that use the 8th bit do exist but
they are not true ASCII. We typically refer to the ASCII chart characters by using
hexadecimal terminology. "0" is 30h, "5" is 35h, "E" is 45h, etc. ("h" means
hexadecimal)
• start bit- In RS-232 the first thing we send is called a start bit. This start bit
("invented" during WW1 by Kleinschmidt) is a synchronizing bit added just before
each character we are sending. This is considered a SPACE or negative voltage
or a 0.
• stop bit- The last thing we send is called a stop bit. This stop bit tells us that the
last character was just sent. Think of it as an end-of -character bit. This is
considered a MARK or positive voltage or a 1. The start and stop bits are
commonly called framing bits because they surround the character we are
sending.
• parity bit- Since most PLCs/external equipment are byte-oriented (8 bits=1byte)
it seems natural to handle data as a byte. Although ASCII is a 7-bit code it is
rarely transmitted that way. Typically, the 8th bit is used as a parity bit for error
checking. This method of error checking gets its name from the math idea of
parity. In simple terms, parity means that all characters will either have an odd
6
•
number of 1's or an even number of 1's.
Common forms of parity are None, Even, and Odd. (Mark and Space aren't very
common so we shall not discuss them). Consider these examples:
send ASCII "E" (45h or 1000101b(inary))
In parity of None, the parity bit is always 0 so we send 10001010.
In parity of Even we must have an Even number of 1's in our total character so
the original character currently has 3 1's (1000101) therefore our parity bit we will
add must be a 1. (10001011) Now we have an even number of 1's.
In Odd parity we need an odd number of 1's. Since our original character already
has an odd number of 1's (3 is an odd number) our parity bit will be a 0.
(10001010)
During transmission, the sender calculates the parity bit and sends it. The
receiver calculates parity for the 7-bit character and compares the result to the
parity bit received. If the calculated and real parity bits don't match, an error
occurred an we act appropriately.
Baud rate- Think of baud rate as referring to the number of bits per second that
are being transmitted. So 1200 means 1200 bits per second are being sent and
9600 means 9600 bits are being transmitted every second. Common values
(speeds) are 1200, 2400, 4800, 9600, 19200, and 38400.
RS232 data format- (baud rate-data bits-parity-stop bits) This is the way the
data format is typically specified. For example, 9600-8-N-1 means a baud rate of
9600, 8 data bits, parity of None, and 1 stop bit.
The picture below shows how data leaves the serial port for the character "E"
(45h 100 0101b) and Even parity.
Figure 3.
Another important thing that is sometimes used is called software handshaking
(flow control). Like the hardware handshaking we saw in the previous chapter, software
handshaking is used to make sure both devices are ready to send/receive data. The
most popular "character flow control" is called XON/XOFF. It's very simple to
understand. Simply put, the receiver sends the XOFF character when it wants the
transmitter to pause sending data. When it's ready to receive data again, it sends the
transmitter the XON character. XOFF is sometimes referred to as the holdoff character
and XON as the release character.
RS323 provides the most simplified serial connection to the system front end
such as a PC or PLC. In most cases all we need is to connect a PC’s RS232 serial port
directly to the external device using only 3 wires. RS232 is the most widely used
7
standard (even in PLCs), so no matter what the system hardware, RS232 is always
supported.
RS485 implementation
RS485 is used if multi-drop (a LAN) and long cable lengths are required. RS485
has become very widely used in factory automation and motion control, and is therefore
fairly easy to implement. RS485 has a more robust electrical interface and works better
than RS232 in “electrically noisy” environments.
RS232 and RS485 Specifications
There is one major difference between RS232 and RS485 - this is the signaling
mode. RS232 is unbalanced while RS485 is balanced. An unbalanced signal is
represented by a single signal wire where a voltage level on that one wire is used to
transmit/receive binary 1 and 0. On the other hand, a balanced signal is represented by
a pair of wires where a voltage difference is used to transmit/receive binary information.
An unbalanced voltage level signal travels slower and shorter than a balanced voltage
difference signal.
Standard
8
RS232
RS485
Cabling
single ended
multi-drop
Number of Devices
1 transmit
1 receive
32 transmitters
32 receivers
Communication
Mode
full duplex
half duplex
Max. Distance
15m at 19.2 Kbps
1200m at 100 Kbps
Max. Data Rate
19.2 Kbps for 15m
10 Mpbs for 15m
Signaling
unbalanced
balanced
Mark (data 1)
-5 V min.
-15 V max.
1.5 V min. (B>A)
5 V max. (B>A)
Space (data 0)
5 V min.
15 V max.
1.5 V min. (A>B)
5 V max. (A>B)
Input Level Min.
+/- 3 V
0.2 V difference
Output Current
500 mA
(Not: driver ICs
normally used in 250 mA
PCs are limited to
10 mA)
RS485 Multi-Drop Wiring
RS485 is sometimes termed as “RS485 Multi-drop LAN” since it can connect
several devices in a LAN network environment. These devices are all connected to a
single pair wire. Transmit and receive share the same two wires.
Officially the RS485 specification allows only 32 nodes (devices) on the LAN.
However, IC manufacturers have developed RS485 drivers capable of allowing 128 to
255 nodes on an RS485 LAN. It is not recommended to use more than 32 nodes.
RS-232
Host PC
or
PLC
Rx
Tx
GND
RS-232
to
RS-485
Converter
RS-485
A
B
GND
Connect up to
31 external
devices (2..32)
Power GND
Power +V
External Device 1
Power Supply
Figure 4.
RS232 Single-Ended Wiring
RS232 can be directly connected to the external device. Care must be taken to
ensure good system grounding to prevent loss of data. Cables should not exceed 10 ft.
when running at 57.6K baud. Shielded cables should be used in all cases.
Host PC
or
PLC
Rx
Tx
GND
RS-232
Power GND
Power +V
Power Supply
External Device
Figure 5.
9
3.2. I2C serial interface
I2C serial interface
In an effort to maximize hardware efficiency and circuit simplicity, Philips has
developed a simple bi-directional 2-wire bus for inter-IC communication. This bus is
called the Inter IC or I2C-bus. All I2C-bus compatible devices incorporate an on-chip
interface, which allows them to communicate directly with each other via the I2C-bus.
This design concept is intended to solve the interfacing problems encountered when
designing digital control circuits. Here are some basic features of the I2C-bus:
• Two bus lines are required; a serial data line (SDA) and a serial clock line (SCL);
• Each device connected to the bus is software addressable by a unique address
and a master/slave relationships exist at all time; masters can operate as mastertransmitters or as master-receivers;
• It is a multi-master bus, including collision detection and arbitration to prevent
data corruption if two or more masters simultaneously initiate data transfer;
• Serial, 8-bit oriented, bi-directional data transfers can be made at up to 100 kbit/s
in the Standard-mode, up to 400 kbit/s in the Fast-mode, or up to 3.4 Mbit/s in
the High-speed mode
• On-chip filtering rejects spikes on the bus data line to preserve data integrity
3.3. Serial Synchronous Interface (SSI)
SSI (Serial Synchronous Interface) is a widely used serial interface between
sensors and controllers in industrial automation systems. SSI uses a clock pulse train
from a controller to initiate an output from the sensor (Fig. 6). Data is continually
updated by the sensor and made available to the shift register. Between each clock
pulse train, there is a minimum dwell of 25 microseconds required, during which fresh
data is moved into the register. Data is shifted out when the sensor receives clock
pulses from the controller. When the clock is held HIGH and the minimum dwell time
has elapsed, new data is available to read.
The diagram in Fig. 7. illustrates the function of a position sensor with Serial
Synchronous Interface (SSI). The position of a magnet mounted on a machine is
precisely determined by a magnetostriction method. The displacement value is provided
in a 24- or 25-bit Binary or Gray code. The data stream is further transmitted to a
controller via the SSI interface at a distance up to 240m with baudrate of 100Kbps .
10
Figure 6. Serial Synchronous Interface.
Figure 7. Serial Synchronous Interface application.
11
4. Parallel Interfaces
IEEE488 Standard
The IEEE (Institute of Electrical and Electronics Engineers) 488 standard is a
bus standard covering the electrical, mechanical, and functional specification of a
parallel instrumentation bus. The bus is commonly used for communication of lab test
equipment and automatic machinery control. The standard allows for 15 devices to be
connected together, over cable lengths up to 18m. The standard defines 16 lines
composed of 3 control, 5 management, and 8 data lines.
12