Cpi Com500
Cpi Com500
Cpi Com500
Notice 1
The information in this document is subject to change without notice and should not
be construed as a commitment by ABB. ABB assumes no responsibility for any error
that may occur in this document.
Notice 2
Notice 3
Additional information such as Release Notes and Last Minute Remarks can be found
on the program distribution media.
Trademarks
Microsoft is a trademark of Microsoft Corporation.
Windows NT is a trademark of Microsoft Corporation.
LONWORKS is a registered trademark of Echelon Corporation.
Other brand or product names are trademarks or registered trademarks of their respective holders
All Microsoft products referenced in this document are either trademarks or registered trademarks of Microsoft.
COM 500 CPI for MicroSCADA 1MRS751365-MEN
Configuration Manual
The following MicroSCADA technology manuals are published with this software
release.
Introduction to MicroSCADA Technology 1MRS751710-MUM
Connecting LONWORKS Devices to MicroSCADA 1MRS751249-MEN
System Configuration 1MRS751248-MEN
System Objects 1MRS751252-MEN
Application Objects 1MRS751253-MEN
Programming Language SCIL 1MRS751250-MEN
Status Codes 1MRS751251-MEN
The following COM 500 manuals are published with this software release.
COM 500 Engineering 1MRS750984 MUM
Configuring MicroSCADA for IEC 60870-5-101 Master Protocol 1MRS751456-MEN
Configuring MicroSCADA for DNP V3.00 Slave Protocol 1MRS751703-MEN
Configuring MicroSCADA for DNP V3.00 Master Protocol 1MRS751456-MEN
Configuring MicroSCADA for IEC 60870-5-101 Slave Protocol 1MRS751702-MEN
Configuring MicroSCADA for Profibus FMS Protocol 1MRS751704-MEN
Configuring MicroSCADA for Modbus Slave Protocol 1MRS751263-MEN
Communication Programming Interface (CPI) 1MRS751365-MEN
ABB Automation
1MRS751365-MEN CPI for MicroSCADA COM 500
Configuration Manual 1 Introduction
Contents
Page
1 Introduction .......................................................................................1
1.1 Hardware and Software Requirements .................................................. 1
1.2 CPI Interface.......................................................................................... 1
1.3 TCP/IP Interface .................................................................................... 2
6 Glossary ...........................................................................................59
7 Disclaimer ........................................................................................63
ABB Automation
1MRS751365-MEN CPI for MicroSCADA COM 500
Configuration Manual 1 Introduction
1 Introduction
This manual is the one that should be read when you want to use the Communication
Programming Interface (CPI) and need information related to it. CPI is available for
connecting foreign systems with MicroSCADA base system (SYS 500 revision 8.4.2
or newer or COM 500 revision 2.0 or newer).
Referenced Manuals
The following MicroSCADA manuals should be available for reference during the use
of this manual:
• System Objects manual.
• Programming Language SCIL.
• System Configuration manual.
• Operating system - Windows NT 4.0, which includes TCP/IP protocol. Install the
software as described in its own respective manuals.
CPI is a collection of functions that make the data transferring between MicroSCADA
base system and the CPI application program possible. The CPI library contains
functions for sending and receiving messages to or from MicroSCADA base system
and functions for packing and unpacking data of messages. CPI application program
may run at the different computer as may be seen in Table 1 below or also at the same
computer with MicroSCADA.
CPI application program (gateway program) which uses CPI interface emulates NET
containing stations of the RTU, SPA or SPI (RP570 slave) device type (SPI device
type can be emulated as a RTU device type. In this case the SPI station should be
ABB Automation 1
COM 500 CPI for MicroSCADA 1MRS751365-MEN
configured as a RTU station by the MicroSCADA base system). CPI supports both the
slave and the master communication.
Normally only the messages from the base system to station devices (RTU, SPA)
configured in the CPI application node are visible for the CPI functions. To be able to
emulate a conventional NET unit operation there is a need to access also messages
directed to the CPI application node itself (NET object). To access these messages the
filtering must be disabled using message filtering functions (see Chapter 4, CPI
Library).
7DEOH 0LFUR6&$'$FRQQHFWHGWRWKHIRUHLJQV\VWHPWKDWKDVD&3,DSSOLFDWLRQ
SURJUDPDVDSDUWRILW7KHGDWDWUDQVPLVVLRQEHWZHHQ&3,DSSOLFDWLRQ
SURJUDPDQGWKH0LFUR6&$'$EDVHV\VWHPLVLPSOHPHQWHGWKURXJK
7&3,3LQWHUIDFH
The communication between application using CPI and MicroSCADA is based on the
TCP/IP protocol. Transmission Control Protocol/Internet Protocol is used for data
transmission in LAN network to provide communication with several protocols across
connected networks of computers, see Table 1. On TCP/IP interfaces, the ACP
messages are sent via stream type BSD sockets.
2 ABB Automation
1MRS751365-MEN CPI for MicroSCADA COM 500
Configuration Manual 2 CPI Overview
2 CPI Overview
CPI communication resembles the communication between base system and NET
unit. CPI application program acts as a communication frontend. This is called the
NET unit emulation. Though CPI is an external and independent application, the base
system can not identify if the message is coming from the NET unit or the CPI
application because of similar interfaces in both cases.
7DEOH 7KH&3,FRPPXQLFDWLRQHPXODWHVWKHFRPPXQLFDWLRQEHWZHHQ
0LFUR6&$'$EDVHV\VWHPDQG1(7XQLW
CPI application program usually runs in an infinite loop where it checks with
cpiSelect function if there are any incoming messages from MicroSCADA. The
following examples show the basic functionality of the CPI interface. The detailed
description of every function presented below can be found in Chapter 4.
/* Infinite loop*/
for(;;)
{
in_set = out_set = exp_set = 0x7;
cpiSelect( &in_set, &out_set, &exp_set,15);
if (cpiISSET(1, in_set)) {
cpiGetMessage(1, &recv_id, &msg_type);
switch( msg_type ) {
case cpiWRMSG:
/* processing of the write message */
cpiGetMsgAttr(recv_id, &attr);
if ( GV_ Is_Config_Attr( &attr )) {
cpiGetReplyBuffer(recv_id,&reply_id);
if (reply_id != 0) {
GV_Process_Write_To_Attribute (recv_id,reply_id,,,);
if (cpiISSET(1, out_set)) {
cpiSendMessage(1,reply_id,5);
reply_pending = 0;
}
else {
reply_pending = 1;
}
}
}
break;
case cpiRDMSG:
/* processing for the read message */
case cpiRPMSG:
/* processing for the reply message */
}
}
}
if (reply_pending) && cpiISSET(1, out_set)) {
cpiSendMessage(1,reply_id,5);
reply_pending = 0;
}
}
4 ABB Automation
1MRS751365-MEN CPI for MicroSCADA COM 500
Configuration Manual 2 CPI Overview
• Received messages.
• Transmitted messages.
• Transmissions failed.
These pools are CPI internal and they are not seen directly by the CPI application
program. It must have its own memory management for communicating with the
protocol it emulates.
ABB Automation 5
COM 500 CPI for MicroSCADA 1MRS751365-MEN
Communication between MicroSCADA base system and frontends like NET unit is
based on ACP (Application Communication Protocol). It is an internal protocol of
MicroSCADA that is generally used in communication between MicroSCADA nodes.
Also the CPI application program can be seen as one of the nodes.
NET unit can communicate concurrently with several applications on the base system.
The CPI library using ACP communication supports following types of message
dialogues presented in Table 3:
7DEOH 0HVVDJHGLDORJXHVVXSSRUWHGLQ$&3FRPPXQLFDWLRQ
DWrite commands: The base system writes the value of an attribute to the
CPI application program.
ACP Messages
Each communication system contains a set of system objects, which specify the line
properties, connected devices etc. These objects can be created, modified and deleted
by SCIL (Supervisory Control Implementation Language), and setting the attributes of
6 ABB Automation
1MRS751365-MEN CPI for MicroSCADA COM 500
Configuration Manual 2 CPI Overview
the objects can change the properties. The detailed description of attributes can be
found in Chapter 5 and creation of protocol converters in Chapter 3.
Target of the ACP message sent by the MicroSCADA base system is an attribute of a
communication system object (NET, STA) configured in the NET unit. The attributes
of the communication system object can be divided into two main categories:
• Configuration attributes.
• Communication attributes.
Configuration attributes refer to the NET unit internal data. To these messages the
NET unit can reply immediately. Communication attributes refer to the data external
device. In this case the ACP message must first be converted to the protocol of
external device before sending it forward. The replies to communication attributes are
not usually sent back to base system before the actual reply from external device is
received.
Data transmission from the base system to the CPI application program is done by
setting the attributes of communication system object or process object. This may
happen by using SCIL and its commands.
7DEOH $&326,OD\HUPDSSLQJ
• ANSI X 3.28 Network layer handles low level (link layer) message routing
(node-to-node).
• ACP Network layer information is used for routing on the device level
(application layer).
ABB Automation 7
COM 500 CPI for MicroSCADA 1MRS751365-MEN
The following is a list of fields of the ACP protocol messages. The CPI functions that
can be used to get referred information are presented as well.
Fields presented in Table 5 are for the low level message routing and the second list in
Table 6 consists of fields used for routing on the device level.
7DEOH )LHOGVXVHGIRUWKHORZOHYHOPHVVDJHURXWLQJ
Field Description CPI function
DST Destination node address cpiGetDestination
SRC Source node address cpiGetSource
CMD Command/reply code cpiGetMessageType (not read
directly)
STS Status cpiGetReplyStatus (not read directly)
TNS Transaction number
7DEOH )LHOGVXVHGIRUPHVVDJHURXWLQJRQWKHGHYLFHOHYHO
Field Description CPI function
LDS Logical destination cpiGetRtuNo (not read directly),
cpiGetDeviceType,
cpiGetDeviceNumber
LSR Logical source Connection number
CNT Transaction count
FNC Function cpiGetMessageType( not read
directly)
MBX Mailbox
ATR Attribute cpiGetAttribute
IND1 First index cpiGetIndex
IND2 Last index cpiGetIndex
DATA Device data cpiGetNextData,
cpiGetNextDataType,
cpiGetNextAddrData
The following examples describe the relationship between SCIL and fields of the ACP
message:
:ULWLQJGDWDWRWKH&3,DSSOLFDWLRQ
#SET STA1:SDT(1..2)=(1,2)
| | | | | |
| | | | | |____Data
| | | | |_________Last index
| | | |____________First index
| | |___________Attribute
| |________________RTU number (device number and type packed to LDS)
|_____________________Message type (command + FNC write)
5HDGLQJGDWDIURPWKHDSSOLFDWLRQ
@A = STA1:SAM(10)
| | | |________First index
| | |____________Attribute
| |__________________RTU number (device number and type packed to LDS)
|________________________Message type (command + read)
8 ABB Automation
1MRS751365-MEN CPI for MicroSCADA COM 500
Configuration Manual 2 CPI Overview
Reserved Attributes
Because the CPI application program emulates STA objects in the NET unit the use of
attributes is not completely free. Some attribute names are reserved for RTU process
data communication. They can not be used as the attributes of an application except if
they have been used exactly in the same way as the RTU or SPA devices do (the
frontend emulation).
Following attributes are used by the system and they are not allowed to be used as the
attributes of the application program. Except these the attribute can be any abreviation
that consist of two letters.
7DEOH $WWULEXWHVQRWDOORZHGWREHXVHGDVWKHDWWULEXWHVRIWKHDSSOLFDWLRQ
SURJUDP
Attribute Description
DA Process data
SM System status message
The messages to the DA attribute are generated automatically by the base system
when the output process objects are set. If this method is used with CPI application
program, it must emulate DA attribute handling exactly in the same way as the RTU
device does.
The attributes IU, SA, AL, AS, MI and MS are used with RTU type station. It is
recommended that these attributes should be used in the same way as documented in
System Objects manual Chapter 14.
When using CPI programming interface there are possibilities to handle different
kinds of communication errors between the CPI application program and the base
system. The following is a list of transmission error types on the CPI application
program level. Examples how the application reacts to each situation are presented as
well:
• TCP/IP connection is not open when the CPI application program tries to send a
message to the base system (or for some other reason the message is not actually
sent):
• MicroSCADA base system does not reply to the ACP data message:
• MicroSCADA base system replies with error status to the data message:
ABB Automation 9
COM 500 CPI for MicroSCADA 1MRS751365-MEN
The application program can read the status of the reply message by using the
cpiGetReplyStatus function. In this case there is no automatic retransmission
mechanism included to the CPI retransmission mechanism. If the base system
replies with the error status message it usually does not help to retransmit the
same message again for it is very much possible that it replies with error status
again.
General
Each base system has a set of objects that specify the base system and its environment,
hardware and software, as well as the physical and logical connections of the base
system and its applications.
Base system objects are defined with SCIL commands in the SYS_BASCON.COM
file, which is executed every time the base system is started. With a few limitations,
you can also define and modify base system objects any time when MicroSCADA is
running. During the operation, the base system objects are in the primary memory of
the base system computer.
The CPI application program emulates a RTU or SPA type of stations which means
that the interface towards the base system is similar as with an RTU or SPA stations.
The following describes the configuration of base system for CPI application program
which emulates RTU type of station. The CPI application program require a node of
its own. Communication between this node and the base system takes place via a LAN
link.
Configuration Steps
To configure SYS_BASCON.COM:
Example
10 ABB Automation
1MRS751365-MEN CPI for MicroSCADA COM 500
Configuration Manual 2 CPI Overview
;****************************************************************************
;
; SYS_BASCON.COM
; BASE SYSTEM CONFIGURATION TEMPLATE
;
;****************************************************************************
#CREATE SYS:B = LIST(-
SA = 209,- ;STATION ADDRESS OF BASE SYSTEM
ND = 9,- ;NODE NUMBER OF BASE SYSTEM
DN = 3,- ;DEFAULT NET NODE NUMBER
DS = "RTU",- ;STA TYPES: E.G. STA,RTU,SPA,REX
FS = "NEVER") ;FILE SYNCH CRITERIA
;****************************************************************************
;
; COMMUNICATION LINKS
#CREATE LIN:V = LIST(- ;REQUIRES TCP/IP
LT = "LAN") ;FOR SYS-SYS AND LAN FRONTEND
#CREATE LIN1:B = %LIN
;****************************************************************************
;
; COMMUNICATION NODES
;****************************************************************************
;
; MONITORS
#LOOP_WITH I = 1..5
#CREATE MON’I’:B = LIST(-
TT = "LOCAL",- ;TRANSLATION TYPE
DT = "X") ;X MONITOR
@MON_MAP(%I) = -1
#LOOP_END
#LOOP_WITH I = 6..10
#CREATE MON’I’:B = LIST(-
TT = "LOCAL",- ;TRANSLATION TYPE
DT = "VS") ;VISUAL SCIL MONITOR
@MON_MAP(%I) = -1
#LOOP_END
;****************************************************************************
;
; APPLICATIONS
#CREATE APL:V = LIST(-
TT = "LOCAL",- ;TRANSLATION TYPE
NA = "CPI_TEST",- ;NAME OF APPLICATION DIRECTORY
AS = "HOT",- ;APPLICATION STATE: COLD,WARM,HOT
HB = 2000,- ;HISTORY BUFFER SIZE)
RC = VECTOR("FILE_FUNCTIONS_CREATE_DIRECTORIES"),-
AP = (1,2),-
MO = %MON_MAP,- ;MONITOR MAPPING
PR = (1,2,3)) ;PRINTER MAPPING
#CREATE APL1:B = %APL
;****************************************************************************
; STATIONS
ABB Automation 11
COM 500 CPI for MicroSCADA 1MRS751365-MEN
;*****************************************************************************
12 ABB Automation
1MRS751365-MEN CPI for MicroSCADA COM 500
Configuration Manual 3 Creating Protocol Converters
with CPI
3.1 General
3.1 General
When a protocol converter is implemented using the CPI library the work of the
project normally consists of following parts:
• The program that utilizes the CPI library for data transfer with MicroSCADA
base system.
• The program that converts the messages between the foreign protocol and the
CPI application program.
• An interface between the CPI part and the foreign protocol part of the program.
Furthermore the protocol converters done with CPI can be usually divided into two
categories. In the first case the MicroSCADA base system is seen as a master and the
slave devices connected via CPI are collecting data into the MicroSCADA process
database. In the second case the MicroSCADA base system is seen as a slave device
and data is sent from the MicroSCADA process database to the master via CPI. Use of
CPI and the work needed in different parts of the project differs significantly in these
two cases. The following chapters explain the differences and give information about
the possible solutions of implementing protocol converters with CPI.
ABB Automation 13
COM 500 CPI for MicroSCADA 1MRS751365-MEN
When slave devices are connected to MicroSCADA base system via the CPI, the data
flow is typically from the slave devices into the MicroSCADA as shown in Table 8.
Only commands (eg. breaker operation) are transferred from the MicroSCADA base
system to the slave devices. From the MicroSCADA base system’s point of view the
slave devices are seen either as RTU or SPA type stations.
7DEOH &3,DSSOLFDWLRQSURJUDPDFWVDVDPDVWHUFROOHFWLQJGDWDIURPWKHVODYH
GHYLFHWRWKH0LFUR6&$'$SURFHVVGDWDEDVH7KHVODYHGHYLFHLVVHHQDV
D578VWDWLRQIRUWKH0LFUR6&$'$EDVHV\VWHP
CPI application is configured into the MicroSCADA base system as a node. This node
is placed on a TCP/IP LAN link. The devices connected to the CPI are configured as
RTU or SPA stations. More about Base System Configuration see Chapter 2.
The need for special application programming in this case is usually very small.
Library can be used to create the process database and the picture functions.
The process data received from the slave devices can be sent to the MicroSCADA
process database using the following CPI functions (detailed descriptions of each
14 ABB Automation
1MRS751365-MEN CPI for MicroSCADA COM 500
Configuration Manual 3 Creating Protocol Converters
with CPI
function can be found in Chapter 4). Notation “XXX” means that there are several
functions with variable timestamps.
Indications: cpiSendRtuIndicationXXX
Analog values: cpiSendRtuAnalogValueXXX
Pulse counters: cpiSendRtuPulseCounterXXX
Digital values: cpiSendRtuDigitalValue
BitStream values: cpiSendRtuBitStream
The commands from the MicroSCADA Base System can be handled using the
following cpi function:
cpiGetNextAddrData
With this function it is possible to read the command object type, address and the
value. The object type of the command can be one of the following:
• Regulation command.
• Digital setpoint.
• Analog setpoint.
For converting messages between CPI and the foreign protocol it is difficult to give
any specific instructions, but typically the following questions need to be answered:
• How does the addressing of the data differ from the MicroSCADA base system
addressing method? Is a cross-reference table needed or could it be possible to
map the addresses directly into the MicroSCADA base system address space?
• How closely do the data types of the foreign protocol match the available types in
the MicroSCADA base system? What kind of a conversion or scaling is needed?
• Is there a need for intermediate database in the CPI to reduce the data transfer
between the CPI application program and the MicroSCADA process database?
ABB Automation 15
COM 500 CPI for MicroSCADA 1MRS751365-MEN
Interface between the CPI Part and the Foreign Protocol Part of the
Program
There are several ways of handling the communication between the CPI part and the
foreign protocol part of the program. The example program delivered with CPI
installation package named CPI_EXAMPLE uses common global variables for
transferring data between the program parts (threads).
When a master device is connected to MicroSCADA base system via the CPI, the data
flow is typically from the base system to the master as shown in Table 9. Only
commands (eg. breaker operation) are transferred from the master into the
MicroSCADA base system. It is suggested that CPI application program will emulate
RP570 slave device (SPI) as close as possible, to be able to use the existing
applications in MicroSCADA base system for data transfer between MicroSCADA
base system and the CPI application program (COM500).
CPI application is configured into the MicroSCADA base system as a node. This node
is placed on a TCP/IP LAN link. The master device connected to the CPI is configured
as RTU or SPA station although the behaviour resembles more the SPI station. More
about Base System Configuration see Chapter 2.
16 ABB Automation
1MRS751365-MEN CPI for MicroSCADA COM 500
Configuration Manual 3 Creating Protocol Converters
with CPI
The application program in the MicroSCADA must take care of forwarding the data
from the process database to the CPI application program. This is usually done using
event channels in the process objects that are connected to command procedures. The
commands from the master are received into input process objects activating a
command procedure that will then operate the actual output process object. When the
interface to the CPI is done according the SPI (RP570 Slave device) profile, it is
possible to use the existing command procedures and tools (COM500). See
MicroSCADA System Objects manual for details of SPI station attribute interface.
The data received from the MicroSCADA can be unpacked with the following CPI
functions (detailed descriptions of each function can be found in Chapter 4):
cpiGetRtuNo
cpiGetAttribute
cpiGetIndex
cpiGetNextDataType
cpiGetNextData
cpiGetNextS32Data
The commands received from the master can be sent to MicroSCADA base system by
using the following CPI function:
cpiSendRtuDigitalValue
For converting the messages between the CPI application program and the foreign
protocol is difficult to give any specific instructions, but typically the following
questions need to be answered:
• How does the addressing of the data differ from the MicroSCADA base system
addressing method? Do we need a cross-reference table or can we map the
addresses directly into the MicroSCADA base system address space?
• How closely do the data types of the foreign protocol match the available types in
the MicroSCADA base system? What kind of a conversion or scaling is needed?
• Is there a need for intermediate database in the CPI to reduce the data transfer
between the CPI application and the MicroSCADA process database?
ABB Automation 17
COM 500 CPI for MicroSCADA 1MRS751365-MEN
Interface between the CPI Part and the Foreign Protocol Part of the
Program
There are several ways of handling the communication between the CPI part and the
foreign protocol part of the program. The example program delivered with CPI
installation package named CPI_EXAMPLE uses common global variables for
transferring data between the program parts (threads).
18 ABB Automation
1MRS751365-MEN CPI for MicroSCADA COM 500
Configuration Manual 4 CPI Library
4 CPI Library
4.9 Initialisations
General
CPI library is a collection of functions for sending and receiving messages between
MicroSCADA and the CPI application, and also for message handling, packing and
unpacking. The functions contained CPI library are specified in this chapter. A list of
the program files is presented in Table 10 below:
7DEOH 3URJUDPILOHVIRU&3,
File Name Description
cpint.lib Microsoft Developer Studio Win32 Static Library file
cpi.h Header file for the CPI functions
cpicl.h CPI internal definition, type and function header file
bufms.h CPI buffer handling definitions
Part of the definition file cpi.h, which contains the definition for different data types:
typedef int cpiMsgID;
typedef unsigned char cpiObjectType;
/* Object type numbers are same as in the ACP */
#define cpiU8 0
#define cpiS8 1
#define cpiU16 2
#define cpiS16 3
#define cpiU32 4
#define cpiS32 5
#define cpiF32 6
#define cpiADDR 7
#define cpiBV 8
#define cpiB 9
typedef struct {
cpiObjectType ObjectType;
unsigned int ObjectAddress;
int ObjectValue;
}addressItem;
ABB Automation 19
COM 500 CPI for MicroSCADA 1MRS751365-MEN
typedef struct {
cpiDataType item_type;
union { /* this definition is cpu specific */
unsigned char U8;
unsigned char S8;
unsigned short int U16;
short int S16;
unsigned long int U32;
unsigned int S32;
float F32;
unsigned short A;
addressItem ADDR;
} value;
}cpiData;
/* Message types */
#define cpiWRMSG 1
#define cpiRDMSG 2
#define cpiRPMSG 3
#define cpiNOTIF 4
typedef struct {
unsigned char (year,month,day,hour,minute,second,ms)
} cpiTime;
The communication between the MicroSCADA base system and the NET unit is
based on the ACP, MicroSCADA internal communication protocol.
7DEOH %DVLF$&3&RPPXQLFDWLRQV
Function Description
cpiSelect Checks the status of the TCP/IP socket.
cpiException Determines the cause of exception.
cpiSendMessage Sends an ACP formatted message to MicroSCADA.
cpiSendRtuMessage Sends an ACP formatted message to MicroSCADA
from RTU.
cpiSendSystemMessage Sends a system message from any device.
cpiGetMessage Reads an ACP formatted message from the received
message queue.
cpiSelect
This function checks the TCP/IP socket if there are any messages coming from the
base system application and if there are any connections ready for writing. It also
returns information if any of the connections have failed or any message has not got a
reply in time. Some of the communication between the base system and application is
actually done inside this function, so it must be called in the main loop of the CPI
application. The cpiSelect function returns when one of the specified input
connections has received a message or at least after the specified time.
When this function is called, its arguments specify which connections we are
interested in. Then the function modifies the arguments to indicate the status of each
connection.
7DEOH 7KHELWSRVLWLRQLQGLFDWHVWKHVWDWXVRIWKHFRQQHFWLRQ
RD WR EX Description
bit0 bit0 bit0 connection 1 flags
bit1 bit1 bit1 connection 2 flags
bit2 bit2 bit2 connection 3 flags
20 ABB Automation
1MRS751365-MEN CPI for MicroSCADA COM 500
Configuration Manual 4 CPI Library
RD Bit is set when CPI has received a message from this connection.
WR Bit is set when CPI does not waiting any reply from this connection.
EX Bit is set when CPI has lost this connection or data message does not get
reply from this connection. The actual cause of exception can be
determined by using cpiException function.
Return values:
0 : OK
cpiException
Return values:
1 : TCP/IP error
- Connection to this node has been lost
2 : No reply error
- Message sent by CPI has not got a reply from MicroSCADA
6 : Application error
- Message sent by CPI has been a reply with error status from MicroSCADA
cpiSendMessage
This function sends an ACP formatted message to MicroSCADA. Before using this
function the message buffer must be reserved by using the functions
cpiGetTransmissionBuffer or GetReplyBuffer, and formatted by using some of the
cpiPutXXXData functions presented in Chapter 4.5.2 Data Filling Functions.
(Notation XXX means, that any function of this type is available.)
Return values:
0 : OK
-2 : Invalid MsgID ; the buffer ID is not free, or it is unknown
cpiSendRtuMessage
This function sends an ACP formatted message to MicroSCADA from RTU. Before
using this function the message buffer must be reserved by using the function
cpiGetTransmissionBuffer and formatted by using some of the cpiPutXXXData
functions presented in Chapter 4.5.2 Data Filling Functions. (Notation XXX means,
that any function of this type is available.)
ABB Automation 21
COM 500 CPI for MicroSCADA 1MRS751365-MEN
Return values:
0 : OK
-2 : Invalid MsgID
cpiSendSystemMessage
The following function can be used to send a system message from any device.
int cpiSendSystemMessage(int con, int source, int address, int dataValid, short
status)
source Source logical device, the following macro should be used to
calculate the value LOGICAL_ADDRESS(deviceType,deviceNumber)
Example:
;Sending NET1 line status 12602 to address 6103:
cpiSendSystemMessage(con,
LOGICAL_ADDRESS(NET_DEVICE,1),
6103,
0,
12602)
cpiGetMessage
This function reads an ACP formatted message from the received message queue.
This function must not be called before the unpacking of the previous message is
completely ready, because the data of the previous message is overwritten by this
function.
Return values:
0 : OK
-4 : No messages from this source
22 ABB Automation
1MRS751365-MEN CPI for MicroSCADA COM 500
Configuration Manual 4 CPI Library
cpiGetFailedMessage
This function returns the id of the failed message. The failed message has not got a
reply from the application.
Return values:
0 : OK
-4 : Not any failed messages in this connection
cpiRetransmitMessage
This function retransmits the message, which is in the failed message queue.
Return values:
0 : OK, the retransmission started
-2 : Invalid MsgID
cpiGiveUp
Return values:
0 : OK
-2 : Invalid MsgID
Normally only the messages from the base system to station devices (RTU,SPA)
configured in the CPI application node are visible for the CPI functions. To be able to
emulate a conventional NET unit operation there is a need to access also messages
directed to the CPI application node itself (NET object). This filtering can be
controlled and monitored with the following functions.
When the filtering is switched off, all messages except diagnostic messages (NET
object attribute names NS and DS are reserved for CPI internal use) directed to CPI
node are passed through the interface and can be further processed with CPI functions.
7DEOH 0HVVDJH)LOWHULQJ
Function Description
cpiNetMessageFiltering Monitors filtering of messages sent by the base
system.
cpiSetNetMessageFiltering Controls filtering of messages sent by the base
system.
ABB Automation 23
COM 500 CPI for MicroSCADA 1MRS751365-MEN
cpiNetMessageFiltering
Monitors filtering of messages sent by the base system. The current state of the
filtering can be read by this function.
int cpiNetMessageFiltering();
Return values:
0 = off
1 = on
cpiSetNetMessageFiltering
The following functions are a sort of “automatic” functions for building and sending
certain ACP messages to the MicroSCADA process database. Each 6HQG function
reserves a buffer for message, fills it and sends it to the base system.
Each one of the following functions can also be made manually, instructions for this
can be found in sections 4.5 Generic ACP Packet Building and 4.6 ACP Packet
Unpacking.
The RTU Object Model is based on an REMHFW W\SH and REMHFW EORFN QXPEHU
concept, see Application objects manual chapter 3. for further details. For input
process data the object block number range is [1…255]. For commands (from the
MicroSCADA application to the CPI application) the range is [1…2047].
7DEOH 578$SSOLFDWLRQ/HYHO'DWD7UDQVPLVVLRQ6HUYLFHV
Function Description
cpiSendRtuStatusMessage Sends an ACP formatted notification message to
MicroSCADA.
cpiSendRtuIndication Sends indication values to the base system process
database.
cpiSendRtuIndicationBlock Sends indication value block to the base system
process database.
cpiSendRtuIndicationWithTS Sends the indication values with timestamp to the
base system process database.
cpiSendRtuAnalogValue Sends an analog value to the base system process
database.
cpiSendRtuAnalogValueWithTS Sends an analog value with timestamp to the base
system process database.
cpiSendRtuPulseCounter Sends a pulse counter value to the base system
process database.
cpiSendRtuPulseCounterWithTS Sends a pulse counter value with timestamp to the
base system process database.
24 ABB Automation
1MRS751365-MEN CPI for MicroSCADA COM 500
Configuration Manual 4 CPI Library
Function Description
cpiSendRtuBitStream Sends a bit string to the process object database of
the base system.
cpiSendRtuStatusMessage
Return values:
0 : OK
-13 : No buffer -> CPI can not get a buffer for the message
After starting the application program (the connections to the base systems and the remote
RTU should be established) it is important to send the system status message to the base
system. The status parameter is OK (or STARTED) and the DATAVALID parameter is
TRUE. The base system marks the object status of the process data of the source RTU to
OK (OS=0) or OBSOLETE_STATUS (OS=2) based on the DATAVALID parameter.
Following status codes are valid when frontend emulates RTU device (refer to Status
Codes manual):
578OHYHOVWDWXVFRGHV
0 OK_STATUS
12602 RTUP_DEVICE_SUSPENDED
12603 RTUP_TIMEOUT_WHILE_WAITING_RESPONSE
12604 RTUP_DEVICE_STOPPED
12605 RTUP_DEVICE_STARTED
12658 RTUC_INVALID_INDEX_RANGE
12662 RTUC_ATTRIBUTE_IS_WRITE_ONLY
12665 RTUC_NOT_EXECUTED_RESPONSE
12676 RTUC_UNEXPECTED_VALUE
ABB Automation 25
COM 500 CPI for MicroSCADA 1MRS751365-MEN
'HVFULSWLRQV
0 OK_STATUS
The purpose of this status message is to indicate that the CPI application program
considers the RTU connection to be working properly. This should always be sent
right after the startup situation, when a connection has been established. After the
communication break it should also be sent, when the connection has been re-
established.
12602 RTUP_DEVICE_SUSPENDED
When the CPI application program activates an RTU device image for process
communication, this is the first system message to be sent. It indicates that the CPI
application program does not currently have the connection to this RTU (but it is
trying to establish it since this is the RTU connection startup situation).
It is also sent when the CPI application program detects that the connection to a
certain RTU is lost. The DATAVALID parameter is set to false to indicate that the
process database image of this RTU is no longer valid (see above).
12603 RTUP_TIMEOUT_WHILE_WAITING_RESPONSE
This status message indicates that to the message initiated from a MicroSCADA
application was not reacted by the RTU. Note, that this means no response
whatsoever. The negative acknowledgements are handled by the "Not executed
response" status code.
12604 RTUP_DEVICE_STOPPED
The CPI RTU device image is "stopped" by setting its "IU" -attribute to zero. This
means that the connection to the RTU is orderly disconnected. When this is done, the
RTU image should send this status message to the MicroSCADA application. The
DATAVALID flag should be set to FALSE since the updating of the MicroSCADA
process database now stops from this RTU image.
12605 RTUP_DEVICE_STARTED
When the "IU" attribute of a device is set to one (1) the RTU image should respond by
this system message. If this is the first time after startup the RTU image is started the
DATAVALID should be set to FALSE. If the RTU image receives an "IU" attribute
while the device connection is OK, the DATAVALID is set to TRUE.
12658 RTUC_INVALID_INDEX_RANGE
26 ABB Automation
1MRS751365-MEN CPI for MicroSCADA COM 500
Configuration Manual 4 CPI Library
12662 RTUC_ATTRIBUTE_IS_WRITE_ONLY
The RTU image responds with this status message for attempts to read values from
attributes that only can be written. A typical example might be some of the command
type attributes.
12665 RTUC_NOT_EXECUTED_RESPONSE
This status message is sent to the MicroSCADA application when the RTU responds
with negative acknowledge to the command from the application.
12676 RTUC_UNEXPECTED_VALUE
This status message indicates the attempts to write an invalid value to an RTU image
attribute, e.g. a text value to an integer type attribute.
1RGHOHYHOVWDWXVFRGHV:
14016 NETW_UNKNOWN_DESTINATION_DEVICE
14018 NETW_UNKNOWN_DEVICE_ATTRIBUTE
14044 NETW_INVALID_STATION_ADDRESS
cpiSendRtuIndication
This function sends indication value to the base system process database.
int cpiSendRtuIndication(int DESTIN, int SOURCE, int BLOCK, int BIT, int VAL,
int STATUS, int TIMEOUT, cpiMsgID *ID);
DESTIN Destination connection number
SOURCE Source RTU number
BLOCK Object address of the process object
BIT Bit number destination word (0..15)
VAL Value of bit 0,1 for single indications, 10,11,12,13 for double
indications
BVAL 16 bit value
TS Timestamp
TIMEOUT Timeout in ms;
STATUS Status code for data (0= ok)
Return values:
0 : OK
-7 : buffer full, the filling of ACP message has been failed
-13 : cannot get buffer for transmission message
-20 : connection waiting
The sending failed because the reply for previously sent message has not
been received
-22 : Invalid value
cpiSendRtuIndicationBlock
This function sends indication value block to the base system process database.
int cpiSendRtuIndicationBlock(int DESTIN, int SOURCE, int BLOCK, int BVAL,
int STATUS, int TIMEOUT, cpiMsgID *ID);
DESTIN Destination connection number
SOURCE Source RTU number
ABB Automation 27
COM 500 CPI for MicroSCADA 1MRS751365-MEN
Return values:
0 : OK
-7 : buffer full, the filling of ACP message has been failed
-13 : cannot get buffer for transmission message
-20 : connection waiting
The sending failed because the reply for previously sent message has not
been received
-22 : Invalid value
cpiSendRtuIndicationWithTS
This function sends indication value with timestamp to the base system process
database.
int cpiSendRtuIndicationWithTS(int DESTIN, int SOURCE, int BLOCK, int BIT,
int VAL, cpiTime TS, int STATUS, int TIMEOUT, cpiMsgID *ID);
DESTIN Destination connection number
SOURCE Source RTU number
BLOCK Object address of the process object
BIT Bit number destination word (0..15)
VAL Value of bit 0,1 for single indications, 10,11,12,13 for double
indications
BVAL 16 bit value
TS Timestamp
TIMEOUT Timeout in ms;
STATUS Status code for data (0= ok)
Return values:
0 : OK
-7 : buffer full, the filling of ACP message has been failed
-13 : cannot get buffer for transmission message
-20 : connection waiting
The sending failed because the reply for previously sent message has not
been received
-22 : Invalid value
cpiSendRtuAnalogValue
This function sends an analog value to the base system process database.
Return values:
0 : OK
-7 : buffer full, the filling of ACP message has been failed
-13 : cannot get buffer for transmission message
-20 : connection waiting
28 ABB Automation
1MRS751365-MEN CPI for MicroSCADA COM 500
Configuration Manual 4 CPI Library
The sending failed because the reply for previously sent message has not
been received
-22 : Invalid value
cpiSendRtuAnalogValueWithTS
This function sends an analog value with timestamp to the base system process
database.
int cpiSendRtuAnalogValueWithTS(int DESTIN, int SOURCE, int BLOCK, int VAL,
cpiTime TS, int STATUS, int FLAGS, int TIMEOUT, cpiMsgID *ID);
Return values:
0 : OK
-7 : buffer full, the filling of ACP message has been failed
-13 : cannot get buffer for transmission message
-20 : connection waiting
The sending failed because the reply for previously sent message has not
been received
-22 : Invalid value
cpiSendRtuPulseCounter
This function sends a pulse counter value to the base system process database.
Return values:
0 : OK
-7 : Buffer full, the filling of ACP message has been failed
-13 : Cannot get buffer for transmission message
-20 : Connection waiting
-The sending failed because the reply for previously sent message has not
been received
-22 : Invalid value
cpiSendRtuPulseCounterWithTS
This function sends a pulse counter value with timestamp to the base system process
database.
int cpiSendRtuPulseCounterWithTS(int DESTIN, int SOURCE, int BLOCK, long VAL,
cpiTime TS, int STATUS, int FLAGS, int TIMEOUT, cpiMsgID *ID);
DESTIN Destination connection number
ABB Automation 29
COM 500 CPI for MicroSCADA 1MRS751365-MEN
Return values:
0 : OK
-7 : Buffer full, the filling of ACP message has been failed
-13 : Cannot get buffer for transmission message
-20 : Connection waiting
-The sending failed because the reply for previously sent message has not
been received
-22 : Invalid value
cpiSendRtuBitStream
This function sends a bit string to the process object database of the base system.
int cpiSendRtuBitStream(int DESTIN, int SOURCE, int ADDR, int LEN, char
STREAM[] ,
int TIMEOUT, cpiMsgID *ID);
DESTIN Destination connection number
SOURCE Source RTU number
ADDR Address of the process object
LEN Length of bitstream in bits !!
STREAM Array of bits stored on the char array (Bitstream begins from bit0 of
first char)
TIMEOUT Timeout in milliseconds
FLAGS Status flags of the pulse counter process objects
bit4 -> End of the period flag
Return values:
0 : OK
-7 : Buffer full, the length of the bit stream is too long.
The following functions reserve a buffer for a message, fill and send it from SPA type
device to the base system.
7DEOH 63$$SSOLFDWLRQ/HYHO'DWD7UDQVPLVVLRQ6HUYLFHV
Function Description
cpiSendSpaAnalogValueWithTS Sends an analog value with timestamp to the base
system process database.
cpiSendSpaAnalogValue Sends an analog value to the base system
process database.
cpiSendSpaDigitalValueWithTS Sends a digital value with timestamp to the base
system process database.
cpiSendSpaDigitalValue Sends a digital value to the base system process
database.
cpiSendSpaIndicationWithTS Sends the indication value with timestamp to the
base system process database.
cpiSendSpaIndicationBlockWithTS Sends the indication value block with timestamp to
the base system process database.
cpiSendSpaIndication Sends indication value to the base system process
database.
cpiSendSpaIndicationBlock Sends indication value block to the base system
process database.
cpiSendSpaPulseCounterWithTS Sends a pulse counter value with timestamp to the
base system process database.
30 ABB Automation
1MRS751365-MEN CPI for MicroSCADA COM 500
Configuration Manual 4 CPI Library
Function Description
cpiSendSpaStatusMessage Sends an ACP formatted notification message to
MicroSCADA.
cpiSendSpaMessage Sends an ACP formatted message to
MicroSCADA from SPA.
cpiSendSpaAnalogValueWithTS
This function sends an analog value with timestamp to the base system process
database.
Return values:
0 : OK
-7 : Buffer full, the filling of ACP message failed
-13 : Cannot get buffer for transmission message
-20 : Connection waiting
-The sending failed because the reply for previously sent message has
not been received
-22 : Invalid value
cpiSendSpaAnalogValue
This function sends an analog value without timestamp to the base system process
database.
int cpiSendSpaAnalogValue(int DESTIN, int SOURCE, int BLOCK, float VAL, int
STATUS, int TIMEOUT, cpiMsgID *ID);
DESTIN Destination connection number
SOURCE Source SPA number
BLOCK Object address of the process object
VAL Value of an analog value
TIMEOUT Timeout in milliseconds
STATUS Status code for data (0 = ok)
Return values:
0 : OK
-7 : Buffer full, the filling of ACP message failed
-13 : Cannot get buffer for transmission message
-20 : Connection waiting
-The sending failed because the reply for previously sent message has
not been received
-22 : Invalid value
cpiSendSpaDigitalValueWithTS
This function sends a digital value with timestamp to the base system process
database.
int cpiSendSpaDigitalValueWithTS(int DESTIN, int SOURCE, int BLOCK, int VAL,
cpiTime TS, int STATUS, int TIMEOUT, cpiMsgID *ID);
DESTIN Destination connection number
SOURCE Source SPA number
BLOCK Object address of the process object
VAL Digital value
TS Timestamp
ABB Automation 31
COM 500 CPI for MicroSCADA 1MRS751365-MEN
Return values:
0 : OK
-7 : Buffer full, the filling of ACP message failed
-13 : Cannot get buffer for transmission message
-20 : Connection waiting
-The sending failed because the reply for previously sent message has
not been received
-22 : Invalid value
cpiSendSpaDigitalValue
This function sends a digital value without timestamp to the base system process
database.
Return values:
0 : OK
-7 : buffer full, the filling of ACP message failed
-13 : cannot get buffer for transmission message
-20 : connection waiting
-the sending failed because the reply for previously sent message has
not been received
-22 : Invalid value
cpiSendSpaIndicationWithTS
This function sends the indication value with timestamp to the base system process
database.
Return values:
0 : OK
-7 : buffer full, the filling of ACP message failed
-13 : cannot get buffer for transmission message
-20 : connection waiting
-the sending failed because the reply for previously sent message has
not been received
-22 : Invalid value
32 ABB Automation
1MRS751365-MEN CPI for MicroSCADA COM 500
Configuration Manual 4 CPI Library
cpiSendSpaIndicationBlockWithTS
This function sends the indication value block with timestamp to the base system
process database.
int cpiSendSpaIndicationBlockWithTS(int DESTIN, int SOURCE,
int BLOCK, int BVAL, cpiTime TS, int STATUS, int TIMEOUT, cpiMsgID *ID);
Return values:
0 : OK
-7 : buffer full, the filling of ACP message failed
-13 : cannot get buffer for transmission message
-20 : connection waiting
-the sending failed because the reply for previously sent message has
not been received
-22 : Invalid value
cpiSendSpaIndication
This function sends an indication value to the base system process database.
int cpiSendSpaIndication(int DESTIN, int SOURCE, int BLOCK, int BIT,
int VAL, int STATUS, int TIMEOUT, cpiMsgID *ID);
DESTIN Destination connection number
SOURCE Source SPA number
BLOCK Object address of process object
BIT Bit number destination word (0..15)
VAL Value of bit 0,1 for single indications,
10,11,12,13 for double indications
BVAL 16 bit value
TIMEOUT Timeout in ms;
STATUS Status code for data (0= ok)
Return values:
0 : OK
-7 : Buffer full, the filling of ACP message failed
-13 : Cannot get buffer for transmission message
-20 : Connection waiting
-The sending failed because the reply for previously sent message has
not been received
-22 : Invalid value
cpiSendSpaIndicationBlock
This function sends an indication value block to the base system process database.
int cpiSendSpaIndicationBlock(int DESTIN, int SOURCE,
int BLOCK, int BVAL, int STATUS, int TIMEOUT, cpiMsgID *ID);
DESTIN Destination connection number
SOURCE Source SPA number
BLOCK Object address of process object
BIT Bit number destination word (0..15)
VAL Value of bit 0,1 for single indications,
10,11,12,13 for double indications
BVAL 16 bit value
TIMEOUT Timeout in ms;
STATUS Status code for data (0= ok)
ABB Automation 33
COM 500 CPI for MicroSCADA 1MRS751365-MEN
Return values:
0 : OK
-7 : Buffer full, the filling of ACP message failed
-13 : Cannot get buffer for transmission message
-20 : Connection waiting
-The sending failed because the reply for previously sent message has
not been received
-22 : Invalid value
cpiSendSpaPulseCounterWithTS
This function sends a pulse counter value with timestamp to the base system process
database.
int cpiSendSpaPulseCounterWithTS(int DESTIN, int SOURCE, int BLOCK,
long VAL, cpiTime TS, int STATUS, int TIMEOUT, cpiMsgID *ID);
Return values:
0 OK
-7 : Buffer full, the filling of ACP message failed
-13 : Cannot get buffer for transmission message
-20 : Connection waiting
-The sending failed because the reply for previously sent message has
not been received
-22 : Invalid value
cpiSendSpaStatusMessage
Return values:
0 : OK
-13 : No buffer -> cpi cannot get buffer for message
Following status codes are valid when frontend emulates SPA device (refer to Status
Codes manual):
63$VWDWXVFRGHV
0 OK_STATUS
13201 SPAC_SC_DATA_OVERFLOW
34 ABB Automation
1MRS751365-MEN CPI for MicroSCADA COM 500
Configuration Manual 4 CPI Library
13202 SPAC_TOO_LONG_REPLY_RECEIVED
13203 SPAC_SPA_ADDRESS_NOT_CONFIGURED
13204 SPAC_DEVICE_MUST_BE_ALLOCATED
13205 SPAC_UNKNOWN_DIAGNOSTIC_COUNTER
13206 SPAC_INVALID_INDEX_RANGE
13207 SPAC_INVALID_RT_ATTRIBUTE_VALUE
13208 SPAC_UNKNOWN_SPA_ATTRIBUTE
13209 SPAC_ILLEGAL_APPLICATION_FOR_OPERATION
13210 SPAC_ATTRIBUTE_IS_WRITE_ONLY
13211 SPAC_ILLEGAL_BROADCAST_ACTION
13212 SPAC_UNEXPECTED_RESPONSE
13213 SPAC_INVALID_ATTRIBUTE_VALUE
13214 SPAC_CHAR_TYPE_EXPECTED
13215 SPAC_INTERNAL_ERROR
13216 SPAC_INVALID_POINT_DEFINITION
13217 SPAC_DATABASE_UPDATE_COMPLETED
13218 SPAC_TOO_MANY_ARGUMENTS
13219 SPAC_ARGUMENT_EXPECTED
13220 SPAC_UNABLE_TO_ALLOCATE_MEMORY
13221 SPAC_POINT_DEFINITION_NOT_FOUND
13222 SPAC_NO_ACKNOWLEDGE_RESPONSE
13223 SPAC_UNEXPECTED_VALUE_TYPE
13224 SPAC_ILLEGAL_OBJECT_TYPE
13225 SPAC_ONLY_WRITE_IS_POSSIBLE
13226 SPAC_NO_ACKNOWLEDGE_REPLY
13227 SPAC_EVENT_DATA_DISCREPANCY_DETECTED
13251 SPAP_DEVICE_SUSPENDED
ABB Automation 35
COM 500 CPI for MicroSCADA 1MRS751365-MEN
13252 SPAP_DEVICE_STOPPED
13253 SPAP_DEVICE_STARTED
13254 SPAP_OUT_OF_BUFFERS
13255 SPAP_TIMEOUT_WHILE_WAITING_RESPONSE
13256 SPAP_UNEXPECTED_BC_REPLY
13257 SPAP_BROADCAST_FAILURE
13258 SPAP_DATABASE_UPDATE_COMPLETED
17201 SPCP_TIMEOUT_WHILE_WAITING_CTS
17202 SPCP_CTS_LINE_FAILURE_WHILE_TRANSM
17203 SPCP_REDUNDANCY_ERRORS_IN_RESPONSE
17205 SPCP_TIMEOUT_WHILE_WAITING_RESPONSE
17211 SPPC_INVALID_ATTRIBUTE_VALUE
1RGHOHYHO
14016 NETW_UNKNOWN_DESTINATION_DEVICE
14018 NETW_UNKNOWN_DEVICE_ATTRIBUTE
cpiSendSpaMessage
This function sends an ACP formatted message to MicroSCADA from SPA. Before
using this function the message buffer must be reserved by using the function
cpiGetTransmissionBuffer and formatted by using some of the cpiPutXXXData
functions presented in Chapter 4.5.2 Data Filling Functions. (Notation XXX means,
that any function of this type is available.)
int cpiSendSpaMessage(int DESTIN, int SOURCE, cpiMsgID ID, int TIMEOUT);
DESTIN Destination connection number
SOURCE Source SPA number
ID Message buffer identification
TIMEOUT Waiting time for the base system reply in milliseconds,
0-> no time-out supervision
Return values:
0 : OK
-2 : Invalid MsgID
All of the functions for sending RTU or SPA process data presented in previous
section can be done manually using the following functions. With them it is possible
36 ABB Automation
1MRS751365-MEN CPI for MicroSCADA COM 500
Configuration Manual 4 CPI Library
to build up messages also for special purposes - usually when functions needed does
not exist. A situation like this can be for example when the several analog values need
to be sent in a single message.
Before any of the following packet building functions can be called, the buffer, where
message is going to be built up, must be reserved by using cpiGetTransmissionBuffer
function.
To be able to emulate a conventional NET unit operation the following functions can
be used for setting freely the logical destination and source.
7DEOH 0HVVDJH+HDGHU6RXUFH
Function Description
cpiPutSource Sets the logical source of the message
cpiPutDestination Sets the logical destination of the message
cpiPutSource
With this function the logical source of the message can be set.
int cpiPutSource(cpiMsgID id, int SOURCE)
SOURCE Source logical device, the following macro should be used to
calculate the value LOGICAL_ADDRESS(deviceType, deviceNumber)
Example:
;Setting the logical source for NET1:
cpiPutSource(id, LOGICAL_ADDRESS(NET_DEVICE,1));
Return values:
0 : OK
-5 : Unknown Message ID
cpiPutDestination
With this function the logical destination of the message can be set.
int cpiPutDestination(cpiMsgID id, int DESTINATION)
DESTINATION Destination logical device, the following macro should be used to
calculate the value LOGICAL_ADDRESS(deviceType,deviceNumber)
Example:
;Setting the logical destination for APL1:
cpiPutSource(id, LOGICAL_ADDRESS(APL_DEVICE,1));
Return values:
0 : OK
-5 : Unknown Message ID
ACP message can be filled with the process data by using the following functions.
7DEOH 'DWD)LOOLQJ)XQFWLRQV
Function Description
cpiPutData Puts data to the ACP message.
cpiPutRtuData Puts the process data with status to the ACP
ABB Automation 37
COM 500 CPI for MicroSCADA 1MRS751365-MEN
Function Description
message.
cpiPutRtuDataWithoutStatus Puts the process data without status to the ACP
message.
cpiPutRtuDataWithTS Puts the process data with timestamp to the ACP
message.
The object type determines also the type of the value. If object type is
0 = NO_OBJCET_TYPE type of value is free.
cpiPutData
cpiPutRtuData
This function puts the process data with status to the ACP message.
int cpiPutRtuData (cpiMsgID ID, cpiObjectType OT, int BLOCK, cpiData VAL, int
STATUS);
ID Identification number for message
OT Object type of RTU process object
BLOCK Object address of RTU process object (1 ... 255)
VAL Value for process object
TS Time stamp
STATUS Status code
0 -> OK
Return values:
0 : OK
-2 : Invalid MsgID
-7 : Message buffer is full, putting of the data has not succeeded
cpiPutRtuDataWithoutStatus
This function puts the process data without status to the ACP message.
int cpiPutRtuDataWithoutStatus(cpiMsgID ID, cpiObjectType OT, int BLOCK,
cpiData VAL);
Return values:
0 : OK
-2 : Invalid MsgID
-7 : Message buffer is full, putting of the data has not succeeded
cpiPutRtuDataWithTS
This function puts the process data with timestamp to the ACP message.
38 ABB Automation
1MRS751365-MEN CPI for MicroSCADA COM 500
Configuration Manual 4 CPI Library
Return values:
0 : OK
-2 : Invalid MsgID
-7 : Message buffer is full, putting of the data has not succeeded
cpiPutReplyStatus
The following function puts the status of the reply to the reply message. If the reply
status is OK, there is no need to use this function.
int cpiPutReplyStatus (cpiMsgID ID, int STATUS);
ID Identification number for message
STATUS Status code
Return values:
0 : OK
-2 : invalid MsgID
The message arrived from MicroSCADA base system can be unpacked by the
following functions.
The following functions are used to read the header information of the received
message. See also the Chapter 2.4.
7DEOH 0HVVDJH+HDGHU,QIRUPDWLRQ
Function Description
cpiGetDestination Reads the station address of the destination node
from the message (CPI application node).
cpiGetSource Reads the station address of the source node from the
message (MicroSCADA node).
cpiGetRtuNo Reads the station number from the message.
cpiGetAttribute Reads the attribute from the message.
cpiGetIndex Reads the index from the message.
cpiGetReplyStatus Reads the reply status of the message.
cpiGetReplyDefinition Reads the reply definition of the message.
cpiGetMessageType Reads the type of the incoming message.
cpiGetMessageLength Reads the length of the received message.
cpiGetDeviceType Retrieves the logical device type message.
cpiGetDeviceNumber Retrieves the logical device number message.
ABB Automation 39
COM 500 CPI for MicroSCADA 1MRS751365-MEN
cpiGetDestination
This function reads the station address of the destination node from the message (CPI
application node).
int cpiGetDestination( cpiMsgID ID, int *DESTIN);
ID Identification number for the message
DESTIN The CPI application node station address
Return values:
0 : OK
-5 : Invalid message buffer
cpiGetSource
This function reads the station address of the source node from the message
(MicroSCADA node).
int cpiGetSource( cpiMsgID ID, int *SOURCE);
Return values:
0 : OK
-5 : Invalid message buffer
cpiGetRtuNo
This function checks which RTU station the message is meant to.
int cpiGetRtuNo(cpiMsgID ID, int *RTU);
ID Identification number for the message
REPLYID Id of the message which response this reply message is
STATUS Status of the reply
HEADER Header information of the message
MSGTYPE Type of the incoming message
LENGTH Length of the received message (whole ACP message)
Return values:
0 : OK
-5 : Invalid message buffer
cpiGetAttribute
Return values:
0 : OK
-5 : Invalid message buffer
cpiGetIndex
40 ABB Automation
1MRS751365-MEN CPI for MicroSCADA COM 500
Configuration Manual 4 CPI Library
Return values:
0 : OK
-5 : Invalid message buffer
cpiGetReplyStatus
Return values:
0 : OK
-5 : Invalid message buffer
cpiGetReplyDefinition
Return values:
0 : OK
-5 : Invalid message buffer
cpiGetMessageType
Return values:
0 : OK
-5 : Invalid message buffer
cpiGetMessageLength
Return values:
0 : OK
-5 : Invalid message buffer
cpiGetDeviceType
A new function will be implemented to retrieve the logical device type message.
int cpiGetDeviceType(cpiMsgID *msg, int *deviceType)
ABB Automation 41
COM 500 CPI for MicroSCADA 1MRS751365-MEN
NET_DEVICE = 2
RTU_DEVICE = 4
IEC_DEVICE = 29
cpiGetDeviceNumber
Return values:
0 : OK
-1 : If fails
The data part of the message can be unpacked with the following functions.
7DEOH 'DWD6FDQQLQJ)XQFWLRQV
Function Description
cpiGetNextData Reads the next data item from the received message
cpiGetNextDataType Reads the type of next item in message
cpiGetNextS32Data Reads the next item from the message
cpiGetTimeData Retrieves the time information from the message
written in RTU_ATIME format.
cpiGetNextData
The following function reads the next data item from the received message. The
function is used to read items one by one from the message to the cpiData structure.
The function returns the value of the same type as the values in the message. Because
the type of data may vary between messages, the type information of cpiData must be
used when data of message is used by CPI application program.
int cpiGetNextData (cpiMsgID ID, cpiData *VAL);
VAL Value (structure!)
Return values:
0 : OK
-1 : Connection error, reading of the next item from the message has failed for
some reason. More detailed reason can be read from the global variable
cpi_errno. The explanation for cpi_errno values can be read from the
Status Codes manual.
-2 : Invalid MsgID
-10 : No data items left in the buffer
cpiGetNextDataType
This function reads the type of the next item in the message. The function does not
remove item from the message.
int cpiGetNextDataType (cpiMsgID ID, cpiDataType *VAL);
VAL Value
Return values:
0 : OK
-1 : Connection error, reading of the next item from the message has failed for
some reason. More detailed reason can be read from the global variable
cpi_errno. The explanation for cpi_errno values can be read from Status
Codes manual
-2 : Invalid MsgID
42 ABB Automation
1MRS751365-MEN CPI for MicroSCADA COM 500
Configuration Manual 4 CPI Library
cpiGetNextS32Data
The following function reads the next item from the message. The item is converted to
the long type. The items of the binary type are not possible to read by using this
function.
int cpiGetNextS32Data (cpiMsgID ID, long *VAL);
VAL Value
Return values:
0 : OK
-1 : Connection error, the reading of next item from message has been failed
for some reason. More detailed reason can be read from the global
variable cpi_errno. The explanation for cpi_errno values can be
read from the Status Codes manual
-2 : Invalid MsgID
-10 : No data items left in the buffer
cpiGetTimeData
This function can be used to retrieve the time information from the message written in
RTU_ATIME format.
int cpiGetTimeData(cpiMsg *msg, cpiTime *time);
Return values:
0 if ok
-1 if fails
This function can be used to read command data from the message.
7DEOH 'DWD6FDQQLQJ)XQFWLRQV
Function Description
cpiGetNextAddrData Reads the next Address Type item from the message
cpiGetNextAddrData
The following function reads the next Address Type item from the message. This can
be used for unpacking the process commands from the MicroSCADA, which are sent
via the process database. All of the commands that are sent via MicroSCADA process
database use the DA attribute and the Address Type data item. The data is divided into
the three parts: the object type, the object address and the object value.
Return values:
0 : OK
-1 : Connection error, the reading of the next item from the message has been
failed for some reason. More detailed reason can be read from the global
the manual Status Codes
-2 : Invalid MsgID
ABB Automation 43
COM 500 CPI for MicroSCADA 1MRS751365-MEN
Example of use:
cpiGetAttribute(id, AT);
if (!strcmp(AT,"DA"))
/* compare AT to see if it is DA = command via process database*/
{
i = 0;
printf("DA message received \n");
while(cpiGetNextAddrData (id, &data) == 0) {
printf(" OT = %d", data.value.ADDR.ObjectType );
printf(" OA = %d", data.value.ADDR.ObjectAddress);
printf(" OV = %d\n", data.value.ADDR.ObjectValue);
switch(data.value.ADDR.ObjectType) {
case cpiOBJECT_COMMAND:
printf("Object Command received\n");
switch(data.value.ADDR.ObjectValue) {
case 0: printf("IMMEDIATE COMMAND OFF \n"); break;
case 1: printf("IMMEDIATE COMMAND ON \n"); break;
case 16: printf("INHIBIT COMMAND \n"); break;
case 17: printf("CHECK BACK COMMAND \n"); break;
case 32: printf("EXECUTE COMMAND OFF \n"); break;
case 33: printf("EXECUTE COMMAND ON \n"); break;
}
break;
case cpiANALOG_SETPOINT:
printf("Analog Setpoint received\n");
break;
}
}
}
The (byte) value received when a command is activated is a byte coded as shown in
the Table 23 (see also the example of use in chapter 4.6.3.1):
7DEOH 7KHUHFHLYHGYDOXHVDQGGHVFULSWLRQV
Object Command Status High Nibble Low Nibble
Value Value
IMMEDIATE COMMAND 0
ON 1
OFF 0
CHECK BACK COMMAND 1
INHIBIT 0
CHECK 1
BACK
EXECUTE COMMAND 2
ON 1
OFF 0
7DEOH 5HJXODWLRQFRPPDQGV
Object Command Status High Nibble Low Nibble
Value Value
IMMEDIATE COMMAND 0 1/0
COMMAND STOP 3 Ignored
44 ABB Automation
1MRS751365-MEN CPI for MicroSCADA COM 500
Configuration Manual 4 CPI Library
The value of the analog setpoint is stored into the ObjectValue field of the cpiData
structure.
cpiConnectionStatus
This function checks the status of an application connection. It also returns the status
code of the last reply message, if it is rejected by the base system.
Return values:
0 : OK
1 : Waiting connection
others : Refer to the Status Codes manual
cpiGetTransmissionBuffer
This function reserves a buffer for a transmission. The function returns with error
status if the transmission queue is full or if the failed transmission queue contains
messages. The length of the transmission queue is in this version, so the previously
sent message must get a reply from the base system before a new buffer can be
reserved.
Return values:
0 : OK
-13 : No buffers left
-20 : Connection is still waiting for a reply for previously sent message
ABB Automation 45
COM 500 CPI for MicroSCADA 1MRS751365-MEN
cpiGetReplyBuffer
This function reserves a buffer for a reply message transmission. It is used when it is
possible to send the reply message back to base system immediately.
Return values:
0 : OK
-13 : No message buffers left
-15 : Invalid source ID
cpiGetDefinedReplyBuffer
This function reserves a buffer for a reply message. It is used when the reply message
cannot immediately be sent back to the base system.
Return values:
0 : OK
-13 : no messages buffers left
cpiGetNotificationBuffer
This function reserves a buffer for a notification message. It is used to send the system
status messages to the base system.
Return values:
0 : OK
-13 : No messages buffers left
4.9 Initialisations
7DEOH ,QLWLDOLVDWLRQV
Function Description
cpiInitThisNode Initialises data of this node.
cpiInitRemoteNode Gives information of MicroSCADA node to CPI.
cpiCreateConnection Creates connection and starts the communication
between CPI and MicroSCADA.
cpiCloseConnection Removes connection between CPI and MicroSCADA
46 ABB Automation
1MRS751365-MEN CPI for MicroSCADA COM 500
Configuration Manual 4 CPI Library
7DEOH ,QLWLDOLVDWLRQQHHGHGZKHQFRQQHFWLQJ&3,WR0LFUR6&$'$
The CPI sends an analog value from RTU2 to application 1 using following function:
cpiSendAnalogValue(con1, 2, block, val, status, &ID);
cpiInitThisNode
Return values:
0 : OK
-26 : Invalid data
cpiInitRemoteNode
Return values:
0 : OK
-1 : Connection error
-8 : Invalid address
-14 : Invalid node
-17 : Invalid tcp address
ABB Automation 47
COM 500 CPI for MicroSCADA 1MRS751365-MEN
cpiCreateConnection
This function creates a connection and starts the communication between CPI and
MicroSCADA.
Return values:
0 : OK
-1 : Connection error
-14 : Invalid node number
cpiCloseConnection
Return values:
0 : OK
-1 : Connection error, invalid connection number
Following functions are used to handle bitset data type. Bitset data type is used in
cpiSelect function.
7DEOH %LWVHW)XQFWLRQV
Function Description
cpiSET Sets one bit in a bit set.
cpiCLR Clears one bit from a bit set.
cpiISSET Checks the value of one bit and returns it.
cpiSET
Return values:
0 : If tested bit does not belong to the bitset
1 : If tested bit belongs to the bitset
cpiCLR
48 ABB Automation
1MRS751365-MEN CPI for MicroSCADA COM 500
Configuration Manual 4 CPI Library
Return values:
0 : If tested bit does not belong to the bitset
1 : If tested bit belongs to the bitset
cpiISSET
This function checks the value of one bit and then returns it.
int cpiISSET(int BIT, cpiBitSet *BITSET)
Return values:
0 : If tested bit does not belong to the bitset
1 : If tested bit belongs to the bitset
ABB Automation 49
1MRS751365-MEN CPI for MicroSCADA COM 500
Configuration Manual 5 Support for System
Configuration Tool
5.1 General
5.2 Functionality
5.1 General
This chapter gives the instructions how to provide support for CPI communication
protocol configuration in System Configuration Tool.
When using System Configuration Tool for configuring CPI application program the
MicroSCADA base system revision needs to be 8.4.3 or later.
'HILQLWLRQV
• Attribute definitions; the information about all CPI configuration attributes. For
each CPI configuration attribute: names, data types, data structures, description
texts, help texts, description texts for different attribute values to be used by the
System Configuration Tool.
Base system and communication system are configured by using the functionality
included into System Configuration Tool during system start-up. The CPI application
programs utilize its own permanent protocol configuration file during its start-up.
More detailed information about base system configuration can be found in Chapter 2.
5.2 Functionality
The included CPI protocols are recognized from the MicroSCADA computer in
System Configuration Tool based on following requirement: under \sc\prog folder,
each sub-folder is assumed to be named according to CPI application program, if
ABB Automation 51
COM 500 CPI for MicroSCADA 1MRS751365-MEN
The station type to be attached into CPI protocol communication line is RTU or SPA.
CPI application program, i.e. the executable file, may exist in the same computer,
where System Configuration Tool is running or in external computer. However, the
permanent protocol configuration file, attribute definitions and mappings files need to
exist in sub-folder under \sc\prog folder in the same computer, where System
Configuration Tool is being used. If CPI application program is running in external
computer, one of its drives can be mapped to the network location, where the
MicroSCADA is running. In this way these files are needed only once both for CPI
application program and configuration with System Configuration Tool. The name of
the protocol to be used for CPI application program is concluded from the sub-folder
name under \sc\prog folder.
In the figure is the MODBUS SLAVE communication protocol included into system
configuration. The folder \sc\prog\modbus_slave exists in MicroSCADA computer,
where System Configuration Tool is located. The name of the protocol is displayed as
MODBUS SLAVE in the object tree, i.e. included underscore character is removed
and the sub-folder name is uppercased.
7DEOH &3,SURWRFROLQ2EMHFW7UHHRI6\VWHP&RQILJXUDWLRQ7RRO
The format of this file follows the Windows Initialization File Format specification.
All the configuration attributes, that are needed to be shown in System Configuration
Tool, need to exist as key names and values under the section name Configuration.
52 ABB Automation
1MRS751365-MEN CPI for MicroSCADA COM 500
Configuration Manual 5 Support for System
Configuration Tool
Other section names may be used to store the information related to CPI application
program, which is not needed to be shown in System Configuration Tool.
[Configuration]
key name 1=key value 1
key name 2=key value 2
…
key name n=key name i
[Section name 2]
key name 1=key value 1
key name 2=key value 2
…
key name n=key name n
…
[Section name m]
key name 1=key value 1
key name 2=key value 2
…
key name n=key name n
The key name is the same as the attribute name in the Attribute definitions file
Attr_Def.scl.
Example of Config.ini
[Configuration]
own_node_number=4
own_station_number=204
base_system_node_number=9
base_system_station_number=209
tcp_ip_address=194.142.148.36
application_number=1
communication_port_name=COM1
baud_rate=9600
parity=0
stop_bit_count=0
data_bit_count=8
flow_control=0
The format of each attribute definition follows the SCIL syntax. The following
common definitions are valid for all data types:
The name of the attribute is unique for all the CPI configuration attributes. No spaces
are allowed, they must be replaced with the underscore characters, e.g. attribute
TCP/IP Address is presented as TCP_IP_ADDRESS as valid CPI attribute name for
System Configuration Tool.
• Integer
• Real
• Text
ABB Automation 53
COM 500 CPI for MicroSCADA 1MRS751365-MEN
• Time
• Boolean.
If attribute is editable the value is TRUE - otherwise FALSE. If the attribute is defined
to be editable its value can be edited in the edit area of System Configuration Tool. If
the attribute is non-editable, the editing of attribute is disabled in the edit area of
System Configuration Tool. All the CPI attributes are included into View named All
Attributes and under group name CPI Configuration Attributes.
7DEOH $WWULEXWHWUHHDQG(GLWDUHDRI6\VWHP&RQILJXUDWLRQ7RRO
Descriptive text is used in the attribute tree of System Configuration Tool. When some
CPI attribute becomes selected in the object tree, the status bar displays the help text at
the bottom of System Configuration Tool.
7DEOH 6WDWXVEDU
Default value is utilized for attribute, when CPI application protocol is added into
System Configuration Tool. It is possible for the user to change the attribute value
according to its attribute definitions by using edit area.
INTEGER
Attribute definition Description data type Example
Data_type TEXT ”INTEGER”
Min_value INTEGER 1
Max_value INTEGER 7
Modifiable BOOLEAN TRUE
Special_values VECTOR of INTEGERs (1, 3, 7)*
Value_descriptions VECTOR of TEXTs (”Not in Use”, ”Synhcronized”,
”Asynchronized”)*
Descriptive_text TEXT “Example Integer Attribute”
Default_value INTEGER 3
54 ABB Automation
1MRS751365-MEN CPI for MicroSCADA COM 500
Configuration Manual 5 Support for System
Configuration Tool
INTEGER
Attribute definition Description data type Example
Help_text TEXT “This is an example of integer
attribute.”
REAL
Attribute definition Description data type Example
Data_type TEXT ”REAL”
Min_value REAL 1.0
Max_value REAL 1.5
Modifiable BOOLEAN TRUE
Descriptive_text TEXT “Example Real Attribute”
Default_value REAL 1.1
Help_text TEXT “This is an example of real attribute.”
TEXT
Attribute definition Description data type Example
Data_type TEXT ”TEXT”
Min_length INTEGER 4
Max_length INTEGER 5
Modifiable BOOLEAN TRUE
Descriptive_text TEXT “Example Text Attribute”
Default_value TEXT ”COM1”
Help_text TEXT “This is an example of text attribute.”
TIME
Attribute definition Description data type Example
Data_type TEXT ”TIME”
Min_value TIME Pack_time(1978,1,1,0,0,0)**
Max_value TIME Pack_time(2045,12,31,23,59,59)**
Modifiable BOOLEAN TRUE
Descriptive_text TEXT “Example Time Attribute”
Default_value TIME Pack_time(1999,12,20,12,0,0)**
Help_text TEXT “This is an example of time attribute.”
BOOLEAN
Attribute definition Description data type Example
Data_type TEXT ”BOOLEAN”
Modifiable BOOLEAN TRUE
Descriptive_text TEXT “Example Boolean Attribute”
Default_value BOOLEAN TRUE
Help_text TEXT “This is an example of boolean
attribute.”
ABB Automation 55
COM 500 CPI for MicroSCADA 1MRS751365-MEN
Example of Attr_Def.scl
#create GL_ATTRIBUTES:V = LIST(-
OWN_NODE_NUMBER = LIST(-
data_type=”INTEGER”,-
min_value=1,-
max_value=99,-
modifiable=TRUE,-
descriptive_text=”Own Node Number”,-
default_value=4,-
help_text=”Specifies the own node number to be used in CPI application
program.”),-
OWN_STATION_NUMBER = LIST(-
data_type=”INTEGER”,-
min_value=1,-
max_value=255,-
modifiable=TRUE,-
descriptive_text=”Own Station Number”,-
default_value=204,-
help_text=”Specifies the own station number to be used in CPI application
program.”),-
BASE_SYSTEM_NODE_NUMBER = LIST(-
data_type=”INTEGER”,-
min_value=1,-
max_value=99,-
modifiable=TRUE,-
descriptive_text=”Base System Node Number”,-
default_value=9,-
help_text=”Specifies the base system node number to be used in CPI application
program.”),-
BASE_SYSTEM_STATION_NUMBER = LIST(-
data_type=”INTEGER”,-
min_value=1,-
max_value=255,-
modifiable=TRUE,-
descriptive_text=”Base System Station Number”,-
default_value=209,-
help_text=”Specifies the base system station number to be used in CPI
application program.”),-
TCP_IP_ADDRESS = LIST(-
data_type=”TEXT”,-
min_length=7,-
max_length=15,-
modifiable=TRUE,-
descriptive_text=”TCP/IP Address”,-
default_value=”192.142.148.36”,-
help_text=”Specifies the TCP/IP address to be used in CPI application
program.”),-
APPLICATION_NUMBER = LIST(-
data_type=”INTEGER”,-
min_value=1,-
max_value=99,-
modifiable=TRUE,-
descriptive_text=”Application Number”,-
default_value=1,-
help_text=”Specifies the application number, where CPI application program is
running.”),-
COMMUNICATION_PORT_NAME = LIST(-
data_type=”TEXT”,-
min_length=4,-
max_length=5,-
modifiable=TRUE,-
descriptive_text=”Communication Port Name”,-
default_value=”COM1”,-
help_text=”Specifies the communication port name, which CPI application program
is utilizing.”))
#return %GL_ATTRIBUTES
56 ABB Automation
1MRS751365-MEN CPI for MicroSCADA COM 500
Configuration Manual 5 Support for System
Configuration Tool
The reason for this is that the format of this file need to follow the SCIL syntax, and
there is always a risk that due to some typing error the Attr_Def.scl file is not
applicable to SCIL syntax. In the SCIL Editor, it is possible to define the Syntax
Check mechanism into use automatically during save operation by selecting Options –
Check Syntax at Save.
The section name refers to the MicroSCADA object, where the attribute name
belongs.
The key name in this file is the same as the attribute name in attribute definitions file
and key name in permanent protocol configuration file. The key value in this file
represents the two-char attribute name to be used for defining the property to the
MicroSCADA object.
E.g. if inside NODE section, there exists key name own_station_number with key
value SA it means that configuration attribute is referenced to the NOD’n’:BSA
attribute in the MicroSCADA, where ’n’ equals to the node number object.
Example Attr_Map.ini
[NODE]
own_station_number=SA
[NODE_LINK]
communication_port_name=SD
baud_rate=BR
stop_bit_count=SB
[STATION]
in_use=IU
ABB Automation 57
1MRS751365-MEN CPI for MicroSCADA COM 500
Configuration Manual 6 Glossary
6 Glossary
This section describes terminology and defines words used in this document. The
same words may have quite different meanings in other circumstances; these
explanations refer only to this document.
$&3
$&30HVVDJH
$WWULEXWH
Individual data items which form part of an object are called attributes. Each object
has a set of attributes that store information and describe the the qualities of the object.
Attributes contain for example measured values, texts, program lines, time stamps etc.
depending on which object type is concerned.
%DVH6\VWHP
%6'6RFNHW
Socket interface defined in the Unix version developed by the Berkeley Software..
&3,DQG&3,/LEUDU\
ABB Automation 59
COM 500 CPI for MicroSCADA 1MRS751365-MEN
&3,$SSOLFDWLRQ3URJUDP
(Called ‘gateway program’ in some cases) ; Application program made by using CPI
interface exchanges data between MicroSCADA and foreign system. It emulates NET
containing stations of the RTU, SPA or SPI device type.
&RPPXQLFDWLRQ6\VWHP
Handles the data transmission in the MicroSCADA system and also between devices.
The communication can be divided into upper level communication and process
communication.
/$1
Local Area Network; used for communication between the base system, frontend and
workstations, for upper level communication. It has a large capacity for data
transmission.
0HVVDJH%XIIHU
A place in the memory to store ACP messages to or from MicroSCADA base system.
CPI Buffer Management functions reserve buffers for different message types.
1(7
1(7(PXODWLRQ
. CPI application program resembles the behaviour of the NET unit, so it “acts” as a
communication frontend.
1RGH
1RGH1XPEHU
26,
60 ABB Automation
1MRS751365-MEN CPI for MicroSCADA COM 500
Configuration Manual 6 Glossary
3URWRFRO
Protocol is a set of rules and conventions for transmitting information in the network.
They govern the content, format, timing, sequencing and error control of messages.
578
6&,/
63$'HYLFH
6\VWHP&RQILJXUDWLRQ7RRO
Manages the configuration of the base system and NET communication unit.
7&3,3
7KUHDG
An independent part of the program that is active until stopped by the main program
or it stops itself. Threads can be used to isolate tasks. Usually the foreign protocol is
implemented as a thread.
ABB Automation 61
1MRS751365-MEN CPI for MicroSCADA COM 500
Configuration Manual 7 Disclaimer
7 Disclaimer
• The information in the CPI manual is subject to change without notice and
should not be construed as a commitment by ABB Substation Automation Oy.
7UDGHPDUNV
ABB Automation 63
1MRS751365-MEN CPI for MicroSCADA COM 500
Configuration Manual
INDEX
Page
ACP ........................................................................................................................... 6, 22, 61
ACP protocol messages ............................................................................................... 6, 7, 61
ACP-OSI ......................................................................................................................... 7, 63
Analog setpoint.................................................................................................................... 15
Application Communication Protocol ................................................................................... 6
Application Programming ............................................................................................. 14, 17
Attr_Def.scl ................................................................................................................... 54, 55
Attr_Map.ini ........................................................................................................................ 54
Attribute definitions............................................................................................................. 53
Attribute Tree ...................................................................................................................... 56
Attributes ......................................................................................................................... 9, 61
Base system ......................................................................................................................... 61
Base System Configuration ..................................................................................... 10, 14, 17
Base System Node Object ................................................................................................... 59
Bit position .......................................................................................................................... 22
Boolean................................................................................................................................ 56
BSD socket ...................................................................................................................... 2, 61
Cause of exception .............................................................................................................. 23
Communication attributes...................................................................................................... 7
Communication Line Object ............................................................................................... 59
Communication Station Object ........................................................................................... 59
Communication system ....................................................................................................... 62
Config.ini............................................................................................................................. 54
Configuration attributes................................................................................................... 7, 53
Connection status................................................................................................................. 22
Connections
&3,DSSOLFDWLRQSURJUDPDVDPDVWHU
&3,DSSOLFDWLRQSURJUDPDVDVODYH
Converting messages ..................................................................................................... 15, 18
CPI....................................................................................................................................... 61
CPI application program...................................................................................................... 62
CPI Library.................................................................................................................... 21, 61
FSL&ORVH&RQQHFWLRQ
FSL&/5
FSL&RQQHFWLRQ6WDWXV
FSL&UHDWH&RQQHFWLRQ
FSL([FHSWLRQ
FSL*HW$WWULEXWH
FSL*HW'HILQHG5HSO\%XIIHU
FSL*HW'HVWLQDWLRQ
FSL*HW'HYLFH7\SH
FSL*HW)DLOHG0HVVDJH
FSL*HW,QGH[
FSL*HW0HVVDJH
FSL*HW0HVVDJH/HQJWK
FSL*HW0HVVDJH7\SH
FSL*HW1H[W$GGU'DWD
FSL*HW1H[W'DWD
FSL*HW1H[W'DWD7\SH
FSL*HW1H[W6'DWD
ABB Automation
COM 500 CPI for MicroSCADA 1MRS751365-MEN
Configuration Manual
FSL*HW1RWLILFDWLRQ%XIIHU
FSL*HW5HSO\%XIIHU
FSL*HW5HSO\'HILQLWLRQ
FSL*HW5HSO\6WDWXV
FSL*HW5WX1R
FSL*HW6RXUFH
FSL*HW7LPH'DWD
FSL*HW7UDQVPLVVLRQ%XIIHU
FSL*LYH8S
FSL,QLW5HPRWH1RGH
FSL,QLW7KLV1RGH
FSL,66(7
FSL1HW0HVVDJH)LOWHULQJ
FSL3XW'DWD
FSL3XW'HVWLQDWLRQ
FSL3XW5HSO\6WDWXV
FSL3XW5WX'DWD
FSL3XW5WX'DWD:LWKRXW6WDWXV
FSL3XW5WX'DWD:LWK76
FSL3XW6RXUFH
FSL3XW;;;'DWD
FSL5HWUDQVPLW0HVVDJH
FSL6HOHFW
FSL6HQG0HVVDJH
FSL6HQG5WX$QDORJ9DOXH
FSL6HQG5WX$QDORJ9DOXH:LWK76
FSL6HQG5WX%LW6WUHDP
FSL6HQG5WX'LJLWDO9DOXH
FSL6HQG5WX,QGLFDWLRQ
FSL6HQG5WX,QGLFDWLRQ%ORFN
FSL6HQG5WX,QGLFDWLRQ:LWK76
FSL6HQG5WX0HVVDJH
FSL6HQG5WX3XOVH&RXQWHU
FSL6HQG5WX3XOVH&RXQWHU:LWK76
FSL6HQG5WX6WDWXV0HVVDJH
FSL6HQG6SD$QDORJ9DOXH
FSL6HQG6SD$QDORJ9DOXH:LWK76
FSL6HQG6SD'LJLWDO9DOXH
FSL6HQG6SD'LJLWDO9DOXH:LWK76
FSL6HQG6SD,QGLFDWLRQ
FSL6HQG6SD,QGLFDWLRQ%ORFN
FSL6HQG6SD,QGLFDWLRQ%ORFN:LWK76
FSL6HQG6SD,QGLFDWLRQ:LWK76
FSL6HQG6SD0HVVDJH
FSL6HQG6SD3XOVH&RXQWHU:LWK76
FSL6HQG6SD6WDWXV0HVVDJH
FSL6HQG6\VWHP0HVVDJH
FSL6(7
CPI_EXAMPLE.............................................................................................................16, 19
Data transfer.........................................................................................................................18
Data Transfer .......................................................................................................................15
Data Types ...........................................................................................................................56
Deleting message .................................................................................................................25
Device level routing ...............................................................................................................8
Digital setpoint.....................................................................................................................15
Edit Area ..............................................................................................................................56
Emulation.........................................................................................................................3, 62
EX connection......................................................................................................................23
ABB Automation
1MRS751365-MEN CPI for MicroSCADA COM 500
Configuration Manual
Example Attr_Map.ini......................................................................................................... 59
Example of Attr_Def.scl...................................................................................................... 58
Example of Config.ini ......................................................................................................... 55
Failed message..................................................................................................................... 25
Fields ..................................................................................................................................... 8
Frontend emulation................................................................................................................ 9
Functionality........................................................................................................................ 54
Functions ............................................................................................................................. 21
Gateway program ............................................................................................................ 1, 62
General persistent output ..................................................................................................... 15
GetDeviceNumber............................................................................................................... 44
Implementation of the foreign protocol............................................................................... 16
Infinite loop ........................................................................................................................... 3
Integer.................................................................................................................................. 56
Key name....................................................................................................................... 55, 59
LAN................................................................................................................................. 2, 62
Location of files................................................................................................................... 54
Low level message routing .................................................................................................... 7
Memory management............................................................................................................ 5
Message buffers............................................................................................................... 5, 62
Message conversion....................................................................................................... 15, 18
Message dialogues................................................................................................................. 6
Message failure types ............................................................................................................ 9
Modbus Slave ...................................................................................................................... 54
Naming of files .................................................................................................................... 54
NET ................................................................................................................................. 3, 62
NET emulation ................................................................................................................ 3, 62
Node .................................................................................................................... 6, 14, 42, 62
Node number ....................................................................................................................... 62
Notifications .......................................................................................................................... 6
Object command.................................................................................................................. 15
Object type of command ..................................................................................................... 15
OSI ........................................................................................................................................ 7
Packet building .................................................................................................................... 39
Packet unpacking................................................................................................................. 42
Program files ....................................................................................................................... 21
Protocol ......................................................................................................................... 13, 63
Protocol Converter............................................................................................................... 13
Protocol Implementation ..................................................................................................... 18
RD connection ..................................................................................................................... 23
Read commands..................................................................................................................... 6
Real...................................................................................................................................... 56
Regulation command........................................................................................................... 15
Reserved attributes ................................................................................................................ 9
Revision............................................................................................................................... 53
Routing .................................................................................................................................. 7
RP570 slave device.............................................................................................................. 16
RTU Object Model.............................................................................................................. 27
RTU station ............................................................................................................. 10, 54, 63
SCIL ................................................................................................................................ 6, 63
SPA device .................................................................................................................... 54, 63
Status Bar ............................................................................................................................ 56
Status codes
578
63$
SYS_BASCON.COM ......................................................................................................... 10
System Configuration Tool ........................................................................................... 53, 63
System Start-Up .................................................................................................................. 53
ABB Automation
COM 500 CPI for MicroSCADA 1MRS751365-MEN
Configuration Manual
ABB Automation
1MRS751365-MEN CPI for MicroSCADA COM 500
Configuration Manual
Customer Feedback
This chapter contains information on how to send customer feedback and how to get
technical support from the SA Help Desk.
Customer Feedback is a Lotus Notes database, using which ABB companies can
report errors, make improvement proposals and queries related to products
manufactured by ABB Substation Automation Oy. Customer Feedback database is
connected to the change management system of ABB Substation Automation Oy,
which handles all error corrections and improvements made to the products.
Please note that the Customer Feedback database is primarily intended for writing
reports about released products. If you are using for example a beta release in a pilot
project, this should be clearly stated.
When writing a Customer Feedback report the following general instructions should
be taken in consideration:
• Write the report in English.
• Write only one error report, query or improvement proposal in a Customer
Feedback report.
• If you are reporting an error, try to isolate the error as well as possible. Describe
the sequence of events and actions that leads to the error. If any error messages or
other debug information is provided by the system please write it down. Include
also information of the system, e.g. a system diagram, revision information and
configuration data.
• If you are making an improvement proposal, try to describe how the improved
function should work and avoid providing solutions. Information about the
importance of the improvement, e.g. number of projects that require the
improvement, helps us to make the decision whether and when the improvement
should be implemented.
To make a Customer Feedback report select Feedback Report from the Create menu.
This opens an empty Customer Feedback document. Fill out the fields listed below. A
question mark next to a filed provides help for filling out the field.
Subject. This should contain a short description of the issue. A more detailed
description can be given in the Description of Feedback field below.
Type of Feedback: Comment/Improvement, Query or Complaint/Error.
Customer Information.
ABB Automation
COM 500 CPI for MicroSCADA 1MRS751365-MEN
Configuration Manual
Reporting Information. This should contain detailed information of the product the
report is about.
The person who you want to send the feedback to and whether you want to get a
reply from that person.
Information related to internal handling of the report (not obligatory).
Category.
You can issue the report by clicking the Issue Feedback button. This will send the
report to the selected person and change its status to “in progress”.
Actions
• In case of a clear error the report is moved to the change management system of
ABB Substation Automation Oy. In this system the error is analysed in detail and
corrected in a future patch release or major release depending on the severity and
impact of the error.
• In case of an improvement proposal the report is also moved to the change
management system where it be taken as a requirement to future releases.
• In case of a query an answer is provided.
When Customer Feedback reports are handled in the change management system, the
outcome can be one of the following:
No Actions It is decided that the report
requires no further action. If for
example the problem is caused by
a configuration error, it belongs to
this category.
Will be implemented in patch/current release This result means that the
correction or new feature will be
available in the next official
program release.
Moved to future release This result means that the new
feature will be available in some
new program release in the near
future.
SA Help Desk
For other kind of technical support please use the Customer Feedback database. SA
Help Desk is available every day from 06:00 to 21:00 Central European Time.
ABB Automation
MRS 751365-MEN
$%%
ABB Substation Automation Oy
P.O.Box 699
FIN-65101 VAASA
Finland
Tel. +358-10 224 000
Fax. +358-10 224 1094
www.abb.com/fi