You are on page 1of 39

Document:

Date

1KEL615158-02
2004.05.19

FLEXGATE PROTOCOL CONVERTER


DNP V3.00 Slave - SPA-bus Master

Abstract

: This is the functional specification of the Flexgate Protocol


Converter for access to SPACOM relays from a system using
the DNP V3.00 protocol. The Flexgate acts as a slave towards a
DNP line and as a master towards a SPA-bus line.

Author
Keywords
Approved
Signed

: Jorgen Winther
: FLEXGATE,SPABUS,DNP,JOWI
:
:

Revision:
01:
02:

2002-06-20
2004-05-19

First issue.
A few document corrections.

References:
[1]
[2]
[3]
[4]
[5]
[6]
[7]

Title
DNP V3.00 Data Link Layer
DNP V3.00 Transport Functions
DNP V3.00 Application Layer
DNP V3.00 Data Object Library
DNP V3.00 Subset Definitions
SPA-BUS COMMUNICATION
PROTOCOL V2.3
FLEXGATE
Hardware specification

Document number
P009-0PD.DL
P009-0PD.TF
P009-0PD.APP
P009-0BL
P009-0IG.SUB
34 SPACOM 2EN1B
01.02.1988
1KEL614979

Copyright belongs to ABB A/S. The information herein must not be supplied to
third parties without written permission from ABB A/S.
2/39

1KEL615158-02

TABLE OF CONTENTS
FRONT PAGE ................................................................................................. 1
REVISION, DISTRIBUTION & REFERENCES ............................................... 2
TABLE OF CONTENTS .................................................................................. 3
1.

INTRODUCTION....................................................................................1-1

2.

INTERFACES ........................................................................................2-3

3.

DNP HANDLING....................................................................................3-5
3.1

4.
5.

3-10

SPA-BUS HANDLING .........................................................................4-13


CONFIGURATION ...............................................................................5-17
5.1
5.2
5.3
5.4
5.5
5.6
5.7
5.8

6.

COMPATIBILITY

Configuration Commands
Introduction to the Configuration Tools
FLEXGATEDNP Workbook - I/O List Sheet
FLEXGATEDNP Workbook - Sheet 2
ConfigFlexgate Program - View Config.
ConfigFlexgate Program - Send Config.
ConfigFlexgate Program - Fetch Config.
ConfigFlexgate Program - Ad Hoc Commands

5-17
5-24
5-25
5-28
5-30
5-31
5-32
5-33

PERFORMANCE .................................................................................6-35

1KEL615158-02

3/39

1. INTRODUCTION
This is the functional description of the FLEXGATE protocol converter as DNP
V3.00 to SPA-bus converter. The converter is the master for a number of
SPA-bus slaves (relays) using one RS-232 port. On another RS-232 (or RS485) port it acts as a DNP V3.00 slave.
Note that the FLEXGATE is now delivered in two versions, one where the
FLEXGATE is a Modbus RTU slave and one where it is a DNP V3.00 slave.
The two versions are described seperately. This document describes the
function where it is a DNP V3.00 slave.
The mapping between DNP and SPA-bus addresses is configured through a
3'rd RS-232 port and stored in flash RAM. This port may also be used for
testing. A possible system configuration is outlined below.

SCADA System
DNP V3.00 master

DNP V3.00 slave


Protocol converter
SPA bus

RS 232
Optical converter
SPAZC_

I/O port

RS 232
Configuration PC

Protection relay

Protection relay

The SCADA system is the master, using requests conforming to the DNP
V3.00 protocol. The section on DNP handling contains a DNP device profile.
The interface is RS-232 or RS-485. Time must be set by means of DNP write
requests. Synchronization down to a few milliseconds can be obtained by
means of a minute pulse input.
According to the configuration, the converter will scan the SPA-bus relays for
the configured data and place it at the required DNP addresses for reading by
DNP read requests. Binary input objects may be updated both from scan of
static SPA-bus data and from SPA-bus events. DNP control operations are
routed directly through to the relay, after proper address and value mapping,
so that the outcome of a DNP control request reflects the result of the writing
to the SPA-bus relay. An optical converter from RS-232 to one or more fiber
optical rings is normally required as interface to the relays.

1KEL615158-02

1-1

DNP object addresses are mapped to SPA-bus addresses by means of


configuration data entered on the terminal I/O port. The configuration uses an
ordinary line oriented ASCII discipline. It is possible to configure by means of
a terminal or terminal emulator. However, a Microsoft Visual Basic program
for down/up-loading of the whole configuration from/to an ASCII file is
included in the delivery. The program may also be used as a simple terminal
emulator for testing. The configuration file may be generated by means of a
Microsoft Excel application.
The hardware for the procotocol converter is based on a Hitachi H8/3003
microprocessor. The processor has two built-in serial ports; a 3'rd port is
implemented by means of an external UART. The kernel hardware is placed
on a small printed circuit board, the Add-On print, plugged onto a Europe card
containing interface circuits and power regulator. The Europe card is mounted
in a rugged aluminium box.

1-2

1KEL615158-02

2. INTERFACES

SCADA System
DNP V3.00 master

DNP V3.00 slave


Protocol converter
SPA bus

RS 232
Optical converter
SPAZC_

I/O port

RS 232
Configuration PC

Protection relay

Protection relay

Interface for
Power supply
SPA-bus

DNP V3.00

Configuration,
diagnostics,
minute pulse

1KEL615158-02

Characteristics
24 Volts DC. Galvanic isolated. Power consumption 2.5
Watts.
9-pole D-sub female. Ground, Rx and Tx used. RS-232
signal levels. 1 start-bit, 7 data bits, 1 even parity bit and 1
stop bit. Speed fixed to 9600 bits per second. SPA-bus
master. The SPA-bus relays may be configured with data
communication addresses in the range 1 to 99.
15-pole D-sub female. RS-232 or RS-485 signal levels
depending on setting of DIL switch 8 on the Addon Print (RS232 if OFF). Ground, Rx, Tx, DTR and RTS used for RS-232;
Rx+, Rx-, Tx+ and Tx- used for RS-485. 1 start-bit, 8 data
bits, 1 stop-bit. Parity configurable as none, even or odd.
Speed configurable from 250 to 20000 bits per second.
Modem control configurable. DNP V3.00 slave. Slave
number, maximum length of link frame and application
fragment and link timeout and retries configurable.
25-pole D-sub female.
Configuration and testing:
RS-232 signal levels. Ground, Rx and TX used. 1 start-bit, 8
data bits, 1 odd parity bit, 1 stop-bit. Speed fixed to 9600 bits
per second. Protocol is ASCII, terminal I/O with carriage
return, line-feed, echo and prompt. Suitable for a standard
PC modem cable.
Diagnostics:
6 pins are used to signal the state of the protocol converter
as 0/+5 Volts digital outputs. The signals are:
2-3

