Modbus data processing
I'm trying to set a sensor network using modbus data sources. I've runned into some problems regarding data processing.
It seems that mango isn't reacting to different Multiplier / Additive settings in "Modbus locator properties". I've tried restarting, disabling/enabling of a point and nothing seemed to help.
The second problem I've figured out is in the "Modbus data type" setting. Even if I set it to "2 byte unsigned integer" the data are processed as *signed.
For example: input data 0xFFF0 --> reads as -16
Is there some solution for this or I'm doing something wrong?
Thanks for pointing out these problems. They are in fact bugs that have now been fixed and will be in an incremental release that we will make available soon (probably within a week or so).
In particular, the multiplier/additive fields were not actually implemented in the data source; this has now been corrected. Numeric values read from the Modbus network will be multiplied and added to. Numeric values that are set in the network will be divided and subtracted from. Note that for the latter case the number that is set by the user will be logged even if that is not the actual number that the network accepts (e.g. fractional values that are discarded by integer registers.)
The data type conversion problem was caused by the Modbus library due to missing "& 0xff" operations. This too has been fixed.
Watch for release 0.8.1 for these fixes and other minor changes.
Thanks for a reply, I'm glad to help improving Mango :-)
If you have time, please look on another problem I've found out.
Imagine I have a light bulb and a light switch. Light switch is implemented via modbus holding register (write only) and a light bulb is represented as modbus input register (read only). I have also a light sensor connected as modbus input register (read only).
Then I set an event handler : if a light sensor value is below 'X' switch on the light. If above some value 'Y' switch it off.
If I'm switching a light manually with writing '0' or '1' to holding register, everything is working. But the change caused by event handler isn't processed. The number related to holding register changes, but the event isn't send to modbus master.
Nice catch. The set point handler was calling an incorrect API to update the point value. I've attached a patch which should fix the problem for you. Please let me know if it does. Just overwrite the existing class files with the one in the zip.
Attachment: download link
BTW, that patch will likely only work with version 0.8.1. Make sure you upgrade first before you install it.
It needs longer testing, but for now I can say it's ok.
Multiplication / addition and also events are processed fine. Thanks!
Glad to hear. Thanks for the feedback Radek.