# DL/T645-2007

DL/T 645-2007 is a multifunctional electric energy meter communication protocol used primarily in power systems for single-phase and three-phase meters. It supports various communication methods, including wired (e.g., RS-485) and wireless (e.g., GSM/GPRS). 

For the generic steps, see [Create a Southbound Driver](../south-devices.md) and [Groups and Tags](../../groups-tags/groups-tags.md).

The EMQX Neuron DLT645-2007 driver provides connectivity with DL/T 645-2007 devices through serial ports and TCP.

## Add Driver

On **Data Collection → South Devices**, click **Add Device**.

- Name: The name of this device node.
- Driver: Select the **DLT645-2007** driver.

## Connection Parameters

Click the driver card to open the **Device Configuration** page and fill in:

| Parameter              | Description                                                  |
| ---------------------- | ------------------------------------------------------------ |
| **Physical Link**      | Choose Serial or Ethernet connection mode.                   |
| **Connection Timeout** | Timeout for sending requests to the device                   |
| **Send Inteval**       | Send read instruction interval(ms)                           |
| **Serial Device**      | Only for **Serial** mode, use a serial device, e.g. /dev/ttyUSB0 |
| **Stop Bits**          | Only for **Serial** mode, stop bits, default 1               |
| **Parity**             | Only for **Serial** mode, parity bit, default 2, which means even parity |
| **Baud Rate**          | Only for **Serial** mode, baud rate, default 9600            |
| **Data Bits**          | Only for **Serial** mode, byte size, default 8               |
| **IP Address**         | Only for **TCP** mode. <br />When EMQX Neuron is used as a client, fill in the IP of the remote device. <br />When EMQX Neuron is used as a server, fill in the IP of EMQX Neuron locally, 0.0.0.0 can be filled in by default. |
| **Port**               | Only for **TCP** mode. <br />When EMQX Neuron is used as a client, fill in the TCP port of the remote device. <br />When EMQX Neuron is used as a server, fill in the TCP port of EMQX Neuron |
| **Connection Mode**    | The way the driver connects to the device, the default is Client, which means that the neuron driver is used as the client. Options: Client, Server. |

## Tag Configuration

The data types and address formats supported by this driver are listed below.

### Data Types

* UIN8
* INT8
* UINT16
* INT16
* UINT32
* INT32
* UIN64
* INT64

:::tip
Selecting the INT type automatically treats the first bit of the collected data as the sign bit.
:::

### Address Format

> mail_address#DI<sub>3</sub>-DI<sub>2</sub>-DI<sub>1</sub>-DI<sub>0</sub> 

* `mail_address` represents the mailing address of the meter.
* DI<sub>3</sub>-DI<sub>2</sub>-DI<sub>1</sub>-DI<sub>0</sub> represents the data identification, and all points only support read attributes, and expressed in hexadecimal.

E.g 123456789012#02-01-01-00, represents the value of the A-phase voltage of the meter device with the mailing address 123456789012.

:::tip
Support a node to configure multiple mailing addresses, that is a single serial port multi-device connection.

Please refer to the DL/T645-2007 industry standard data coding table for the specific data item name corresponding to the data identifier.

* The data length is 1, and the data type is UINT8.
* The data length is 2, and the data type is UINT16.
* The data length is 3 or 4, and the data type is UINT32.
* The data length is 5 or 6 or 7 or 8, and the data type is UINT64.
* Set the value of **Decimal** according to the data format, e.g, if the data format is XXX.X, then **Decimal** is set to 0.1.
:::

