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. About Segmentation Problem of Activity Calendar Day Profile

About segmentation problem of Activity Calendar day profile

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 TaeSoo_Han , 17 October, 2019
Forums
Gurux.DLMS

Dear Sir,

I checked read-method of TGXP Program and found it same of GetObjectsRequest to get sender data to meter.

When I send Activity Calendar data day profile ( array, structure of unsigned, Structure of octet string and long unsigned) to get responding data from meter, I got data using "TGXDLMSClient.GetData(reply: TBytes; data: TGXReplyData)" and it contained various kind of data like this;

resultval := Common.GetData(Reply.Data, info);
--> resultval is Tvalue data type.

Reply.Data of TGXByteBuffer is as bellows;

01 0A // Array data type, 10ea
02 02 // Structure data type, member varialbe 2ea
11 00 // Unsigned data type
01 0c // array data type 12ea
...

when I extract data from resultval of Tvalue like this
"extractdata := resultval.AsType<Tbytes>",

function TValue.AsType<T>: T;
begin
if not TryAsType<T>(Result) then
raise EInvalidCast.CreateRes(@SInvalidCast);
end;

"Invalid class typecast" exception error is occurred.

The reason of exception error is seemed to containing various data type of resultval (Tvalue type).

How can I solve this status to extract data from resultval?

Is there any function of parsing day profile of Activity Calendar?

Please comment to find best function or method.

Thanks a lot.

TaeSoo_Han

6 years 7 months ago

Sir I applied above Reply

Sir I applied above Reply.data to

Client.ParseObjects(GetReqReply.Data, True) in TGXProgram as bellows;

Reply.Data =

01 0A // Array data type, 10ea
02 02 // Structure data type, member varialbe 2ea
11 00 // Unsigned data type
01 0c // array data type 12ea
...

and enters TGXDLMSClient.ParseLNObjects(Reply.Data, true); in Gurux.DLMS.GXDLMSClient.pas.

procedure TGXDLMSClient.ParseLNObjects(buff : TGXByteBuffer; onlyKnownObjects : Boolean);
var
ot, cnt, objectCnt: Integer;
objects: TArray<TValue>;
comp : TGXDLMSObject;
info: TGXDataInfo;
begin
cnt := buff.GetUInt8(); //Check that data is in the array.
if cnt <> 1 Then
raise TGXDLMSException.Create('Invalid response.');

//Get object count
cnt := TGXCommon.GetObjectCount(buff);
objectCnt := 0;

info := TGXDataInfo.Create();
try

//Some meters give wrong item count.
while (buff.Position <> buff.Size) and (cnt <> objectCnt) do
begin
info.Clear();
objects := TGXCommon.GetData(buff, info).AsType<TArray<TValue>>;

if Length(objects) <> 4 Then
raise TGXDLMSException.Create('Invalid structure format.');
....

like above sentence, "Invalid structure Format" error is occurred, but actual result Length ( objects ) is two.

to continue ParseLNObjects function,

I disabled
"if Length(objects) <> 4 Then
raise TGXDLMSException.Create('Invalid structure format.');

but I faced in other error from
comp := CreateDLMSObject(ot, objects[1].AsType<WORD>, 0, Hobjects[2], Hobjects[3]);

by error of objects[1].AsType<WORD> by invalid type.

Please let me know its exact solution about it.

Profile picture for user Kurumi

Kurumi

6 years 7 months ago

Hi,

Hi,

I have answered for your question here:
https://www.gurux.fi/node/13899

Please, don't create multiple topics from the same question.

BR,

Mikko

TaeSoo_Han

6 years 7 months ago

I got it. Thanks a lot

I got it. Thanks a lot

  • 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