Interface for

Characteristics
RUN - converter alive (toggles every second)
CONFIG - converter configuration checked and accepted
SLAVE - communication ok with all SPA-bus relays
MASTER - correct DNP telegram received within last 30
seconds
MINP - toggled every time a minute pulse is received (if
minute pulse is configured)
5V - internal Voltage
Signals CONFIG, SLAVE, MASTER and 5V are steady on
(+5 Volts) when ok.
These signals and Rx and Tx may be displayed by field
service personel by means of a special FLEXGATE TEST
TOOL.
Minute pulse:
2 pins, ground and pulse input. The synchronization point is
defined when input is falling at some level below 5 Volts. The
ON level may be from +5 to +30 Volts. The input resistance
is 10 KOhm. The pulse input is only used if it is included in
the configuration.

Note that all grounds are common, except the power supply ground.

2-4

1KEL615158-02

3. DNP HANDLING
The FLEXGATE acts as a DNP slave according to the device profile at the

SCADA System
DNP V3.00 master

MoDNP V3.00 slave


Protocol converter
SPA bus

RS 232
Optical converter
SPAZC_

I/O port

RS 232
Configuration PC

Protection relay

Protection relay

end of this section. The following key features can be mentioned.

All polling can be done as class polling, class 0 static binary input and
static analog input for the initial checkcycle, class 1 for binary changes and
class 2 for analog changes. Class 3 is not used.

The normal strategy for a DNP master is to read all static objects and then
poll for changes. It is however possible to use static read exclusively,
either as class 0 poll or as more specific reading. In that case the master
must time-stamp changes, of course.

When a static binary input object is read, all change events queued for the
object are removed from the event queue. This means that after a
checkcycle, only new change events will be seen.

When any read of binary or analog changes and any read of static binary
input returns one or more changed objects, a confirm is required. After the
confirm, the changes are not sent in a subsequent reading of changes as it
is assumed that the DNP master has recorded the changes even if sent in
a static read response.

When reading static analog inputs, the change flags are removed from the
objects read, i.e., they will only be transmitted as changes if they change
again.

The blocked, failed, event overflow and restarted statuses of the individual
SPACOM relays may be controlled and monitored using configurable DNP
index ranges.

1KEL615158-02

3-5

Only one analog change event is stored for each analog input object. The
change event is without time-tag. The DNP master may however request
analog changes with time-tags; the time-tag will then be generated as the
time of the DNP response.

In case of binary event overflow (in the relays event buffer or in the
FLEXGATE event buffer) all stored time-tags of events from the SPACOM
relay causing the overflow are lost and only the final change of a changed
binary input will be sent, time-tagged with the time of the DNP response.

As long as the overflow state persists, no new time-stamped events are


generated for the object; the object flag is just changed and marked for
transfer as a change.

The overflow state is removed for all relays when there are no pending
binary changes, as inspected once every second.

If the communication with a relay is lost, the flags of all objects belonging
to the relay are changed to communication failed and all binary input
events of the relay are removed from the event queue as with event
overflow. When the object lateron is read from the relay, the object flag is
changed to communication ok. Communication failed is also the initial
state after restart of FLEXGATE. This will not be seen from the DNP
master for all objects which are read ok during the initial SPA-bus
checkcycle of all configured input items.

Time-stamped events are not generated for an object, in case of event


overflow, change of communication failed flag or if the object has been
marked for transfer, but not transferred yet; the flag of the object is just
changed and marked for transfer as a change (stamped with time of
response).

Binary change events are not sorted according to time. I.e., queued
change events are transmitted to the DNP master in the sequence they
are detected from the relays.

Analog changes and not time-stamped binary changes are not sorted. If
there are pending changes, the changes are handled in a round-robin
fashion. If there are no pending changes, the first detected change is sent
first; the rest are sent round-robin.

For static binary input, variation 0, 1 or 2 may be requested, but the


response will always contain variation 2. The default binary change
variation is configurable. A binary change is only sent once, i.e., either with
or without time-tag, not both.

The default variations for static analog input and analog changes can be
chosen as 16-bit or 32-bit integers. The corresponding SPA-bus values
may be prescaled by a factor of 10, 100 or 1000 in order to preserve
decimals.

The DNP control operations select/operate, direct operate and direct


operate no acknowledge are all supported by the FLEXGATE. The select
operation is handled within the FLEXGATE with a fixed timeout of 60

3-6

1KEL615158-02

seconds, i.e., the eventual operation towards the relay is always direct, not
using any select/execute feature of the relay.

Unsolicited responses are never sent.

In read responses, the minimal qualifier is always used, i.e., qualifier 00 for
static data if the stop index is <= 255 and qualifier 17 for changes if the
first changed index is <= 255. (A new object header with qualifier 28 is
made if a later changed index is > 255).

Maximum link frames of 292 bytes are always accepted as requests. A


request must always be within one application fragment and within one link
frame.

Handling of internal indications:


Octet

Bit

First
octet

All stations message received. Sent in first response after


a broadcast message has been received.

Class 1 data available. Set if there may be binary changes


available.

Class 2 data available. Set if there may be analog


changes available.

Time-synchronization required from master. Set


immediately after restart, a configurable period after last
time-synchronization and after a time-synchronization
which has not been accepted. Cleared after a successful
time-synchronization and after an explicit write of 0 to this
bit.

Device restart. Set after restart or reconfiguration of


FLEXGATE. Cleared after an explicit write of 0 to this bit.

Function code not implemented. Set in the response when


an unimplemented application function code has been
received or reading of a not handled object group and
variation is requested.

Object unknown. Write or control to object group and


variation for which write or control is not handled.

Parameter error. Used for a not handled qualifier or if


