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

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

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

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

  • 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

  • Kak_zqKr
  • Kak_maKr
  • Marciaannem
  • Scottstike
  • rcprociG
RSS feed
Privacy FAQ GXDN Issues Contact
Follow Gurux on Twitter Follow Gurux on Linkedin