IEC 60870-5-104 Server communication protocol
Supported device types and versions
This protocol (known also as IEC 870-5-104 or IEC-104) implements a server side of IEC-104 communication.
Communication supports reading and writing data by means of the IEC 60870-5-104 communication protocol operating on the basis of TCP network communication. D2000 system works in the mode IEC 60870-5-104 server (slave), that is enable to communicate with multiple (N) clients (masters). Implementation is according to the standard IEC 60870-5-104 as follows:
- initial Originator ASDU address is 1 byte, it is defined as line number.
- ASDU address is 2 bytes, it is defined as station address. For each station on one line, there must be defined different ASDU address.
- Cause of transmission is 2 bytes (it also contains Originator ASDU address)
- Information object address = 3 bytes, it is defined as I/O tag address.
- There are implemented the following ASDU types in the direction of logging (from D2000 system to control station and also vice-versa in balanced mode):
Table nr. 1
|ASDU type||I/O tag type|
|1 - Single-point information||Dout|
|2 - Single-point information with time tag||Dout|
|3 - Double-point information||Dout,Cout|
|4 - Double-point information with time tag||Dout,Cout|
|5 - Step position information||Cout|
|6 - Step position information with time tag||Cout|
|7 - Bitstring of 32 bits||Cout|
|8 - Bitstring of 32 bits with time tag||Cout|
|9 - Measured value, normalized value||Ao|
|10 - Measured value, normalized value with time tag||Ao|
|11 - Measured value, scaled value||Cout|
|12 - Measured value, scaled value with time tag||Cout|
|13 - Measured value, short floating point value||Aout|
|14 - Measured value, short floating point value with time tag||Aout|
|15 - Integrated totals||Cout|
|16 - Integrated totals with time tag||Cout|
|20 - Packed single-point information with status change detection||Cout *|
|21 - Measured value, normalized value without quality descriptor||Ai|
|30 - Single-point information with time tag CP56Time2a||Dout|
|31 - Double-point information with CP56Time2a tag||Dout,Cout|
|32 - Step position information with CP56Time2a tag||Cout|
|33 - Bitstring of 32 bits with CP56Time2a tag||Cout|
|34 - Measured value, normalized value with CP56Time2a tag||Aout|
|35 - Measured value, scaled value with CP56Time2a tag||Cout|
|36 - Measured value, short floating point value with time tag CP56Time2a||Aout|
|37 - Integrated totals with time tag CP56Time2a||Cout|
|241 - 64-bit floating point value (Ipesoft & URAP implementation)||Ao|
|243 - 64-bit floating point value with time tag CP56Time2a (Ipesoft & URAP implementation)||Ao|
|251 - Archive data values (Ipesoft's implementation)||none **|
|252 - D2000 Unival(Ipesoft's implementation)||all|
Note: For setting individual bites of the byte that inform us on quality (SIQ for ASDU 1,2,30; DIQ for ASDU 3,4,31; QDS for ASDU 5..14,20,32..36), there are used the flags FLA (0.bit),FLB (1.bit) ..FLH (7.bit).
- for ASDU 4: FLA=DPI bit 0, FLB=DPI bit 1, FLC=0, FLD=0, FLE=BL bit, FLF=SB bit, FLG=NT bit, FLH=IV bit.
- for ASDU 16: FLA..FLE Sequence number bites 0..4, FLF=CY bit, FLG=CA bit, FLH=IV bit
Except the bites, which are set directly by a value (e.g. for ASDU 1, the 0.bit is not set by the flag FLA but by the value of output I/O tag).
If there is the attribute Invalid is set to a new value, the higher bit (IV) will be set in the status byte of all ASDU (except ASDU 21 not containing it).
* - Status is taken as low 2 bytes, Status change detection is taken as high 2 bytes of 32-bite integer.
There are implemented the following ASDU types in the direction of control (from control station to D2000, also the opposite direction in balanced mode):
Table nr. 2
|ASDU type||I/O tag type|
|45 - Single command||Di, Qi|
|46 - Double command||Qi|
|47 - Regulating step command||Di, Qi|
|48 - Set point command, normalised value||Ai|
|49 - Set point command, scaled value||Ci|
|50 - Set point command, short floating point value||Ai|
|51 - Bitstring of 32 bit||Ci|
|58 - Single command with time tag CP56Time2a||Di, Qi|
|59 - Double command with time tag CP56Time2a||Qi|
|60 - Regulating step command with time tag CP56Time2a||Di, Qi|
|61 - Set point command, normalised value with time tag CP56Time2a||Ai|
|62 - Set point command, scaled value with time tag CP56Time2a||Ci|
|63 - Set point command, short floating point value with time tag CP56Time2a||Ai|
|64 - Bitstring of 32 bit with time tag CP56Time2a||Ci|
|250 - Archive data request command (Ipesoft's implementation)||none **|
|252 - D2000 Unival (Ipesoft's implementation)||all (except Qi)|
Bites of "status" byte (SCO fro ASDU 45,58; DCO for ASDU 46,59; RCO for ASDU 47,60; QOS for ASDU 48..50,61..63) causes setting the flags FLA (0.bit),FLB (1.bit) ..FLH (7.bit) with exception for the bites, which are directly set by the value of a variable ( SCO bit 0, DCO a RCS bity 0-1). After receiving an response (positive/negative), the flags FLA..FLH are set according the bites of "status" byte.
When writing values, the value of 6 [Activation] is waited as CauseOfTransmission. Response of control station depends on the setting of the parameter CMDC. Originator ASDU address will be used the same as in the received command.
- process D2000 KOM is waiting on TCP port and, after establishing a connection, is waiting for sending the U-frame StartDT Act from the client. It is waiting for StartDT Con as a response (it is possible to send TestFrame before StartDT Act)
- if the parameter EOI is set for the process D2000 KOM, there is sent ASDU 70 [End of initialization], the initial address (set a line number) is used as Originator ASDU address
- if the parameter Synchronisation period (the tab Time parameters) for some station is different from 0, ASDU 103 [Clock synchronisation command] with CauseOfTransmission= 6 [Activation] is sending in given period. The initial address (set as line number) or Originator ASDU of the last received ASDU 1000 or 101 is used as Originator ASDU address.
- process D2000 KOM sends new values acquired from the process D2000 Server for variables with ASDU 1..14, 20, 21, 30 .. 36 to a client, which sent ASDU 100 [Interrogation Command] and new values for variables with ASDU 15,16,37 to a client, which sent ASDU 101 [Counter Interrogation Command]
- process D2000 KOM accepts time synchronisation using ASDU of 103 type [Clock synchronisation command] with CauseOfTransmission=6 [Activation] or 3 [Spontaneous]. If CauseOfTransmission= 6, it responds in dependence on setting the parameter CMDC, if CauseOfTransmission= 3, it does nOt response.
- process D2000 KOM responses to received commands (ASDU 45..51, 58..64) with CauseOfTransmission= 6 [Activation] in dependence on setting the parameter CMDC.
Originator ASDU address (OA): initial OA is set as TCP line number in the configuration. The address will be used for optimum sending the ASDU 70 [End of initialization] at the beginning of connection and always when sending new values.
After receiving ASDU 100 or 101, there are sent current values of all output I/O tags (with no attribute Invalid set) with the same OA as contained in ASDU 100 or 101.
As responses to received commands (ASDU 45..51, 58..64), there are sent confirmations with the same ASDU as contained in the received command.
D2000 system also supports the balanced mode. In the mode, the task of controlled and control stations is changed. That time, D2000 system sends commands and ASDU 100/101. The balanced mode may be used only when is supported by partner station. An advantage is that D2000 system sends ASDU 100 [Interrogation Command] a 101 [Counter Interrogation Command] and gets the status of output I/O tags (configured as ASDU 1-40) after disconnection and re-establishing the connection. It is suitable to configure single-shot commands as ASDU 45 - 64; they are not repeated after re-establishing the connection.
Writing an output I/O tag:
When writing IEC 104 values (ASDU 1-40), there are valid the rules of server protocols.
When writing IEC 104 values (ASDU 45-64) in the balanced mode, ASDU is considered to be confirmed (away from the state Transient) in dependence on the parameter CMDC. If the connection to a client is lost when writing, the writing success depends on the parameter PW.
Communication line configuration
- Communication line category: TCP/IP-TCP
- TCP Parameters
- Required to define the server parameters
- Host: string containing at most 80 characters – name of the network interface in form of INET (name or numerical address a.b.c.d, e.g. 192.168.0.1) using of which the process D2000 KOM will receive clients. If the name is ALL, tge process D2000 KOM will wait on all network interfaces of the computer, where is running.
- Port: TCP port number (0..65535), where the process D2000 KOM is waiting.
- Line number: will be used as Originator ASDU address (1 byte, 0-255).
Note: Starting from D2000 version 7.02.004 the flags FLA to FLP are used during setting of the value of communication line to inform about connected active clients. Active client is a client who after establishing the connection sent U-frame StartDT Act, i.e. asked for sending the data. The first connected active client will cause change of flag FLA to TRUE, the second flag FLB etc upto flag FLP and continuing with the flag FLA. If the client sends U-frame StopDT Act (requesting the server to stop sending data) or disconnects, the value of its flag will be changed to FALSE.
Communication station configuration
- Communication protocol: IEC870-TCP Server.
- Station address is a decimal number within the range 0...65535, defines the ASDU address.
Note 2: The protocol supports sending long time stamps (CP56Time2a tag) in local time or UTC time with defined offset (see the parameter Use monotonic UTC time +).
The Browse button opens a browsing dialog for the station address. If the communication is functional, a dialog with the ASDU addresses received so far is displayed. The Refresh button can be used to clear the list of received ASDU addresses.
Station protocol parameters
The following parameters can be defined as station protocol parameters:
Table nr. 3
|Keyword||Full name||Meaning||Unit||Default value|
|Command Confirm||Confirmation of control ASDU.|
If CMDC=0, the process D2000 KOM does not confirm any control ASDU from the partner station using backward sending ASDU with other CauseOfTransmission.
If CMDC=1, the process D2000 KOM confirms control ASDU with CauseOfTransmission=7 (Activation Confirmation).
If CMDC=2, the process D2000 KOM confirms control ASDU with CauseOfTransmission=10 (Activation Termination).
If CMDC=3, the process D2000 KOM confirms control ASDU with CauseOfTransmission=7 and CauseOfTransmission=10.
|The parameters are intended for configuration of communication station for communication between two D2000 systems with using ASDU 252 - D2000 Unival (Ipesoft's implementation). more ...|
|D2000 64-bit Historical Values||When sending the historical values (as an answer to request for historical data), it uses ASDU 249, which uses 64-bit representation of floating points (the same as D2000 internally), instead of ASDU 251 (which encodes the values as 32-bit floating points) to improve precision.|
Note: Before enabling this parameter, you should verify that also the client supports ASDU 249. This support was implemented in November, 2011 for D2000 v8.00.011.
|Debug Input||A mask for debug levels of input data. The meaning of bits is as follows:||-||0|
|Debug Output||A mask for debug levels of output data. The meaning of bits is as follows:||-||0|
|End of initialization||If EOI=0, the process D2000 KOM doesn't send ASDU 70 (End of initialisation). If EOI=1 and a client sends U-frame StartDT Act, the process D2000 KOM responses StartDT Con and sends ASDU.||-||0|
|GI Send New||If GISN=True, then the process D2000 KOM after receiving the command General Interrogation sends also values with more recent times than is the time when the command is received. The value of the parameter GISN must be True to send values with more recent times using the command General Interrogation.||-||False|
|Ignore Control Field 3bit 0||Determines behaviour, if ASDU contains Control Field (Receive set bit 1 (test))in 3. byte.||-||False|
|Ignore Invalids on Interrogation||if this parameter is set on a station, the process D2000 KOM will not send as a reply for ASDU 100 and 101 (Interrogation / Counter interrogation command) values of I/O tags which are Invalid or Unknown. Parameter can be used e.g. when controlling, if sending Invalid values causes breakdown of control.||-||False|
|Ignore Tests||Determines behaviour, if ASDU contains 1 bite (test) set in CauseOfTransmission.||-||0|
|Ignore Unknown Addresses||If IUA=TRUE, the process D2000 KOM will not show an error on its console or write it into log files in case that incoming value has the address not matching any of the addresses of I/O tags defined in the D2000 system.||-||False|
|Implicit Interrogation||Balanced mode: After connecting the client, there are automatically sent the values of all variables without ASDU 100 and 101 [Interrogation/Counter Interrogation Command] requests.||-||False|
|Interrogation Covers Counter Interrogation||As a reply to Interrogation, there are also sending ASDU 15,16,37 (Integrated Totals), which are by default requested by ASDU 101 [Counter Interrogation].||-||False|
|Interrogation Groups Objects||Optimisation of sending values during General Interrogation (answer to Interrogation Command / Counter Interrogation Command). If IGO=True, multiple values will be sent inside a single ASDU (so that the length of ASDU is within maximum defined by standard - 253 Bytes). This parameter does not influence change-based sending of values during normal communication.||-||False|
|Interrogation WithOut Timestamps||If IWOT=True then values sent as a response to ASDU 100 [Interrogation Command] will be sent as ASDUs without timestamps.|
For example instead of ASDU 2 (Single-point information with time tag) or ASDU 30 (Single-point information with time tag CP56Time2a) ASDU 1 (Single-point information) will be sent.
This behaviour is suitable in situation when the values have been invalidated as a result of communication error and after the communication is re-established the values come with old timestamps which causes problems in archive (if the values change only rarely, calculated archives depending on them will be also invalid till a new value arrives). At the same time, this behavior is strictly according to the IEC standard, which says that the response to Interrogation should not use ASDUs with time stamps.
|K||Sending window size i.e. packet quantity, which is sent by the process D2000 KOM without receiving a confirmation (S-frame or I-frame). According to the standard, the default value is 12.||-||12|
|Maximum Clients||Maximum number of connected clients. Parameter is needed for D2000 OpenVMS, where a task pool containing 2 * MC tasks for client handling (one task for receiving data, one task for sending data) is created during KOM startup. If a value of parameter Maximum Clients is equal to 0, number of clients is not limited and threads are created dynamically as needed.||-||0|
|No Flags||If the value of the parameter is True, then the status bit of incoming ASDUs is ignored and not saved into the flags FA...FH. Flags of output I/O tags are also ignored and they not set the status bit.||-||False|
|Order of IC||Balanced mode: Sending sequence of ASDU 100 [Interrogation Command] when initializing the connection. If OIC<OCIC, then ASDU 100 is sending before ASDU 101. If OIC= 0, ASDU 100 is not sending. The parameter can be defined and valid specially for each of the stations.||-||0|
|Order of Counter IC||Balanced mode: Sending sequence of ASDU 101 [Counter Interrogation Command] when initializing the connection. If OIC<OCIC, then ASDU 101 is sending before ASDU 100. If OIC= 0, ASDU 101 is not sending. The parameter can be defined and valid specially for each of the stations.||-||0|
|Pessimistic Write||Defines the evaluation of writing success in case of connection of more than one client. If PW=0, writing a value is consider to be successful, if at least one client confirms it (confirmation method is defined by the parameter CMDC). If PW= 1, writing must be confirmed by all connected clients. If at least one client doesn't confirm it (e.g. connection failure occurs or the confirmation is negative), writing is consider to be unsuccessful.||-||0|
|Send sequence number||Initial SSN. According to the standard, having established the connection the SSN is set to 0, other than zero could be appropriate e.g. for testing.||-||0|
|Standby Keep Open||If True - after transition of the process D2000 Server, the process D2000 KOM is connected to, from the HOT status to the STANDBY status (redundant system), connections with clients will not be closed and receiving the clients will not be terminated.||-||False|
|Standby Set Control Field||If True, - after transition of the process D2000 Server, the process D2000 KOM is connected to, from the HOT status to the STANDBY status (redundant system), there will be sent the value of 1 in the lowest bite of 3.byte of Control Field of Information APDU (APDU containing data) instead the standard value of 0 (according to the standard). The behaviour doesn't strictly follow the standard and if possible, use the parameter SST instead of this.||-||False|
|Standby Set Test Bit||If True - after transition of the process D2000 Server, the process D2000 KOM is connected to, from the HOT status to the STANDBY status (redundant system), there will be sent Test bit set in Cause Of Transmission.||-||False|
|Standby Write Values||If True - after transition of the process D2000 Server, the process D2000 KOM is connected to, from the HOT status to the STANDBY status (redundant system), the server will send new values to clients.||-||False|
|W||Quantity of received packets, after which the process D2000 KOM sends a S-frame confirmation. According to the standard, the default value is 8. There must be true w < k, the standard recommends w = 2/3 * k.||-||8|
|Wait Timeout T1||Timeout for receiving the confirmation of a I-frame sent (either the confirmation within the I-frame or the S-frame itself) or a U-frame. If the process D2000 KOM doesn't get the confirmation in the time WT1, it closes the TCP connection. According to the standard, the WT1 default value is 15000 ms.||ms||15 000|
|Wait Timeout T2||Timeout for sending the confirmation of a I-frame received. WT2 < WT1. If another I-frame (which confirms the I-frame received) is not sent in the time WT2 since the I-frame was received, so the process D2000 KOM sends a S-frame confirming the received I-frame to the partner. According to the standard, the WT2 default value is 10000 ms.||ms||10 000|
|Wait Timeout T3||Timeout for sending test frames (U-frame TEST ACT). If no data are sent in any direction for a long time, an U-frame TEST ACT will be sent to the process D2000 KOM after expiration of the WT3 time and there is expected (in the WT1 time after sending) receiving a U-frame TEST CON. If the WT3 on the partner side is set to a lower value, it sends the test frames and the process D2000 KOM replies to them. According to the standard, the WT2 default value is 20000 ms. Setting the value to 0 disables sending test frames.||ms||20 000|
|Wait Timeout No answer||Balanced mode: Timeout for receiving the confirmation of a sent value for ASDU in the direction of control (ASDU 45 - 64). Receiving e.g. S-frame with RSN (Receive Sequence Number) confirming, that the other party received previous I-frame doesn't mean, that the I-frame was processed. In the WTn time, the process D2000 KOM waits for receiving the response (e.g. after sending ASDU with TypeIdentificator=45 [Single Command] with CauseOfTransmission=6 [Activation] there is expected receiving Single Command with CauseOfTransmission=7 [Activation Confirmation]. |
After the expiration of the WTn time, the process D2000 KOM closes the TCP connection.
String containing the protocol parameters is being defined as follows:
If there is used a keyword with an invalid value in the initialization string, there will be used corresponding default value according the table. Defined parameters, except for OIC, OCIC and FST are valid for the entire line - i.e. it is enough to define them for one station on the line.
I/O tag configuration
Possible I/O tag types: Ai, Ao, Ci, Co, Di, Dout, Qi
- I/O tag address is mapped on Information object address, i.e. it has 3 bytes and must within the range of 0..16777215.
- Input tags must be particular types (Ai, Ci, Di, Qi) for received ASDU, see the table 1.
- For particular type of output tag (Ao, Dout, Co) it is necessary to set an ASDU type, that has to be used, see the table 2 and also the table 1 in the balanced mode.
- Archive for providing old values: if client requires archive values using ASDU 250, the server sends:
- values of archived I/O tag, which are defined in this entry field
- if the entry field is not defined, values of archived I/O tag, that are directly archived by the I/O tag
- if the archived I/O tag does not exist, values of the I/O tag, that is archived by the control object of the I/O tag
- if the object doesn't exist (or the archive is not available), the server returns an error.
For the I/O tags, it is possible to discover the list of objects, as long as the KOM process is running and communication with a station is established.
Clicking the Browse button opens the IEC870-TCPSRV Item Browser window and displays a list of objects that have been read so far. The object list is created dynamically as a result of received messages.
The list of objects is dynamic, i.e. when a new value arrives in the KOM process, it is updated. Filtering in individual columns is also supported, asterisks can be used in the mask (e.g. *Short*).
Double-clicking on a particular line will cause the Address parameter to be inserted into the configuration of I/O tag from which the IEC870-TCPSRV Item Browser window was opened.
The Refresh button clears the list of values in both the CNF and the KOM process.
The Value column contains the received value.
|STWATCH||STWATCH StationName||Tell command sends Interrogation Command and/or Counter Interrogation Command to the station (based on station parameters).|
- Ver. 1.0 – February 5th, 2004
- Ver. 1.1 – December 1st, 2004: extension - support of balanced mode
- Ver. 1.2 – June 15th, 2020: browsing support