Skip to main content
Home
for DLMS smart meters

Main navigation

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

Breadcrumb

  1. Home
  2. Wrting Array of Objects In Java's Dlms Gurux

Wrting array of objects in java's Dlms Gurux

By zalew, 26 August, 2024
Forums
Gurux DLMS for Java

Hello, I am new to the forum and DLMS protocol and currently working on an application that uses java’s Gurux DLMS library. In my case I want to create new control action for meter called DISPLAY_CONTROL – change what is displayed on LCD. What I need to do is to write an array of objects for example [{value1; value2; value3}, ,{value4; value5; value6}] for given obis in given attribute. For that I wanted to use GXArray object filled with GXStructure objects and then write it as GXDLMSData. Is this the correct and optimal way to do it or there is dedicated class for such write like in tariff write?

Thank You for all answers and help.

Profile picture for user Kurumi

Kurumi

1 year 4 months ago

Hi, I don't know how the…

Hi,

I don't know how the meter manufacturer has implemented this, but usually data is written in the same structure as it's read.

Try to read value from the meter and then write it back. If it's working you can use GXArray and GXStructure to update the value.

BR,
Mikko

zalew

1 year 4 months ago

Hey, thanks for answer. I…

Hey, thanks for answer. I followed up your suggestion and did some research. I turns out display register is treated as GenericProfile so I tried writing it like it.
Here is my implementation of creating writing data:

private List<Map.Entry<GXDLMSObject, Integer>> prepareDisplayControlWriteData(Map<Pair<String, Integer>, List<MeterDisplayConfigurationDTO>> meterDisplayConfigurationDTOMap, MeterDriver meterDriver) {
List<Map.Entry<GXDLMSObject, Integer>> reqeust = new ArrayList<>();
meterDisplayConfigurationDTOMap.forEach((key, meterDisplayConfigurationDTOS) -> {
String obis = key.getLeft();
Integer attribute = key.getRight();
GXDLMSProfileGeneric profileGeneric = (GXDLMSProfileGeneric) meterClient.getObjects().findByLN(ObjectType.PROFILE_GENERIC, obisCode);

meterDisplayConfigurationDTOS.forEach(meterDisplayConfigurationDTO -> {
GXDLMSObject object = meterClient.getObjects().stream()
.filter(gxobjetc -> gxobjetc.getLogicalName().equals(obisCode)).findFirst().orElse(null);
profileGeneric.addCaptureObject(object, meterDisplayConfigurationDTO.getDisplayAttribute(), meterDisplayConfigurationDTO.getArrayIndex());
});
reqeust.add(new AbstractMap.SimpleEntry<>(profileGeneric, attribute));
});
return reqeust;
}
It works well if I have only one captureObject to write, but for more I get an error: Access Error: Other reason.

 
Successful communication:
00 01 00 01 00 01 00 38 60 36 A1 09 06 07 60 85 74 05 08 01 01 8A 02 07 80 8B 07 60 85 74 05 08 02 01 AC 0A 80 08 32 32 32 32 32 32 32 32 BE 10 04 0E 01 00 00 00 06 5F 1F 04 00 42 1E 5D FF FF
00 01 00 01 00 01 00 2B 61 29 A1 09 06 07 60 85 74 05 08 01 01 A2 03 02 01 00 A3 05 A1 03 02 01 00 BE 10 04 0E 08 00 06 5F 1F 04 00 00 1A 1D 02 00 00 07
61 29 A1 09 06 07 60 85 74 05 08 01 01 A2 03 02 01 00 A3 05 A1 03 02 01 00 BE 10 04 0E 08 00 06 5F 1F 04 00 00 1A 1D 02 00 00 07.
00 01 00 01 00 01 00 0D C0 01 C1 00 08 00 00 01 00 00 FF 02 00
00 01 00 01 00 01 00 12 C4 01 C1 00 09 0C 07 E8 08 1E 05 09 17 02 00 FF C4 00
00 01 00 01 00 01 00 1B C1 01 C1 00 08 00 00 01 00 00 FF 02 00 09 0C 07 E8 08 1E 05 0A 17 04 FF 80 00 80
00 01 00 01 00 01 00 04 C5 01 C1 00
00 01 00 01 00 01 00 0D C0 01 C1 00 08 00 00 01 00 00 FF 02 00
00 01 00 01 00 01 00 12 C4 01 C1 00 09 0C 07 E8 08 1E 05 09 17 04 00 FF C4 00
00 01 00 01 00 01 00 1B C1 01 C1 00 08 00 00 01 00 00 FF 02 00 09 0C 07 E8 08 1E 05 0A 17 04 FF 80 00 80
00 01 00 01 00 01 00 04 C5 01 C1 00
00 01 00 01 00 01 00 0D C0 01 C1 00 08 00 00 01 00 00 FF 02 00
00 01 00 01 00 01 00 12 C4 01 C1 00 09 0C 07 E8 08 1E 05 09 17 04 00 FF C4 00
00 01 00 01 00 01 00 1B C1 01 C1 00 08 00 00 01 00 00 FF 02 00 09 0C 07 E8 08 1E 05 0A 17 05 FF 80 00 80
00 01 00 01 00 01 00 04 C5 01 C1 00
00 01 00 01 00 01 00 0D C0 01 C1 00 08 00 00 01 00 00 FF 02 00
00 01 00 01 00 01 00 12 C4 01 C1 00 09 0C 07 E8 08 1E 05 09 17 06 00 FF C4 00
00 01 00 01 00 01 00 1B C1 01 C1 00 08 00 00 01 00 00 FF 02 00 09 0C 07 E8 08 1E 05 0A 17 06 FF 80 00 80
00 01 00 01 00 01 00 04 C5 01 C1 00
00 01 00 01 00 01 00 0D C0 01 C1 00 08 00 00 01 00 00 FF 02 00
00 01 00 01 00 01 00 12 C4 01 C1 00 09 0C 07 E8 08 1E 05 09 17 06 00 FF C4 00
00 01 00 01 00 01 00 23 C1 04 C1 01 00 07 00 00 15 00 01 FF 03 00 01 01 01 02 04 12 00 01 09 06 00 00 60 01 00 FF 0F 02 12 00 00
00 01 00 01 00 01 00 05 C5 05 C1 01 00
00 01 00 01 00 01 00 05 62 03 80 01 00
00 01 00 01 00 01 00 05 63 03 80 01 00
63 03 80 01 00

