# 14.6 IEC 60870-5-104 Slave IEC 60870-5-104 Slave is designed not to lose data acquired from Master protocols. The data that arrives from Master protocols is stored in the cache. This data is checked every second to manage further data sending. The data that leaves IEC 60870-5-104 Slave has output caches. They’re built to provide switching between multiple sessions (redundant SCADA). If a new connection arrives, the old one is dropped, but data, that is stored in a cache, not sent and not confirmed by SCADA is transferred to the new connection. #### Configuring IEC 104 Slave datapoints To use IEC 60870-­5­-104 Slave in WCC Lite, it has to be configured via an Excel configuration. This configuration contains two Excel sheets where parameters have to be filled in ­Devices and Signals. ##### IEC 60870-­5-­104 Slave parameters for *Devices* tab
**Parameter** **Type** **Description** **Required **Default value** (when not specified) **Range**
Min Max
name stringUser-friendly name for a device Yes
description stringDescription of a device No
device\_alias stringAlphanumeric string to identify a device Yes
enablebooleanEnabling/disabling of a device No101
protocolstringProtocol to be used Yes IEC 60870­-5-104 slave
asdu\_sizeintegerCommon address size in bytesNo212
time\_syncbooleanEnable/disable (1 or 0) time synchronizationYes
portintegerTCP portNo2404065535
ioa\_sizeintegerInformation object address (IOA) size in bytesNo313
swtintegerSend window (SWT)No12
rwtintegerReceive window (RWT)No8
cot\_sizeintegerCause of transmission (COT) size in bytesNo213
hoststringSpace-separated remote host IP addresses (ipv4)Yes
bind\_addressstringBind to local IP address (ipv4)No0.0.0.0
t1 integerAcknowledge timeout t1 (sec)Yes151255
t2integerConnection ACKRSN clock t2 (sec), t2 should be less than t1 Yes101254
t3integerConnection TESTFR clock t3 (sec)Yes201172800
message\_sizebooleanThe maximum length of a messageYes2530255
cache\_sizeintegerAmount of data to be cachedYes10001000
tlsbooleanEnable/disable the use of TLSNo001
tls\_local\_certificatestringLocal certificate for TLS connectionYes (for TLS)
tls\_peer\_certificatestringCertificate authority file for TLS connectionNo
tls\_private\_keystringA file consisting of the private key for TLS connectionNo
command\_timeout\_msintegerTime to execute a command before responding negatively.No300000
command\_age\_msintegerThe amount of time shift allowed for the command to still be executed.No00
##### IEC 60870­-5­-104 Slave parameters for *Signals* tab
**Parameter** **Type** **Description** **Required **Default value** (when not specified) **Range**
Min Max
signal\_name stringUser-friendly signal name Yes
device\_alias stringAlphanumeric string to identify a device Yes
signal\_alias stringUnique alphanumeric name of the signal to be Yes used Yes
source\_device\_alias stringdevice\_alias of a source device For commands
source\_signal\_alias stringsignal\_alias of a source signal For commands
enablebooleanEnabling/disabling of an individual signal No101
log integerAllow signal to be logged. If **log is 0 signal** will not be logged. If **log is more than 0** signal will be logged No001
gibooleanIncluding/excluding (1 or 0) signal from General InterrogationNo001
common\_addressintegerAddress of a destination deviceYes
info\_addressintegerInformation object addressYes
data\_typeintegerASDU type id.Yes
1, 3, 5, 9, 11, 13, 21, 30, 31, 32, 34, 35, 36, 45, 46, 47, 48, 49, 50, 58, 59, 60, 61, 62, 63
select\_msintegerTime limit in milliseconds for command execution. Command select has to be performed before execution if this parameter is specified. Direct command execution can be performed only if this field is left empty or set to zero.No0
##### Device status signals
IEC 60870-­5-­104 has an additional signal which can be configured to show communication status. It is used to indicate if the master device has disconnected from slave (WCC Lite). To configure such signal for IEC 60870-­5-­104 protocol, job\_todo and tag\_job\_todo fields with string values are required. For IEC 60870-­5-­104 slave required parameters for status signal will be: **signal\_name** **device\_alias, signal\_alias, common\_address, info\_address, data\_type, job\_todo** and **tag\_job\_todo**. Job\_todo value must be *device\_status* and for tag\_job\_todo there are 4 variations: communication\_status, device\_running, device\_error, uknown\_error. Each signal has 4 possible values and are based on the same logic. If signal returns value of 0, it means unknown error has appeared, 1 – device or protocol connection is on and working properly, 2 – device is off or protocol is disconnected, 3 – error or service is down. ### Debugging an IEC 60870-5-104 Slave application If the configuration for IEC 60870-5-104 devices is set up, the handler for the protocol will start automatically. If a configuration is missing parameters or contains errors, the protocol will not start. It is done intentionally to decrease unnecessary memory usage. If IEC 60870-5-104 does not work properly (e.g. no communication between devices, data is corrupted, etc.), a user can launch a debug session from the command-line interface and find out why the link is not functioning properly or use WCC Utility to do that. To launch a debugging session, a user should stop the *iec104-slave* process and run the *iec104-slave* command with respective flags. - Step 1: Service must be stopped by entering the following command into the WCC Lite: **/etc/init.d/iec104-­slave stop** - Step 2: After service is stopped it must be started with the preferred configuration file (JSON files found in /etc/ folder) and a debug level 7: **iec104-­slave­-c /etc/iec104-slave/0\_0\_0\_0\_502.json -­d7;** (0\_0\_0\_0 - bind\_address, 502 - port) - Step 3: Once the problem is diagnosed normal operations can be resumed with the following command: **/etc/init.d/iec107-­slave start** ##### IEC 60870-­5­-104 command-line debugging options ``` -h [ –help ] Display help information -V [ –version ] Show version -d Set debugging level -c [ –config ] Config path -r [ –raw ] Show raw telegram data -f [ –frame ] Show frame data

­-e [ –redis ] Show redis message -R [ –readyfile ] Ready notification file ```