{
  "$schema": "https://raw.githubusercontent.com/nobrega8/mbmap-library/main/schema/mbmap-2.schema.json",
  "mbmap": 2,
  "vendor": "Carlo Gavazzi",
  "model": "EM21",
  "models": ["EM21"],
  "vendor_website": "gavazziautomation.com",
  "description": "3-phase 4-wire DIN-rail energy meter — per-phase V/I/P/S/Q, PF, Hz, system totals, import energy (INT32 LSW-first, INT16 for PF/Hz, holding registers).",
  "revision": 2,
  "source": "Omni Console device library (OmniCoreST), modbus-library/carlo-gavazzi-em21.toml; Source: carlo-gavazzi-em21-modbus.pdf. Not verified against the manufacturer's documentation",
  "notes": [
    "Carlo Gavazzi EM21.",
    "Converted automatically from the Omni Console device library (OmniCoreST).",
    "Not verified against the manufacturer's documentation.",
    "Corrections are welcome (CONTRIBUTING.md). Change x_status once this table has been checked against the manual.",
    "| Carlo Gavazzi EM21 — Modbus register map for Omni Console",
    "|",
    "| Source: carlo-gavazzi-em21-modbus.pdf",
    "| - 3-phase 4-wire DIN-rail energy meter, RS485.",
    "| - Holding registers (FC03), INT32 little-endian (LSW first), INT16 for PF/Hz.",
    "| - All addresses are 0-based protocol addresses.",
    "| - Scales: V×0.1, A×0.01, W/VA/VAr×0.1, PF×0.001, Hz×0.1, kWh/kVArh×0.1.",
    "| - Factory defaults: slave=1, baud=9600, 8N2."
  ],
  "byte_order": "big",
  "word_order": "big",
  "address_base": 0,
  "x_status": "unofficial",
  "x_origin": "omniconsole",
  "registers": [
    {"name": "Voltage L1-N", "area": "holding", "address": 0, "type": "int32", "scale": 0.1, "unit": "V", "access": "R", "byte_order": "big", "word_order": "little"},
    {"name": "Voltage L2-N", "area": "holding", "address": 2, "type": "int32", "scale": 0.1, "unit": "V", "access": "R", "byte_order": "big", "word_order": "little"},
    {"name": "Voltage L3-N", "area": "holding", "address": 4, "type": "int32", "scale": 0.1, "unit": "V", "access": "R", "byte_order": "big", "word_order": "little"},
    {"name": "Voltage L1-L2", "area": "holding", "address": 6, "type": "int32", "scale": 0.1, "unit": "V", "access": "R", "byte_order": "big", "word_order": "little"},
    {"name": "Voltage L2-L3", "area": "holding", "address": 8, "type": "int32", "scale": 0.1, "unit": "V", "access": "R", "byte_order": "big", "word_order": "little"},
    {"name": "Voltage L3-L1", "area": "holding", "address": 10, "type": "int32", "scale": 0.1, "unit": "V", "access": "R", "byte_order": "big", "word_order": "little"},
    {"name": "Current L1", "area": "holding", "address": 12, "type": "int32", "scale": 0.01, "unit": "A", "access": "R", "byte_order": "big", "word_order": "little"},
    {"name": "Current L2", "area": "holding", "address": 14, "type": "int32", "scale": 0.01, "unit": "A", "access": "R", "byte_order": "big", "word_order": "little"},
    {"name": "Current L3", "area": "holding", "address": 16, "type": "int32", "scale": 0.01, "unit": "A", "access": "R", "byte_order": "big", "word_order": "little"},
    {"name": "Active power L1", "area": "holding", "address": 18, "type": "int32", "scale": 0.1, "unit": "W", "access": "R", "byte_order": "big", "word_order": "little"},
    {"name": "Active power L2", "area": "holding", "address": 20, "type": "int32", "scale": 0.1, "unit": "W", "access": "R", "byte_order": "big", "word_order": "little"},
    {"name": "Active power L3", "area": "holding", "address": 22, "type": "int32", "scale": 0.1, "unit": "W", "access": "R", "byte_order": "big", "word_order": "little"},
    {"name": "Apparent power L1", "area": "holding", "address": 24, "type": "int32", "scale": 0.1, "unit": "VA", "access": "R", "byte_order": "big", "word_order": "little"},
    {"name": "Apparent power L2", "area": "holding", "address": 26, "type": "int32", "scale": 0.1, "unit": "VA", "access": "R", "byte_order": "big", "word_order": "little"},
    {"name": "Apparent power L3", "area": "holding", "address": 28, "type": "int32", "scale": 0.1, "unit": "VA", "access": "R", "byte_order": "big", "word_order": "little"},
    {"name": "Reactive power L1", "area": "holding", "address": 30, "type": "int32", "scale": 0.1, "unit": "var", "access": "R", "byte_order": "big", "word_order": "little"},
    {"name": "Reactive power L2", "area": "holding", "address": 32, "type": "int32", "scale": 0.1, "unit": "var", "access": "R", "byte_order": "big", "word_order": "little"},
    {"name": "Reactive power L3", "area": "holding", "address": 34, "type": "int32", "scale": 0.1, "unit": "var", "access": "R", "byte_order": "big", "word_order": "little"},
    {"name": "Average voltage L-N", "area": "holding", "address": 36, "type": "int32", "scale": 0.1, "unit": "V", "access": "R", "byte_order": "big", "word_order": "little"},
    {"name": "Average voltage L-L", "area": "holding", "address": 38, "type": "int32", "scale": 0.1, "unit": "V", "access": "R", "byte_order": "big", "word_order": "little"},
    {"name": "Total active power", "area": "holding", "address": 40, "type": "int32", "scale": 0.1, "unit": "W", "access": "R", "byte_order": "big", "word_order": "little"},
    {"name": "Total apparent power", "area": "holding", "address": 42, "type": "int32", "scale": 0.1, "unit": "VA", "access": "R", "byte_order": "big", "word_order": "little"},
    {"name": "Total reactive power", "area": "holding", "address": 44, "type": "int32", "scale": 0.1, "unit": "var", "access": "R", "byte_order": "big", "word_order": "little"},
    {"name": "Power factor L1", "area": "holding", "address": 46, "type": "int16", "scale": 0.001, "access": "R"},
    {"name": "Power factor L2", "area": "holding", "address": 47, "type": "int16", "scale": 0.001, "access": "R"},
    {"name": "Power factor L3", "area": "holding", "address": 48, "type": "int16", "scale": 0.001, "access": "R"},
    {"name": "Total power factor", "area": "holding", "address": 49, "type": "int16", "scale": 0.001, "access": "R"},
    {"name": "Frequency", "area": "holding", "address": 52, "type": "int16", "scale": 0.1, "unit": "Hz", "access": "R"},
    {"name": "Total import kWh", "area": "holding", "address": 53, "type": "int32", "scale": 0.1, "unit": "kWh", "access": "R", "byte_order": "big", "word_order": "little"},
    {"name": "Total import kVArh", "area": "holding", "address": 55, "type": "int32", "scale": 0.1, "unit": "kvarh", "access": "R", "byte_order": "big", "word_order": "little"}
  ]
}
