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

Unit

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.

Profile picture for user ivan
By ivan , 6 July, 2017
Forums
Gurux.DLMS

I Wonder why did you use description of units as Unit?

namespace Gurux.DLMS.Enums
{
/// <summary>
/// Unit describes available COSEM unit types.
/// </summary>
public enum Unit : int
{
...
/// <summary>
/// Unit is Active power P watt W = J/s.
/// </summary>
[XmlEnum("27")]
ActivePower,
/// <summary>
/// Unit is Apparent power S.
/// </summary>
[XmlEnum("28")]
ApparentPower,
/// <summary>
/// Unit is Reactive power Q.
/// </summary>
[XmlEnum("29")]
ReactivePower,
/// <summary>
/// Unit is Active energy W*60*60s.
/// </summary>
[XmlEnum("30")]
ActiveEnergy,
/// <summary>
/// Unit is Apparent energy VA*60*60s.
/// </summary>
[XmlEnum("31")]
ApparentEnergy,
...

It translates as Enum string instead ... W, VA, var, Wh, VAh ...

Table 4. in BlueBook has 5 columns
unit ::= enum; Unit; Quantity; Unit name; SI definition (comment).

Thank you.

Profile picture for user ivan

ivan

8 years 11 months ago

Catch 22

OK, I've found the catch

In COSEM IC you never call GetUnit, so we get only description without the unit

/// <inheritdoc cref="GXDLMSObject.GetValues"/>
public override object[] GetValues()
{
//return new object[] { LogicalName, Value, "Scaler: " + Scaler + " Unit: " + Unit };
//my mod
return new object[] { LogicalName, Value, "Scaler: " + Scaler + " Unit: " + GXDLMSConverter.GetUnit(Unit) };
}

Profile picture for user Kurumi

Kurumi

8 years 11 months ago

Unit

Hi,

GXDLMSConverter.GetUnit is used to get unit description. It's more textual description and we might change it later (localize, etc).
We must return plain Unit on GetValues because some of our clients are saving this info to the DB and it's localized from there.

I suggest that you check if object is Register and get description later if you want.
This might cause problems if we change descriptions and you are comparing using this info.

BR,

Mikko

Profile picture for user ivan

ivan

8 years 11 months ago

Unit

Yes, I've figured out that.

I'll create additional resource or enum attribute decoration with additional info about unit or something.

  • 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