Fast Modbus/en: различия между версиями

Нет описания правки
(Новая страница: «However, it is possible to assign a high priority to an individual device or multiple devices. In this case, devices with high priority will be polled ahead of others even if their slave ID is higher. If multiple devices have a high priority, arbitration will first be conducted among them, and then among devices with low priority.»)
 
(не показано 17 промежуточных версий этого же участника)
Строка 58: Строка 58:
However, it is possible to assign a high priority to an individual device or multiple devices. In this case, devices with high priority will be polled ahead of others even if their slave ID is higher. If multiple devices have a high priority, arbitration will first be conducted among them, and then among devices with low priority.
However, it is possible to assign a high priority to an individual device or multiple devices. In this case, devices with high priority will be polled ahead of others even if their slave ID is higher. If multiple devices have a high priority, arbitration will first be conducted among them, and then among devices with low priority.


<div lang="ru" dir="ltr" class="mw-content-ltr">
It is possible to set the priority in the web interface of the controller, in the settings of the serial device driver. If any value other than "In order" is specified for the polling period parameter, the register will have a high priority.  
Установить приоритет можно в веб-интерфейсе контроллера, в настройках драйвера serial-устройств. Если в параметре период опроса '''указать любое значение отличное от «В порядке очереди»''', то регистр будет иметь высокий приоритет.
</div>


<div lang="ru" dir="ltr" class="mw-content-ltr">
Please note that for event generating registers, the time specified in the polling interval field does not matter. Event queries will be executed every 50 ms. However, the actual response time to events will depend on the number of devices on the bus and events, as well as the presence of errors. Nevertheless, this time will be significantly shorter than when using standard commands.
Обратите внимание, что для регистров генерирующих события не важно какое время указано в поле период опроса. Запрос событий будет выполняться каждые 50 мс. Но реальное время реакции на события будет зависеть от количества устройств на шине и событий, наличия ошибок. Тем не менее это время будет значительно меньше чем при опросе стандартными командами
</div>


<div lang="ru" dir="ltr" class="mw-content-ltr">
===Support for events in firmware===
===Поддержка событий в прошивках===
The table below shows the devices and firmware versions that introduced support for events.
В таблице указаны устройства и версии прошивок, в которых появилась поддержка событий.
{| border="1" class="wikitable"  
{| border="1" class="wikitable"  
! Device || Firmware version with event support
! Устройство || Версия прошивки, в которой появились события
|-
|-
| WB-MRx, WB-MWAC
| WB-MRx, WB-MWAC
Строка 76: Строка 71:
|-
|-
| WB-MDM3
| WB-MDM3
| 2.7.0 (в testing)
| 2.7.0 (in testing)
|-
|-
| WB-LED, WB-MRGBW-D
| WB-LED, WB-MRGBW-D
| 3.4.0
| 3.4.0
|-
|-
| WB-MSWx
| WB-MSWx
| 4.31.0 (в testing)
| 4.31.0 (in testing)
|-
|-
| WB-M1W2
| WB-M1W2
| 4.32.0 (в testing)
| 4.32.0 (in testing)
|-
|-
|}
|}
</div>


<div lang="ru" dir="ltr" class="mw-content-ltr">
==Scanning devices on the bus==
==Сканирование устройств на шине==
[[Image:Scan-screen.png|300px|thumb|right|Scanning devices on the ''Settings Scanning'' tab]]
[[Image: Scan-screen.png |300px|thumb|right| Сканирование устройств на вкладке ''Настройки Сканирование'']]
Usually, an installation includes several slave devices on one RS-485 bus inside a panel or in the field. Each device has an address that the user can change. During installation, the addresses of slave devices are written down from the device casing and manually entered into the master configuration. This is not very convenient.
Обычно инсталляция содержит несколько slave-устройств в щите или в поле на одной шине RS-485. Каждое устройство имеет адрес, который пользователь может менять. При монтаже адреса slave-устройств переписываются с корпуса устройства и вносятся вручную в конфигурацию мастера. Это не очень удобно.
To simplify device configuration, there is a bus scanning function. It was available in the Wiren Board controller even before the Quick Modbus extension was released. With the release of the extension, the ability to quickly scan the bus without waiting for a timeout for each non-existent address was added.
Чтобы упростить конфигурирование устройств есть функция сканирования шины. Она была доступна в контроллере Wiren Board и до выхода расширения Быстрый Modbus. С появлением расширения добавилась возможность быстро сканировать шину без необходимости выжидать таймаут для каждого несуществующего адреса.
</div>


