Skip to main content
Home
for DLMS smart meters
Open source solutions for DLMS smart metering

Main navigation

  • Home
  • Products
  • About us
  • Open Source
  • Community
  • Forum
  • Downloads
User account menu
  • Log in

Breadcrumb

  1. Home
  2. Forums
  3. DLMS/COSEM On Embedded Systems

DLMS/COSEM on embedded systems

Forum Rules

Before commenting read Forum rules

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

Thanks a lot guys

Elie

Profile picture for user Administrator

Administrator

14 years 6 months ago

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

elie

14 years 5 months ago

In reply to GuruxDLMS for java by Administrator

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

elie

14 years 5 months ago

In reply to GuruxDLMS for java by Administrator

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

Profile picture for user Kurumi

Kurumi

14 years 5 months ago

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

elie

14 years 5 months ago

In reply to More info by Kurumi

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

Profile picture for user Kurumi

Kurumi

14 years 5 months ago

Examples of byte array

Hi,

This is not DLMS/COSEM reply data. :-(
Can you read this value by DLMSDirector?

BR,

Mikko

elie

14 years 5 months ago

In reply to Examples of byte array by Kurumi

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

Profile picture for user Kurumi

Kurumi

14 years 5 months ago

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

elie

14 years 5 months ago

In reply to Examples of byte array by Kurumi

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!

Profile picture for user Kurumi

Kurumi

14 years 5 months ago

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

elie

14 years 5 months ago

In reply to Structure by Kurumi

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

Profile picture for user Kurumi

Kurumi

14 years 5 months ago

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

  • Create new account
  • Reset your password

Hire Us!

Latest Releases

  • Tue, 06/09/2026 - 11:16
    gurux.dlms.java 4.0.95
  • Tue, 06/09/2026 - 10:03
    Gurux.DLMS.Python 1.0.199
  • Mon, 06/08/2026 - 13:39
    gurux.dlms.cpp 9.0.2606.0801
  • Mon, 06/01/2026 - 10:15
    gurux.dlms.cpp 9.0.2606.0101
  • Thu, 05/28/2026 - 16:06
    gurux.dlms.java 4.0.94

New forum topics

  • Error reading L&G Meter
  • Pass a TCP Client to GXNet
  • Australian EDMI Mk10D (Essential Energy area)
  • Strange mix of data notificiation vs get response
  • DLMS Connection
More

Who's new

  • Tuanhgg
  • Adel
  • charnon
  • Paddles
  • Miguel Ángel
RSS feed
Privacy FAQ GXDN Issues Contact
Follow Gurux on Twitter Follow Gurux on Linkedin