# DTSU666 emulation

### Defaults

* Modbus device id: `2`
* RS485: `9600 8N1`
* Function codes: `FC03`
* Data types: mixed `int16` control registers and `float32` measurement registers

### Low register block

These are implemented as signed 16-bit style values:

| Register | Description       | Value               |
| -------- | ----------------- | ------------------- |
| `0x0000` | software version  | `204`               |
| `0x0001` | programming code  | `701`               |
| `0x0002` | power reset       | `0`                 |
| `0x0003` | network selection | `0`                 |
| `0x0005` | reserved / fixed  | `0`                 |
| `0x0006` | fixed config      | `1`                 |
| `0x0007` | fixed config      | `10`                |
| `0x000A` | fixed config      | `0`                 |
| `0x000C` | fixed config      | `0`                 |
| `0x002C` | phase mode        | `3`                 |
| `0x002D` | baud selector     | depends on baudrate |
| `0x002E` | device id         | current `DevID`     |

### Measurement registers

| Register | Description            | Unit / encoding                 |
| -------- | ---------------------- | ------------------------------- |
| `0x101E` | import energy active   | kWh                             |
| `0x1028` | export energy active   | kWh                             |
| `0x2000` | line\_voltage\_l1\_l2  | V x10                           |
| `0x2002` | line\_voltage\_l2\_l3  | V x10                           |
| `0x2004` | line\_voltage\_l3\_l1  | V x10                           |
| `0x2006` | voltage\_l1            | V x10                           |
| `0x2008` | voltage\_l2            | V x10                           |
| `0x200A` | voltage\_l3            | V x10                           |
| `0x200C` | current\_l1            | A x1000                         |
| `0x200E` | current\_l2            | A x1000                         |
| `0x2010` | current\_l3            | A x1000                         |
| `0x2012` | active\_power\_total   | W x10                           |
| `0x2014` | active\_power\_l1      | W x10                           |
| `0x2016` | active\_power\_l2      | W x10                           |
| `0x2018` | active\_power\_l3      | W x10                           |
| `0x201A` | reactive\_power\_total | same sign logic as active total |
| `0x201C` | reactive\_power\_l1    | same sign logic as active L1    |
| `0x201E` | reactive\_power\_l2    | same sign logic as active L2    |
| `0x2020` | reactive\_power\_l3    | same sign logic as active L3    |
| `0x202A` | power\_factor\_total   | `1000` or `-1000`               |
| `0x202C` | power\_factor\_l1      | `1000` or `-1000`               |
| `0x202E` | power\_factor\_l2      | `1000` or `-1000`               |
| `0x2030` | power\_factor\_l3      | `1000` or `-1000`               |
| `0x2044` | frequency              | `5000` = 50.00 Hz               |

### Device info

| Register | Description      | Value           |
| -------- | ---------------- | --------------- |
| `0x4006` | pre4 meter flag  | `0` or `1`      |
| `0x4008` | firmware version | packed `MMmmpp` |
| `0x4010` | dongle name      | packed `P1M3`   |

### Notes

* For power registers, export is represented using a negative sign convention.
* This is a targeted subset for inverter compatibility, not a full DTSU666 implementation.
