{
  "$schema": "https://raw.githubusercontent.com/nobrega8/mbmap-library/main/schema/mbmap-2.schema.json",
  "mbmap": 2,
  "model": "GRIDSCAN 5000",
  "models": [
    "GRIDSCAN 5000"
  ],
  "description": "Transformer hydrogen and oil temperature sensor with Modbus RTU",
  "vendor": "Electron do Brasil",
  "vendor_website": "electron.com.br",
  "revision": 1,
  "revised": "2026-11-10",
  "source": "Electron do Brasil, Mapa de Registradores MODBUS RTU, GRIDSCAN 5000, v1.0",
  "sources": [
    {
      "title": "Mapa de Registradores MODBUS RTU, GRIDSCAN 5000",
      "version": "1.0",
      "url": "https://electron.com.br/api/downloads/file/mapa_de_registradores_modbus_rtu_gdscan_5000_v1-0_pt-br.pdf",
      "note": "linked in issue #131"
    }
  ],
  "notes": [
    "Addresses are the register numbers of the document, which starts at 0 (hydrogen at registers 0 and 1), so address_base is 0. The document lists them as holding registers (function 03).",
    "Default connection from the document: 19200 baud, 8 data bits, no parity, 1 stop bit (the framing register also allows 2 stop bits, even and odd parity), RS-485 two-wire, unit ID 1. Set the master timeout to 10 seconds or more.",
    "32-bit values (hydrogen, rates, calibration values) are read with the high word first. The document asks to read the high word before the low word: read both registers in one request.",
    "Strings are ASCII, two characters per register, up to 19 characters, null-terminated. Dates are packed as month and day in one register (high and low byte) and the year in the next.",
    "The document also describes discrete inputs (function 02, addresses 0 to 67) that repeat the status bits and mark which values are valid; they are not mapped here.",
    "The document also says input registers 0 to 14 exist, but gives no table for them, so only holding registers are mapped.",
    "Written from the manufacturer's document; not tested on a device."
  ],
  "protocol": "rtu",
  "unit_id": 1,
  "baudrate": 19200,
  "parity": "N",
  "databits": 8,
  "stopbits": 1,
  "address_base": 0,
  "byte_order": "big",
  "word_order": "big",
  "x_status": "official",
  "enums": {
    "activity": {"1": "Measuring hydrogen", "2": "Measuring oil temperature", "3": "Self-calibration", "4": "Oil temperature too high"},
    "edit_command": {"1": "Open for editing", "2": "Save and close", "3": "Abort editing"},
    "mode": {"0": "Field", "1": "Laboratory"},
    "liquid_type": {"0": "Mineral", "1": "Silicone", "2": "Natural ester", "3": "Synthetic ester"},
    "framing": {"1": "8N1", "2": "8N2", "3": "8E1", "4": "8E2", "5": "8O1", "6": "8O2"},
    "baud": {"1": "9600", "2": "14400", "3": "19200", "4": "38400", "5": "57600", "6": "115200"}
  },
  "registers": [
    {"name": "Hydrogen", "group": "Measurements", "area": "holding", "address": 0, "type": "uint32", "unit": "ppm", "access": "R", "description": "Dissolved hydrogen in ppm H2, unscaled. Read the high word (register 0) first; the value is 0 until the ready bit of the unit status is set"},
    {"name": "PCB temperature", "group": "Measurements", "area": "holding", "address": 7, "type": "uint16", "scale": 0.01, "offset": -100, "unit": "°C", "access": "R", "description": "Internal temperature of the electronics; above 105 °C can damage the device"},
    {"name": "Oil temperature", "group": "Measurements", "area": "holding", "address": 8, "type": "uint16", "scale": 0.01, "offset": -100, "unit": "°C", "access": "R", "description": "0 until the first measurement; the sensor is calibrated up to 105 °C"},
    {"name": "Hydrogen rate of change per day", "group": "Measurements", "area": "holding", "address": 13, "type": "uint32", "offset": -20000000, "unit": "ppm/day", "access": "R", "description": "Raw value is stored with an offset of 20,000,000; negative means falling hydrogen. Trends reset to zero after a power cycle"},
    {"name": "Hydrogen rate of change per week", "group": "Measurements", "area": "holding", "address": 15, "type": "uint32", "offset": -20000000, "unit": "ppm/week", "access": "R", "description": "Raw value is stored with an offset of 20,000,000; negative means falling hydrogen. Trends reset to zero after a power cycle"},
    {"name": "Hydrogen rate of change per month", "group": "Measurements", "area": "holding", "address": 17, "type": "uint32", "offset": -20000000, "unit": "ppm/month", "access": "R", "description": "Raw value is stored with an offset of 20,000,000; negative means falling hydrogen. Trends reset to zero after a power cycle"},
    {"name": "Model number", "group": "Information", "area": "holding", "address": 31, "type": "string", "length": 10, "access": "R"},
    {"name": "Product serial number", "group": "Information", "area": "holding", "address": 41, "type": "string", "length": 10, "access": "R", "role": "serial"},
    {"name": "Sensor serial number", "group": "Information", "area": "holding", "address": 51, "type": "string", "length": 10, "access": "R"},
    {"name": "Sensor board serial number", "group": "Information", "area": "holding", "address": 61, "type": "string", "length": 10, "access": "R"},
    {"name": "Manufacturing date month", "group": "Information", "area": "holding", "address": 81, "type": "uint16", "bit": 8, "bits": 8, "access": "R"},
    {"name": "Manufacturing date day", "group": "Information", "area": "holding", "address": 81, "type": "uint16", "bit": 0, "bits": 8, "access": "R"},
    {"name": "Manufacturing date year", "group": "Information", "area": "holding", "address": 82, "type": "uint16", "access": "R"},
    {"name": "Factory calibration date month", "group": "Information", "area": "holding", "address": 83, "type": "uint16", "bit": 8, "bits": 8, "access": "R"},
    {"name": "Factory calibration date day", "group": "Information", "area": "holding", "address": 83, "type": "uint16", "bit": 0, "bits": 8, "access": "R"},
    {"name": "Factory calibration date year", "group": "Information", "area": "holding", "address": 84, "type": "uint16", "access": "R"},
    {"name": "Dissolved gas calibration date month", "group": "Information", "area": "holding", "address": 87, "type": "uint16", "bit": 8, "bits": 8, "access": "R"},
    {"name": "Dissolved gas calibration date day", "group": "Information", "area": "holding", "address": 87, "type": "uint16", "bit": 0, "bits": 8, "access": "R"},
    {"name": "Dissolved gas calibration date year", "group": "Information", "area": "holding", "address": 88, "type": "uint16", "access": "R"},
    {"name": "Firmware revision", "group": "Information", "area": "holding", "address": 89, "type": "string", "length": 10, "access": "R", "description": "Text in the form x:y:z (major, minor, product designator), for example 3:7:A"},
    {"name": "Unit ready", "group": "Status", "area": "holding", "address": 111, "type": "bool", "bit": 15, "access": "R", "description": "Hydrogen readings are valid"},
    {"name": "New measurement available", "group": "Status", "area": "holding", "address": 111, "type": "bool", "bit": 14, "access": "R", "description": "Cleared by reading the register"},
    {"name": "Error", "group": "Status", "area": "holding", "address": 111, "type": "bool", "bit": 12, "access": "R", "description": "An unrecoverable error occurred; see registers 112 and 113"},
    {"name": "Sensor activity", "group": "Status", "area": "holding", "address": 111, "type": "uint16", "bit": 3, "bits": 3, "access": "R", "enum": "activity"},
    {"name": "Heater fault", "group": "Status", "area": "holding", "address": 112, "type": "bool", "bit": 15, "access": "R"},
    {"name": "Temperature sensor fault", "group": "Status", "area": "holding", "address": 112, "type": "bool", "bit": 14, "access": "R"},
    {"name": "Hydrogen sensor fault", "group": "Status", "area": "holding", "address": 112, "type": "bool", "bit": 13, "access": "R"},
    {"name": "Battery backup error", "group": "Status", "area": "holding", "address": 113, "type": "bool", "bit": 8, "access": "R", "description": "Cleared by setting the clock or cycling the power"},
    {"name": "PCB temperature above 105 C", "group": "Status", "area": "holding", "address": 113, "type": "bool", "bit": 4, "access": "R"},
    {"name": "Required data not available", "group": "Status", "area": "holding", "address": 113, "type": "bool", "bit": 1, "access": "R"},
    {"name": "Configuration data invalid", "group": "Status", "area": "holding", "address": 113, "type": "bool", "bit": 0, "access": "R"},
    {"name": "Command DA", "group": "Calibration", "area": "holding", "address": 121, "type": "uint16", "access": "RW", "description": "First step of the DGA adjustment: write when an oil sample is taken. Not within 24 hours of installation or of the last DC command. The document gives no value to write"},
    {"name": "Command DB", "group": "Calibration", "area": "holding", "address": 122, "type": "uint16", "access": "RW", "description": "Second step: write after registers 126 to 129 are set. Needs a prior DA and takes up to 10 seconds to answer. The document gives no value to write"},
    {"name": "Command DC", "group": "Calibration", "area": "holding", "address": 125, "type": "uint16", "access": "RW", "description": "Clears the DGA adjustment. The document gives no value to write"},
    {"name": "DGA calibration hydrogen", "group": "Calibration", "area": "holding", "address": 126, "type": "uint32", "unit": "ppm", "access": "RW", "write_min": 0, "write_max": 1000000, "description": "Laboratory hydrogen result, written before command DB"},
    {"name": "DGA calibration month", "group": "Calibration", "area": "holding", "address": 128, "type": "uint16", "bit": 8, "bits": 8, "access": "RW", "description": "The date must match the internal clock for command DB to be accepted"},
    {"name": "DGA calibration day", "group": "Calibration", "area": "holding", "address": 128, "type": "uint16", "bit": 0, "bits": 8, "access": "RW"},
    {"name": "DGA calibration year", "group": "Calibration", "area": "holding", "address": 129, "type": "uint16", "access": "RW"},
    {"name": "User-defined oil type name", "group": "Configuration", "area": "holding", "address": 136, "type": "string", "length": 8, "access": "RW", "description": "Up to 15 characters, null-terminated"},
    {"name": "Ostwald slope m", "group": "Configuration", "area": "holding", "address": 144, "type": "uint32", "scale": 1e-06, "offset": -0.001, "access": "RW", "description": "Stored as m x 1,000,000 + 1,000 (default 1093 for synthetic ester). A wrong value disables hydrogen measurement"},
    {"name": "Ostwald offset b", "group": "Configuration", "area": "holding", "address": 146, "type": "uint32", "scale": 1e-06, "offset": -0.001, "access": "RW", "description": "Stored as b x 1,000,000 + 1,000 (default 40739 for synthetic ester). A wrong value disables hydrogen measurement"},
    {"name": "Oil type edit command", "group": "Configuration", "area": "holding", "address": 148, "type": "uint16", "access": "RW", "enum": "edit_command", "description": "Write 1 to open the user-defined type for editing, then 2 to save or 3 to abort"},
    {"name": "Modbus unit ID", "group": "Device", "area": "holding", "address": 150, "type": "uint16", "access": "RW", "write_min": 1, "write_max": 247, "description": "Writing to unit 0 reaches every connected device. The new ID applies after a power cycle"},
    {"name": "Operation mode", "group": "Device", "area": "holding", "address": 151, "type": "uint16", "access": "RW", "enum": "mode", "description": "Laboratory mode runs the self-calibration every 4 hours instead of every 12"},
    {"name": "Oil type selection", "group": "Configuration", "area": "holding", "address": 152, "type": "uint16", "access": "RW", "enum": "liquid_type"},
    {"name": "Parity and stop bits", "group": "Device", "area": "holding", "address": 159, "type": "uint16", "access": "RW", "enum": "framing", "description": "Applies after a power cycle"},
    {"name": "Baud rate", "group": "Device", "area": "holding", "address": 160, "type": "uint16", "access": "RW", "enum": "baud"},
    {"name": "Clock month", "group": "Clock", "area": "holding", "address": 175, "type": "uint16", "bit": 8, "bits": 8, "access": "RW", "description": "Read register 175 first; write 175 to 178 in order, the clock is saved when 178 is written"},
    {"name": "Clock year", "group": "Clock", "area": "holding", "address": 175, "type": "uint16", "bit": 0, "bits": 8, "offset": 2000, "access": "RW", "description": "Year minus 2000 in the register"},
    {"name": "Clock hour", "group": "Clock", "area": "holding", "address": 176, "type": "uint16", "bit": 8, "bits": 8, "access": "RW"},
    {"name": "Clock day", "group": "Clock", "area": "holding", "address": 176, "type": "uint16", "bit": 0, "bits": 8, "access": "RW"},
    {"name": "Clock second", "group": "Clock", "area": "holding", "address": 177, "type": "uint16", "bit": 8, "bits": 8, "access": "RW"},
    {"name": "Clock minute", "group": "Clock", "area": "holding", "address": 177, "type": "uint16", "bit": 0, "bits": 8, "access": "RW"},
    {"name": "Clock millisecond", "group": "Clock", "area": "holding", "address": 178, "type": "uint16", "access": "RW", "description": "Write 0"},
    {"name": "Owner ID", "group": "Device", "area": "holding", "address": 201, "type": "string", "length": 10, "access": "RW", "description": "Up to 19 characters; read from the lowest address, write all registers to save"},
    {"name": "Substation ID", "group": "Device", "area": "holding", "address": 211, "type": "string", "length": 10, "access": "RW"},
    {"name": "Transformer ID", "group": "Device", "area": "holding", "address": 221, "type": "string", "length": 10, "access": "RW"}
  ]
}
