Promotic

PmIEC62056 - Driver for communication by the IEC 62056 protocol

The PmIEC62056 driver serves for communication with devices that measure the consumption of electricity. The communication is based on the IEC62056-21:2002 standard or IEC1107:1996 standard. See Communication by the IEC 62056 protocol.

Before using this driver in the PROMOTIC application it is highly recommended to watch "PROMOTIC video tutorial 4 - Communication drivers".

Basic properties of the driver:
- The driver supports modes A, B, C. The driver does not support the modes D and E, however the devices suggesting the usage of E mode (IEC 62056-46: data link layer using the HDLC protocol) can usually be "forced" to use the C mode.
Following types of communication transfers are supported:
- Readout: Reading all values at once. It is functional for modes A, B, C.
Caution: This type of the communication is too slow for data acquisition (all configured items in the device are received in text form). Sometimes the ammount of data is very large and the transmission may therefore last for several minutes! This is the main reason why this is not suitable regular, fast (e.g. every second) reading of requested data.
- Programming mode: Reading selected values. It is functional only for C mode. Also note that this may not be supported by all devices.
Programming mode allows both data reading and writing. Although it is necessary to enter password for data writing. The password is not needed for reading the data.
- Usage of this driver requires purchase of the PmIEC62056 licence. When developing the application in the freeware mode PmFree, or with development environment and while testing it in runtime, this component is always functional.
- The communication is done for Ethernet (PROMOTIC application is client) or for serial link (COM1, COM2 ...).
The serial link is commonly used in these meters as standard interface.
Communication via Ethernet can be implemented in two ways:
- By Ethernet-serial link converter. This option can be selected, for example, if the device is equipped with the serial link and it is connected to the Ethernet through the RS232/Ethernet converter. If the converter does no modifications to the transmitted data, then it is a very easy way how to communicate via Ethernet with the device not equipped with Ethernet interface.
Caution: The usage of this communication via Ethernet is technicaly limited. It is not possible to dynamically modify the transfer rate, which is required by the standard (see below)! And therefore such solution is suitable only for configurations not using dynamic communication speed modifications.
- Some meters support the Ethernet communication directly.
For example the CU-E22 module for Landis-Gyr meters (E650 or E850) supports the Ethernet IEC62056 protocol on port 12212 (maybe also on port 4059 ?).
- The driver is incorporated into the PROMOTIC system by means of the PmaComm object.
The driver supports the usage of the PmaCommMsg object. The PmaCommGroup object cannot be used.
For easy integration of this driver into the application it is handy to use: Preconfigurations in group "IEC62056"


Types of communication physical interfaces:
For communication with energy meters mased on the IEC62056-21 standard, the following physical interfaces can be used:
- RS232
- RS485
- 20mA data current loop
- Optical head:
There are two types of optical heads: for connection to the PC serial port (RS232), or for USB.
In order to let the PROMOTIC system communicate with head connected to USB, the host computer must be equiped with a driver that emulates a virtual COM port on the USB bus. Majority of the optical heads use circuits manufactured by the FTDI (Future Technology Devices International) company. The Windows OS since version 7 (if connected to the Internet) is able to install the corresponding driver without user interaction. If the older Windows OS version is used, it is necessary to download the driver manually from http://www.ftdichip.com/Drivers/VCP.htm.
Sometimes problems may occure while using the optical heads. Some heads return the sent data as received data - in such case it is necessary to set the "Filter ECHO chars" configurator. Before the specific head is used the device-head compatibility must be tested. The declaration od standard comliance is insufficient. Also carefully observe the head orientation (rotation angle). Some heads are functional only in specific angle.


Recommended values of the PmaComm object parameters:

Recommended values for the Serial link parameters:
Baud rate300 Bd (based on standard).
During the communication with the device via the computer's serial port 2 different communication speeds may be used. The first transfer rate (usually 300Bd) is used for estabilishing the connection with the device and for basic information exchange between the device and the driver. Then the devicec "proposes" a new transfer rate and the driver conforms to the new speed.
Despite the fact that the standard defines the first speed as 300 Bd, some devices may be configured in order to use another basic speed. For example some Landis+Gyr electricity meters equipped with the Dialog CU-Bx communication unit can be configured in order to use the same speed for the whole communication - this way it is possible to communicate for example via modems and the Internet tunnels.
Number data bits7 (based on standard).
ParityEVEN (based on standard).
Number of stop bits1 (based on standard).
Timeout between receiving 2 characters100 ms (or more).
However this number must not be too high. For example for meters by the LandisGir company it must not be higher than 1200 ms.
Filter ECHO charsNo.
If the device returns the sent data (e.g. some optical heads), then set Yes.
Description and recommended values for the Protocol parameters:
Response receipt timeout20000 ms. Only for serial link.
The time (in milliseconds) the driver is waiting for the response on sending the message.
If no response comes during this time, then the transmission of the message is terminated (the onEndOfTransfer event is triggered with error 24 or 66).
The data exchange by the IEC62056-21 protocol can be quite time-consuming (up to tens seconds)! Therefore when using the higest communication speed of 9600Bd we recommend to set this timeout to 20000ms. When using the 1200Bd speed, we recommend to set 40000ms.
Number of Packet Leading Wake-up Zeroes10.
It may be necessary to wake up some devices before the communication is estabilished. For this purpose, here you can set how many zero characters are to be sent by the driver before the main communication starts.
BaudRate Limit19200. Only for serial link.
If the connection with the device is done via a physical data interface with limited bandwidth (e.g. Optical head), then this limitation can be defined in this setting. In such case the driver does not comply with the proposed communication speed, but lowers it to the value defined here.

