You are on page 1of 5

Phone: 818-785-6200

FAX: 818-785-4415
Email: scandata@aol.com
Web Site: www.scan-data.com

APP-1129
06-01-00
Application Note APP-1129
What is a protocol?
The CAP SCADA Protocol.
A protocol is simply the language the RTUs,
computers and other devices use when they
communicate with each other.
Why is the CAP protocol so widely
Protocols have proliferated and today there are
used? hundreds of them. Many are proprietary (not
public) and are designed to lock the end user into
Many protocols are proprietary (not open to the public). a specific manufacturer's product.
Others are obsolete and are no longer supported by The worlds first protocol was the Morse code, a
the manufacturer. Other protocols, such as MODBUS, series of dots and dashes. It travelled along
have become virtual standards for communicating with railroad lines on iron wires and reached ships at
PLCs by virtue of their wide use. Every manufacturer sea over radios and flashing lights. Remember the
most famous Morse code message of them all,
tries to make a forceful case for using his own
SOS, Save Our Souls?
particular protocol. Which one to use?
The Morse code is a bit protocol, difficult to read.
The protocol requirements of PLCs (Programmable You have to interpret each set of bits.
Logic Controllers) and RTUs (Remote Telemetry Bit protocols are still used, especially in
proprietary systems and in large and complex
Units) differ in a number of aspects: SCADA systems for electric power distribution.

PLCs, most often used in factory floor and other local PLC protocols are often bit oriented as they are
control systems, need rapid access to read and designed to read and command single specific
inputs or outputs. "Turn coil #214 on" is a typical
change single individual points PLC command. These bit protocols are difficult to
handle by humans and by computers.
RTUs, used in SCADA systems, need rapid access to
all their information for quick central station screen Two protocols now dominate the world. The first,
obviously, is plain speech (English, Chinese,
updates. It is impractical to repeatedly ask for point
Norwegian, whatever). It dominates. Just listen to
after point in these systems. your TV or radio or mother in law. Even RTUs use
this plain speech protocol. Check the ScanData
This application note describes the CAP protocol in VBX-7 Voice Box Supervisor RTU.
detail.
The second dominating protocol is ASCII,
American Standard Code for Information
Interchange. It has been accepted by the whole
Why is the CAP protocol preferred for all world. Virtually all computers and printers and
modern SCADA systems? modems and what have you now communicate in
ASCII. It is an excellent RTU protocol, easily
generated and read by all computers.
1. CAP uses ASCII (American Standard Code For
Information Interchange) format:

ASCII interfaces directly with all modern SCADA


software such as Lookout. ASCII was specifically 2 .CAP compresses data values:
designed to allow computers, printers, modems and
other devices to communicate with each other over Compressing certain information saves space and
sometimes noisy and questionable lines. It has built in transmitting time. Transmitting each status (contact) bit
transmission security and error checking and it is an of information as one character, for instance, would be
open protocol, easily written and interpreted. It is used wasteful. These are therefore compressed, typically
all over the world. four status bits into one character. Compressing the
ASCII RTU message gives us CAP (Compressed message has too many or too few bits, this transmitted
ASCII protocol) which is used all over the world. checksum will not match with the checksum
calculated by the receiving software.

3. CAP separates the data into blocks

Modern software such as Lookout has made it easy to Message Security.


configure computers to transmit, receive and display The information transmitted by an RTU is often used
information to and from RTUs. This is made even in automatic process control and used by operators
easier when the RTU messages are organized by the to take vital action, such as turning pumps on and off,
CAP protocol into well defined separate elements as opening and closing valves, etc.
described in this application note. This means that no errors in the transmission can be
tolerated. The slightest error in a message makes the
whole message suspect. The message must then
be rejected and a new message requested. This
4. CAP uses start and stop message identifiers. must be repeated until an error free message is
received.
Your computer software has to know when the RTU
transmission starts, so that it can point to a buffer. It The effect of these re-transmissions is that updates
on noisy lines will be slow. On a noisy radio circuit,
also has to know where it ends, so that it can close its
for example, you will see how an analog value in a
communication port and ignore the garbage Mode-C signal multiplexer system slowly updates,
characters that invariably follow, especially over radio with long pauses in between the updates. With good
when the carrier turns off. . error checking you will never see an erroneous
message.
To make it easy to read the RTU messages during How do you check for errors? Complex schemes for
testing, the start identifying character should be a line long messages, such as Cyclic Redundancy Check
feed (LF) and the end character should be a carriage (CRC), stick parity, etc., have been used. These are
return (CR). In this manner, the message will be easy available for ScanData RTUs on special order but are
not needed for short RTU messages.
to read during tests as it scrolls up on the computer
screen or on the printer. A four level error check is used in the CAP protocol.
First, each individual character is checked for parity,
The CAP message, formatted with these start and stop overrun and framing. After this rigorous test the
identifiers, looks like this : whole message is checked to see if the total count of
all the received bits in all the characters matches the
transmitted count of bits (checksum check). This
(LF)RTU message (CR) method has resulted in no reported errors in many
years of operating RTUs.

