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. How To Generate Frame From DLMS Server?

How to generate frame from DLMS server?

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 purvesh gaudani , 17 June, 2022
Forums
Gurux.DLMS

we are using GuruX C library

Following is the flow of our system
Meter<->Controller<->Gateway<->Cloud

We have implemented dlms client in Controller to read the data from Real Meter. we have successfully implemented client and reading data from real meter. meter is providing data and controller is parsing the dlms data to fetch the correct values.

Reading Values from meter are Voltage, Current, PF, Frequency, kWh, kVAh, power in kW, kVA, kVAr.

So, to generate the DLMS frame for the values(received from real meter) we require DLMS Sever in controller. we have implemented the server but we don't know how to generate the DLMS frame for the values we have received from meter and parsed in controller. We need to transmit DLMS frame to the cloud.

can DLMS server generate frame with obis code from values only?
can you please provide steps to generate the frame? is there a common API in server for all the values to generate the frame?

Profile picture for user Kurumi

Kurumi

3 years 11 months ago

Hi,

Hi,

You need to implement the server and the client. You need to listen svr_preRead and then client reads value from the meter. Value is updated to e->value. You also need to set e->handled = 1;.

Check how clock is read and implement it in the same way.
https://github.com/Gurux/GuruxDLMS.c/blob/cf7c1bdd47287ac0a95fb439b1207…

BR,
Mikko

purvesh gaudani

3 years 11 months ago

Thanks for the reply,

Thanks for the reply,

I've checked svr_preRead API by clicking shared link. I've doubt how client should pass the value to the server for generate the DLMS frame? link does not have those details or might I'm not understanding it correctly. can you please help me to understand in detail?

For instance, client has value of voltage=230. now how to pass that value to the server to generate the voltage dlms frame?

Profile picture for user Kurumi

Kurumi

3 years 11 months ago

Hi,

Hi,

You don't need to care from DLMS frame. You just give the value for the server what it needs to return. It might be that meter and HES are using different settings (ex. frame size or PDU size or interface type). All those settings cause you to need to implement the server for the HES and client for the meter.

Because this seems to be a hot topic, a VERY simple example is done in the next week for Windows where are a client and a server implemented.

BR,
Mikko

purvesh gaudani

3 years 11 months ago

Following is the source from

Following is the source from the shared link

if (e->target == BASE(clock1) && e->index == 2)
{
gxtime dt;
time_now(&dt, 1);
if (e->value.byteArr == NULL)
{
e->value.byteArr = (gxByteBuffer*)gxmalloc(sizeof(gxByteBuffer));
bb_init(e->value.byteArr);
}
e->error = cosem_setDateTimeAsOctetString(e->value.byteArr, &dt);
e->value.vt = DLMS_DATA_TYPE_OCTET_STRING;
e->handled = 1;
}

will above source encodes the obis code for the value? Our HES is only understands the obis code. it parse the data on the basis of the obis code. so, we need to encode obis code with the value from controller.

Profile picture for user Kurumi

Kurumi

3 years 11 months ago

Hi,

Hi,

OBIS code is not sent back on the reply message in the DLMS protocol if that is not part of the content.

BR,
Mikko

purvesh gaudani

3 years 11 months ago

understood. if client provide

understood. if client provide obis code to the server than can server encode it in dlms format(just like value)?

Profile picture for user Kurumi

Kurumi

3 years 11 months ago

Hi,

Hi,

Obis code is sent in part of write, read or action methods. Obis code can also be part of the content of the data and the server can handle it.

BR,
Mikko

purvesh gaudani

3 years 11 months ago

so, let's say if we want to

so, let's say if we want to provide voltage obis code "1.0.12.7.0.255" and voltage value=230 to the dlms server to perform the encode operation than which API we should use to pass the value to sever?

Profile picture for user Kurumi

Kurumi

3 years 11 months ago

Hi,

Hi,

You need to create a register object with OBIS code "1.0.12.7.0.255". If you want to use hard-coded value it can be set on initializing. If you want to update the value in reading, you can set it in svr_preRead method.

BR,
Mikko

purvesh gaudani

3 years 11 months ago

understood. we have use

understood. we have use voltage=10 to call svr_preRead API and it generates this value 200023a0, doesn't look like a correct encoding. can you verify and confirm are we on correct path or not?

Profile picture for user Kurumi

Kurumi

3 years 11 months ago

Hi,

Hi,

Just to make sure: You don't call the svr_preRead.
You can update value like this in the svr_preRead

GX_UINT16(activePowerL1.value, 230);

OR if you use reference you can update the value like this:
activePowerL1Value = 230;

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