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. Raw Values (scaled) of Registers and of The Registers Inside Profiles Generic

raw values (scaled) of registers and of the registers inside profiles generic

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 wildstray , 17 December, 2021
Forums
Gurux.DLMS

Hi Mikko,
is there a better way to obtain pure values compared to mine? It "just works" but probably there are already helper functions for this... especially for scalers... is there "something automatic" in C as like as the Python version?

(... here is the com_reads of index 2 and 3 of gxobject *it... )

case DLMS_OBJECT_TYPE_EXTENDED_REGISTER:
{
gxExtendedRegister *reg = (gxExtendedRegister*)it;
Serial.println(reg->value.vt);
switch(reg->value.vt) {
case DLMS_DATA_TYPE_INT32:
{
Serial.println(reg->unit);
Serial.println(pow((float)10, reg->scaler));
Serial.println(reg->value.lVal * pow((float)10, reg->scaler));
break;
}
case DLMS_DATA_TYPE_UINT32:
{
Serial.println(reg->unit);
Serial.println(pow((float)10, reg->scaler));
Serial.println(reg->value.ulVal * pow((float)10, reg->scaler));
break;
}
}
break;
}

At now just for debugging, then I need to cast/round in uint64_t plus float64 to store them in a cache.

Moreover, I need also to read the registers of gxProfileGeneric. I successfully read the profile itself and I can print the content thru obj_toString. It's very useful for debug purposes, but I need to read raw values of the registers. How can I do?

TIA!
BR,
Andrea

Profile picture for user Kurumi

Kurumi

4 years 5 months ago

Hi Andrea,

Hi Andrea,

In ANSI C you need to do everything by yourself. Automatic scaling is not used in ANSI C because of memory usage. But you don't need to check the data type. You can use var_toInteger to get the integer value. Something like this:

Serial.println(var_toInteger(&reg->value) * pow((float)10, reg->scaler));

BR,
Mikko

wildstray

4 years 5 months ago

Hi Mikko,

Hi Mikko,
thank you, in that way is much more comfortable and readble! But I notice it doesn't exists a "var_toFloat()" :-( I'll going to write it on the bases of var_toInteger().
And excuse me again, and what about reading the values inside gxProfileGeneric? I saw it's a gxArray, but how to find the indexes? (the correspondence between gxArray index and LNs of profile registers).

BR,
Andrea

Profile picture for user Kurumi

Kurumi

4 years 5 months ago

Hi,

Hi,

Use var_toDouble. :-)

You can get the index from the Capture objects attribute.
https://www.gurux.fi/Gurux.DLMS.Objects.GXDLMSProfileGeneric

BR,
Mikko

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