Don't comment the topic if you have a new question.
You can create a new topic selecting correct category from Gurux Forum and then create a new topic selecting "New Topic" from the top left.
By elie, 15 December, 2011
Hello,
I am looking for a DLMS/COSEM in Java that will work on an embedded system (CDC Foundation 1.1). What I am specifically looking for is something to decode/encode (into some java objects) the bytes received from the meter!
I can communicate with the meter, the only thing missing is to understand the data that will be sent by the meter
First of all, thanks a lot for your reply, really appreciate it!
I'll give you some details on what I need to do, this way you can have a better idea!
I already have a library (Supplied by the manufacturer) that allows us to connect to the meter and retrieve the data (for example, the reactive energy). The data we retrieve is in an array of bytes! So, what we need to do is to be able to decode the result into usable information (for example the kWh and the value of the scalar)!!
Do you guys have any pointers on how to best do this? Can the Java component help us do this?
First of all, thanks a lot for your reply, really appreciate it!
I'll give you some details on what I need to do, this way you can have a better idea!
I already have a library (Supplied by the manufacturer) that allows us to connect to the meter and retrieve the data (for example, the reactive energy). The data we retrieve is in an array of bytes! So, what we need to do is to be able to decode the result into usable information (for example the kWh and the value of the scalar)!!
Do you guys have any pointers on how to best do this? Can the Java component help us do this?
I believe that you can use GetValue-method. Can you send an example of the byte array?
We can check whether the data to be received in the expected format.
Sometimes libraries, such as you use, might remove or add extra bytes.
Thanks a lot for your replies, here are some example of byte arrays:
A byte array in response of a get value on a register of class ID 3 (value attribute):
01000600000054
A byte array in response of a get value and scalar_enum structure on a register of class ID 3 (value attribute + scalar attribute):
020006000000540002020F00161E
Why should it be 0xC4? I am not aware of the significance of this byte!
Here's my understanding of every byte:
0C : ReadResponse (this byte is not included in the array of bytes received)
02 : Response contains 2 elements
00 : First element Data
06 : First element type : Unsigned Integer32
00 00 00 54 : Value=84
00 : Second Element Data
02 : Second Element Type : Structure
02: Number of elements in the structure : 2
0F : First Element type = Integer8
00 : Value = 0
16 : Second element type = Enum
1E : Value = 30 (Wh)
I'm guessing that what is received is only the information contained in the register, everything else is stripped!
First of all, thanks a lot for your replies, and merry christmas to everybody.
Unfortunately, I was not able to test using the GXDLSDirector, I was not able to connect it to the meter (the physical connection to the meter was done via a RS485 to usb connector)
Anyways, the library that I use to connect to the meter, specifies the response(in ASN.1 format) as follows:
SEQUENCE OF Get_Data_Result
(1 per COSEM_Attribute_Descriptor)
Get_Data_Result ::= CHOICE {
data [0] Data,
data_access_error [1] IMPLICIT Data_Access_Result
}
where COSEM_Attribute_Descriptor is as defined in "COSEM application layer – IEC 62056-53"
Does this help? Can we use this to know how to decode the response which is given in a byte array format?
Usually you can see your RS485 converter as COM port and use GXDLMSDirector.
You can test this. Just start GXDLMSDirector and create new device. Select serial port and from settings you can see all available COM ports.
Now Close GXDLMSDirector, plug USB converter.
Start GXDLMSDirector and there should be one new COM port. Use that COM port to communicate with you device.
If you could tell what meter (model and manufacturer) you are using, we can help you more.
GuruxDLMS for java
Hi,
Have you try GuruxDLMS for java? It should work.
http://www.gurux.fi/GXDLMSforJava
I'm not sure about CDC. Java is not my area of expertise. :-)
Let us know if there is any problems.
BR,
Mikko
More info
First of all, thanks a lot for your reply, really appreciate it!
I'll give you some details on what I need to do, this way you can have a better idea!
I already have a library (Supplied by the manufacturer) that allows us to connect to the meter and retrieve the data (for example, the reactive energy). The data we retrieve is in an array of bytes! So, what we need to do is to be able to decode the result into usable information (for example the kWh and the value of the scalar)!!
Do you guys have any pointers on how to best do this? Can the Java component help us do this?
thanks a lot
Elie
More info
First of all, thanks a lot for your reply, really appreciate it!
I'll give you some details on what I need to do, this way you can have a better idea!
I already have a library (Supplied by the manufacturer) that allows us to connect to the meter and retrieve the data (for example, the reactive energy). The data we retrieve is in an array of bytes! So, what we need to do is to be able to decode the result into usable information (for example the kWh and the value of the scalar)!!
Do you guys have any pointers on how to best do this? Can the Java component help us do this?
thanks a lot
Elie
More info
Hi,
I believe that you can use GetValue-method. Can you send an example of the byte array?
We can check whether the data to be received in the expected format.
Sometimes libraries, such as you use, might remove or add extra bytes.
BR,
Mikko
Examples of byte array
Hello,
Thanks a lot for your replies, here are some example of byte arrays:
A byte array in response of a get value on a register of class ID 3 (value attribute):
01000600000054
A byte array in response of a get value and scalar_enum structure on a register of class ID 3 (value attribute + scalar attribute):
020006000000540002020F00161E
Thanks again guys
Elie
Examples of byte array
Hi,
This is not DLMS/COSEM reply data. :-(
Can you read this value by DLMSDirector?
BR,
Mikko
I used icube's xml translator
I used icube's xml translator (http://www.cyamon.com/xmltranslator/xml_translator.html) and it worked (I only have to add the "0C" sequence at the beginning to indicate that it is a request response)!
I will try to use the DLMSDirector and get back to you
Elie
Examples of byte array
Hi,
OK, Now value attribute look OK, but value + scalar attribute data looks strange.
Are you sure that it is 0x0C and not 0xC4 what you should add?
What meter you are using?
BR,
Mikko
Why should it be 0xC4? I am
Why should it be 0xC4? I am not aware of the significance of this byte!
Here's my understanding of every byte:
0C : ReadResponse (this byte is not included in the array of bytes received)
02 : Response contains 2 elements
00 : First element Data
06 : First element type : Unsigned Integer32
00 00 00 54 : Value=84
00 : Second Element Data
02 : Second Element Type : Structure
02: Number of elements in the structure : 2
0F : First Element type = Integer8
00 : Value = 0
16 : Second element type = Enum
1E : Value = 30 (Wh)
I'm guessing that what is received is only the information contained in the register, everything else is stripped!
Structure
Hi,
I believe that you are right. Only problem is that this is not a DLMS response. :-)
C0 01 is GET.request.normal
C4 01 is GET.response.normal
This is the reason why I asked are you sure it is not C4.
Another thing is that the number of elements is not present with two bytes.
This is the reason why I asked the manufacturer. We have to think are we going to add this behavior because it is not the standard way.
Could you read the meter with GXDLSDirector and tell can you read it?
Happy coding,
Mikko
First of all, thanks a lot
First of all, thanks a lot for your replies, and merry christmas to everybody.
Unfortunately, I was not able to test using the GXDLSDirector, I was not able to connect it to the meter (the physical connection to the meter was done via a RS485 to usb connector)
Anyways, the library that I use to connect to the meter, specifies the response(in ASN.1 format) as follows:
SEQUENCE OF Get_Data_Result
(1 per COSEM_Attribute_Descriptor)
Get_Data_Result ::= CHOICE {
data [0] Data,
data_access_error [1] IMPLICIT Data_Access_Result
}
where COSEM_Attribute_Descriptor is as defined in "COSEM application layer – IEC 62056-53"
Does this help? Can we use this to know how to decode the response which is given in a byte array format?
Thanks
Elie
Data structure
Hi,
Usually you can see your RS485 converter as COM port and use GXDLMSDirector.
You can test this. Just start GXDLMSDirector and create new device. Select serial port and from settings you can see all available COM ports.
Now Close GXDLMSDirector, plug USB converter.
Start GXDLMSDirector and there should be one new COM port. Use that COM port to communicate with you device.
If you could tell what meter (model and manufacturer) you are using, we can help you more.
BR,
Mikko