-
Notifications
You must be signed in to change notification settings - Fork 1k
Description
Versions
- Python: 3.6
- OS: Mac OS X 10.13
- Pymodbus: v1.3-branch-python3-plus-pull74, v1.4 pip install, v1.5 pull
- Modbus Hardware (if used): 3x Maxwell MTA-48 PIDs
Pymodbus Specific
- Server: ---
- Client: rtu sync
Description
This issue popped on using pymodbus within the Artisan open-source roast logging app https://github.com/artisan-roaster-scope/artisan. In the use case here, the user configured the app to harvest the product value (PV) from all three PIDs every 2 sec, triggering Artisan to invoke master.read_holding_registers().
On moving Artisan from Py2 to Py3 a while ago, first a variant of the pymodbus python3 branch was used, patched with the pull74 patch as well as some other minor modifications. The exact version used can be generated by applying the patch https://github.com/artisan-roaster-scope/artisan/tree/master/src/patches to the python3 branch of pymodbus.
That worked quite well. However, updating pymodbus via pip to v1.4 (and now also to the v1.5 Pull #285 ) resulted in flaky communication (lots of errors and drop-outs on the application level, including swap of data between channels).
Code and Logs
I activated logging via
import logging
import logging.handlers as Handlers
logging.basicConfig()
myFormatter = logging.Formatter('%(asctime)s - %(message)s')
log = logging.getLogger()
log.setLevel(logging.DEBUG)
filehandler = Handlers.RotatingFileHandler(os.getenv("HOME") + "/Desktop/artisan-logfile-1.3-patched.txt
[artisan-logfile-1.4.txt](https://github.com/riptideio/pymodbus/files/1925147/artisan-logfile-1.4.txt)
", maxBytes=1024*1024)
filehandler.setFormatter(myFormatter)
log.addHandler(filehandler)
# Artisan logger
_logger = logging.getLogger('Artisan')
to the Artisan source and forwarded 3 builds to that user to run on his setup and returning the corresponding log files (had to add logging of send/recv to the pymodbus-v1.3 variant to match the other two versions).
- pymodbus v1.3-patched: artisan-logfile-1.3-patched.txt
- pymodbus v1.4 (pip): artisan-logfile-1.4.txt
- pymoodbus v1.5 (Pull Pymodbus 1.5.0 #285 ): artisan-logfile-1.5.txt
I see that the v1.3-patched variant does not contain any trace of a communication error. The resulting data looks flawless. The v1.4 variant contains errors and the pymodbus lib internal retry seems never to be successful. The retry on the Artisan app level mostly succeeds, but not always. The v1.5 variant contains lots of errors, some Python unpack errors and some typos (TRANSCATION_COMPLETE).
Hope we can work that out as we would love to upgrade to an official pymodbus release soon. Note that Artisan is used with a wide range of PLCs and PIDs via MODBUS RTU/TCP/RTU and otherwise runs flawless.
Let me know if you need more information or we can run more tests. Note that I don't have access to that hardware, but the owner (in another country) is quite supportive.