30 IEC 62056-21
Introduction
IEC 61107 or currently IEC 62056-21, was an international standard for a computer protocol to read utility meters. It is designed to operate over any media, including the Internet. A meter sends ASCII (in modes A..D) or HDLC (mode E) data to a nearby hand-held unit (HHU) using a serial port. The physical media are usually either modulated light, sent with an LED and received with a photodiode, or a pair of wires, usually modulated by a 20mA current loop. The protocol is usually half-duplex.
The following exchange usually takes a second or two, and occurs when a person from the utility company presses a meter-reading gun against a transparent faceplate on the meter, or plugs into the metering bus at the mailbox of an apartment building.
The general protocol consists of a "sign on" sequence, in which a handheld unit identifies itself to the metering unit. During sign-on, the handheld unit addresses a particular meter by number. The meter and hand-held unit negotiate various parameters such as the maximum frame length during transmission and reception, whether multiple frames can be sent without acknowledging individual frames (windowing), the fastest communication rate that they can both manage (only in case of mode E switching to HDLC) etc.
Next, the meter informs the handheld unit about the various parameters that are available with it in various security settings viz. the 'no-security logical group', ' the low-security logical groups' and ' the high-security logical groups'.
If the parameter required is in the no-security group, just a get.request will provide the HHU with the desired response. If the parameter required is in the low-security group, a password authentication of the HHU is required before information can be read.
In case of high-security parameters, the meter challenges the handheld unit with a cryptographic password. The handheld unit must return an encrypted password. If the password exchange is correct, the meter accepts the handheld unit: it is "signed on."
After signing on, the handheld unit generally reads a meter description. This describes some registers that describe the current count of metered units (i.e. kilowatt hours, megajoules, litres of gas or water) and the metering unit's reliability (is it still operating correctly?). Occasionally a manufacturer will define a new quantity to measure, and in this case, a new or different data type will appear in the meter definition. Most metering units have special modes for calibration and resetting meter registers. These modes are usually protected by anti-tampering features such as switches that sense if the meter enclosure has been opened.
The HHU may also be given limited rights to set or reset certain parameters in the meter.
The handheld unit then sends a sign-off message. If no sign-off message is sent, the meter automatically signs off after a previously negotiated time interval after the last message.
Source: https://en.wikipedia.org/wiki/IEC_62056#IEC_62056-21
Overview
The IEC 62056-21 standard defines protocol specifications for local meter data exchange.
Data is read out via serial port in modes A, B or C. The default initial serial port settings are 300 bps 7E1, as per standard, but can be user configured.
The driver implementation additionally allows for communication via TCP/IP, which is not described in the standard. In this case, baud rate acknowledgement is allowed however actual switchover between baud rates is not possible.
Mode A: data is requested and read out at the configured baud rate.
Mode B: data is requested at the configured baud rate and mutually switched to the baud rate proposed by the meter. Baud rate confirmation is absent.
Mode C: data is requested at the configured baud rate, new baud rate is proposed by the meter and, if acknowledged, data is read out at the proposed baud rate.
Currently data readout is supported in modes A, B and C.
For data readout it is necessary to know the port settings and the format of OBIS code representation as they can slightly differ (see table) depending on the configuration of the meter.
Configuration
Device section
The serialnumber defines the serial number of the meter. 0 (zero) will result in a ’/?!’ handshake string and may cause issues if more than one meter is wired to the serial port.
The baudrate defines the initial connection baud rate. In modes B and C this will be switched to what ever baud rate is proposed by the meter.
The meter_model defines the meter profile. This is reserved for future use and should be set to 1. type defines the connection mode. Modes A, B and C are supported.
If ip or port parameters are configured, any serial port settings are ignored and connections are initiated via TCP.
IEC 62056-21 device configuration parameters:
Parameter |
Type |
Description |
Required |
Default Value (when not specified) |
Range |
|
Min | Max | |||||
name |
string |
User-friendly name for a device |
Yes | |||
description |
string |
Description of a device |
No | |||
device_alias |
string |
Alphanumeric string to identify a device |
Yes | |||
enable | boolean |
Enabling/disabling of a device |
No | 1 | 0 | 1 |
protocol | string |
Protocol to be used |
Yes |
IEC 62056-21 |
||
poll_delay_ms | integer | Minimum time delay in miliseconds to wait before sending any data on port. | No | 200 | ||
scan_rate_ms | integer | 10000 | ||||
device | string | Communication port | No (for serial) | PORT1 | PORT2 | |
baudrate |
integer |
Communication speed, bauds/s | No (for serial) | 6900 | 300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200 | |
databits | integer | Data bit count for communication | No (for serial) | 8 | 6 | 9 |
stopbits | integer | Stop bit count for communication | No (for serial) | 1 | 1 | 2 |
parity | string | Communication parity option | No (for serial) | NONE | NONE, EVEN, ODD | |
flowcontrol | string | Communication device flow control option | No | NONE | ||
serialnumber | unsigned long | Meter serial number | Yes | 1 | ||
serial_close_delay | integer | Delay before closing serial port | No | 400 | ||
timeout_ms | integer | Timeout of waiting for incoming request | No | 2500 | ||
type | string | Defines a connection mode | No | C | A,B,C | |
t2 | integer | Time to wait before acknowledging the suggested baudrate in mode C | No | 300 | 200 | 1500 |
ip | string | IP address for TCP connection | Yes (for TCP) | |||
port | integer | TCP port | Yes (for TCP) | 0 | 65535 |
Signals section
tag_job_todo defines the job sub-job. This field should contain the exact representation of the OBIS code as it is configured in the meter. E.g. if the parameter of interest is represented as
”1.8.0*24(0147238.4*kWh)”, the value of the configuration field should be ”1.8.0*24” (excluding quotation marks).
Parameter |
Type |
Description |
Required |
Default Value (when not specified) |
Range |
|
Min | Max | |||||
signal_name | string | User-friendly signal name | Yes |
|
||
device_alias | string | Device alias from a Devices tab | Yes | |||
signal_alias |
string |
Unique alphanumeric name of the signal to be use | Yes | |||
enable | boolean | No | 1 | 0 | 1 | |
log | integer | Allow signal to be logged. If log is 0 signal will not be logged. If log is more than 0 signal will be logged | No | 0 | 0 | |
number_type | string | Number format type | Yes | |||
tag_job_todo |
string |
Tag job in OBIS format |
Yes |
For tag_job_todo configuration it is best to first manually read the meter via PC or HHU (hand-held unit) to determine the exact OBIS representation format of the parameter as they can differ between meter manufacturers and utility companies.