there is a format error, e.g., not room in request for the
given qualifier or stop index less than start index or
quantity = 0.

Second
octet

Handling

A NULL response is given when an otherwise correct read request does not
hit any objects.

1KEL615158-02

3-7

Use of DNP flags for input objects:


Flag Bit

Flag Name

Usage

bit0

Online

Set to 1 for all configured input objects.

bit2

Communication
lost

Set for input objects from relays which are


blocked or in error. Also set for individual objects
if syntax problem or NACK when reading the
value. Removed when a value has been read
from the relay.

bit5

Over-range

Only set for analog input values when sent as


16-bit, if the value does not fit within 16 bits. The
value will be the exceded range end value. The
flag is not set directly due to the value read from
SPA-bus. In case of numeric problems there,
communication lost is set.

bit7

State

The state, 0 or 1, of a binary input.

Handling of time synchronization:

The internal indication, time-synchronization required, is set immediately


after restart, a configurable number of seconds after last timesynchronization and after a time-synchronization which has been skipped.

If the DNP request defines a time change which excedes +/- 19


milliseconds, the first two consecutive such changes are skipped,
assuming some timing problem. The following write time request sets the
clock unconditionally.

The time of a DNP write time request is taken as the time when the first
byte of the telegram has been received. The DNP master must take any
preceding delay into account.

18 milliseconds are added to the received time before setting the local time
of the FLEXGATE in order to make the local time adequate for the SPAbus time setting procedure.

Handling of controls:

There may be at most 20 controls active at time.

A select which has not timed out (60 seconds) and a control which has not
yet been executed towards SPA-bus is active.

A control relay output block with clear = 1 cancels an active control for the
same object.

A control relay output block with count = 0 or trip/close and code both
NULL is dummy, except for a possible clear function.

A control relay output block with trip or pulse ON or latch ON gives the
control value 1, otherwise control value 0. For a single item SPA-bus
command this value is written to the relay. For a double item SPA-bus

3-8

1KEL615158-02

command, 0 selects the lowest SPA-bus channel number or data number


and 1 selects the highest channel or data number; a 1 is written to the
relay in both cases. For a unit block DNP index, control value 0 means
deblock, 1 means block. For a non-unit control, the control value may be
inverted by means of the configuration.

On/Off times and pulse or latch are ignored, as these functions are
assumed to be handled by the SPA-bus relays. Queue and count except
for the non-zero check, is not handled.

1KEL615158-02

3-9

3.1 COMPATIBILITY
The FLEXGATE converter implements a
"LEVEL 2 DNP V3.00 IMPLEMENTATION (DNP-L2)" according to the
DNP V3.00 SUBSET DEFINITIONS (Doc. P009-0IG.SUB)
The following Device Profile identifies the selected options:

DNP V3.00
DEVICE
DOCUMENT

PROFILE

Vendor Name

Device Name

ABB A/S Denmark

FLEXGATE
DNP - SPA-bus

Highest
DNP
Level Device Function:
Supported:
Master Slave
For Requests Level 2
For Responses Level 2
Notable objects, functions, and/or qualifiers supported in addition to
the Highest DNP Levels Supported (the complete list is described in
the attached table):
Max. Data Link Frame
Size (octets):

Transmitted
configurable
range 46 to 292
Received
292

Max. Application Fragment


Size (octets):

Transmitted
configurable
range 31 to 2048
Received
249 *)
*) in one link frame

Maximum
Application
Retries:

Maximum Data Link


Retries:

None
Fixed at
Configurable,
range 0 to 15

Layer

None
Configurable,
range_ to_

Requires Data Link Layer Confirmation:


Never

Always

Sometimes

Configurable

Requires Application Layer Confirmation:


Never
Always (not recommended)
When reporting any Event Data and when
reporting changed static binary inputs (Slave devices only)
When sending multi-fragment responses (Slave devices only)

Timeouts while waiting for:


Data Link Confirm
Complete Appl. Fragment
Application Confirm
Complete Appl. Response

None
None
None
None

Fixed at _________
Fixed at _________
Fixed at _________
Fixed at _________

Variable
Variable
Variable
Variable

Configurable
Configurable
Configurable
Configurable

Sends/Executes Control Operations:


WRITE Binary Outputs
SELECT/OPERATE
DIRECT OPERATE
DIRECT OPERATE - NO ACK
Count > 1
Pulse On
Pulse Off
Latch On
Latch Off
Queue
Clear Queue

Never
Never
Never
Never
Never
Never
Never
Never
Never
Never
Never

Always
Always
Always
Always
Always
Always
Always
Always
Always
Always
Always

Sometimes
Sometimes
Sometimes
Sometimes
Sometimes
Sometimes
Sometimes
Sometimes
Sometimes
Sometimes
Sometimes

Configurable
Configurable
Configurable
Configurable
Configurable
Configurable
Configurable
Configurable
Configurable
Configurable
Configurable

See details on handling of control relay output in the preceding description.


Reports Binary Input change Events when no
specific variation is requested:

3-10

Reports time-tagged Binary Inputs


change Events when no specific variation

1KEL615158-02

Never
Only time-tagged
Only non-time tagged
Configurable to send one or the other

requested:
Never
Binary input Change with time
Binary input Change with Relative time
Configurable
Sends Static Data in Unsolicited
Responses
Never
When device restarts
When status flags change

Sends unsolicited responses


Never
Configurable
Only certain objects
Sometimes
ENABLE/DISABLE function codes supported

Default Counter Object/Variation

Counters Roll Over at:

No counters Reported
Configurable
Default Object:
Default Variation:
Point-by-point list attached

Sends Multi-Fragment Responses:

No counters Reported
Configurable with database
maintenance
16 bits
32 bits
Other Value: 8 to 32 bits
Point-by-point list attached
Yes

No

The following objects, variations, qualifiers and functions are handled:


OBJECT
Description

REQUEST
Func
Qual
Codes
Codes
(dec)
(hex)
1
00, 01,
06
1
00, 01,
06
1
00, 01,
06
1
06, 07,
08
1
06, 07,
08
1
06, 07,
08
1
06, 07,
08

RESPONSE
Func
Qual
Codes
Codes
(dec)
(hex)

Analog Input - All Variations

3, 4, 5,
6
1

32-Bit Analog Input

30

16-Bit Analog Input

30

