====== Using the IEC 60870-5-104 Protocol ======
#;;
Patron
Gate
#;;
Mervis RT includes the functionality of an IEC 60870-5-104 server to provide data access to third parties. For example, it is used to regulate output power of power stations connected to the ČEZ distribuce network.
===== Limitations and Notes =====
For the IEC 60870-5-104 protocol to function, Mervis RT must be activated with an extended license that includes this protocol. To get it, contact the [[https://www.unipi.technology/contacts|sales department of Unipi]].
Running IEC 60870-5-104 server is certified only on Patron and Gate units, it can not be used on other Unipi controllers.
===== Configuration in Mervis IDE =====
As with other protocols, using the IEC 60870-5-104 protocol requires defining a server channel of the appropriate type at the PLC level.
Let's add a Server Channel:
{{:en:sw:01-mervis:iec-60870-5-104-server:add-server.png?direct|Adding a server channel}}
We set its protocol to //IEC 60870-5-104// and set desired [[#server_communication_channel|protocol parameters]].
{{:en:sw:01-mervis:iec-60870-5-104-server:set-protocol.png?direct|Setting protocol and IEC parameters}}
Now, we add a server device, select it by clicking on it and we can set [[http://example.com|server parameters]] and add a [[#data_point|datapoint]].
{{:en:sw:01-mervis:iec-60870-5-104-server:add-device.png?direct|Adding a server device and datapoints}}
One or more devices can be defined on the channel, differing in the set Common Address (ASDU) and TCP port.
===== Server Communication Channel =====
* **Enable** - True/False
* **Link Protocol** - TCP only
**IEC 60870-5-104 Protocol Parameters**
* **Maximum Number of Unacknowledged APDU (K-value)**
* **Maximum Number of Unacknowledged APDU (W-value)**
* **Timeout of Acknowledgement (t1)** - time interval
* **Timeout of Acknowledgement via S-frame (t2)** - time interval
* **Timeout of Test Frame (t3)** - time interval
* **Check Maximum Delay of Control Commands** - True/False
* **Maximum Delay of Control Commands** - time interval
* **Remap Types for Interrogation** - True/False
* During initial interrogation, data types with time stamps will be replaced with data types without time stamps.
===== Device =====
Device properties include parameters for connecting clients to the server:
* **Enable** - True/False
**TCP Parameters**
* **IP Address**
* The address of the network interface on which the server should listen. Currently, only the value 0.0.0.0 for all interfaces is supported.
* **Port** - The TCP port on which the server listens. Default value **2404**
**IEC 60870-5-104 Protocol Parameters**
* **Common Address (ASDU)**
===== Data Point =====
**IEC 60870-5-104 Data Point Parameters**
* **Identification Object Address**
* **Identification Object Type**
* **Mapped Variable**
===== Supported Data Types =====
^ M_SP_NA_1 [1] | Single point information |
^ M_SP_TA_1 [2] | Single point information with time tag |
^ M_DP_NA_1 [3] | Double point information |
^ M_DP_TA_1 [4] | Double point information with time tag |
^ M_ST_NA_1 [5] | Step position information |
^ M_ST_TA_1 [6] | Step position information with time tag |
^ M_BO_NA_1 [7] | Bitstring of 32 bits |
^ M_BO_TA_1 [8] | Bitstring of 32 bits with time tag |
^ M_ME_NA_1 [9] | Measured normalized value |
^ M_ME_TA_1 [10] | Measured normalized value with time tag |
^ M_ME_NB_1 [11] | Measured scaled value |
^ M_ME_TB_1 [12] | Measured scaled value with time tag |
^ M_ME_NC_1 [13] | Measured short floating point value |
^ M_ME_TC_1 [14] | Measured short floating point value with time tag |
^ M_ME_ND_1 [21] | Measured normalized value without quality descriptor |
^ M_SP_TB_1 [30] | Single point information with CP56Time2a time tag |
^ M_DP_TB_1 [31] | Double point information with CP56Time2a time tag |
^ M_ST_TB_1 [32] | Step position information with CP56Time2a time tag |
^ M_BO_TB_1 [33] | Bitstring of 32 bits with CP56Time2a time tag |
^ M_ME_TD_1 [34] | Measured normalized value with CP56Time2a time tag |
^ M_ME_TE_1 [35] | Measured scaled value with CP56Time2a time tag |
^ M_ME_TF_1 [36] | Measured short floating point value with CP56Time2a time tag |
^ C_SC_NA_1 [45] | Single command |
^ C_DC_NA_1 [46] | Double command |
^ C_RC_NA_1 [47] | Regulating step command |
^ C_SE_NA_1 [48] | Set-point command, normalised value |
^ C_SE_NB_1 [49] | Set-point command, scaled value |
^ C_SE_NC_1 [50] | Set-point command, short floating point value |
^ C_BO_NA_1 [51] | Bitstring command, 32 bits |
^ C_SC_TA_1 [58] | Single command with CP56Time2a time tag |
^ C_DC_TA_1 [59] | Double command with CP56Time2a time tag |
^ C_RC_TA_1 [60] | Regulating step command with CP56Time2a time tag |
^ C_SE_TA_1 [61] | Set-point command, normalised value with CP56Time2a time tag |
^ C_SE_TB_1 [62] | Set-point command, scaled value with CP56Time2a time tag |
^ C_SE_TC_1 [63] | Set-point command, short floating point value with CP56Time2a time tag |
^ C_BO_TA_1 [64] | Bitstring command, 32 bits with CP56Time2a time tag |