Wb-mqtt-serial templates: различия между версиями

м
→‎WB-MAP3H: WB-MAP3H → WB-MAP3E
м (→‎Описание: Поправил)
м (→‎WB-MAP3H: WB-MAP3H → WB-MAP3E)
Строка 732: Строка 732:
</syntaxhighlight>
</syntaxhighlight>


=== WB-MAP3H ===
=== WB-MAP3E ===


Устройство [[WB-MAP3H_Power_Meter|WB-MAP3H]] — трехканальный счетчик электроэнергии. Он измеряет большое количество параметров электрической сети. Поскольку опрос всех регистров такого устройства может занять достаточно много времени, есть несколько шаблонов, содержащих оптимальный набор параметров для решения текущей задачи. Мы рассмотрим базовый шаблон.
Устройство [[WB-MAP3E_Power_Meter|WB-MAP3E]] — трехканальный счетчик электроэнергии. Он измеряет большое количество параметров электрической сети. Поскольку опрос всех регистров такого устройства может занять достаточно много времени, есть несколько шаблонов, содержащих оптимальный набор параметров для решения текущей задачи. Мы рассмотрим шаблон из поставки драйвера.


<syntaxhighlight lang="JSON">
<syntaxhighlight lang="JSON">
{
{
"device_type": "WB-MAP3H (basic)",  
  "device_type": "WB-MAP3E fw2",
"device": {
  "device": {
  "name": "WB-MAP3H (basic)",  
    "name": "WB-MAP3E fw2",
  "id": "wb-map3h",  
    "id": "wb-map3e",
  "max_read_registers": 60,  
    "max_read_registers": 60,
  "channels": [
    "response_timeout_ms": 1,
  {
    "frame_timeout_ms": 15,
    "name": "Urms L1",  
    "channels": [
    "reg_type": "input",  
      {
    "address": "0x10d9",  
        "name": "L1",
    "type": "voltage",  
        "id": "",
    "format": "u16",  
        "device_type": "phase L1"
    "scale": 0.01,  
      },
    "round_to": 0.01
      {
  },  
        "name": "L2",
  {
        "id": "",
    "name": "THDN U L1",  
        "device_type": "phase L2",
    "reg_type": "input",  
        "stride": 1
    "address": "0x10f1",  
      },
    "type": "value",  
      {
    "format": "u16",  
        "name": "L3",
    "scale": 0.01,
        "id": "",
    "round_to": 0.01
        "device_type": "phase L3",
  },  
        "stride": 2
  {
      },
    "name": "Urms L2",  
      {
    "reg_type": "input",  
        "name": "Total P",
    "address": "0x10da",
        "reg_type": "input",
    "type": "voltage",
        "address": "0x1300",
    "format": "u16",  
        "type": "power",
    "scale": 0.01,  
        "format": "s32",
    "round_to": 0.01
        "scale": 0.00512,
  },  
        "round_to": 0.01
  {
      },
    "name": "THDN U L2",  
      {
    "reg_type": "input",  
        "name": "Total Q",
    "address": "0x10f2",  
        "reg_type": "input",
    "type": "value",  
        "address": "0x1308",
    "format": "u16",  
        "type": "value",
    "scale": 0.01,  
        "format": "s32",
    "round_to": 0.01
        "scale": 0.00512,
  },  
        "round_to": 0.01
  {
      },
    "name": "Urms L3",  
      {
    "reg_type": "input",  
        "name": "Total S",
    "address": "0x10db",  
        "reg_type": "input",
    "type": "voltage",  
        "address": "0x1310",
    "format": "u16",  
        "type": "value",
    "scale": 0.01,  
        "format": "s32",
    "round_to": 0.01
        "scale": 0.00512,
  },  
        "round_to": 0.01
  {
      },
    "name": "THDN U L3",  
      {
    "reg_type": "input",  
        "name": "Total PF",
    "address": "0x10f3",  
        "reg_type": "input",
    "type": "value",  
        "address": "0x10bc",
    "format": "u16",  
        "type": "value",
    "scale": 0.01,  
        "format": "s16",
    "round_to": 0.01
        "scale": 0.001,
  },  
        "round_to": 0.01
  {
      },
    "name": "Frequency",  
      {
    "reg_type": "input",  
        "name": "Total AP energy",
    "address": "0x10f8",  
        "reg_type": "input",
    "type": "value",  
        "address": "0x1200",
    "format": "u16",  
        "type": "power_consumption",
    "scale": 0.01,  
        "format": "u64",
    "round_to": 0.01
        "scale": 1e-05,
  },  
        "round_to": 1e-06,
  {
        "word_order": "little_endian"
    "name": "Voltage angle L1",  
      },
    "reg_type": "input",  
      {
    "address": "0x10fd",  
        "name": "Total RP energy",
    "type": "value",  
        "reg_type": "input",
    "format": "s16",  
        "address": "0x1220",
    "scale": 0.1,  
        "type": "value",
    "round_to": 0.01
        "format": "u64",
  },  
        "scale": 1e-05,
  {
        "round_to": 1e-06,
    "name": "Voltage angle L2",  
        "word_order": "little_endian"
    "reg_type": "input",  
      },
    "address": "0x10fe",  
      {
    "type": "value",  
        "name": "Frequency",
    "format": "s16",  
        "reg_type": "input",
    "scale": 0.1,  
        "address": "0x10f8",
    "round_to": 0.01
        "type": "value",
  },  
        "format": "u16",
  {
        "scale": 0.01,
    "name": "Voltage angle L3",  
        "round_to": 0.01
    "reg_type": "input",  
      },
    "address": "0x10ff",
      {
    "type": "value",  
        "name": "Uptime",
    "format": "s16",
        "reg_type": "input",
    "scale": 0.1,  
        "address": 104,
    "round_to": 0.01
        "format": "u32",
  },  
        "enabled": false
  {
      },
    "name": "Irms L1",  
      {
    "reg_type": "input",  
        "name": "Supply voltage",
    "address": "0x10dd",  
        "reg_type": "input",
    "type": "value",  
        "address": 121,
    "format": "u16",  
        "scale": 0.001,
    "scale": 0.001,  
        "type": "voltage",
     "round_to": 0.01
        "enabled": false
  },
      }
  {
    ],
    "name": "THDN I L1",  
     "subdevices": [
    "reg_type": "input",
      {
    "address": "0x10f5",
        "device_type": "phase L1",
    "type": "value",  
        "device": {
    "format": "u16",  
          "parameters": {
    "scale": 0.01,  
            "turns": {
    "round_to": 0.01
              "title": "Turns",
  },  
              "order": 1,
  {
              "address": "0x1460",
    "name": "P L1",  
              "min": 0
    "reg_type": "input",
            },
    "address": "0x1302",  
            "phi": {
    "type": "power",
              "title": "Phi",
    "format": "s32",  
              "order": 2,
    "scale": 1.52588e-05,  
              "address": "0x1463",
    "round_to": 0.01
              "min": 0
  },
            }
  {
          },
    "name": "Q L1",
          "channels": [
    "reg_type": "input",  
            {
    "address": "0x130a",  
              "name": "Urms",
    "type": "value",  
              "id": "Urms L1",
    "format": "s32",  
              "reg_type": "input",
    "scale": 1.52588e-05,  
              "address": "0x1410",
    "round_to": 0.01
              "type": "voltage",
  },  
              "format": "u32",
  {
              "scale": 1.52588e-07,
    "name": "S L1",  
              "round_to": 0.001
    "reg_type": "input",  
            },
    "address": "0x1312",  
            {
    "type": "value",  
              "name": "Upeak",
    "format": "s32",  
              "id": "Upeak L1",
    "scale": 1.52588e-05,  
              "reg_type": "input",
    "round_to": 0.01
              "address": "0x1810",
  },  
              "type": "voltage",
  {
              "format": "s32",
    "name": "PF L1",  
              "scale": 0.01,
    "reg_type": "input",  
              "round_to": 0.01,
    "address": "0x10bd",  
              "word_order": "little_endian"
    "type": "value",  
            },
    "format": "s16",  
            {
    "scale": 0.001,  
              "name": "Voltage angle",
    "round_to": 0.01
              "id": "Voltage angle L1",
  },  
              "reg_type": "input",
  {
              "address": "0x10fd",
    "name": "AP energy L1",  
              "type": "value",
    "reg_type": "input",  
              "format": "s16",
    "address": "0x1204",  
              "scale": 0.1,
    "type": "power_consumption",  
              "round_to": 0.01
    "format": "u64",  
            },
    "scale": 3.125e-05,  
            {
    "round_to": 0.0001,  
              "name": "Irms",
    "word_order": "little_endian"
              "id": "Irms L1",
  },  
              "reg_type": "input",
  {
              "address": "0x1416",
    "name": "RP energy L1",  
              "type": "value",
    "reg_type": "input",  
              "format": "u32",
    "address": "0x1224",  
              "scale": 2.44141e-07,
    "type": "value",  
              "round_to": 0.0001
    "format": "u64",  
            },
    "scale": 3.125e-05,  
            {
    "round_to": 0.0001,  
              "name": "Ipeak",
    "word_order": "little_endian"
              "id": "Ipeak L1",
  },  
              "reg_type": "input",
  {
              "address": "0x1818",
    "name": "Irms L2",  
              "type": "value",
    "reg_type": "input",  
              "format": "s32",
    "address": "0x10de",  
              "scale": 0.016,
    "type": "value",  
              "round_to": 0.01,
    "format": "u16",  
              "word_order": "little_endian"
    "scale": 0.001,  
            },
    "round_to": 0.01
            {
  },  
              "name": "P",
  {
              "id": "P L1",
    "name": "THDN I L2",  
              "reg_type": "input",
    "reg_type": "input",  
              "address": "0x1302",
    "address": "0x10f6",  
              "type": "power",
    "type": "value",  
              "format": "s32",
    "format": "u16",  
              "scale": 0.00512,
    "scale": 0.01,  
              "round_to": 0.01
    "round_to": 0.01
            },
  },  
            {
  {
              "name": "Q",
    "name": "P L2",  
              "id": "Q L1",
    "reg_type": "input",  
              "reg_type": "input",
    "address": "0x1304",  
              "address": "0x130a",
    "type": "power",  
              "type": "value",
    "format": "s32",  
              "format": "s32",
    "scale": 1.52588e-05,  
              "scale": 0.00512,
    "round_to": 0.01
              "round_to": 0.01
  },  
            },
  {
            {
    "name": "Q L2",  
              "name": "S",
    "reg_type": "input",  
              "id": "S L1",
    "address": "0x130c",  
              "reg_type": "input",
    "type": "value",  
              "address": "0x1312",
    "format": "s32",  
              "type": "value",
    "scale": 1.52588e-05,  
              "format": "s32",
    "round_to": 0.01
              "scale": 0.00512,
  },  
              "round_to": 0.01
  {
            },
    "name": "S L2",  
            {
    "reg_type": "input",  
              "name": "PF",
    "address": "0x1314",  
              "id": "PF L1",
    "type": "value",  
              "reg_type": "input",
    "format": "s32",  
              "address": "0x10bd",
    "scale": 1.52588e-05,  
              "type": "value",
    "round_to": 0.01
              "format": "s16",
  },  
              "scale": 0.001,
  {
              "round_to": 0.01
    "name": "PF L2",  
            },
    "reg_type": "input",  
            {
    "address": "0x10be",  
              "name": "AP energy",
    "type": "value",  
              "id": "AP energy L1",
    "format": "s16",  
              "reg_type": "input",
    "scale": 0.001,  
              "address": "0x1204",
    "round_to": 0.01
              "type": "power_consumption",
  },  
              "format": "u64",
  {
              "scale": 1e-05,
    "name": "AP energy L2",  
              "round_to": 1e-06,
    "reg_type": "input",  
              "word_order": "little_endian"
    "address": "0x1208",  
            },
    "type": "power_consumption",  
            {
    "format": "u64",  
              "name": "RP energy",
    "scale": 3.125e-05,  
              "id": "RP energy L1",
    "round_to": 0.0001,  
              "reg_type": "input",
    "word_order": "little_endian"
              "address": "0x1224",
  },  
              "type": "value",
  {
              "format": "u64",
    "name": "RP energy L2",
              "scale": 1e-05,
    "reg_type": "input",  
              "round_to": 1e-06,
    "address": "0x1228",  
              "word_order": "little_endian"
    "type": "value",  
            },
    "format": "u64",  
            {
    "scale": 3.125e-05,
              "name": "Phase angle",
    "round_to": 0.0001,  
              "id": "Phase angle L1",
    "word_order": "little_endian"
              "reg_type": "input",
  },  
              "address": "0x10f9",
  {
              "type": "value",
    "name": "Irms L3",  
              "format": "s16",
    "reg_type": "input",  
              "scale": 0.1,
    "address": "0x10df",  
              "round_to": 0.01
    "type": "value",  
            }
    "format": "u16",  
          ]
    "scale": 0.001,  
        }
    "round_to": 0.01
      },
  },  
      {
  {
        "device_type": "phase L2",
    "name": "THDN I L3",  
        "device": {
    "reg_type": "input",  
          "parameters": {
    "address": "0x10f7",  
            "turns": {
    "type": "value",  
              "title": "Turns",
    "format": "u16",  
              "order": 1,
    "scale": 0.01,
              "address": "0x1460",
    "round_to": 0.01
              "min": 0
  },  
            },
  {
            "phi": {
    "name": "P L3",  
              "title": "Phi",
    "reg_type": "input",  
              "order": 2,
    "address": "0x1306",  
              "address": "0x1463",
    "type": "power",  
              "min": 0
    "format": "s32",
            }
    "scale": 1.52588e-05,
          },
    "round_to": 0.01
          "channels": [
  },  
            {
  {
              "name": "Urms",
    "name": "Q L3",  
              "id": "Urms L2",
    "reg_type": "input",  
              "reg_type": "input",
    "address": "0x130e",  
              "address": "0x1410",
    "type": "value",  
              "type": "voltage",
    "format": "s32",  
              "format": "u32",
    "scale": 1.52588e-05,  
              "scale": 1.52588e-07,
    "round_to": 0.01
              "round_to": 0.001
  },  
            },
  {
            {
    "name": "S L3",  
              "name": "Upeak",
    "reg_type": "input",  
              "id": "Upeak L2",
    "address": "0x1316",  
              "reg_type": "input",
    "type": "value",  
              "address": "0x1810",
    "format": "s32",  
              "type": "voltage",
    "scale": 1.52588e-05,  
              "format": "s32",
    "round_to": 0.01
              "scale": 0.01,
  },  
              "round_to": 0.01,
  {
              "word_order": "little_endian"
    "name": "PF L3",  
            },
    "reg_type": "input",  
            {
    "address": "0x10bf",  
              "name": "Voltage angle",
    "type": "value",  
              "id": "Voltage angle L2",
    "format": "s16",  
              "reg_type": "input",
    "scale": 0.001,  
              "address": "0x10fd",
    "round_to": 0.01
              "type": "value",
  },  
              "format": "s16",
  {
              "scale": 0.1,
    "name": "AP energy L3",  
              "round_to": 0.01
    "reg_type": "input",  
            },
    "address": "0x120c",  
            {
    "type": "power_consumption",  
              "name": "Irms",
    "format": "u64",  
              "id": "Irms L2",
    "scale": 3.125e-05,  
              "reg_type": "input",
    "round_to": 0.0001,  
              "address": "0x1416",
    "word_order": "little_endian"
              "type": "value",
  },  
              "format": "u32",
  {
              "scale": 2.44141e-07,
    "name": "RP energy L3",  
              "round_to": 0.0001
    "reg_type": "input",  
            },
    "address": "0x122c",  
            {
    "type": "value",  
              "name": "Ipeak",
    "format": "u64",  
              "id": "Ipeak L2",
    "scale": 3.125e-05,  
              "reg_type": "input",
    "round_to": 0.0001,  
              "address": "0x1818",
    "word_order": "little_endian"
              "type": "value",
  },  
              "format": "s32",
  {
              "scale": 0.016,
    "name": "Total P",  
              "round_to": 0.01,
    "reg_type": "input",  
              "word_order": "little_endian"
    "address": "0x1300",  
            },
    "type": "power",  
            {
    "format": "s32",  
              "name": "P",
    "scale": 6.10352e-05,  
              "id": "P L2",
    "round_to": 0.01
              "reg_type": "input",
  },  
              "address": "0x1302",
  {
              "type": "power",
    "name": "Total Q",  
              "format": "s32",
    "reg_type": "input",  
              "scale": 0.00512,
    "address": "0x1308",  
              "round_to": 0.01
    "type": "value",  
            },
    "format": "s32",  
            {
    "scale": 6.10352e-05,  
              "name": "Q",
    "round_to": 0.01
              "id": "Q L2",
  },  
              "reg_type": "input",
  {
              "address": "0x130a",
    "name": "Total S",  
              "type": "value",
    "reg_type": "input",  
              "format": "s32",
    "address": "0x1310",  
              "scale": 0.00512,
    "type": "value",  
              "round_to": 0.01
    "format": "s32",  
            },
    "scale": 6.10352e-05,  
            {
    "round_to": 0.01
              "name": "S",
  },  
              "id": "S L2",
  {
              "reg_type": "input",
    "name": "Total PF",  
              "address": "0x1312",
    "reg_type": "input",  
              "type": "value",
    "address": "0x10bc",  
              "format": "s32",
    "type": "value",  
              "scale": 0.00512,
    "format": "s16",  
              "round_to": 0.01
    "scale": 0.001,  
            },
    "round_to": 0.01
            {
  },  
              "name": "PF",
  {
              "id": "PF L2",
    "name": "Total AP energy",  
              "reg_type": "input",
    "reg_type": "input",  
              "address": "0x10bd",
    "address": "0x1200",  
              "type": "value",
    "type": "power_consumption",  
              "format": "s16",
    "format": "u64",  
              "scale": 0.001,
    "scale": 3.125e-05,  
              "round_to": 0.01
    "round_to": 0.0001,  
            },
    "word_order": "little_endian"
            {
  },  
              "name": "AP energy",
  {
              "id": "AP energy L2",
    "name": "Total RP energy",
              "reg_type": "input",
    "reg_type": "input",  
              "address": "0x1204",
    "address": "0x1220",  
              "type": "power_consumption",
    "type": "value",  
              "format": "u64",
    "format": "u64",
              "scale": 1e-05,
    "scale": 3.125e-05,  
              "round_to": 1e-06,
    "round_to": 0.0001,
              "word_order": "little_endian"
    "word_order": "little_endian"
            },
  },  
            {
  {
              "name": "RP energy",
    "name": "Phase angle L1",  
              "id": "RP energy L2",
    "reg_type": "input",  
              "reg_type": "input",
    "address": "0x10f9",
              "address": "0x1224",
    "type": "value",  
              "type": "value",
    "format": "s16",  
              "format": "u64",
    "scale": 0.1,  
              "scale": 1e-05,
    "round_to": 0.01
              "round_to": 1e-06,
  },  
              "word_order": "little_endian"
  {
            },
    "name": "Phase angle L2",  
            {
    "reg_type": "input",  
              "name": "Phase angle",
    "address": "0x10fa",  
              "id": "Phase angle L2",
    "type": "value",  
              "reg_type": "input",
    "format": "s16",  
              "address": "0x10f9",
    "scale": 0.1,
              "type": "value",
    "round_to": 0.01
              "format": "s16",
  },  
              "scale": 0.1,
  {
              "round_to": 0.01
    "name": "Phase angle L3",  
            }
    "reg_type": "input",  
          ]
    "address": "0x10fb",  
        }
    "type": "value",  
      },
    "format": "s16",  
      {
    "scale": 0.1,  
        "device_type": "phase L3",
    "round_to": 0.01
        "device": {
  }
          "parameters": {
  ]
            "turns": {
}
              "title": "Turns",
              "order": 1,
              "address": "0x1460",
              "min": 0
            },
            "phi": {
              "title": "Phi",
              "order": 2,
              "address": "0x1463",
              "min": 0
            }
          },
          "channels": [
            {
              "name": "Urms",
              "id": "Urms L3",
              "reg_type": "input",
              "address": "0x1410",
              "type": "voltage",
              "format": "u32",
              "scale": 1.52588e-07,
              "round_to": 0.001
            },
            {
              "name": "Upeak",
              "id": "Upeak L3",
              "reg_type": "input",
              "address": "0x1810",
              "type": "voltage",
              "format": "s32",
              "scale": 0.01,
              "round_to": 0.01,
              "word_order": "little_endian"
            },
            {
              "name": "Voltage angle",
              "id": "Voltage angle L3",
              "reg_type": "input",
              "address": "0x10fd",
              "type": "value",
              "format": "s16",
              "scale": 0.1,
              "round_to": 0.01
            },
            {
              "name": "Irms",
              "id": "Irms L3",
              "reg_type": "input",
              "address": "0x1416",
              "type": "value",
              "format": "u32",
              "scale": 2.44141e-07,
              "round_to": 0.0001
            },
            {
              "name": "Ipeak",
              "id": "Ipeak L3",
              "reg_type": "input",
              "address": "0x1818",
              "type": "value",
              "format": "s32",
              "scale": 0.016,
              "round_to": 0.01,
              "word_order": "little_endian"
            },
            {
              "name": "P",
              "id": "P L3",
              "reg_type": "input",
              "address": "0x1302",
              "type": "power",
              "format": "s32",
              "scale": 0.00512,
              "round_to": 0.01
            },
            {
              "name": "Q",
              "id": "Q L3",
              "reg_type": "input",
              "address": "0x130a",
              "type": "value",
              "format": "s32",
              "scale": 0.00512,
              "round_to": 0.01
            },
            {
              "name": "S",
              "id": "S L3",
              "reg_type": "input",
              "address": "0x1312",
              "type": "value",
              "format": "s32",
              "scale": 0.00512,
              "round_to": 0.01
            },
            {
              "name": "PF",
              "id": "PF L3",
              "reg_type": "input",
              "address": "0x10bd",
              "type": "value",
              "format": "s16",
              "scale": 0.001,
              "round_to": 0.01
            },
            {
              "name": "AP energy",
              "id": "AP energy L3",
              "reg_type": "input",
              "address": "0x1204",
              "type": "power_consumption",
              "format": "u64",
              "scale": 1e-05,
              "round_to": 1e-06,
              "word_order": "little_endian"
            },
            {
              "name": "RP energy",
              "id": "RP energy L3",
              "reg_type": "input",
              "address": "0x1224",
              "type": "value",
              "format": "u64",
              "scale": 1e-05,
              "round_to": 1e-06,
              "word_order": "little_endian"
            },
            {
              "name": "Phase angle",
              "id": "Phase angle L3",
              "reg_type": "input",
              "address": "0x10f9",
              "type": "value",
              "format": "s16",
              "scale": 0.1,
              "round_to": 0.01
            }
          ]
        }
      }
    ]
  }
}
}
  </syntaxhighlight>
  </syntaxhighlight>