32-Bit Analog Input without Flag

30

16-Bit Analog Input without Flag

32

32

32

Analog Change Event - All


Variations
32-Bit Analog Change Event
without Time
16-Bit Analog Change Event

Obj

Var

Binary Input - All Variations

Binary Input

Binary Input with Status

Binary Input Change - All


Variations
Binary Input Change without
Time
Binary Input Change with Time

12
12

0
1

Binary Input Change with


Relative Time
Control Block - All Variations
Control Relay Output Block

30

30

1KEL615158-02

1
1

129

00, 01

129

17, 28

129

17, 28

129

17, 28

129

echo of
request

01,

129

00, 01

01,

129

00, 01

01,

129

00, 01

01,

129

00, 01

07,

129

17, 28

07,

129

17, 28

17, 28
00,
06
00,
06
00,
06
00,
06
00,
06
06,
08
06,
08
06,

*)

01,

07,

3-11

32

32

41

41

without Time
32-Bit Analog Change Event
with Time **)
16-Bit Analog Change Event
with Time **)
Analog Output Block - All
Variations
32-Bit Analog Output Block

41

16-Bit Analog Output Block

50
50

0
1

Time and Date - All Variations


Time and Date

51

51

Time and Date CTO - All


Variations
Time and Date CTO

51

Unsynchronized Time and Date


CTO

52
52

0
1

Time Delay - All Variations


Time Delay Coarse

129

52

Time Delay Fine

129

60

06

60

Class 0 Data - static binary and


analog input
Class 1 Data - binary changes

60

Class 2 Data - analog changes

60

80

Class 3 Data - no data in


response
Internal Indications

06, 07,
08
06, 07,
08
06, 07,
08
00,
index=7
or
index=4

Cold restart
Delay measurement

13
23

1
1

08
06,
08
06,
08

07,

129

17, 28

07,

129

17, 28

echo of
request
echo of
request

3, 4, 5,
6
3, 4, 5,
6

17, 28

129

17, 28

129

07,
quantity
=1

129

129
129

07,
quantity
=1
07,
quantity
=1
07,
quantity
=1
07,
quantity
=1

*) the response is always variation 2, binary input with status.


**) the time is the time of the response. There is no queue of analog events.

3-12

1KEL615158-02

4. SPA-BUS HANDLING
The table below gives a survey of the SPA-bus activities performed, in priority

SCADA System
DNP V3.00 master

DNP V3.00 slave


Protocol converter
SPA bus

RS 232
Optical converter
SPAZC_

I/O port

RS 232
Configuration PC

Protection relay

Protection relay

order.
Priority

Activity

Comment

Command or
setpoint

SPA-bus output performed as the direct handling


of a DNP operate or direct operate request.
Control operations are handled in the order they
are received. Normally only one control is active
because the DNP response waits for the SPAbus operation. Note that one DNP control
request may contain several individual controls.

2.1

Read events

Events are used to update binary states


according to the configuration. If one of the
standard events E50 (restart) or E51 (event
overflow) is obtained, a WC:0 operation is
performed instead of the next read event.

2.2

Cyclical
scanning

All binary and analog input items are normally


scanned cyclically. However, binary inputs which
are event updated and binary and analog inputs
which are marked as checkcycle only in the
configuration (=) are not scanned cyclically.

Time setting

This is done by broadcast, relay communication


address 900. It is done every 10 seconds by
sending the time within the minute. The time sent
is the actual clock of the protocol converter just

2.3.1

1KEL615158-02

4-13

Priority

Activity

Comment
before the first byte of the telegram is sent.
Every 200 seconds, the complete date and time
is sent before sending the time within the minute.
Time setting is only done if the DNP master has
set the time at least once.

2.3.2

Test failed relay

If some relays, but not all, have failed, one relay


is tested every 10 seconds. The testing is
performed by means of an RC request. If the
request succeeds, testing of the next failed relay
is scheduled within 2 seconds in order to get all
relays back in service as fast as possible, e.g., if
an optical loop or power has been reestablished.
If the test request fails, it is not retried
immediately. If all relays are failed, testing is
performed continuously. After deblock of a failed
relay, testing is performed immediately.

2.3.3

Checkcycle

When a test failed operation has succeeded,


when a not failed relay is deblocked and when a
command or setpoint has been performed the
relay is checkcycled. The checkcycle always
starts with reading of all pending events from the
relay. After that, all static input items of the relay
are read, except after a control operation, where
binary input items which are configured as event
updated are not checkcycled, in order not to
disturb the expected event updated backindication. On the other hand, if event updated
items have been skipped, the checkcycle ends
with a single reading of events in order to
capture a late back-indication.

The priority column above should be read such:

priority 1 is done before any other activity

priority 2.1, 2.2 and 2.3 are done round-robin so that a 2.1 activity is
followed by a 2.2 which is followed by a 2.3, if any, which is followed by a
2.1 etc.

priority 2.3.1, if pending, is done before 2.3.2 which is done before 2.3.3.

The strategy is that, in the absence of retries, a read event request is


performed at least as every 3'rd SPA-bus request. This should ensure a
maximum response time for binary changes. The same is true for changes
due to scan of static items.
A SPA-bus request which is not answered in time with a syntactically correct
response is retried up to two times. After that, the relay is reported in error and
the only activity is the periodical test (2.3.2 above) to get it into service again.

4-14

1KEL615158-02

Initially, after restart or reconfiguration of the FLEXGATE, all configured relays


are first tested and then the ok ones are checkcycled. After that, the
operations are performed according to the table above. During the initial test
and checkcycle phase, DNP requests for data are not answered in order not
to return unnecessary invalid data.

1KEL615158-02

4-15

The table below defines the limitations imposed by the implementation of the
protocol converter concerning the SPA-bus relays.
Item

Allowed range

Relay
communication
address

The unique logical address for each relay can be


selected from 1 to 99.

Number of relays

The FLEXGATE software may impose a restriction on


how many different communication addresses (slave
units) it will handle. For example at most 15 relays.

Channel number

0 to 999

Data letter

A to Z, but it should normally be I, M, O, S or V

Data number

0 to 999

Event number

0 to 254

Item range
(as in 1/16I1)

At most one range (/) is allowed, i.e., channel or data


