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. Scalers and Units - Problem With Parsing?

Scalers and units - problem with parsing?

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 Mariusz Jędrzejewski , 21 February, 2022
Forums
Gurux DLMS for Java

Hi,

we have two meters of the same type - L+G ZMD. This type uses Short Name referencing along with HDLC interface type. We want to read scalers and units for generic profile 1.0.99.1.0.255, the base short address for this profile is 25200 (decimal). So, we have to read attribute 3 of profile and we know what registers are inside the profile.

Than, we can ask first meter for scalers and units, request is combined with short names of simple registers readed from profile:

7E A0 2C 00 02 68 47 41 FA D4 CB E6 E6 00 05 09 02 48 B0 02 25 E8 02 1D A8 02 1E 50 02 1F 08 02 24 88 02 25 38 02 2E D0 02 2E 20 64 4C 7E

Decoded byte stream:

<HDLC len="43">
<TargetAddress Value="23075"/>
<SourceAddress Value="32"/>
<!--I frame.-->
<FrameType Value="FA"/>
<PDU>
<ReadRequest Qty="9">
<VariableName Value="18608"/>
<VariableName Value="9704"/>
<VariableName Value="7592"/>
<VariableName Value="7760"/>
<VariableName Value="7944"/>
<VariableName Value="9352"/>
<VariableName Value="9528"/>
<VariableName Value="11984"/>
<VariableName Value="11808"/>
</ReadRequest>
</PDU>
</HDLC>

Meter reply:

7E A0 50 41 00 02 68 47 DE 30 44 E6 E7 00 0C 09 00 02 02 0F 00 16 FF 00 02 02 0F FE 16 1E 00 02 02 0F FE 16 1E 00 02 02 0F FE 16 20 00 02 02 0F FE 16 20 00 02 02 0F FE 16 20 00 02 02 0F FE 16 20 00 02 02 0F FE 16 1E 00 02 02 0F FE 16 1E 24 CF 7E

<HDLC len="79">
<TargetAddress Value="32"/>
<SourceAddress Value="23075"/>
<!--I frame.-->
<FrameType Value="DE"/>
<PDU>
<ReadResponse Qty="9">
<Data>
<Structure Qty="2">
<Int8 Value="0"/>
<Enum Value="255"/>
</Structure>
</Data>
<Data>
<Structure Qty="2">
<Int8 Value="-2"/>
<Enum Value="30"/>
</Structure>
</Data>
<Data>
<Structure Qty="2">
<Int8 Value="-2"/>
<Enum Value="30"/>
</Structure>
</Data>
<Data>
<Structure Qty="2">
<Int8 Value="-2"/>
<Enum Value="32"/>
</Structure>
</Data>
<Data>
<Structure Qty="2">
<Int8 Value="-2"/>
<Enum Value="32"/>
</Structure>
</Data>
<Data>
<Structure Qty="2">
<Int8 Value="-2"/>
<Enum Value="32"/>
</Structure>
</Data>
<Data>
<Structure Qty="2">
<Int8 Value="-2"/>
<Enum Value="32"/>
</Structure>
</Data>
<Data>
<Structure Qty="2">
<Int8 Value="-2"/>
<Enum Value="30"/>
</Structure>
</Data>
<Data>
<Structure Qty="2">
<Int8 Value="-2"/>
<Enum Value="30"/>
</Structure>
</Data>
</ReadResponse>
</PDU>
</HDLC>

Looks good so far. When we read values from profile, all values are re-scaled based on above scalers and everything is ok.

Second meter - we ask for scalers:

TX: 7E A0 44 00 02 80 51 41 3A AF 75 E6 E6 00 05 11 02 48 B0 02 25 E8 02 1D A8 02 1E 50 02 1F 08 02 24 88 02 25 38 02 9A F8 02 9B 88 02 9C 18 02 9C A8 02 9D 38 02 9D C8 02 2C C0 02 2D 70 02 A8 78 02 AA B8 08 68 7E