Строка 1148: Строка 1289:
Также показательным является параметр, описывающий накопленную реактивную энергию по фазе L1:
Также показательным является параметр, описывающий накопленную реактивную энергию по фазе L1:
<syntaxhighlight lang="JSON">
<syntaxhighlight lang="JSON">
  {
{
    "name": "RP energy L1",  
  "name": "RP energy",
    "reg_type": "input",  
  "id": "RP energy L1",
    "address": "0x1224",  
  "reg_type": "input",
    "type": "value",  
  "address": "0x1224",
    "format": "u64",  
  "type": "value",
    "scale": 3.125e-05,  
  "format": "u64",
    "round_to": 0.0001,  
  "scale": 1e-05,
    "word_order": "little_endian"
  "round_to": 1e-06,
  },  
  "word_order": "little_endian"
},  
</syntaxhighlight>  
</syntaxhighlight>  


Здесь стоит обратить внимание на то, что адрес регистра может задаваться и в шестнадцатеричном виде: <code>"address": "0x1224"</code>, вещественный коэффициент масштабирования можно задавать в экспоненциальной записи: <code>"scale": 3.125e-05</code>, при считывании значения округлять его до нужного порядка: <code>"round_to": 0.0001</code>, а также учитывать, что число в modbus-регистрах хранится в порядке от младшего к старшему: <code>"word_order": "little_endian"</code>.   
Здесь стоит обратить внимание на то, что адрес регистра может задаваться и в шестнадцатеричном виде: <code>"address": "0x1224"</code>, вещественный коэффициент масштабирования можно задавать в экспоненциальной записи: <code>"scale": 1e-05</code>, при считывании значения округлять его до нужного порядка: <code>"round_to": 1e-06</code>, а также учитывать, что число в modbus-регистрах хранится в порядке от младшего к старшему: <code>"word_order": "little_endian"</code>.   
 
Форматы хранения для 16-битных modbus-регистров описываются следующим образом:
Форматы хранения для 16-битных modbus-регистров описываются следующим образом:
<pre>
<pre>