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. Not Working DLMS_DATA_TYPE_FLOAT32 In Gurux.DLMS.cpp and GXDLMSDirector

Not working DLMS_DATA_TYPE_FLOAT32 in Gurux.DLMS.cpp and GXDLMSDirector

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 roman.moravcik , 1 November, 2016
Forums
Gurux.DLMS

Hi all,

I'm playing GuruxDLMSServerExample from Gurux.DLMS.cpp and GXDLMSDirector.

I wanted to use DLMS_DATA_TYPE_FLOAT32 type for register values for my test, but GXDMLSDirector was displaying a completely wrong values.

First of all, I've checked the code of CGXByteBuffer::SetFloat(), because what was send by Gurux.DLMS.cpp seems to be wrong and I think I found the problem:

diff --git a/development/src/GXBytebuffer.cpp b/development/src/GXBytebuffer.cpp
index 3e3aaf9..d754bfc 100644
--- a/development/src/GXBytebuffer.cpp
+++ b/development/src/GXBytebuffer.cpp
@@ -231,10 +231,10 @@ void CGXByteBuffer::SetFloat(float value)
m_Capacity += VECTOR_CAPACITY;
m_Data = (unsigned char*) realloc(m_Data, m_Capacity);
}
- m_Data[m_Size + 4] = tmp.b[3];
- m_Data[m_Size + 5] = tmp.b[2];
- m_Data[m_Size + 6] = tmp.b[1];
- m_Data[m_Size + 7] = tmp.b[0];
+ m_Data[m_Size] = tmp.b[3];
+ m_Data[m_Size + 1] = tmp.b[2];
+ m_Data[m_Size + 2] = tmp.b[1];
+ m_Data[m_Size + 3] = tmp.b[0];
m_Size += 4;
}

After fixing that code, values send by GuruxDLMSServerExample seems to be ok, but what is displayed in GXDLMSDirector is still wrong.

For example:
Value: 1.000000
GuruxDLMSServerExample:
<- 7E A0 15 21 03 74 69 CE E6 E7 00 C4 01 81 00 17 3F 80 00 00 98 92 7E
GXDLMSDirector:
Value: 4.600603E-41

Value: 2.123000
GuruxDLMSServerExample:
<- 7E A0 15 21 03 B8 09 C2 E6 E7 00 C4 01 81 00 17 40 07 DF 3B 6E A9 7E
GXDLMSDirector:
Value: 0.006806284

Are float values correctly working GXDLMSDirector?

Thank you,
Roman

Profile picture for user Kurumi

Kurumi

9 years 9 months ago

Double and float.

Hi Roman,

We have fixed this. I updated new version to github.

BR,

Mikko

roman.moravcik

9 years 9 months ago

Thank you Mikko,

Thank you Mikko,

it's working perfectly now.

Regards,
Roman

  • 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

  • T_APPL_DATA_LN_N1 subtest 3 fails on an LN-only server regardless of the response to a non-existing-object GET
  • 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
More

Who's new

  • eloisedc16
  • OlegVoiva
  • Martaepili
  • Vegazone-Alini
  • Curtistig
RSS feed
Privacy FAQ GXDN Issues Contact
Follow Gurux on Twitter Follow Gurux on Linkedin