Thank you so much @mbs38!
fixing logging
Regarding your logging configuration, can you please remove multiple definitions for the same logger. Now you have:
<logger name="net.wimpi.modbus" level="DEBUG" />
<logger name="net.wimpi.modbus" level="TRACE" />
<logger name="net.wimpi.modbus" level="INFO" />
Leave just the TRACE
:
<logger name="net.wimpi.modbus" level="TRACE" />
This explain the missing log statements.
why debug and non-debug are different
(everything is a theory of course… unless proven otherwise )
Indeed, that feels weird but I believe the explanation is still the natural one: the delay introduced by all the logging makes the duration between transactions larger which again reduces the errors we get with the serial device. The difference between “non-debug” and “debug” configurations vanishes when the inter transaction delay is increased from the 10ms since then the modbus binding waits couple of milliseconds to ensure enough delay between transactions. It should be highlighted that the inter transaction delay does nothing if enough time has passed since the transaction – it only waits if previous transaction was just executed. Perhaps I should consider renaming the parameter…
As mentioned in the summary, best performance you got out with a single slave was ~24ms/transaction – even though the inter transaction delay parameter was set to 10ms. This means that due to read/write taking time, roughly 14ms goes just to that. In fact, some sort ideal performance was witnessed in my “virtual null modem” test, where IO took basically all the time (11ms to read modbus response, ~1ms to overhead in the binding to facilitiate next transactions).
Still, it beats to me why multiple slaves has different performance and different issues than single slave configuration – even though the time between transactions is the same (for example, 25ms). This is why I asked you to clarify the devices you are serving behind /dev/ttyS0. If the devices are different, the multi-slave might not be comparable with single-slave test.
Let me suggest next steps
1. please run single slave configuration with logging fixed (see above). Use this configuration:
modbus:poll=5
modbus:serial.slave1.connection=/dev/ttyS0:38400:8:none:1:rtu:280:35
modbus:serial.slave1.id=247
modbus:serial.slave1.start=42
modbus:serial.slave1.length=14
modbus:serial.slave1.type=holding
Do not have any rules in openhab. Have this item only, nothing else:
Number Slave1Item1 "slave1 (modbus) [%d]" {modbus="slave1:0"}
2. please run multiple slave configuration, with logging fixed, repeating same slave definition with different names
Use this configuration (13 identical slaves with 35ms inter transaction delay). Do not have any rules. Have these items only, nothing else:
Number Slave1Item1 "slave1 (modbus) [%d]" {modbus="slave1:0"}
Number Slave2Item1 "slave2 (modbus) [%d]" {modbus="slave2:0"}
Number Slave3Item1 "slave3 (modbus) [%d]" {modbus="slave3:0"}
Number Slave4Item1 "slave4 (modbus) [%d]" {modbus="slave4:0"}
Number Slave5Item1 "slave5 (modbus) [%d]" {modbus="slave5:0"}
Number Slave6Item1 "slave6 (modbus) [%d]" {modbus="slave6:0"}
Number Slave7Item1 "slave7 (modbus) [%d]" {modbus="slave7:0"}
Number Slave8Item1 "slave8 (modbus) [%d]" {modbus="slave8:0"}
Number Slave9Item1 "slave9 (modbus) [%d]" {modbus="slave9:0"}
Number Slave10Item1 "slave10 (modbus) [%d]" {modbus="slave10:0"}
Number Slave11Item1 "slave11 (modbus) [%d]" {modbus="slave11:0"}
Number Slave12Item1 "slave12 (modbus) [%d]" {modbus="slave12:0"}
Number Slave13Item1 "slave13 (modbus) [%d]" {modbus="slave13:0"}
In both cases, it is enough to store debug level logs only. Please let it run for 10secs at least so
we get good picture of the performance.
For the tests it is important that the slave definitions are identical in both single-slave and multi-slave configurations. This should make situations more comparable.
If you please do these steps we should have much much better understanding what is going on.