Adding UNICAST device to HAH livebox
My house lighting is controlled by a PLC that is not a xAP device at all. I've managed to write a custom xAP stack for it (in CodeSys ST language), but still - it was not accepting broadcast messages like 192.168.1.255. To solve this I created a simple lua applet that intercepts broadcast messages to the specific target (khome.PLC.41) and sends UDP datagram directly to PLC IP (192.168.1.50)
Attachment | Size |
---|---|
plchelperApplet.lua | 738 bytes |
I found this http://www.opendax.org/ which also has a set of LUA binding for the C backend modules once of which is MODBUS. Might be worth looking into.
Anyway let me know how you get one this might be worth rolling into the code base.
Brett
You know what I think? A set of LUA wrappers around http://libmodbus.org would be the way to go, this is by far the most stable and best modbus library out there. Writing a high level set of LUA API's onto this would give power and simplicity with code that is already proven to be stable and reliable.
Which brings me to this http://think-deep.com/wiki/freesigs/start looks like he has the same idea and has already done all the API wrappings - this would do nicely.
Although what he does is use LUA as an internal scripting language to a C driver which runs as a daemon. We should be able to work with that as all the xAP code for us is written in pure LUA - it should just work(tm).
What do you thing?
I've always liked MODBUS. It reminds me of the good old days when I programmed avionic units using 1553B. No doubt that adding this sort of thing to the HAH would up our game.
The Lua wrappers from Freesignals look neat.
Of course, the main problem is the cost of establishing a decent test framework for MODBUS. e.g. check http://www.ebay.co.uk/itm/WAGO-750-841-ETHERNET-TCP-IP-PROG-FIELDBUS-/251002788148?pt=UK_BOI_Industrial_Automation_Control_ET&hash=item3a70ee9934#ht_500wt_950
This gives us 10 inputs and ten outputs for £3196 (£159 per I/O). Compare with a HAH and our PPE expander giving 32 I/Os for under £75 (£2.34 per I/O)!
Derek
p.s. OK, I concede that the WAGO unit has nicer connectors
Perhaps I am over simplifying a little but I would think a framework something like this would suffice. I'm not sure why you are polling for the INFO message. The BSC framework takes care of all this nitty gritty for you. Or maybe you didn't notice this.
This i really rough and there are a few things I've not considered but to keep it simple, I've made sweeping assumptions. The devil is in the detail.... :)
Brett
Attachment | Size |
---|---|
modbusApplet.lua | 1.31 KB |
vores8 that is nicely done, so much control, so little code. Love it. I'll take those thanks :)
What you might want to do then is use LUA to create a BSC endpoint that is synthetic for this PLC and that will act as a bridge for its native control protocol. Then you can treat it like an xAP device and not have to worry about the unicast/broadcast issues, it will also then integrate nicely with the whole xAP stack.
Nice job on the socket capture and redirect thuo.
This would be even cooler.
Brett