number range is allowed, not both. For scanned data,
there must be at most 16 items in the range. For
setpoints no range is allowed. For commands, it is
allowed to have a range with 2 items. This causes the
first item to be used for a close/off command and the
last item to be used for a trip/on command or the
opposite.

Decimals
conserved

When converting to the internal 32-bit integer format, 0,


1, 2 or 3 digits after the decimal point in the SPA-bus
telegram may be conserved. Rounding takes place
when decimals are discarded from an input value.
Decimal point may be inserted for setpoints to give 1, 2
or 3 decimals.

Maximum digits

There may be at most 9 digits in a SPA-bus value.

Value range

The internal value format is 32-bit signed integer equal


to the SPA-bus value multiplied by 1, 10, 100 or 1000
according to the configuration. The DNP master may
choose to read analog values as 32- or 16-bit signed
integers.

SPA-bus requests

At most 1000 individual SPA-bus requests can be


defined, input or output (BIN, ANA, CMD and SET lines).

Events

At most 22 events may occur in one SPA-bus input


telegram. At most 1000 binary changes may be stored in
the internal queue.

4-16

1KEL615158-02

5. CONFIGURATION

SCADA System
DNP V3.00 master

DNP V3.00 slave


Protocol converter
SPA bus

RS 232
Optical converter
SPAZC_

I/O port

RS 232
Configuration PC

Protection relay

Protection relay

5.1 Configuration Commands


The configuration dialog may be performed manually from a terminal
(emulator) as well as by means of the FlexConfig program. The general dialog
is this:
From terminal or
program
COMMAND<CR>

To terminal or program

Comment

COMMAND

A command and its echo

<CR><LF>ANSWER

Answer to the command, 0 to n


lines.

<CR><LF> >

Prompt for next command.

In COMMAND's, capital and non-capital letters may be used freely.


The contents and meaning of the individual configuration commands is the
following:
Config command
LIST

1KEL615158-02

Function
The LIST command, followed by a sufficient number of
empty lines produces a complete listing of the
configuration, one line at a time. Used for uploading
(reading) of the configuration. A non-empty command
line interrupts the listing. The listing is sorted on line
type, CONFIG, PORT, MPULSE, LINK, APPL, UNIT,
5-17

Config command

Function
BIN, ANA, CMD, SET and CHECK, and within the
same type it is sorted on DNP indexes. All letters are
capital, except in the xxxxx text of the CONFIG line
where non-capital letters are conserved.

CONFIG xxxxx
D18.rr

The CONFIG command stops the protocol operation


and clears the existing configuration in RAM, not in
flash RAM. It starts the checksum calculation for the
configuration lines. The parameter xxxxx is a free text
of up to 65 characters. The D18.rr is an optional
identification of the program version. It is inserted or
corrected by the LIST command. Note that this may
influence the checksum.

PORT aaaaa sssss


pppp
RTS dddd

The PORT command defines the basic interface


parameters. The parameter aaaaa is the DNP slave
address, 0..65534. The parameter sssss defines the
line speed, 250..20000 bits/second. The optional
parameter pppp defines the parity as EVEN, ODD or
NONE. The optional parameter RTS dddd defines a
delay of 1..2000 milliseconds after setting request-tosend to sending of first data. Delay after sending of last
data to request-to-send down is fixed to 11 bits time + 1
millisecond. If RS-485 is used, dddd is the time from
activation of the transmitter to sending of data; in that
case dddd should be set to 1 millisecond. Default if
PORT command not used or parameters omitted is
PORT 1 9600 NONE
Slave address 1, speed 9600, no parity and no modem
control (and not RS-485).

MPULSE ddddd

Minute pulse input used. The default is no minute pulse


input. ddddd is the offset from the real minute change
to the pulse (falling edge) occurs given as +/- 0..59999
milliseconds. The offset should take into account the
transmission time of the SPA-bus time set telegram, so
add extra 18 milliseconds to the offset. The time
between two pulses must be within 59 to 61 seconds
measured on the internal clock. When the first such
interval is seen, the internal status bit - time not
synchronized by minute pulse - is cleared. From the
second such interval, the internal clock is adjusted so
that it will be at most +/-3 milliseconds out of sync. at
the next minute pulse. If the minute pulse stops, the
internal status bit - time not synchronized by minute
pulse - is set after 90 seconds.

CHECK s1 s2 s3 s4

The check command tests that the checksum of the


preceding configuration lines starting with CONFIG has
the checksum given by s1, s2, s3 and s4. Here s1 is
the number of lines, s2 is the number of characters, not

5-18

1KEL615158-02

Config command

Function
counting trailing blanks, <CR> and <LF>, and only
counting seperating blanks as one blank. s3 is the sum
of these characters and s4 is the sum of sums starting
summation on each line so that the sum does not
depend on the line order. The sums are decimal
integers modulo 65536 (16-bits). The sums are
generated by the LIST command. If the check is ok, the
new configuration is saved in flash RAM; if the
checksum is wrong, an error message is given and the
configuration is not saved in flash RAM. The protocol is
restarted from the contents of the flash RAM in any
case.

SAVE

If at least one preceding BIN, ANA, CMD or SET line


has been accepted, the new configuration is saved in
flash RAM. May be used after manual configuration or if
the configuration file has been edited and the
checksum is not known. The protocol is restarted from
the contents of the flash RAM in any case.

LINK
MAX mmm
TIMEOUT tttt
RETRIES rr

This is an optional line with optional parameter pairs


defining the maximum size of a transmitted link frame
including CRC's from 46 to 292 bytes, the timeout for
retry of confirmed link operations from 50 to 5000
milliseconds and the number of retries if a link confirm
is not received from 1 to 15. The default, if LINK
command or a parameter pair is omitted, is
LINK MAX 292
which means maximum transmitted link frame size is
292 and that link data are sent unconfirmed. If
TIMEOUT is given, link data are sent confirmed. If
RETRIES are not given but TIMEOUT is given,
RETRIES defaults to 2.

APPL
MAX mmmm
SYNCPER pppp
BCHVAR v
ANAVAR v
ACHVAR v

This is an optional line with optional parameter pairs


