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. How Could I Read Proper Format For Scalars and Units of a Profile Generic Object?

How could I read proper format for scalars and units of a profile generic object?

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 pradson , 9 October, 2019
Forums
Gurux.DLMS

Hi Mikko,

Kindly refer below mentioned code:
//--------------------------------------------------------------------------------
CGXDLMSProfileGeneric *obj = new CGXDLMSProfileGeneric("1.0.94.91.3.255");
std::string sValues;
if ((ret = comm.Read(obj, 3, sValues)) != 0){
TRACE("err! failed to read register: %s \n", CGXDLMSConverter::GetErrorMessage(ret));
}
sValues.clear();
if ((ret = comm.Read(obj, 2, sValues)) != 0){
TRACE("err! failed to read register: %s \n", CGXDLMSConverter::GetErrorMessage(ret));
}
//--------------------------------------------------------------------------------
OutPut:
{-3, 33, } | {-3, 33, } | {-3, 33, } | {-2, 35, } | {-2, 35, } | {-2, 35, } | {-3, 255, } | {-3, 255, } | {-3, 255, } | {-3, 255, } | {-2, 44, } | {0, 28, } | {0, 27, } | {0, 29, } | {-1, 30, } | {-1, 30, } | {-1, 31, } | {-1, 31, } | {0, 6, } | {0, 255, } | {0, 27, } | {0, 27, } | {0, 27, } |
//--------------------------------------------------------------------------------

But when I read the same using DLMSDirector application, then I get the below mentioned output.
//############################################################################
{0.001, Current} {0.001, Current} {0.001, Current} {0.01, Voltage} {0.01, Voltage} {0.01, Voltage} {0.001, NoUnit} {0.001, NoUnit} {0.001, NoUnit} {0.001, NoUnit} {0.01, Frequency} {1, ApparentPower} {1, ActivePower} {1, ReactivePower} {0.1, ActiveEnergy} {0.1, ActiveEnergy} {0.1, ApparentEnergy} {0.1, ApparentEnergy} {1, Minute} {1, NoUnit} {1, ActivePower} {1, ActivePower} {1, ActivePower}
//############################################################################

How could I get this type of format?
Kindly suggest me.

Thanks & Regards
Pradson

pradson

6 years 9 months ago

Hi Mikko,

Hi Mikko,

I observed scalars values like-
0 represents 1
-1 represents 0.1
-2 represents 0.01
-3 represents 0.001
etc..etc...

Am I right?

Profile picture for user Kurumi

Kurumi

6 years 9 months ago

Hi,

Hi,

Scaler is pow(10, X), where X is read number. So you are right. ANSI C++ don't convert read values to the string, you must do it by your self at the moment.

BR,
Mikko

pradson

6 years 9 months ago

In reply to Hi, by Kurumi

and what about units?

and what about units?

How could I convert-
33 to "Current"
35 to "Voltage"
255 to "NoUnit"
44 to "Frequency"
...
...
etc...etc...

I mean,
Is any method which convert numeric units to string units in Gurux?

Thanks

Profile picture for user Kurumi

Kurumi

6 years 9 months ago

Hi,

Hi,

You can use CGXDLMSConverter::GetUnitAsString -method for that.

BR,

Mikko

pradson

6 years 9 months ago

In reply to Hi, by Kurumi

Hi Mikko,

Hi Mikko,

Thanks a lot for your kind help.

Thanks & Regards,
Pradson

  • Create new account
  • Reset your password

Hire Us!

Latest Releases

  • Mon, 07/27/2026 - 12:37
    gurux.dlms.cpp 9.0.2607.2701
  • Thu, 07/23/2026 - 16:19
    gurux.dlms.java 4.0.96
  • Thu, 07/09/2026 - 14:34
    Gurux.DLMS.Python 1.0.201
  • Fri, 06/26/2026 - 16:32
    Gurux.Service 3.0.2606.2601
  • Wed, 06/24/2026 - 08:36
    Gurux.DLMS.Python 1.0.200

New forum topics

  • Version mismatch between Gurux.DLMS 9.x and Gurux.Common/Gurux.Serial 8.x
  • Service not known error on gprs communication
  • Help Needed: Interfacing Saral 100 Energy Meter with Microcontroller via RS232
  • Connecting Meter to Agent via serial
  • Reading block profile with Compact array
More

Who's new

  • ArthurDaype
  • hirenec11mic
  • Yeyen
  • Virtual
  • joesa4
RSS feed
Privacy FAQ GXDN Issues Contact
Follow Gurux on Twitter Follow Gurux on Linkedin