<div lang="ru" dir="ltr" class="mw-content-ltr">
Therefore, with the Fast Modbus extension, scanning works in two modes: fast and slow.  
Поэтому с расширением Быстрый Modbus сканирование работает в двух режимах: быстрое и медленное.
</div>


<div lang="ru" dir="ltr" class="mw-content-ltr">
In slow scanning, a script is used that iterates through all possible addresses on the bus and waits for a response from them within a certain time frame. The process takes several minutes and depends on the communication settings of the devices: speed, stop bits, etc. The slow scanning mode is preserved to support devices with older firmware versions.
В медленном сканировании используется скрипт, который перебирает все возможные адреса на шине и ждет от них ответа в течение определенного времени. Процесс занимает несколько минут и зависит от настроек связи устройств: скорости, стоповых битов и т.п. Режим медленного сканирования сохранен для поддержки устройств со старыми версиями прошивок.
</div>


<div lang="ru" dir="ltr" class="mw-content-ltr">
Quick scanning is performed much faster and allows to detect devices supporting Fast Modbus almost instantly. In quick scanning mode, the master sends a broadcast request to the bus, and devices respond with data about themselves one by one. The order is determined by the arbitration.
Быстрое сканирование выполняется значительно быстрее и позволяет обнаруживать устройства поддерживающие Быстрый Modbus практически мгновенно. В режиме быстрого сканирования мастер отправляет широковещательный запрос в шину, а устройства по очереди отвечают данными о себе. Очередность определяет арбитраж.
</div>