defining the maximum size of a transmitted application
fragment from 31 to 2048 bytes, the maximum time
between time synchronizations from master and the
default variations for binary changes, static analogs and
analog changes. The default, if APPL command or a
parameter pair is omitted, is
APPL MAX 2048 SYNCPER 300
BCHVAR 2 ANAVAR 1 ACHVAR 1
which means that the maximum transmitted application
fragment is 2048 bytes, that time-synchronization is
required 300 seconds after last sync., that binary
changes are sent with time and analogs are sent as 32bit with flag, but without time. SYNCPER can be given
from 0 (no period) to 3600 seconds. BCHVAR can be 1
to 3, ANAVAR 1 to 4 and ACHVAR 1 to 4.

1KEL615158-02

5-19

Config command

Function

UNIT
BLOCK iiiii
FAIL iiiii
OVERFLOW iiiii
RESTART iiiii

This is an optional line with optional parameter pairs


defining DNP indexes for unit status control. The
indexes given corresponds to the relay with the lowest
configured unit number. The highest DNP index is then
given by adding the difference between highest and
lowest configured unit number. For the BLOCK
indexes, both a binary input range and a control relay
block range is configured, for the others only a binary
input range is configured. The RESTART inputs are
handled as ONONLY (wischer), i.e., only changes to 1
are sent, see description of BIN. The default, if UNIT
command or a parameter pair is omitted, is that the
ranges are not configured. The indexes can be
anywhere from 0 to 65534, but must not overlap with
other configured DNP indexes for the same object
types.

BIN iiiii uu-sssss


events
conv
=

This line defines one or more DNP binary input bits to


be updated from SPA-bus. The line contents are:

5-20

iiiii is the lowest DNP index, 0 to 65535

uu-sssss is the SPA-bus request definition in the


format given by these examples: 17-1/16I1, 43O1/7 or 7-I5. Here, the first number is the relay
communication address, the next, if any, is a
channel number or a channel number range,
then follows the data type letter and at last the
data number or a data number range. The
number of items determines together with the
conversion function conv the number of bits and
thus DNP indexes.

events are from 1 to 4 optional event codes


given f.ex. as E2 E1 E3 E4, i.e., one event is
given as Ennn where nnn is a number from 0 to
254. If there is a range in the SPA-bus request, it
must be a channel number range. The channel
number of the event, when it occurs, must
correspond to a channel number within the
range. The update value is given by the
sequence in which the event codes are
configured, so that the update value for the 4
events are 1, 2, 0, 3 respectively, i.e., 1 for the
first event (E2 in the example above), 2 for the
second (E1 above), 0 for the 3'rd (E3 above) and
3 for the last (E4 above). For ONONLY objects,
one event code should suffice, for SINGLE
objects, two event codes (only the lowest value
bit is used) and for DOUBLE objects, all 4 event

1KEL615158-02

Config command

ANA iiiii uu-sssss


conv
=

1KEL615158-02

Function
codes should be specified. For BIT16, event
updating is not really meaningful.

conv is an optional conversion function given by


an ASCII string: SINGLE, DOUBLE, BIT16,
ONONLY. The default is SINGLE, one bit taken
from the lowest bit of the SPA-bus value.
DOUBLE means that two DNP indexes are
updated from the SPA-bus value, the lowest bit
of the value goes to the lowest DNP index.
BIT16 means that 16 DNP indexes are updated.
As SINGLE, ONONLY defines one DNP index,
but the value can only be updated to 1 from
SPA-bus (wischer) and only one such change
will be pending towards the DNP master at any
time. Internally, the value goes to 0 only after
transmission to and confirm from the DNP
master. The change to 0 does not cause a
binary change event.

the optional character = indicates that the item


should only be read at checkcycle time. This can
be used for input which normally never change
or only change due to control. If events are
specified, = is the default and need not be given.

This line defines one or more DNP analog inputs to be


updated from SPA-bus. The line contents are:

iiiii is the lowest DNP index, 0 to 65535

uu-sssss is the SPA-bus request definition in the


format given by these examples: 17-112S1/5,
43-I1/3 or 7-I5. I.e., the same as for BIN lines.
The first number is the relay communication
address, the next, if any, is a channel number or
a channel number range, then follows the data
type letter and at last the data number or a data
number range. The number of items determined
by the channel or number range determines the
number of DNP indexes.

conv is an optional conversion function given by


an ASCII string: INT, INT.1, INT.2 or INT.3. The
default is INT meaning that the floating point
SPA-bus value is converted directly to the DNP
integer value. The other 3 means that the SPAbus value is multiplied by 10, 100 or 1000
respectively before the conversion in order to
preserve decimals.

the optional character = indicates that the item

5-21

Config command

CMD iiiii uu-sssss


conv

SET iiiii uu-sssss


conv

5-22

Function
should only be read at checkcycle time. This can
be used for input which normally never change
or only change due to control in order to save
scanning time.
This line defines one DNP control relay output block.
The line contents are:

iiiii is the DNP index, 0 to 65535

uu-sssss is the SPA-bus request definition in the


format given by these examples: 13-120V4, 43120V4/5 or 99-120/121V4. The first number is
the relay communication address, the next, if
any, is a channel number or a channel number
range, then follows the data type letter and at
last the data number or a data number range. If
there is a range, it must be a range of two
consecutive numbers, either channel or data
number, not both. There is only one DNP index
involved in any case. If there is no range, the
SPA-bus output value will be 0 or 1, depending
on conv and the control. If there is a range, the
command value is alway one, the control selects
then the lowest or the highest of the two
numbers in the range instead.

conv is an optional conversion function given by


an ASCII string: CMD or CMDN. The default is
CMD meaning that a control relay output block
with trip or pulse ON or latch ON gives the
control value 1, otherwise control value 0. With
CMDN, a control relay output block with trip or
pulse ON or latch ON gives the control value 0,
otherwise control value 1. The control value
selects either the SPA-bus value or the SPA-bus
ID as described above.

This line defines one DNP analog output block. The


line contents are:

iiiii is the DNP index, 0 to 65535

uu-sssss is the SPA-bus request definition in the


format given by these examples: 13-11V43, 43S18. The first number is the relay communication
address, the next, if any, is a channel number,
then follows the data type letter and at last the
data number, if any. There is only one DNP
index involved.

conv is an optional conversion function given by


an ASCII string: SET, SET.1, SET.2 or SET.3.
1KEL615158-02

Config command

1KEL615158-02

