rscada / libmbus

Meter-bus library and utility programs
http://www.rscada.se/libmbus
BSD 3-Clause "New" or "Revised" License
224 stars 138 forks source link

mbus-tcp-request-data / mbus-tcp-request-data-multi-reply #97

Open t006 opened 8 years ago

t006 commented 8 years ago

Here I have a ABB CEM 05100 reading a B23 212-100 meter. mbus-tcp-request-data is working perfectly, however mbus-tcp-request-data-multi-reply failed to receive any data. When I login into the web interface of the CEM I can see a lot more frames. Any idea?

mbus-tcp-request-data-multi-reply -d 192.168.2.43 6021 1 int init_slaves(mbus_handle *): debug: sending init frame #1 [2016-03-28 06:55:01] SEND (005): 10 40 FD 3D 16 int init_slaves(mbus_handle *): debug: sending init frame #2 [2016-03-28 06:55:06] SEND (005): 10 40 FD 3D 16 [2016-03-28 06:55:06] SEND (005): 10 7B 01 7C 16 int mbus_sendrecv_request(mbus_handle *, int, mbus_frame *, int): Failed to receive M-Bus response frame. Failed to send/receive M-Bus request.

`mbus-tcp-request-data -d 192.168.2.43 6021 1 [2016-03-28 06:55:19] SEND (005): 10 7B 01 7C 16 [2016-03-28 06:55:20] RECV (149): 68 8F 8F 68 08 01 72 83 52 07 00 42 04 20 02 36 20 00 00 0E 84 00 03 00 00 00 00 00 8E 40 84 00 00 00 00 00 00 00 04 FF A0 15 00 00 00 00 04 FF A1 15 00 00 00 00 04 FF A2 15 00 00 00 00 04 FF A3 15 00 00 00 00 07 FF A6 00 00 00 00 00 00 00 00 00 07 FF A7 00 06 00 00 00 00 00 00 00 07 FF A8 00 00 00 B6 21 1B 00 00 00 07 FF A9 00 B0 0D D9 00 00 00 00 00 0D FD 8E 00 07 30 2E 37 31 2E 31 42 0D FF AA 00 0B 30 30 31 2D 32 31 32 20 33 32 42 1F 26 16 int mbus_frame_print(mbus_frame *): Dumping M-Bus frame [type 4, 149 bytes]: 68 8F 8F 68 08 01 72 83 52 07 00 42 04 20 02 36 20 00 00 0E 84 00 03 00 00 00 00 00 8E 40 84 00 00 00 00 00 00 00 04 FF A0 15 00 00 00 00 04 FF A1 15 00 00 00 00 04 FF A2 15 00 00 00 00 04 FF A3 15 00 00 00 00 07 FF A6 00 00 00 00 00 00 00 00 00 07 FF A7 00 06 00 00 00 00 00 00 00 07 FF A8 00 00 00 B6 21 1B 00 00 00 07 FF A9 00 B0 0D D9 00 00 00 00 00 0D FD 8E 00 07 30 2E 37 31 2E 31 42 0D FF AA 00 0B 30 30 31 2D 32 31 32 20 33 32 42 1F 26 16 <?xml version="1.0" encoding="ISO-8859-1"?>

``` 75283 ABB 32 Electricity 54 20 0000 Instantaneous value 0 Energy (10 Wh) 3 2016-03-28T06:55:20 Instantaneous value 0 0 1 Energy (10 Wh) 0 2016-03-28T06:55:20 Instantaneous value 0 Manufacturer specific 0 2016-03-28T06:55:20 Instantaneous value 0 Manufacturer specific 0 2016-03-28T06:55:20 Instantaneous value 0 Manufacturer specific 0 2016-03-28T06:55:20 Instantaneous value 0 Manufacturer specific 0 2016-03-28T06:55:20 Instantaneous value 0 Manufacturer specific 0 2016-03-28T06:55:20 Instantaneous value 0 Manufacturer specific 6 2016-03-28T06:55:20 Instantaneous value 0 Manufacturer specific 116529692672 2016-03-28T06:55:20 Instantaneous value 0 Manufacturer specific 14224816 2016-03-28T06:55:20 Instantaneous value 0 Firmware version B1.17.0 2016-03-28T06:55:20 Instantaneous value 0 Manufacturer specific B23 212-100 2016-03-28T06:55:20 More records follow 2016-03-28T06:55:20 ``` `
lategoodbye commented 8 years ago

Do you have the same behavior on requesting the secondary address of the B23 212-100?

t006 commented 8 years ago

Yes, same story

t006 commented 8 years ago

The multi-reply fails on Debian@armv7, Freebsd@intel. However it succeeds on Debian@intel/virtualbox. On all tested platforms mbus-tcp-request-data succeeds

lategoodbye commented 8 years ago

@t006 Could you please try the following patch?

https://gist.github.com/lategoodbye/79f8b487d78522cdaaeb0de8c857d2a7

arska commented 8 years ago

Although on page 210 the manual at https://library.e.abb.com/public/94eba55dce8048e6b6e6fcff264a3163/2CMC484001M0201.pdf mentions the meter can be stateful in the M-Bus answers and should be properly reset (where #95 would come in) I don't think this applies here as according to the debug output both applications send out "10 7B 01 7C 16" as the last command and the meter answers to one but not the other. Lets see if the timing helps or if the request just doesn't make it all the way to the reader and needs to be repeated. @t006 what do you mean by "When I login into the web interface of the CEM I can see a lot more frames" ? Screenshot ?

Cheers, Aarno