PC to PLC Communications - best method? Using C/C++.

M

Michael Griffin

In reply to Juan Miguel Taboada Godoy: I was interested in your Modbus library, so I had a look at the MODBUS_TCP.py and MATH_BIN.py files (MATH_BIN is imported by MODBUS_TCP). As I don't know Spanish, I am not quite sure how you intended it to be used, and if there are some other important parts to the project (I am referring to the Modbus/TCP only, not the rest of likindoy).

However, in the course of looking over the code, I noticed a few areas which could be optimised for speed. I rewrote some of the code and got the following improvements in these functions.

msg2modbus - 5.0 times faster.

modbus2msg - 15.5 times faster.

inversorbin - 9 times faster. (This is typical, but varies slightly depending upon the data).

hex1tobin - 2 to 24 times faster (depending on the data being converted). Actual speed up on real data is probably more on the order of 3 to 5 times, assuming the data contains mainly zeros. The speed of the algorithm you are using depends upon the data being converted, while the algorithm I used is linear except when errors are encountered.

bin1tohex - I would expect similar results for this function as with hex1tobin, but I didn't test it.

With the rewritten functions, the functions hextobin and zeros are no longer used (so there's no need to optimise these).

I ran both sets of algorithms side by side and got identical results from them for the same inputs over a large set of test data.

If you are interested in these results, please reply and we can discuss this further.
 
J

Juan Miguel Taboada Godoy

Yes, I am interested to check the improvements you have done to that library. You can contact me at my email address or through the Likindoy project website, and I will add your patched to the source code.

About the source code, it will be translated slowly, but first we would like to get the website translated as soon as possible.
 
Top