5.2 Протокол Modbus
Communication protocols
Modbus protocol
Общая информация
Плата BMS Main 2.x реализует протокол Modbus для настройки и чтения состояния АКБ и BMS. BMS является Modbus-сервером и отвечает на команды Modbus-клиента.
Взаимодействие с устройством осуществляется через шину RS-485 (Modbus RTU) или сеть Ethernet (Modbus TCP).
Параметры шины RS-485:
- частота, бит/с — 600, 1200, 2400, 4800, 9600 (по умолчанию), 19200, 38400, 57600, 115200;
- длина слова, бит — 8;
- четность — нет;
- адрес устройства (по умолчанию) — 32.
Параметры Ethernet:
- порт — 502.
Ниже приводятся описание Input и Holding регситров. В колонке «Тип параметра»:
- U8 – беззнаковое 8-разрядное число;
- U16 – беззнаковое 16-разрядное число;
- S16 – знаковое 16-разрядное число;
- U32 – беззнаковое 32-разрядное число.
- REAL32 — число с плавающей точкой одинарной точности (стандарт IEEE 754);
- U8[x] — массив беззнаковых 8-разрядных чисел длиной x;
- U16[x] — массив беззнаковых 16-разрядных чисел длиной x;
- REAL32[x] — массив чисел с плавающей точкой одинарной точности длиной x.
Порядок байт в словах – от младшего к старшему (little endian).
Input регистры
| Регистр | Количество регистров | Содержимое | Тип параметра |
| 0x0000 | 1 | Аппаратная версия: byte 0 — минорная версия; byte 1 — мажорная версия. | U8[2] |
| 0x0001-0x0002 | 2 | Версия ВПО: byte 0 — версия патча; byte 1 — минорная версия; byte 2 — мажорная версия; byte 3 — не используется (установлен в 0). | U8[4] |
| 0x0003-0x0004 | 2 | Версия загрузчика: byte 0 — версия патча; byte 1 — минорная версия; byte 2 — мажорная версия; byte 3 — не используется (установлен в 0). | U8[4] |
| 0x1000-0x1003 | 3 | Текущее время на устройстве: byte 0 — день (Двоично-десятичный код); byte 1 — месяц (Двоично-десятичный код); byte 2 — год (Двоично-десятичный код); byte 3 — час (Двоично-десятичный код); byte 4 — минуты (Двоично-десятичный код); byte 5 — секунды (Двоично-десятичный код). | U8[6] |
| 0x2000 | 1 | Дискретные входы 1 (битовое поле): бит 0 – сигнал «Открыта АКБ»; бит 1 – сигнал «Подключено ЗУ»; бит 2 – сигнал «Запрос на отключение питания»; бит 3 – сигнал «Запрет заряда»; бит 4 – сигнал «Запрет разряда»; бит 5 – сигнал «Обратная связь контактора заряда»; бит 6 – сигнал «Обратная связь контактора разряда»; бит 7 – сигнал «Статус контроля изоляции». бит 8 – сигнал «Запрос на заряд»; бит 9 – сигнал «Запрос на предзаряд»; бит 10 – сигнал «Запрос на разряд»; бит 11 – сигнал «Обратная связь контактора предзаряда»; бит 12 – сигнал «Обратная связь комбинированного контактора заряда/разряда»; бит 13 – сигнал «Обратная связь главного контактора»; бит 14 – сигнал целостности высоковольной цепи; бит 15 – сигнал состояния предохранителя 1. | U16 |
| 0x2001-0x2002 | 2 | Ток через АКБ, имеренный датчиком холла, А | REAL32 |
| 0x2003-0x2004 | 2 | Внешняя температура, °C | REAL32 |
| 0x2005-0x2006 | 2 | Влажность, RH% | REAL32 |
| 0x2007-0x2008 | 2 | Регистр ошибок 1 (битовое поле): бит 0 – ошибка «Превышение тока»; бит 1 – ошибка «Низкое напряжение»; бит 2 – ошибка «Высокое напряжение»; бит 3 – ошибка «Низкая температура (разряд)»; бит 4 – ошибка «Высокая температура (разряд)»; бит 5 – ошибка «Открыта крышка АКБ»; бит 6 – ошибка «Повышенная влажность»; бит 7 – ошибка «Вода»; бит 8 – ошибка «Перегрев Logic»; бит 9 – ошибка «Потеря связи c Logic»; бит 10 – критическая ошибка; бит 11 – ошибка Crown; бит 12 – ошибка «Несоответствие кол-ва ячеек»; бит 13 – ошибка «Потеря связи с HYG»; бит 14 – флаг о необходимости квитировать записи в журнале ошибок; бит 15 – ошибка «Потеря связи с Combilift»; бит 16 – ошибка «Короткое замыкание»; бит 17 – ошибка «Перегрев контактора»; бит 18 – ошибка «Несоответствие кол-ва Logic»; бит 19 – ошибка АЦП; бит 20 – ошибка в цепи подключения датчика тока (обрыв или короткое замыкание); бит 21 – большая частота переключений контактора заряда; бит 22 – большая частота переключений контактора разряда; бит 23 – ошибка «Потеря связи с BMS Current Sensor»; бит 24 – внутренняя ошибка BMS Current Sensor; бит 25 – ошибка контрольной суммы настроек платы; бит 26 – флаг перезапуска платы по требованию WDT; бит 27 – ошибка «Нет датчиков температуры»; бит 28 – ошибка «КЗ датчика температуры»; бит 29 – ошибка «Потеря связи со Spirit»; биты 30-31 – не используются. | U32 |
| 0x2009-0x200A | 2 | Флаги состояния (битовое поле): бит 0 – сигнал «SOC ниже заданного уровня»; бит 1 – сигнал «Ток заряда выше заданного уровня»; бит 2 – состояние контактора заряда (0 – разомкнуто, 1 – замкнуто); бит 3 – сигнал «Разрешение ЗУ»; бит 4 – сигнал «Заряд АКБ» (детектируется ток заряда); бит 5 – состояние контактора разряда (0 – разомкнуто, 1 – замкнуто); бит 6 – сигнал «Разряд АКБ» (детектируется ток разряда); бит 7 – сигнал «Повышенное напряжение» (EV); бит 8 – сигнал «Нагрев АКБ»; бит 9 – сигнал «Охлаждение АКБ»; бит 10 – сигнал на отключение контактора разряда от погрузчика HYG; бит 11 – сигнал об инициализации платы (во время инициализации калибруется датчик тока и сканируются платы BMS Logic); бит 12 – состояние контактора предзаряда; бит 13 – сигнал на отключение контактора разряда от погрузчика Combilift; бит 14 – сигнал о запущенном процессе анализа ячеек (Cell analysis); бит 15 – сигнал на балансировку серии батареи №1; бит 16 – сигнал на балансировку серии батареи №2; бит 17 – состояние дополнительного (AUX) контактора разряда (0 – разомкнуто, 1 – замкнуто); бит 18 – подтверждение отключения питания; бит 19 – сигнал EWS от погрузчика Crown; бит 20 – состояние главного контактора (0 – разомкнут, 1 - замкнут); бит 21 – сигнал служебного сброса системы; бит 22 – состояние комбинированного контактора заряда/разряда (0 – разомкнуто, 1 – замкнуто); бит 23 – сигнал «Готовность заряжаться»; бит 24 – сигнал «Готовность разряжаться»; бит 25 – сигнал включения платы "Power up"; биты 26-31 – не используются. | U32 |
| 0x200B | 1 | Discrete output signals (битовое поле): бит 0 — state of the output #1; бит 1 — state of the output #2; бит 2 — state of the output #3; бит 3 — state of the output #4; биты 4-15 — не используются. | U16 |
| 0x200C | 1 | Relay states (битовое поле): бит 0 — state of the relay #1; бит 1 — state of the relay #2; бит 2 — state of the relay #3; бит 3 — state of the relay #4; биты 4-15 — не используются. | U16 |
| 0x200E-0x200F | 2 | Errors 2 (битовое поле): бит 0 – "Low CH temperature", temperature is too low for charging; бит 1 – “High CH temperature”, temperature is too high for charging; бит 2 – “SD mount error”; бит 3 – “SD read/write error”; бит 4 – “Unallowable charging”, charging the battery through the discharging contactor; бит 5 – “Stuck contactor”; бит 6 – “CH contactor feedback error”; бит 7 – “DCH contactor feedback error”; бит 8 – “Insulation fault”; бит 9 – “PCH contactor feedback error”; бит 10 – “CH/DCH contactor feedback error”; бит 11 – “Main contactor feedback error”; бит 12 – не используются (set to 0); бит 13 – “General error”; биты 14-31 — не используются. | U32 |
| 0x2010 | 1 | Адрес устройства BMS Logic, чьи параметры содержатся в регистрах 0x2011-0x20C9 | U16 |
| 0x2011 | 1 | Состояние BMS Logic (битовое поле): бит 0 — device is present; бит 1 — device is online; бит 2 — device is ready; бит 3 — data from the device is actual; бит 4 — датчик температуры №1 обнаружен; бит 5 — датчик температуры №2 обнаружен; бит 6 — датчик температуры №1 закорочен бит 7 — датчик температуры №2 is shorted; биты 8-15 — не используются. | U16 |
| 0x2012-0x2013 | 2 | Temperature of the BMS Logic, °C | REAL32 |
| 0x2014-0x2015 | 2 | Cell balancing flags (битовое поле): бит i — balancing resistor is connected to the ith cell. | U32 |
| 0x2016-0x2029 | 20 | Array of cells states. Each element of the array corresponds to a cell and is a битовое поле: бит 0 — cell is present; бит 1 — temperature sensor is present; бит 2 — need to connect a balancing resistor to the cell; бит 3 — balancing resistor is connected to the cell; бит 4 — temperature sensor is shorted; бит 5 — wires are connected to the cell; биты 6-15 — не используются. | U16[20] |
| 0x202A-0x2051 | 40 | Array of cells voltages (V) | REAL32[20] |
| 0x2052-0x2079 | 40 | Array of cells temperatures (°C) | REAL32[20] |
| 0x207A-0x20A1 | 40 | Array of cells SOCs (%) | REAL32[20] |
| 0x20A2-0x20C9 | 40 | Array of cells resistances (Ohm) | REAL32[20] |
| 0x20F4 | 1 | Discrete input signals 2 (битовое поле): бит 0 – “Fuse 2”; бит 1 – “Fuse 3”; бит 2 – “Circuit breaker status”; биты 3-15 – не используются. | U16 |
| 0x2100-0x2101 | 2 | Battery state of charge (SOC), % | REAL32 |
| 0x2102 | 1 | Number of BMS Logic devices | U16 |
| 0x2103 | 1 | Number of cells | U16 |
| 0x2104-0x2105 | 2 | Battery voltage, V | REAL32 |
| 0x2106-0x2107 | 2 | Battery resistance, Ohm | REAL32 |
| 0x2108-0x2109 | 2 | Effective capacity, A×h | REAL32 |
| 0x210A-0x210B | 2 | Balancing effectivity, % | REAL32 |
| 0x210C-0x210D | 2 | State of health, % | REAL32 |
| 0x210E-0x210F | 2 | Depth of discharge, A×h | REAL32 |
| 0x2110-0x2111 | 2 | Minimum BMS Logic temperature | REAL32 |
| 0x2112 | 1 | Address of the BMS Logic device whose temperature is minimal | U16 |
| 0x2113-0x2114 | 2 | Maximum BMS Logic temperature | REAL32 |
| 0x2115 | 1 | Address of the BMS Logic device whose temperature is maximal | U16 |
| 0x2116-0x2117 | 2 | BMS Logic polling rate, commands pre second | REAL32 |
| 0x2118-0x2119 | 2 | Minimum cell temperature | REAL32 |
| 0x211A | 1 | Address of the BMS Logic device which is connected to the cell whose temperature is minimal | U16 |
| 0x211B | 1 | Position of the cell whose temperature is minimal | U16 |
| 0x211C-0x211D | 2 | Maximum cell temperature | REAL32 |
| 0x211E | 1 | Address of the BMS Logic device which is connected to the cell whose temperature is maximal | U16 |
| 0x211F | 1 | Position of the cell whose temperature is maximal | U16 |
| 0x2120-0x2121 | 2 | Minimum cell voltage | REAL32 |
| 0x2122 | 1 | Address of the BMS Logic device which is connected to the cell whose voltage is minimal | U16 |
| 0x2123 | 1 | Position of the cell whose voltage is minimal | U16 |
| 0x2124-0x2125 | 2 | Maximum cell voltage | REAL32 |
| 0x2126 | 1 | Address of the BMS Logic device which is connected to the cell whose voltage is maximal | U16 |
| 0x2127 | 1 | Position of the cell whose voltage is maximal | U16 |
| 0x2128 | 1 | Error flag: 0 — no errors; 1 — there are some errors. | U16 |
| 0x2130-0x2131 | 2 | Energy received from the charger, W×h | REAL32 |
| 0x2132-0x2133 | 2 | Energy consumed by the load, W×h | REAL32 |
| 0x2134-0x2135 | 2 | Energy dissipated by the balancing resistors, W×h | REAL32 |
| 0x2140 | 1 | SD-card mounting flag: 0 — not mounted; 1 — mounted. | U16 |
| 0x2141 | 1 | не используются | U16 |
| 0x2142 | 1 | не используются | U16 |
| 0x2170 | 1 | Wi-Fi connection status: 0 — no connection; 1 — connection is established. | U16 |
| 0x2171-0x2172 | 2 | IP-address in the Wi-Fi network | U8[4] |
| 0x2173-0x2175 | 3 | MAC-address of the Wi-Fi module | U8[6] |
| 0x2179-0x217A | 2 | Instant effective capacity, A×h | REAL32 |
| 0x217B-0x217C | 2 | Coulomb received from the charger, A×h | REAL32 |
| 0x217D-0x217E | 2 | Coulomb consumed by the load, A×h | REAL32 |
| 0x217F-0x2180 | 2 | Ethernet IP-address | U8[4] |
| 0x2181-0x2182 | 2 | Ethernet netmask | U8[4] |
| 0x2183-0x2184 | 2 | Ethernet gateway | U8[4] |
| 0x2185-0x2186 | 2 | Calibrated voltage in the reference line of the current sensor, V | REAL32 |
| 0x218E | 2 | Voltage from the current sensor, V | REAL32 |
| 0x2190 | 2 | Voltage in the reference line of the current sensor, V | REAL32 |
| 0x2192 | 2 | Voltage from the auxiliary current sensor, V | REAL32 |
| 0x2194 | 2 | Voltage in the reference line of the auxiliary current sensor, V | REAL32 |
| 0x219F | 2 | Charge current limit, A | REAL32 |
| 0x21A1 | 2 | Discharge current limit, A | REAL32 |
| 0x21B8 | 1 | Flag indicating that the cells are balancing | U16 |
| 0x21C6 | 2 | Calibrated voltage in the reference line of the auxiliary current sensor, V | REAL32 |
| 0x21CA | 2 | Average cell voltage, V | REAL32 |
| 0x2200-0x2203 | 4 | Record #1 from the errors journal. First 32-бит word contains a timestamp, second 32-бит word contains errors 1 flags (see 0x2007-0x2008). Timestamp format: биты 0-5 — year; биты 6-9 — month; биты 10-14 — day; биты 15-19 — hours; биты 20-25 — minutes; биты 26-31 — seconds. | U32[2] |
| 0x2204-0x2207 | 4 | Record #2 from the errors journal | U32[2] |
| 0x2208-0x227B | Records #3-31 from the errors journal | ||
| 0x227C-0x227F | 4 | Record #32 from the errors journal | U32[2] |
| 0x2300 | 1 | Number of the last record from the errors journal (1..32) | U16 |
| 0x2380 | 4 | Record data #1 from the errors journal. First 32-бит word contains errors 2 flags (see 0x200E-0x200F). | U32[2] |
| 0x2384-0x2387 | 4 | Record data #2 from the errors journal | U32[2] |
| 0x2388-0x23FB | Records data #3-31 from the errors journal | ||
| 0x23FC-0x23FF | 4 | Record data #32 from the errors journal | U32[2] |
| 0x2400 | 2 | Current measured by the auxiliary current sensor, A | REAL32 |
| 0x2402 | 2 | Final battery current, A Note — Typically it is the sum of the values measured by the main and auxiliary current sensors | REAL32 |
| 0x2410 | 1 | Battery state: 0 – Unknown; 1 – Charging ON; 2 – Charging OFF; 3 – Relaxed (after charging); 4 – Discharging ON; 5 – Discharging OFF; 6 – Relaxed (after discharging). | U16 |
| 0x2411 | 2 | Duration of the battery state (0x2410), seconds | U32 |
| 0x2420 | 2 | Nominal battery capacity, A×h | REAL32 |
| 0x2422 | 2 | Maximum charge voltage, V | REAL32 |
| 0x2424 | 2 | Minimum discharge voltage, V | REAL32 |
| 0x2426 | 2 | Maximum charge current, A | REAL32 |
| 0x2428 | 2 | Maximum discharge current, A | REAL32 |
Holding registers
| Регистр | Количество регистров | Содержимое | Тип параметра |
| 0x4000 | 1 | Address of the BMS Logic device whose parameters should be in the input registers 0x2011-0x20C9 | U16 |
| 0x4100 | 2 | Command to acknowledge errors in the errors journal (битовое поле). Each ith бит corresponds to (i+1) record. Notes: 1 – After the errors are acknowledged, the register value will be set to 0. 2 – To acknowledge all errors, set 0xFFFFFFFF. | U32 |
| 0x5100 | 1 | Software control of the "Battery cover" signal. Allowable values: 0 – clear the signal; 1 – set the signal; 2-65535 – use the physical input "Battery cover". | U16 |
| 0x5101 | 1 | Software control of the "Charger connected" signal. Allowable values: 0 – clear the signal; 1 – set the signal; 2-65535 – use the physical input "Charger connected". | U16 |
| 0x5102 | 1 | Software control of the "Power down request" signal. Allowable values: 0 – clear the signal; 1 – set the signal; 2-65535 – use the physical input "Power down request". | U16 |
| 0x5103 | 1 | Software control of the "Inhiбит charging" signal. Allowable values: 0 – clear the signal; 1 – set the signal; 2-65535 – use the physical input "Inhiбит charging". | U16 |
| 0x5104 | 1 | Software control of the "Inhiбит discharging" signal. Allowable values: 0 – clear the signal; 1 – set the signal; 2-65535 – use the physical input "Inhiбит discharging". | U16 |
| 0x5105 | 1 | Software control of the "Charging contactor feedback" signal. Allowable values: 0 – clear the signal; 1 – set the signal; 2-65535 – use the physical input "Charging contactor feedback". | U16 |
| 0x5106 | 1 | Software control of the "Discharging contactor feedback" signal. Allowable values: 0 – clear the signal; 1 – set the signal; 2-65535 – use the physical input "Discharging contactor feedback". | U16 |
| 0x5107 | 1 | Software control of the "Insulation status" signal. Allowable values: 0 – clear the signal; 1 – set the signal; 2-65535 – use the physical input "Insulation status". | U16 |
| 0x5108 | 1 | Software control of the "Charge request" signal. Allowable values: 0 – clear the signal; 1 – set the signal; 2-65535 – use the physical input "Charge request". | U16 |
| 0x5109 | 1 | Software control of the "Precharge request" signal. Allowable values: 0 – clear the signal; 1 – set the signal; 2-65535 – use the physical input "Precharge request". | U16 |
| 0x510A | 1 | Software control of the "Discharge request" signal. Allowable values: 0 – clear the signal; 1 – set the signal; 2-65535 – use the physical input "Discharge request". | U16 |
| 0x510B | 1 | Software control of the "PCH contactor feedback" signal. Allowable values: 0 – clear the signal; 1 – set the signal; 2-65535 – use the physical input "PCH contactor feedback". | U16 |
| 0x510C | 1 | Software control of the "CH/DCH contactor feedback" signal. Allowable values: 0 – clear the signal; 1 – set the signal; 2-65535 – use the physical input "CH/DCH contactor feedback". | U16 |
| 0x510D | 1 | Software control of the "Main contactor feedback" signal. Allowable values: 0 – clear the signal; 1 – set the signal; 2-65535 – use the physical input "Main contactor feedback". | U16 |
| 0x510E | 1 | Software control of the "Interlock" signal. Allowable values: 0 – clear the signal; 1 – set the signal; 2-65535 – use the physical input "Interlock". | U16 |
| 0x510F | 1 | Software control of the "Fuse 1" signal. Allowable values: 0 – clear the signal; 1 – set the signal; 2-65535 – use the physical input "Fuse 1". | U16 |
| 0x5110 | 1 | Software control of the "Fuse 2" signal. Allowable values: 0 – clear the signal; 1 – set the signal; 2-65535 – use the physical input "Fuse 2". | U16 |
| 0x5111 | 1 | Software control of the "Fuse 3" signal. Allowable values: 0 – clear the signal; 1 – set the signal; 2-65535 – use the physical input "Fuse 3". | U16 |