<HDLC len="67">
<TargetAddress Value="24616"/>
<SourceAddress Value="32"/>
<!--I frame.-->
<FrameType Value="3A"/>
<PDU>
<ReadRequest Qty="17">
<VariableName Value="18608"/>
<VariableName Value="9704"/>
<VariableName Value="7592"/>
<VariableName Value="7760"/>
<VariableName Value="7944"/>
<VariableName Value="9352"/>
<VariableName Value="9528"/>
<VariableName Value="39672"/>
<VariableName Value="39816"/>
<VariableName Value="39960"/>
<VariableName Value="40104"/>
<VariableName Value="40248"/>
<VariableName Value="40392"/>
<VariableName Value="11456"/>
<VariableName Value="11632"/>
<VariableName Value="43128"/>
<VariableName Value="43704"/>
</ReadRequest>
</PDU>
</HDLC>

Reply:

RX: 7E A8 50 41 00 02 80 51 D2 C2 AD E6 E7 00 0C 11 00 02 02 0F 00 16 FF 00 02 02 0F FE 16 1E 00 02 02 0F FE 16 1E 00 02 02 0F FE 16 20 00 02 02 0F FE 16 20 00 02 02 0F FE 16 20 00 02 02 0F FE 16 20 00 02 02 0F FE 16 23 00 02 02 0F FE 16 23 72 A9 7E

<HDLC len="79">
<TargetAddress Value="32"/>
<SourceAddress Value="24616"/>
<!--I frame.-->
<FrameType Value="D2"/>
<NextFrame Value="0C110002020F0016FF0002020FFE161E0002020FFE161E0002020FFE16200002020FFE16200002020FFE16200002020FFE16200002020FFE16230002020FFE1623"/>
</HDLC>

TX: 7E A0 0A 00 02 80 51 41 51 5D E9 7E

<HDLC len="12">
<TargetAddress Value="24616"/>
<SourceAddress Value="32"/>
<!--S frame.-->
<FrameType Value="51"/>
<Command Value="NextFrame"/>
</HDLC>

RX: 7E A0 44 41 00 02 80 51 D4 F7 3F 00 02 02 0F FE 16 23 00 02 02 0F FD 16 21 00 02 02 0F FD 16 21 00 02 02 0F FD 16 21 00 02 02 0F FE 16 1E 00 02 02 0F FE 16 1E 00 02 02 0F FD 16 FF 00 02 02 0F FD 16 FF C8 E4 7E

<HDLC len="67">
<TargetAddress Value="32"/>
<SourceAddress Value="24616"/>
<!--I frame.-->
<FrameType Value="D4"/>
<NextFrame Value="0002020FFE16230002020FFD16210002020FFD16210002020FFD16210002020FFE161E0002020FFE161E0002020FFD16FF0002020FFD16FF"/>
</HDLC>

At first glance, the response data stream looks very similar to previous one, but frame types are different, something like RAW data stream. Regardless, the data looks similar. But, we have a problem right here: when we read profile values, the above scalers are not applied for register values. It looks like situation when scalers are not readed from attribute 3 before readout of values from attribute 2.

Can you check if second meter replies with proper scaler and unit data, or maybe this kind of data stream is not properly parsed by the GuruX Java library? If you want more data, we're ready.

Thank you in advance!

Best regards,
Mariusz

Mariusz Jędrzejewski

4 years 3 months ago

Dupicate of http://www.gurux

Duplicate of http://www.gurux.fi/node/19715 :)

Profile picture for user Kurumi

Kurumi

4 years 3 months ago

Hi,

Hi,

The data looks correct. Are you using ReadList-method to read scalers and units from the meter?

BR,
Mikko

Mariusz Jędrzejewski

4 years 3 months ago

We are using standard

We are using standard GXDLMSSecureClient class, and code is derived from your reference GXDLMSReader example.

void readScalerAndUnits(GXDLMSProfileGeneric profileGeneric) throws Exception {
GXDLMSObjectCollection collection = new GXDLMSObjectCollection();
profileGeneric.getCaptureObjects().stream()
.filter(entry -> !driverParameters.usesShortNameReferencing() || nonNull(dlmsClient.getObjects().findBySN(entry.getKey().getShortName())))
.forEach(entry -> collection.add(entry.getKey()));
readScalerAndUnits(collection);
}