5. CAP uses a message security checksum For instance, a Mode-C leak detect system was
character. delivered many years ago to the then Getty Oil in
central California, working over very noisy VHF
splinter frequency radios. Four ScanData RTUs at
There may be errors during a transmission due to crude oil custody transfer stations deliver CAP
noisy lines or to radio static. The software must have a protocol leak detect and metering pulse counts to a
way of finding out if this has happened so that it can central ScanData RTU. No erroneous counts have
ever been reported with this system.
disregard the message and ask the RTU to transmit
another one (see sidebar).

A checksum character (CS) is therefore transmitted


before the message stop character, as follows:
6. CAP uses message delineators.
(LF)RTU message (CS)(CR)
Your computer software needs to know where the
information starts and where it ends in the received
This checksum is a running sum of all the bits of all the
message string. There may be garbage characters at
characters transmitted, ignoring all carry past 6 bits
the beginning and at the end. If the message is
and sent as a printable ASCII character. If the received
transmitted over radio there may certainly be some

APP-1129, Page 2
garbage characters. Some RTUs have only a few analog and digital inputs
and outputs, others have lots of them. How many
The message delineators are usually a pair of '{ }' (so inputs and outputs does this RTU have? And what kind
dear to Pascal programmers). The CAP message now are they? The software needs to know an the RTU
looks like this: configuration field has the information.

(LF){ RTU message }(CS)(CR) The configuration field contains five pairs of numbers.
Certain protocols use five groups of three numbers.
The software now knows exactly where the message These five numbers follows the message type
starts and where it ends. This is essential for the identifier. The first number tells you how many analog
checksum calculation. If there is any flaw in any of the inputs the RTU has, the second pair how many pulse
characters in the message (inside these delineators) or counter inputs it has, the third pair how many digital
if the checksum does not match, the message is inputs it has, the fourth how many digital outputs (relay
discarded and another one asked for. drivers) it has and finally the fifth pair tells you how
many analog outputs the RTU has.

7. CAP uses a protocol version identifier: For example, an RTU with 8 analog inputs, 2 pulse
counter inputs, 8 digital inputs, 8 digital outputs and 1
There are different versions of the CAP protocol suit analog output (a version of the ScanData LMX RTU)
different applications. Some transmit analog has the following configuration field:
information in compressed form, others transmit it in
ASCII digits, etc. The receiving software needs to know (LF){ BXYZ!0802080801RTU message }(CS)(CR)
which version is in use.

Which particular CAP protocol version is the RTU 11. CAP uses separate data fields.
using? The protocol identifier character tells you. It
follows the space after the message start delineator. The RTU reports its analog, pulse counter and digital
For instance, where a 'B' version protocol is used, the input readings in three data fields. It reports the
message looks like this: contents of its analog and digital output buffers in two
more data fields. Five data fields in total. The RTU
(LF){ BRTU message }(CS)(CR) automatically dimensions its report data field size by
the information in its configuration field. No RTU
reporting space is wasted.
8. CAP uses a station identifier (address).

Each RTU has its own three character identifying 12. Example of a complete CAP RTU report.
code. For example, receiving a message from an
RTU in 'B' protocol with the identifier XYZ reads: For example, a complete report from an LMR RTU
with the identifier 513, with a D version protocol and
(LF){ BXYZRTU message }(CS)(CR) with 2 analog inputs, 1 counter input, 2 digital inputs, 2
digital outputs and 1 analog output, reads as follows:

