DLMS meter reader

15 posts / 0 new
Last post
ozkee
DLMS meter reader

Hi everyone,

I managed to connect and read data from the meter using GuruxDirector. Attached is a screenshot of my configuration for one of the meters (SerialNumber and IP are fake).

I am in the process of creating DLMS meter reader application. I successfully connected to the metter but then when I try to read all object and save them to a file I get permission errors "Access Error : Device reports Read-Write denied.".

The code I use to read data is below:

cl.open();

dlms = new GXDLMSClient();
dlms.setUseLogicalNameReferencing(false);
dlms.setInterfaceType(InterfaceType.HDLC);
dlms.setClientAddress(16);
dlms.setServerAddress(GXDLMSClient.getServerAddress(11111111)); //Tj
dlms.setAuthentication(Authentication.NONE);

GXReplyData reply = new GXReplyData();
byte[] data;
data = dlms.snrmRequest();
if (data != null)
{
readDLMSPacket(data, reply);
//Has server accepted client.
dlms.parseUAResponse(reply.getData());
}

//Generate AARQ request.
//Split requests to multiple packets if needed.
//If password is used all data might not fit to one packet.
for (byte[] it : dlms.aarqRequest())
{
reply.clear();
readDLMSPacket(it, reply);
}
//Parse reply.
dlms.parseAareResponse(reply.getData());
reply.clear();

System.out.println("DONE");

PrintWriter logFile = null;
logFile = new PrintWriter(new BufferedWriter(new FileWriter("logFile.txt")));

readAllObjects(logFile);

Can anyone help me with finding what am I doing wrong? I feel that I am really close, but obviously something is missing.

Thanks!!!

kurumi
kurumi's picture
DLMS meter reader

Hi,

You should check error code from reply.
Can you access your meter with ServerAddress 1?

BR,

Mikko

________________________________________
Mikko Kurunsaari
Gurux Ltd
Hermiankatu 6-8 H 33720 TAMPERE, FINLAND
Phone: +358 3 265 1244
Home page: http://www.gurux.org

adarsh bharadwaj
control field understanding

we are trying to read the meters using mobile app but got stuck in one place we are getting response from meter but also getting some more control field information how to check and uncheck that.
Control Field (Sending Frame Number & Receving Frame Number )

can you share some docs on this.

adarsh

kurumi
kurumi's picture
Control field understanding

Hi,

This is described on HDLC standard. I'm sorry but I do not have any docs.

BR,

Mikko

________________________________________
Mikko Kurunsaari
Gurux Ltd
Hermiankatu 6-8 H 33720 TAMPERE, FINLAND
Phone: +358 3 265 1244
Home page: http://www.gurux.org

ozkee
Read output

Mikko,

When I use 1 as an ServerAddress like so:

dlms.setServerAddress(GXDLMSClient.getServerAddress(1));

I cannot even send SNRM request.

When I use real device SerialNumber, I can connect to it and when I run readProfileGenericColumns function I get this some line saying:

Unknown object : 10032 16

Profile Generic 24800 Columns:
11200 Ch. 0 Clock object 1 | 18592 Manufacturer specific | 18592 Manufacturer specific | 18592 Manufacturer specific | 1096 Ch. 0 Error object 1 | 9440 Ch. 1 Sum Li Active power+ (QI+QIV) Time integral 1 Rate 0 (0 is total) | 7576 Ch. 1 Sum Li Active power- (QII+QIII) Time integral 1 Rate 0 (0 is total)
Profile Generic 25200 Columns:
Invalid HDLC Frame ID.

Profile Generic 53664 Columns:
Err! Failed to read columns:Access Error : Device reports Read-Write denied.

What I am trying to do is to read energy for specific date interval. Do you have any tips on how I can do this?

I really appriciate your help!

kurumi
kurumi's picture
Read output

Hi,

You should give meter serial number as a parameter for GXDLMSClient.getServerAddress.
I believe this should work for you:
dlms.setServerAddress(1);

This unknown object warning is because your meter manufacturer is using own custom object type that it's not in the standard.

I believe that 53664 profile generic is empty. There are no columns. Some meters are returning error.

You can read data between start and end time using
client.ReadRowsByRange

Check that you are using latest version:2.0.9

BR,

Mikko

________________________________________
Mikko Kurunsaari
Gurux Ltd
Hermiankatu 6-8 H 33720 TAMPERE, FINLAND
Phone: +358 3 265 1244
Home page: http://www.gurux.org

ozkee
Profile generics

Mikko,

Thanks for your tips!

There is one thing I don't fully understand. If I want to get data for Generic Profile and I have it's Short Name and Logical name, do I still have to get Association View?
Do I have to loop through all objects and use "if" statement to perform ReadRowsByRange on just one object (LN and SN are known)? Is there a really efficient way to get range data for specific objects?

Thank Mikko for your patience

kurumi
kurumi's picture
Profile generics

Hi,

If you know Logical name or short name you do not need to read association view. Association view only tells what kind of data meter can give to you. Usually we are reading association view if meter is new or firmware is changed. Then we save information to the DB. If your meter is using Logical Name referencing and you know what to read, you do not need to do this.

You can use ReadByRange or ReadByEntry methods to read profile generic data.

BR,

Mikko

________________________________________
Mikko Kurunsaari
Gurux Ltd
Hermiankatu 6-8 H 33720 TAMPERE, FINLAND
Phone: +358 3 265 1244
Home page: http://www.gurux.org

ozkee
Hi Mikko,

Hi Mikko,

I just seen your reply here. This makes sense what you said. Thank you!!!

ozkee
Mikko,

Mikko,

I encountered weird situation while reading data from the meter. When I read data from entire day I get 12h entries for clock but there is no indication weather it is AM or PM. It results with duplicate clock times. For instance right after midnight I get clock 05/16/2017 12:15 and after noon I get the same clock. Am I missing something? Should I pass any configuration function to a reading function? Is there a way to receive 24h clock entries?

Thanks Mikko

kurumi
kurumi's picture
Profile generics

Hi,

What meter you try to read? Can you send trace from sent and received bytes to me by email?

BR,

Mikko

________________________________________
Mikko Kurunsaari
Gurux Ltd
Hermiankatu 6-8 H 33720 TAMPERE, FINLAND
Phone: +358 3 265 1244
Home page: http://www.gurux.org

kurumi
kurumi's picture
Profile generics

Hi,

What time zone you are using? Check that you clock is in 24 hour format.

BR,

Mikko

________________________________________
Mikko Kurunsaari
Gurux Ltd
Hermiankatu 6-8 H 33720 TAMPERE, FINLAND
Phone: +358 3 265 1244
Home page: http://www.gurux.org

ozkee
Hi Mikko,

Hi Mikko,

Do you mean time zone and clock format on my computer? Or there is a time zone and clock format configuration on Gurux library somewhere?

Thanks!

ozkee
Hi Mikko,

Hi Mikko,

I am still struggling with this time issue. Even when I use Gurux Director I get 12-hour format time without AM/PM indicator. Any ideas how can I convert to 24-hour format or at least receive AM/PM indicator?

Oskar

kurumi
kurumi's picture
Profile generics

Hi,

Can you read your meter and send trace to me by email? What meter you try to read?

BR,

Mikko

________________________________________
Mikko Kurunsaari
Gurux Ltd
Hermiankatu 6-8 H 33720 TAMPERE, FINLAND
Phone: +358 3 265 1244
Home page: http://www.gurux.org