Function
The default is SET meaning that the SPA-bus
value is taken directly as the DNP integer value
in the analog output block. The other 3 means
that the floating point SPA-bus value is found by
dividing the DNP value with 10, 100 or 1000
respectively in order to set also 1, 2 or 3
decimals.

5-23

5.2 Introduction to the Configuration Tools


Two configuration tools for Windows PC's can be used for configuration and
testing of the Flexgate:

FLEXGATEDNP.xls - a Microsoft Excel workbook for definition of an


I/O list and for preparation of the configuration file from the I/O list. It is
opened as a normal Excel workbook. If the configuration file has to be
generated, Macros must be enabled. The Macro is a Visual Basic
subroutine, which generates worksheet 2 of the workbook when
activated from a pushbutton. The subroutine works entirely within the
workbook and does not access any files. Be careful not to change the
few reserved cells.

ConfigFlexgate.exe - a Microsoft Visual Basic program for download


and upload of configuration files. It works also as a simple terminal
emulator for testing of the protocol converter. It uses COM port 1
(COM1). It will only access files, which are explicitly selected by the
user. It enables COM1 from the start.

The two tools may be downloaded from our Webpage or received as attached
mail files. The two tools are described in the following sections.

5-24

1KEL615158-02

5.3 FLEXGATEDNP Workbook - I/O List Sheet


The workbook contains a small example. This may be copied and changed
according to the actual project.

Rows 8 to 42 contain an example I/O list and should be replaced by the actual
I/O list. Each of the 5 columns are commented in details with Excel comments
in row 4 of the sheet. The comments can be seen at the end of this section.
Columns A, B and C must be entered to define the data points on the SPAbus. Column D is a free text. Comment rows like row 7 and 8, with an empty
cell in column A, may be used freely. Column E contains a pushbutton, DNPSPA Config. When the button is activated, the rest of column E is calculated.
It contains FLEXGATE configuration commands derived from columns A, B
and C. DNP indexes are generated consecutively, starting from index 0 for
each type. The index generation may be controlled by means of the FILLER
feature.

1KEL615158-02

5-25

This is the bottom of the example sheet. The last row (here row 43) must not
be changed. In column E it shows that 29 configuration lines were generated
OK.
Column
A
B

5-26

Comment
SPA-bus relay communication address, 1..99.
The Flexgate may set a limit on how many different addresses are
allowed.
SPA-bus identification of point as:
channel-number (none or 1..999)
data letter (I, M, O, S or V)
data number (1..999).
For control, point type Cmd and CmdN, a range of 2 numbers may
be given, V3/4 means V3 for OFF and V4 for ON command or
opposite.
For binary input, additional up to 4 event codes, Ennn are allowed.
Use FILLER nn to reserve DNP indexes for nn items of the given
type.
Point type as:
Single - 1 binary input bit
Double - 2 binary input bits from 1 SPA-bus item
OnOnly - 1 binary input which only goes on (wischer)
Bit16 - 16 binary input bits from 1 SPA-bus item
Int - analog input, no SPA-bus decimals conserved
Int.1 - analog input, SPA-bus value * 10
Int.2 - analog input, SPA-bus value * 100
Int.3 - analog input, SPA-bus value * 1000
Cmd - relay control block, ON/OFF command
CmdN - relay control block, OFF/ON command
Set - analog output, no SPA-bus decimals
Set.1 - analog output. div 10 gives SPA-bus value
Set.2 - analog output. div 100 gives SPA-bus value

1KEL615158-02

D
E

Set.3 - analog output. div 1000 gives SPA-bus value


For binary and analog input a = may be used after the type to
indicate checkcycle only. This may be used to save normal
scanning time.
Free describing text, this column is only for description.
It is also possible to have complete rows with free text, but leave
column A blank.
This button activates a complete check of columns A, B and C. It
calculates column E of this sheet and column A of Sheet 2.
Column A of sheet 2 can be saved as a (.txt) file and used directly
for configuration of the FLEXGATE converter.

1KEL615158-02

5-27

5.4 FLEXGATEDNP Workbook - Sheet 2


Sheet 2 of the workbook contains the FLEXGATE configuration commands to
be downloaded to the protocol converter.

Sheet 2 of the workbook contains only one column. The lines starting with
CONFIG, PORT, MPULSE, LINK, APPL and UNIT must be entered directly
according to the wanted configuration, see the definition of these configuration
commands. The first line must be CONFIG in order to have the configuration
loaded to a FLEXGATE converter. The MPULSE command should be
blanked if a minute pulse is not used. The rest of the column is calculated
when the pushbutton, DNP-SPA Config., is activated. The contents are
essentially the same as column E of worksheet 1, but the SPA-bus read
accesses have been optimized by using the range feature (/). If range reading
is not wanted, e.g., because a relay does not support it, an empty line may be
used in the I/O list to suppress the optimization. The optimization requires that
the only change from line to line is that either channel or data number
increases by 1. For BIN lines with events, it must be the channel number
which increases.

5-28

1KEL615158-02

This is the bottom of sheet 2. The next step in order to load the configuration
by means of the ConfigFlexgate program is to save sheet 2 as a text file, use
File - Save As... - Save as type: Text (Tab delimited) (*.txt) - Save. Ignore the
error messages as you are not saving the whole workbook here. (But
remember to save the workbook as a *.xls file). The saved *.txt file may then
be viewed and loaded by the ConfigFlexgate program.

1KEL615158-02

5-29

5.5 ConfigFlexgate Program - View Config.


The program may be activated from the Start button, from a shortcut or from
Explorer. The View Config button may be used to inspect a configuration file
(Notepad could also be used). For this function it is not necessary to connect
COM port 1 of the PC to FLEXGATE.

After the standard file selection dialog, the View Config. function lists the file
line by line. Empty lines are not shown.

5-30

1KEL615158-02

5.6 ConfigFlexgate Program - Send Config.


For this function, COM port 1 of the PC must be connected to the
configuration port of the protocol converter by a standard modem cable.