<div lang="ru" dir="ltr" class="mw-content-ltr">
The scanning function is available in the controller's web interface under the section '''Settings Scanning'''.  
Функция сканирования доступна в веб-интерфейсе контроллера в разделе '''Настройки Сканирование'''.
</div>


<div lang="ru" dir="ltr" class="mw-content-ltr">
Current scanning capabilities in the web interface:
Текущие возможности функции сканирования в веб-интерфейсе:
*displaying all Wiren Board devices connected to the controller,
*отображение всех устройств Wiren Board, подключенных к контроллеру,
*detecting devices with identical addresses on the same bus,
*обнаружение устройств с одинаковыми адресами на одной шине,
*detecting devices with different communication parameters on the same bus.
*обнаружение устройств с разными параметрами связи на одной шине.
</div>


<div lang="ru" dir="ltr" class="mw-content-ltr">
When the scanning function is launched in the controller's web interface, it first performs a quick scan, followed by a slow scan. This can be observed in the scanning status.
При запуске функции сканирования в веб-интерфейсе контроллера сначала выполняется быстрое сканирование, затем — медленное. Это можно увидеть в статусе сканирования.
</div>


<div lang="ru" dir="ltr" class="mw-content-ltr">
===Changing Modbus Device Addresses===
===Изменение Modbus-адреса устройств===
For devices that support Fast Modbus, you can set new addresses by accessing the device using its unique serial number. This is convenient when multiple devices with the same address are detected on the bus.
Для устройств, которые поддерживают Быстрый Modbus, можно задать новые адреса, обращаясь к устройству по уникальному серийному номеру. Это удобно когда на шине обнаружено несколько устройств с одинаковым адресом.
Changing addresses is done using the ''wb-modbus-scanner'' utility and is currently not supported through the web interface. Detailed commands and the reference implementation of the utility are available in the [https://github.com/wirenboard/wb-modbus-ext-scanner utility's repository].
Изменение адресов выполняется с помощью утилиты ''wb-modbus-scanner'' и пока не поддерживается веб-интерфейсом. Описание расширенных команд и референсная реализация утилиты доступны в [https://github.com/wirenboard/wb-modbus-ext-scanner репозитории утилиты].
</div>


<div lang="ru" dir="ltr" class="mw-content-ltr">
To change the device's address, connect to the controller via [[SSH]].
Для смены адреса устройства подключитесь к контроллеру через [[SSH |SSH]].
</div>


<div lang="ru" dir="ltr" class="mw-content-ltr">
# Install the utility using the command:
#Установите утилиту командой:
#:<syntaxhighlight lang="bash">
#:<syntaxhighlight lang="bash">
apt update && apt install wb-modbus-ext-scanner
apt update && apt install wb-modbus-ext-scanner
</syntaxhighlight>
</syntaxhighlight>
#Остановите драйвер wb-mqtt-serial:
# Stop the wb-mqtt-serial driver using the command:
#:<syntaxhighlight lang="bash">
#:<syntaxhighlight lang="bash">
systemctl stop wb-mqtt-serial
systemctl stop wb-mqtt-serial
</syntaxhighlight>
</syntaxhighlight>
#Выполните команду
# Execute the command:
#:<syntaxhighlight lang="bash">
#:<syntaxhighlight lang="bash">
wb-modbus-scanner -d /dev/ttyRS485-1 -b 115200 -s 4267937719 -i 3
wb-modbus-scanner -d /dev/ttyRS485-1 -b 115200 -s 4267937719 -i 3
</syntaxhighlight>
</syntaxhighlight>
#:где,       /dev/ttyRS485-1 — порт к которому подключено устройство,
# Where, /dev/ttyRS485-1 is the port to which the device is connected, 115200 is the exchange rate, 4267937719 is the device's serial number, 3 is the new slave ID.
#:115200 — скорость обмена,  
# As a result, the following output should appear:
#:4267937719 — серийный номер устройства,
#:3 — новый slave ID.
#В результате должен появиться такой вывод:
#:<syntaxhighlight lang="bash">
#:<syntaxhighlight lang="bash">
Serial port: /dev/ttyRS485-1
Serial port: /dev/ttyRS485-1
Строка 157: Строка 129:
Change ID for device with serial  4267937719 [FE638FB7] New ID: 3
Change ID for device with serial  4267937719 [FE638FB7] New ID: 3
</syntaxhighlight>
</syntaxhighlight>
#Запустите обратно драйвер wb-mqtt-serial:
# Start the wb-mqtt-serial driver again using the command:
#:<syntaxhighlight lang="bash">
#:<syntaxhighlight lang="bash">
systemctl start wb-mqtt-serial
systemctl start wb-mqtt-serial
</syntaxhighlight>
</syntaxhighlight>
</div>


<div lang="ru" dir="ltr" class="mw-content-ltr">
=== Support for scanning in firmware ===
=== Поддержка сканирования в прошивках===
 
</div>
{| border="1" class="wikitable"
 
! Device || Firmware version where scanning was introduced


<div lang="ru" dir="ltr" class="mw-content-ltr">
{|  border="1" class="wikitable"
! Устройство || Версия прошивки, в которой появилось сканирование
|-
|-
| WB-MRx, WB-MWAC
| WB-MRx, WB-MWAC
| 1.19.0
| 1.19.0
|-
|-
| WB-MDM3
| WB-MDM3
| 2.6.0
| 2.6.0
|-
|-
| WB-LED, WB-MRGBW-D
| WB-LED, WB-MRGBW-D
| 3.2.0
| 3.2.0
|-
|-
| WB-MSx, WB-MSWx, WB-MIR, WB-M1W2
| WB-MSx, WB-MSWx, WB-MIR, WB-M1W2
| 4.23.0
| 4.23.0
|-
|-
| WB-MAI11
| WB-MAI11
| не поддерживается
| not supported
 
|-
|-
| WB-MAI6
| WB-MAI6
| 2.0.0
| 2.0.0
|-
|-
| WB-MAO4
| WB-MAO4
| 2.2.0
| 2.2.0
|-
|-
| WB-MAPx
| WB-MAPx
| 2.4.0
| 2.4.0
|-
|-
| WB-MIO
| WB-MIO
| 1.6.0
| 1.6.0
|-
|-
| WB-REF-U
| WB-REF-U
| 1.4.0
| 1.4.0
|-
|-
| WB-REF-DF
| WB-REF-DF
| 1.1.0
| 1.1.0
|-
|-
|}
|}
</div>


<div lang="ru" dir="ltr" class="mw-content-ltr">
==Useful links==
==Полезные ссылки==
* [https://habr.com/p/772308/ Upgrading Modbus: arbitration, bus scanning, events] - an article with details on implementing the extension
* [https://habr.com/p/772308/ Прокачиваем Modbus: арбитраж, сканирование шины, события] - статья с подробностями реализации расширения
* [https://github.com/wirenboard/wb-modbus-ext-scanner/blob/main/protocol.md Extension description on GitHub]
* [https://github.com/wirenboard/wb-modbus-ext-scanner/blob/main/protocol.md Описание расширения на GitHub]
* [[Modbus | Modbus protocol description]]
* [[Modbus | Описание протокола Modbus]]
* [https://github.com/wirenboard/wb-modbus-ext-scanner Scanning utility repository]
* [https://github.com/wirenboard/wb-modbus-ext-scanner Репозиторий утилиты сканирования]
</div>