void readScalerAndUnits(GXDLMSObjectCollection objectsToRead) throws Exception {
try {
if (dlmsClient.getNegotiatedConformance().contains(Conformance.MULTIPLE_REFERENCES)) {
List<Entry<GXDLMSObject, Integer>> list = new ArrayList<>();
for (GXDLMSObject it : objectsToRead) {
chooseInstanceOfGXDLMSObject(list, it);
}
readList(list);
}
} catch (Exception e) {
dlmsClient.getNegotiatedConformance().remove(Conformance.MULTIPLE_REFERENCES);
}
}

private void chooseInstanceOfGXDLMSObject(List<Entry<GXDLMSObject, Integer>> list, GXDLMSObject it) {
if (it instanceof GXDLMSRegister) {
list.add(new GXSimpleEntry<>(it, 3));
}
if (it instanceof GXDLMSDemandRegister) {
list.add(new GXSimpleEntry<>(it, 4));
}
}

and finally:

private void readList(List<Entry<GXDLMSObject, Integer>> list) throws Exception {
if (!list.isEmpty()) {
byte[][] data = dlmsClient.readList(list);
GXReplyData reply = new GXReplyData();
List<Object> values = new ArrayList<>(list.size());
for (byte[] it : data) {
readDataBlock(it, reply);
if (reply.getValue() != null) {
values.addAll((List<?>) reply.getValue());
}
reply.clear();
}
if (values.size() != list.size()) {
throw new MeterConnectionUnsuccessfulException("Invalid reply. Read items count do not match.");
}
dlmsClient.updateValues(list, values);
}
}

From my point of view it looks like this: when collection size of objects to read is short that meter can respond in just one packet with scalers and units data, everything is fine. When collection is longer, and meter need to respond within two or more packets (when client calls chunks with NextPacket frame type), scalers are not updated. For now, that only applies to SN referencing meters and HDLC interface.

Profile picture for user Kurumi

Kurumi

4 years 3 months ago

Hi Mariusz,

Hi Mariusz,

The version 4.0.30 is released. There is one change for reading multiple values with the list method.
I hope it solves your problem.

BR,
Mikko

lukasm

4 years 3 months ago

Hello Mikko,

Hello Mikko,
We have tried to read the scallers with newest (4.0.30) Gurux version and the result is still the same:

<HDLC len="79" >
<TargetAddress Value="32" />
<SourceAddress Value="22165" />
<!--I frame.-->
<FrameType Value="D2" />
<NextFrame Value="0C110002020F0016FF0002020FFF161E0002020FFF161E0002020FFF16200002020FFF16200002020FFF16200002020FFF16200002020FFE16230002020FFE1623" />
</HDLC>
<HDLC len="12" >
<TargetAddress Value="22165" />
<SourceAddress Value="32" />
<!--S frame.-->
<FrameType Value="51" />
<Command Value="NextFrame" />
</HDLC>
<HDLC len="67" >
<TargetAddress Value="32" />
<SourceAddress Value="22165" />
<!--I frame.-->
<FrameType Value="D4" />
<NextFrame Value="0002020FFE16230002020FFE16210002020FFE16210002020FFE16210002020FFF161E0002020FFF161E0002020FFD16FF0002020FFD16FF" />
</HDLC>

Could You verify it?

Best Regards,
Lukasz

Profile picture for user Kurumi

Kurumi

4 years 3 months ago

Hi Lukasz,

Hi Lukasz,

One line modification was added to parse your data. This modification was tested when I was told that you should be able to read your meter, but it was rejected before release.

Our clients are reading old Landis+Gyr E650 meters and this modification causes those meters were not able to read anymore using with readlist method.

Your meter is working like standard defines, but this modification can't be started to use before those E650 meters can be read. I'm thinking about how to read both meters, but there is no simple solution at the moment.

Modify readScalerAndUnits and remove readList part for now. The application will read scalers one by one, but you can read all scalers without problems.

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