Unsuccessful communication:
00 01 00 01 00 01 00 38 60 36 A1 09 06 07 60 85 74 05 08 01 01 8A 02 07 80 8B 07 60 85 74 05 08 02 01 AC 0A 80 08 32 32 32 32 32 32 32 32 BE 10 04 0E 01 00 00 00 06 5F 1F 04 00 42 1E 5D FF FF
00 01 00 01 00 01 00 2B 61 29 A1 09 06 07 60 85 74 05 08 01 01 A2 03 02 01 00 A3 05 A1 03 02 01 00 BE 10 04 0E 08 00 06 5F 1F 04 00 00 1A 1D 02 00 00 07
61 29 A1 09 06 07 60 85 74 05 08 01 01 A2 03 02 01 00 A3 05 A1 03 02 01 00 BE 10 04 0E 08 00 06 5F 1F 04 00 00 1A 1D 02 00 00 07.
00 01 00 01 00 01 00 0D C0 01 C1 00 08 00 00 01 00 00 FF 02 00
00 01 00 01 00 01 00 12 C4 01 C1 00 09 0C 07 E8 08 1E 05 09 06 18 00 FF C4 00
00 01 00 01 00 01 00 1B C1 01 C1 00 08 00 00 01 00 00 FF 02 00 09 0C 07 E8 08 1E 05 0A 06 1A FF 80 00 80
00 01 00 01 00 01 00 04 C5 01 C1 00
00 01 00 01 00 01 00 0D C0 01 C1 00 08 00 00 01 00 00 FF 02 00
00 01 00 01 00 01 00 12 C4 01 C1 00 09 0C 07 E8 08 1E 05 09 06 1B 00 FF C4 00
00 01 00 01 00 01 00 1B C1 01 C1 00 08 00 00 01 00 00 FF 02 00 09 0C 07 E8 08 1E 05 0A 06 1B FF 80 00 80
00 01 00 01 00 01 00 04 C5 01 C1 00
00 01 00 01 00 01 00 0D C0 01 C1 00 08 00 00 01 00 00 FF 02 00
00 01 00 01 00 01 00 12 C4 01 C1 00 09 0C 07 E8 08 1E 05 09 06 1C 00 FF C4 00
00 01 00 01 00 01 00 1B C1 01 C1 00 08 00 00 01 00 00 FF 02 00 09 0C 07 E8 08 1E 05 0A 06 1B FF 80 00 80
00 01 00 01 00 01 00 04 C5 01 C1 00
00 01 00 01 00 01 00 0D C0 01 C1 00 08 00 00 01 00 00 FF 02 00
00 01 00 01 00 01 00 12 C4 01 C1 00 09 0C 07 E8 08 1E 05 09 06 1B 00 FF C4 00
00 01 00 01 00 01 00 1B C1 01 C1 00 08 00 00 01 00 00 FF 02 00 09 0C 07 E8 08 1E 05 0A 06 1C FF 80 00 80
00 01 00 01 00 01 00 04 C5 01 C1 00
00 01 00 01 00 01 00 0D C0 01 C1 00 08 00 00 01 00 00 FF 02 00
00 01 00 01 00 01 00 12 C4 01 C1 00 09 0C 07 E8 08 1E 05 09 06 1C 00 FF C4 00
00 01 00 01 00 01 00 35 C1 04 C1 01 00 07 00 00 15 00 01 FF 03 00 01 01 02 02 04 12 00 01 09 06 00 00 60 01 00 FF 0F 02 12 00 00 02 04 12 00 03 09 06 01 00 02 08 00 FF 0F 02 12 00 02
00 01 00 01 00 01 00 05 C5 05 C1 01 FA
00 01 00 01 00 01 00 05 62 03 80 01 00
00 01 00 01 00 01 00 05 63 03 80 01 00
63 03 80 01 00