9. CAP uses a message type identifier. (LF){ D513!0201020201 FAGM 54321 A B EG


}(CS)(CR)
What type of message is it? A command, a report, a
register request or other? Each type of message has This is a very small RTU so the five data fields, FAGM
its own identifying character. The report message (two analog inputs), 54321 (one pulse count input), A
identifier character is normally an exclamation mark ' (status inputs), B (relay driver outputs) and EG (analog
! '. It follows the station identifier: output) are short. Larger RTUs will have
correspondingly larger data fields. The fields are
(LF){ BXYZ!RTU message }(CS)(CR) always placed in these positions, however, with spaces
between each field. Unused fields therefore occupy
two spaces. This way the software knows exactly
10. CAP has an RTU configuration field. where each data group is and knows exactly how

APP-1129, Page 3
many data groups there are of each kind. (CR) is the end of transmission character.

Lets examine the whole message in our example:


CAP Polling Requests:
(LF) is the start of transmission character.
Polling requests to an RTU normally very short. All the
{ is the start of message character.
RTU needs to know is that the polling request
concerns this particular RTU and that it is a polling
D is the protocol version identifier.
request (message identifier '!'). This polling request will
cause RTU 513 to answer with a report:
513 is the station identifier.
(LF)513!(CS)(CR).
! is the message type identifier, in this case a complete
When manually polling the RTU from a keyboard, you
RTU report.
can omit the checksum (which may be difficult for you
to calculate on the fly) by sending this polling
0201020201 is the RTU configuration field. It means
message:
that the RTU is equipped as follows:
(LF)513!!(CR)
0201020201: 2 analog inputs.
Sending the message identifier twice causes the RTU
0201020201: 1 pulse counter input.
to ignore the checksum calculation.
0201020201: 2 digital inputs.
0201020201: 2 digital outputs.
0201020201: 1 analog output. CAP commands to the RTU:
FAGM is the analog input report field. Two Commands to an RTU are also normally much shorter
compressed analog values are reported in this field, than the RTU reports and are therefore easier to
FA and GM, corresponding to the RTUs analog input configure. The same message elements described
#1 and #2. These are binary values, 8 bits, where the above are used, with the following additions:
high order 4 bits are reported in the first character and
the low order 4 bits are reported in the second Command message type identifier.
character.
The command message identifier is normally a
54321 is the pulse counter input report field. It is percent sign '%'. If it is transmitted twice it will cause
reported in straight ASCII numericals and means that the RTU to ignore the checksum check. This is very
the pulse counter has counted 54,321 pulses. valuable when you are testing an RTU as you don't
have to calculate the checksum each time you
A is the compressed status input report field, manually type in a command to the RTU. For
corresponding to the RTU status inputs 1 and 2. example, to manually send a command to an LMX
'A' is a binary representation an indicates that status RTU with identifier 'XYZ' to turn relay driver #5 'ON',
input #1 is 'ON". type the following string:

B is the compressed status output (relay driver) (LF)XYZ%%R051(CR)


condition report field, corresponding to the RTU relay
driver outputs 1 and 2. 'B' indicates that relay driver (LF) is the start of transmission character. Press ctrl 'j'
output #2 is 'ON'. on your PC keyboard.

EG is the compressed analog output register report XYZ is the station identifier.
field, corresponding to the RTU analog output #1.
Same compression as with the analog inputs. %% is the command message identifier. It tells the
RTU that a command follows.
} is the end of message character.
R05 identifies relay driver (status output) #5.
(CS) is the checksum character.
1 tells the RTU to turn this relay driver 'ON'. 0 would

APP-1129, Page 4
have told the RTU to turn this relay driver 'OFF'.

Note that no checksum character needs to be


included, as the message type identifier character is
transmitted twice

(CR) is the end of transmission character, Press


'Enter' on your keyboard.

You type these commands manually when you test


an RTU. Normally, a computer or another RTU sends
these codes. They know how to calculate and place
the checksum and therefore send only one command
message identifier.

Other Commands and Reports.


In addition to the above, many other requests,
commands and reports are available. For instance,
multiple registers and large data bases are used in gas
calculating RTUs for variables and constants. These
registers are written into and read out over the CAP
protocol, using three letter data base tag designators.

Summary:
The public domain CAP protocol is in use in systems
all over the world. It is fast, flexible virtually error free
and adapts easily to different RTU configurations and
functions. Complete CAP protocol manuals are
delivered with each ScanData RTU.

Most modern software, like National Instruments'


Lookout (voted the world's best SCADA software) all
have built in drivers for the CAP protocol.

This application note, together with many other helpful


application notes, additional technical information and
prices, is available on our WEB site:
www.scan-data.com

You can also call us, 818-785-6200 for help during


US West Coast business hours.

APP-1129, Page 5

You might also like