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. Node
  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

10 years ago

Double and float.

Hi Roman,

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

BR,

Mikko

roman.moravcik

10 years ago

Thank you Mikko,

Thank you Mikko,

it's working perfectly now.

Regards,
Roman

  • Create new account
  • Reset your password

Hire Us!

Latest Releases

  • Thu, 11/19/2026 - 10:57
    Gurux.DLMS.Python 1.0.204
  • Thu, 11/19/2026 - 10:12
    gurux.dlms.c 9.0.2611.1901
  • Tue, 10/13/2026 - 12:00
    gurux.dlms.java 4.0.97
  • Tue, 09/22/2026 - 14:02
    Gurux.DLMS.Net 9.0.2609.2201
  • Mon, 09/21/2026 - 10:18
    Gurux.DLMS.Net 9.0.2609.2101

New forum topics

  • Landis E650 meter reading over DLMS
  • class_id = 40, version = 2, pushsetup Unparsed data frame
  • GXObisValueItem entries without MaskSize appear to be interpreted as bit flags
  • CheckedListBox incorrectly selects GXObisValueItem Value=0 for non-zero values
  • UIValueType=TextBox is rendered as CheckedListBox when Values are defined
More

Who's new

  • Sayang
  • q80435762@gmail.com
  • ONCAK
  • Berhasil
  • ratirvivege1979
RSS feed
Privacy FAQ GXDN Issues Contact
Follow Gurux on Twitter Follow Gurux on Linkedin