ERROR- Unable to cast object of type 'Gurux.DLMS.GXBitString' to type 'System.Object[]'

6 posts / 0 new
Last post
PaulAdebo
ERROR- Unable to cast object of type 'Gurux.DLMS.GXBitString' to type 'System.Object[]'

Hello,

I am using the GXDLMSDirector to test my DLMS implementation in my smart meters, however, I see an error when my objects are more than 128. Can I know why the GXDLMSDirector gives such an exception?

This happens when I try to connect to the DLMS meter, and the GXDLMSDirector is reading the object list.

I checked the log (below), and it's seems nothing is wrong as I could see that the entire object list was sent, so why do I keep getting this error.

If I reduce the object list to 128, everything seems okay.

Thanks.

N.B: Did not see how else to attach the log below

Kurumi
Kurumi's picture

Hi,

Your object count is invalid. Your data:
01
81 //FIX THIS:
0204120008110009060000010000FF0202010902030F0116010002030F0216010002030F0316010002030F0416000002030F05160000

When it should be:
01
82 //FIX THIS:
0204120008110009060000010000FF0202010902030F0116010002030F0216010002030F0316010002030F0416000002030F05160000

I'll remove your original trace from here.

BR,
Mikko

________________________________________
Mikko Kurunsaari
Gurux Ltd
http://www.gurux.fi

PaulAdebo

Hi Mikko,

Thanks for the response.

However, I am not sure I understand what you mean. Can you please explain further?

The frame
01
81 //FIX THIS:
0204120008110009060000010000FF0202010902030F0116010002030F0216010002030F0316010002030F0416000002030F05160000
is for 129 objects (0x81), and my object count is actually 129. Is this not correct?

If I reduce my object count to 128 I see
7E A0 4E 21 03 52 5E 9F E6 E7 00 C4 02 C1 00 00 00 00 01 00 38
01
80 //128 Objects
02 04 12 00 08 11 00 09 06 00 00 01 00 00 FF 02 02 01 09 02 03 0F 01 16 01 00 02 03 0F 02 16 01 00 02 03 0F 03 16 01 00 02 03 0F 04 16 00 00 02 03 0F 05 16 00 00 B3 0C 7E

..and everything works fine.

But once I add another object I get the error.

Thanks
Paul.

Regards,
Paul Adebo.

Kurumi
Kurumi's picture

Hi,

Your object count is wrong. You can add max 127 objects with one byte. After that, you need to use two bytes. You need to check this from DLMS specifications.
If you want to add 128 bytes you need to add count with two bytes:
81 80

BR,
Mikko

________________________________________
Mikko Kurunsaari
Gurux Ltd
http://www.gurux.fi

PaulAdebo

Hi Mikko,

Thanks for your comment.

So I got working, just including the 0x81.

Can you kindly point me to the exact part of the DLMS specs that addresses this? I have look through the green book, but still cant find where this is explained.

I also used the GXDLMSDirector to read another known meter, can you help explain the frame (81 B3 01 82 01 D1) as should below.

14:49:44 --- Collecting objects. ---
2:49:44 PM Collecting objects
7E A0 19 03 23 32 DF EB E6 E6 00 C0 01 C1 00 0F 00 00 28 00 00 FF 02 00 91 53 7E

2:49:44 PM
7E A8 89 23 03 52 3E 1C E6 E7 00 C4 02 C1 00 00 00 00 01 00

81 B3 01 82 01 D1 // What does this mean? I was expecting to see just the object count here

02 04 12 00 01 11 00 09 06 00 00 80 81 00 FF 02 02 01 02 02 03 0F 01 16 01 00 02 03 0F 02 16 03 00 01 00 02 04 12 00 01 11 00 09 06 00 00 80 82 00 FF 02 02 01 02 02 03 0F 01 16 01 00 02 03 0F 02 16 03 00 01 00 02 04 12 00 01 11 00 09 06 00 00 80 83 00 FF 02 02 01 02 02 03 0F 01 16 01 00 02 03 0F 02 16 03 00 01 00 02 04 12 00 01 B2 2E 7E

Thanks
Paul.

Regards,
Paul Adebo.

Kurumi
Kurumi's picture

Hi Paul ,

I'm sorry, but I can't remember the exact spot because I haven't needed this for years.

That is the length of the block (0xB3) and the amount of the items (0x01D1).

BR,
Mikko

________________________________________
Mikko Kurunsaari
Gurux Ltd
http://www.gurux.fi