Also I wasn't able to read display profile in gurux director. I am getting an error: Not enough memory to continue executing this program.

Profile picture for user Kurumi

Kurumi

1 year 4 months ago

Hi, You try to write this…

Hi,

You try to write this with SetRequestWithList. I believe that your meter doesn't support it. Try with normal write.

The meter returns invalid data if you are getting an error when you read the display profile with GXDLMSDirector.

You should ask if there is a firmware updates available to the meter.

I can check what is the issue, if you add meter response as a hex here.

BR,
Mikko

zalew

1 year 4 months ago

Hi, I followed up your…

Hi, I followed up your suggestion and tried to use write method for single object. Unfortunately I still get the same error.

Here is HEX communication with meter:

TX: 00 01 00 01 00 01 00 33 C1 01 C1 00 07 00 00 15 00 01 FF 03 00 01 02 02 04 12 00 01 09 06 00 00 60 01 00 FF 0F 02 12 00 00 02 04 12 00 03 09 06 01 00 01 08 00 FF 0F 02 12 00 01
RX: 00 01 00 01 00 01 00 04 C5 01 C1 FA

  • Create new account
  • Reset your password

Hire Us!

Latest Releases

  • Mon, 12/29/2025 - 10:38
    Gurux.Serial.Android 3.0.5
  • Mon, 12/15/2025 - 08:11
    Gurux.DLMS.Net 4.0.87
  • Fri, 12/12/2025 - 08:38
    Gurux.DLMS.Python 1.0.195
  • Thu, 12/11/2025 - 13:22
    Gurux.DLMS.Python 1.0.194
  • Thu, 12/11/2025 - 11:01
    gurux.dlms.java 4.0.88

New forum topics

  • 6-digit field values from meter not fully received (only 5 digits shown)
  • Gurux DLMS Android App
  • AMR support for bidirectional meters.
  • addition of new object in object list, meter not working
  • old meter take to much time(l&t)
More
RSS feed
Privacy FAQ GXDN Issues Contact
Follow Gurux on Twitter Follow Gurux on Linkedin