| DI<sub>3</sub> | DI<sub>2</sub>    | DI<sub>1</sub>   | DI<sub>0</sub>   | Description                             | Type of data | Decimal value | Example                                                         |
| -------------- | ----------------- | ---------------- | --------------- | -------------------------------- | ------- | --------- | ------------------------------------------------------------ |
| 00    | 00~0A  | 00 ~ 3F | 00 ~ 0C      | DI<sub>3</sub>= 00, representing the electrical energy<br />DI<sub>0</sub>, representing the settlement date              | UINT64  | 0.01 | 00-00-00-00 Representative (current) combined active total energy<br />00-00-00-01 Representative (last settlement date) combined active total energy |
| 00    | 80~86<br />15~1E<br />94~9A<br />29~32<br />A8~AE<br />3D~46<br />BC~C2 | 00      | 00 ~ 0C   | DI<sub>3</sub>= 00, representing the electrical energy<br />DI<sub>0</sub>, representing the settlement date            | UINT64  | 0.01  | 00-80-00-00 Representative (current) total associated power<br />00-80-00-01 Representative (last 1 settlement date) associated total power<br />00-15-00-01 Representative (last 1 settlement date) A-phase positive Active energy<br />00-15-00-01 represents (last 2 settlement days) A-phase forward active energy<br /> 00-29-00-02 represents (last 2 settlement days) B-phase forward active energy |
| 01    | 01 ~ 46   | 00 ~ FF  | 01 ~ 0C              | DI<sub>3</sub>= 01   | UINT64<br />STRING | 0.0001 | For example, 01-01-00-00 represents the current maximum active demand in the forward direction<br />01-01-00-00#T represents the occurrence time of the current maximum active demand in the forward direction |
| 02    | 01~09   | 01 ~ 03  | 00                   | DI<sub>3</sub>= 02, representing the variable                                 | UINT16<br />UINT32 | 0.1<br />0.01<br />0.001<br />0.0001 | 02-01-01-00 Represents A-phase voltage<br />02-02-01-00 Represents A-phase current |
| 02    | 0A~0B   | 01 ~ 03  | 01 ~15               | DI<sub>2</sub>= 0A, representing the voltage harmonic content<br />DI<sub>2</sub> = 0B, representing the current harmonic content<br />DI<sub>1</sub>, representing A, B, C phase<br /> DI~0~, representing the th order of harmonic content | UINT16 |  0.01   | 02-0A-01-01 Represents the 1st harmonic content of A-phase voltage<br />02-0A-02-02 represents the 2nd harmonic content of B-phase voltage<br />02-0B-01-01 represents the 1st harmonic content of A-phase current<br />02-0B-02-02 represents the second harmonic content of phase B current |
| 02    | 80        | 00       | 01 ~ 0A              | DI<sub>3</sub>= 02, representing the variable     | UINT16    | 0.01 | 02-80-00-01 Represents zero line current<br />02-80-00-02 Represents grid frequency    |
| 04    | 00        | 01 ~ 0E  | 01 ~ 0C              | DI<sub>3</sub>= 04, representing the parameter  | UINT8<br />UINT16<br />UINT32<br />UINT64 | 0<br />0.1<br />0.001<br />0.0001 | 04-00-01-01 Represents date and time<br />04-00-01-03 represents maximum demand period<br />04-00-04-01 represents communication address<br />04-00-05-01 represents meter running status word 1 |
| 05    | 00  03    | 00            | 01  03, 0C              | DI<sub>3</sub>= 05, DI<sub>1</sub>= 00  | STRING | 0    | (Last 1) Timed Freeze Time |
| 05    | 00 ~ 03    | 01 ~ 08       | 01 ~ 03, 0C              | DI<sub>3</sub>= 05                      | UINT32 | 0.01    | (Last 1) Timed Freeze Energy Data:<br />For example, 05-00-01-01 represents total active energy in the forward direction<br />05-00-01-01#1 represents active energy for rate 1 in the forward direction |
| 05    | 00 ~ 03    | 09 ~ 0A       | 01 ~ 03, 0C              | DI<sub>3</sub>= 05                      | UINT32<br />STRING | 0.0001    | (Last 1) Timed Freeze Maximum Demand and Occurrence Time:<br />For example, 05-00-09-01 represents the maximum active demand in the forward direction<br />05-00-09-01#T represents the occurrence time of the maximum active demand in the forward direction<br />05-00-09-01#01 represents the maximum demand for rate 1 in the forward direction<br />05-00-09-01#01#T represents the occurrence time of the maximum demand for rate 1 in the forward direction |
| 05    | 00  03    | 10            | 01  03, 0C              | DI<sub>3</sub>= 05, DI<sub>1</sub>= 10  | UINT32 | 0.0001    | (Last 1) Timed Freeze Variables:<br />For example, 05-00-10-01 represents total active power<br />05-00-10-01#1 represents phase A active power<br />05-00-10-01#2 represents phase B active power<br />05-00-10-01#3 represents phase C active power<br />05-00-10-01#4 represents total reactive power<br />05-00-10-01#5 represents phase A reactive power<br />05-00-10-01#6 represents phase B reactive power<br />05-00-10-01#7 represents phase C reactive power |
| 06    | 00~06   | 00       | 00 ~ 02              | DI<sub>3</sub>= 06, representing the load record  | UINT8<br />UINT64 | 0    | 06-00-00-00 Represents the oldest recorded block<br />06-06-00-00 represents the earliest recorded block of class 6 loads |

## Use Case

You can continue to read how to use the EMQX Neuron DLT645-2007 driver to connect [Chint Single-phase Rail Meter](./example/connect.md) for a quick start.