This shows the situation where the configuration from the worksheet example
has just been sent to the protocol converter which has accepted the
configuration, copied it to flash RAM and restarted. The sending is done by
activation of the Send Config. button which then initiates the standard file
selection dialog. Note that the last line in worksheet 2 was a SAVE command,
not a CHECK command. But in order to check the transfer, the
ConfigFlexgate program changes the SAVE command into the proper CHECK
command which makes the protocol converter check the checksum of all the
configuration commands. The > character is the prompt from the protocol
converter. The Send function reads the input file and copies it line by line to
the COM port, skipping empty lines. It terminates when there are no more
configuration lines in the file or when no prompt is received from the
converter.
Be careful not to leave the protocol converter in the state where it has
accepted a CONFIG command but never received a SAVE or CHECK
command. In this state there is no normal protocol handling. To get out of the
state, turn power off and on or retry Send Config.

1KEL615158-02

5-31

5.7 ConfigFlexgate Program - Fetch Config.


For this function, COM port 1 of the PC must be connected to the
configuration port of the protocol converter by a standard modem cable.

This shows the situation where the configuration has just been fetched from
the protocol converter. To get to top of the list window, use the slide ruler.
The standard file selection dialog is used to select the file in which to save the
configuration. The Fetch Config. button uses the LIST command to read the
configuration. The > character is the prompt from the protocol converter.
When the CHECK line from the converter is read, the program compares the
checksum it has calculated with the checksums in the CHECK line. If there is
a difference, an error message is printed. The Fetch function terminates when
the CHECK line has been read, when an error message is received or when
nothing is received from the converter. Note that the CHECK command is not
the same as that shown in the Send Config. example. That is because the
LIST command has added the program version of the protocol converter,
D18.01, to the CONFIG line. Note also that the configuration lines have been
sorted on point type.

5-32

1KEL615158-02

5.8 ConfigFlexgate Program - Ad Hoc Commands


For this function, COM port 1 of the PC must be connected to the
configuration port of the protocol converter by a standard modem cable.

The window is shown after 5 useful commands have been entered:

time - shows in the first line date and time and the number of days and
milliseconds since power-up of the protocol converter. The second line
shows that a valid minute pulse has not been received; MPULSE is
configured, but in this case no minute interrupt is connected. The 3'rd line
says that time has been set from the DNP master, that the FLEXGATE
clock was set 61 milliseconds forward in the last adjustment and that the
internal CPU clock is counting 15998 pulses per millisecond. The count is
initially set to 16000 (16 MHz), but adjusted automatically according to the
external time setting. The 4'th line shows the overall state and the DNP
input telegram state. The overall state is Ok running if the configuration is
ok and a legal DNP application request requiring a new response has
been received within the last 30 seconds. The last line shows the current
SPA-bus address, the SPA-bus activity and the input telegram state, here
waiting for the first byte (<) of the response to read events.

dnp - shows the number of DNP application request messages received,


not counting retries. Below that the error counts due to DNP telegrams,
here 1 RESET link which is normal at startup. On the last line, the number
of binary change events actually queued (0), the maximum number of

1KEL615158-02

5-33

events queued at any time since reset (2) and the number of events which
can at all be queued (1000). After that is shown the configation index of
the next to be sent non-queued, but changed, binary input and the next to
send analog input, here both 0 meaning none. Any parameter to the dnp
command (here clear) resets the message and error counts and the
maximum number of queued events.

spabus - shows error counts due to (not) received SPA-bus telegrams.


Below that, one line for each SPA-bus communication address for which
an error has been detected since last reset. The lines show the
communication address, the state of the relay, active or failed, and the
type of the last error. Here both relays have last given timeout. If it is a
NACK, the NACK code is shown as well. NACK normally indicates some
wrong SPA-bus Id in the configuration. As the last line, the times for the
last rounds through all relays reading of events and scanning of static
data, i.e., the maximum response times for SPA-bus event data and static
data respectively. Any parameter to the spabus command (here clear)
resets the error counts.

sbin - this command is used to show the current states of the binary inputs
at and after a specified DNP index, within one configured BIN item. For
each index, the state is shown as On or Off. After the state, in a bracket,
the DNP flag is shown in Hex, (01) = Online/Off, (81) = Online/On, (05) =
Online/Comm.lost/Off. After the bracket, a * means that the object is
marked for transmission as a change, a + that it also has been transmitted
and waits for confirmation. A ! means that one or more events have been
queued for the object since it was last statically read and since last
comm.lost, event overflow or block state.

sana - this command is used to show the current states and values of the
analog inputs at and after a specified DNP index, within one configured
ANA item. For each index, the value is shown as a signed 32-bit integer.
After the value, in a bracket, the DNP flag is shown in Hex, (01) = Online,
(05) = Online/Comm.lost. After the bracket, a * means that the object is
marked for transmission as a change, a + that it also has been transmitted
and waits for confirmation.

The last entered command is easily repeated by using the Enter key. The
commands may be lower or upper case.
The Clear Screen button just clears the two displayed text fields. This is
normally only needed when Ad Hoc commands have been entered. The 3
Config. buttons all start by clearing the fields.

5-34

1KEL615158-02

6. PERFORMANCE
The main limitation of the converter lies in the turn-around time on the SPAbus. In normal operation, the FLEXGATE reads events (i.e., normally ensures
that there are none) from one relay, then takes the next BIN or ANA line
configured without a = (only checkcycle), then reads events from the next
relay and so on. As a practical mean, it can be estimated that it takes 100
milliseconds for one read event + one read SPA-bus item. It is assumed that
the DNP master asks for both binary and analog changes all the time and that
there is no queue of pending changes.
The response time to SPA-bus events depends only on the number of relays:
maximum event response time =
(0.1 seconds * number of relays) + DNP scan cycle time
With f.ex. 15 relays and a DNP scan cycle of
maximum event response time of 2 seconds.

0.5 seconds, this gives a

The update cycle time for scanned SPA-bus items depends only on the total
number (and complexity) of BIN or ANA lines configured without a = (only
checkcycle). This gives the following calculation:
maximum age of scanned SPA-bus item =
(0.1 seconds * number of scanned BIN and ANA items)
+ DNP scan cycle time
With f.ex. 150 scanned SPA-bus items (f.ex. 15 relays with 10 items each)
and a DNP scan cycle of 0.5 seconds, this gives a maximum age in the DNP
master of a scanned SPA-bus item of 15.5 seconds.
Note that control commands and setpoints are executed immediately and that
the controlled relay is checkcycled after the control in order to get changes
due to the control back fast. These activities will of course give longer
response times for a while.

1KEL615158-02

6-35

You might also like