The communication description by means of the PmaCommMsg object

List and description of the communication messages:

1) Readout - Values readout:
This message type asks the device for data and the device sends a single (often very long) data package in text form. This data ure unprocessed and saved into the ResultString variable. The application designer then has to disassemble the text in order to extract the desired values.
In order to create this message type it is recommended to use the "Preconfiguration "PmIEC62056 - Communication set with data and panel"". This preconfiguration also creates the script for disassembling the received text.
Caution: The received text can be very long (even several hundred rows) and if the device supports only slow transmission speeds (300Bd, 600Bd, 1200Bd), then the transmission of a single message may take several minutes! It is sometimes possible to configure the device in order to communicate only the necessary data and optimize the communication.

There are following variables on the "Data-sent" tab:
Addr: (String) The device address. If left empty, then the device always answers regardless on the set address.
There are following variables on the "Data-received" tab:
ResultList: (String) Received text string. See Description of received ResultList text string.


2) Programming mode - Block oriented data transfer:
This communication type is functional only with devices supporting the C mode (but it may not be supported by all such devices).
In theory it is also possibe to write data in this programming mode, but it is mostly used by the PROMOTIC system for reading individual values. The password is not required for data reading, eventually the password is published (e.g. password is 0000).
The exact syntax of commands (i.e. values to be used in variables Param and Data) may differ for each device type and must be consulted with the documentation (manual) of such device.

There are following variables on the "Data-sent" tab:
Param: (String) Programming command parameters. Entries are in the KeyVal format, for example "seq:3;psw:P2.0000;".
- seq: Sequence of communication transfers of this message.
0 = (default) only corresponding command is executed
1 = connection with the device is established and switching to programming mode is done before the command is executed
2 = the programming mode is terminated after the command
3 = first 1 is executed, then the corresponding command is executed, then 2 is executed
- psw: Command type and value for entering password. The entries are separated by full stop. It can be e.g. "P1.()", "P2.(0000)", etc.
This parameter must be entered only if the message is supposed to switch the device into programming mode (i.e. if seq:1; or seq:3;) and if the device requires password (even if the password is e.g. () or (0000)).


Examples for Landis+Gyr MAP120:
seq:3; = If reading only, then the password is not entered (the psw parameter is not used).
Examples for POZYTON EQM:
seq:3;psw:P1.() = If reading only, then an empty password () is entered.
seq:3;psw:P2.(0000) = If reading only, then the (0000) password is entered (for older versions of POZYTON 02.13-02.15).
Data: (String) Command type and data (entries are separated by full stop). The exact syntax of the command depends on on device type. Command type consists of 2 characters. Based on the standard it can be e.g.:
- R1 - read ASCII-coded data
- R2 - formatted communication coding method read
- R3 - read ASCII-coded with partial block
- R4 - formatted communication coding method read with partial block
- W1 - ASCII-coded data writing
- etc. according to the IEC62056-21/6.3.14 standard.


Examples for Landis+Gyr MAP120:
R2.C001() = Read time and date (in the form YYMMDDhhmmsswwn)
R2.C100() = Read cumulation counter
Examples for POZYTON EQM:
R1.VI() = Read meter type
R3.MOM(aaaa) = Read current values
There are following variables on the "Data-received" tab:
Data: (String) Received data as response to command. See Description of received ResultList text string.

Description of received ResultList text string

The text string usually consists of multiple rows. Each row contains the information regarding one (or more) values. An example of some rows:

F.F(01000000)
0.1.0*03(23-03-07 06:54)
2.6.0*03(000.00*kW)
1.8.1*03(283570.39*MWh)
0.9.7(23-03-07)


Description:
- 1st row: F.F is the record of error registry
- 2nd row: 0.1.0 is MD reset counter, last reset (3rd in the order) was 7.3.2023
- 3rd row: 2.6.0 is Negative active maximum demand (A-) total - 0 kW.
- 4th row: 1.8.1 is Positive active energy (A+) in tariff T1 - 283570 MWh.
- 5th row: 0.9.7 is current date (7.3.2023)


Each row syntax is in general:
OBIScode(Value*Unit)(Value*Unit)...
- All items are optional, the brackets with values may repeat multiple times.
- OBIScode is the device value identifier. For the code description see Description of OBIS code for IEC 62056 standard protocol.

History:
Pm8.03.18: Generalization for new message type "Programming mode - Block oriented data transfer".
Pm8.02.07: Created
PROMOTIC 9.0.27 SCADA system documentation MICROSYS, spol. s r.o.

Send page remarkContact responsible person
© MICROSYS, spol. s r.o.