Comments (6)
Hello,
I agree that the behaviour should be what you are expecting.
I've just pushed a new version with a new unit-test that tries to reproduce
your problem.
Can you please try to get it and run:
python functest_modbus_rtu.py RtuTestQueries.testWriteMultipleCoilsIssue23
Does the test pass? In my case, it is ok and the queries seems to be what you
are expecting.
Did you notice similar issue on other function codes?
Best
luc
Original comment by [email protected]
on 11 Oct 2011 at 9:20
- Changed state: Started
from modbus-tk.
Hello,
Thanks for the quick reaction. I did the test connecting two of my serial ports
one to each other. The request now looks how it should be, however the test
failed. The output is following:
Hello
RtuMaster COM6 is opened
RtuServer COM1 is opened
-> 10-15-0-0-0-32-4-204-204-204-204-75-150
-->10-15-0-0-0-32-4-204
handle request failed: Invalid CRC in request
<--129-4
-->204-204-204-75-150
handle request failed: Invalid CRC in request
<--129-4
<- 129-4-129-4
Emodbus_tk.modbus_rtu.RtuServer has stopped
======================================================================
ERROR: testWriteMultipleCoilsIssue23 (__main__.RtuTestQueries)
Write the values of a multiple coils and check that it is correctly written
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Documents and Settings\Petar\Desktop\functest_modbus.py", line 287, in testWriteMultipleCoilsIssue23
result = self.master.execute(10, modbus_tk.defines.WRITE_MULTIPLE_COILS, 0,output_value=[0, 0, 1, 1]*8)
File "C:\Documents and Settings\Petar\Desktop\modbus_tk\utils.py", line 26, in new
raise excpt
ModbusInvalidResponseError: Response address 129 is different from request
address 10
----------------------------------------------------------------------
Ran 1 test in 1.203s
FAILED (errors=1)
---
One more thing: unittest.sys.argv is somehow not valid for me, so I used only
"sys.argv" instead.
I forget to mention, I use Python 2.7
Original comment by [email protected]
on 11 Oct 2011 at 12:04
from modbus-tk.
OK it seems that there is a "blank" on the serial link and that it causes the
rtu server to see 2 different queries.
Can you try to increase the serial timeout by changing the value of
server._serial.interCharTimeout and server._serial.timeout
I've pushed a new version when timeout is set to 5*to rather that 1.5*to (which
seems wrong). May be it is noot enough?
Tell me if it fix the issue.
Best
luc
Original comment by [email protected]
on 12 Oct 2011 at 6:07
- Changed state: Accepted
from modbus-tk.
So, I did some tests with my own code. I played a bit wit the two
aforementioned parameters and found out, that the best working solution is:
self._serial.interCharTimeout = 1.5 * self._t0 #Line 148
self._serial.timeout = 10 * self._t0 #Line 149
If .timeout is above 5 and less than 10, it's still working, but from time to
time it's splitting again some queries.
I've just tested with FC5, FC6 and FC16 commands and they are working fine too.
BR
Petar
Original comment by [email protected]
on 12 Oct 2011 at 7:32
from modbus-tk.
Hello Petar,
I am ok to increase this timeout to 10*to.
I will commit and publish a new version soon.
Thanks for feedback and your contribution to modbus-tk.
Best
luc
Original comment by [email protected]
on 12 Oct 2011 at 7:46
- Changed state: Fixed
from modbus-tk.
modbus-tk 0.4.2 has been released and fix the problem
Original comment by [email protected]
on 12 Oct 2011 at 8:30
- Changed state: Verified
from modbus-tk.
Related Issues (20)
- The global lock can be replaced by `self.lock` in `Master.execute`
- Raising ModbusException in modbus.Slave.handle_request doesn't work
- Transmitting a modbus tcp broadcast message halts other communication for 200-300 ms
- Response address xxx is different from request address 33
- Is there a function that flags when the TCPServer receives a packet? HOT 2
- RTU Server periodically only interprets the first byte of a request.
- Latest modbus.py/Master.execute() fails to decode. HOT 7
- simulator.py/RpcHandler() needs encode/decode to work these days HOT 1
- Project dependencies may have API risk issues HOT 1
- Make a new release and release it on PyPI HOT 4
- When "data_format='f'",Invalid CRC in response HOT 7
- how to use the utils.calculate_crc() HOT 1
- Result is wrongly decoded instead of unpacked after PR #148 HOT 1
- ModbusInvalidResponseError: Invalid CRC in response HOT 2
- modbus_tk.exceptions.ModbusInvalidResponseError: Invalid CRC in response
- modbus sever IP HOT 1
- the float value is moved forward by one register
- API docs HOT 1
- Poor quality of communications
- Submit a new version
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from modbus-tk.