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 7 months ago

Double and float.

Hi Roman,

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

BR,

Mikko

roman.moravcik

9 years 7 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

  • 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