Getting started

Join the Gurux Community or follow @Gurux for project updates.

Gurux.DLMS library is a high-performance component that helps you to read you DLMS/COSEM compatible electricity, gas or water meters. Component is available for csharp, java, ANSI C, ANSI C++ and Delphi. So you can select what programming language you want to use. We have tried to make component so easy to use that you do not need understand protocol at all.

You should read FAQ first to get started.

Build

If you want to build source codes you need Nuget package manager for Visual Studio. If you are usinng Visual Studio 2010 or 2013 you can get it here: https://visualstudiogallery.msdn.microsoft.com/27077b70-9dad-4c64-adcf-c7cf6bc9970c

Gurux.DLMS.XMLClient

Purpose of Gurux DLMS Xml client is that you can describe DLMS commands using xml syntax and then you can communicate with your meter using xml. This is great tool meter testing. You can add new command and you do not need to modify source code. Just create new xml file and thats it.

Structure of XML

In xml you describe what you want to do. Example below makes Get (read) reguest to the meter. You give (Interface type, OBIS code and attribute id).
<?xml version="1.0" encoding="utf-8"?>
<Messages>
<!--Read clock from the meter.-->
<GetRequest>
  <GetRequestNormal>
    <InvokeIdAndPriority Value="193" />
    <AttributeDescriptor>
      <!--DATA-->
      <ClassId Value="1" />
      <!--0.0.42.0.0.255-->
      <InstanceId Value="00002A0000FF" />
      <AttributeId Value="2" />
    </AttributeDescriptor>
  </GetRequestNormal>
</GetRequest>
</Messages>


You can convert DLMS bytes to xml easily. First read your meter with GXDLMSDirector or some other app and get sent bytes. Then open GuruxDLMSTranslator and select Messages tab. Paste sent bytes to the left side and press "To Messages" -button. Create file and copy generated xml to file ("sample1.xml") You can add comment field where you describe purpose of generated command.
You can try with this data:
7E A0 19 03 21 32 6F D8 E6 E6 00 C0 01 C1 00 01 00 00 2A 00 00 FF 02 00 12 80 7E 
Generated xml should be same as xml above, without comment field.
Gurux XmlClient only shows data what is received from the meter. You can modify HandleReply method for your needs.

Command line parameters

You can give command line parameters for the app. You can give example meter ip address and port number and input xml file or folder if you want to execute several messages. Connection to the meter is closed after each file is executed. If you want to ask several objecs, you can add them to the one file.
You can read data from Gurux example server using HDLC framing and Logican name referencing like this:
Gurux.DLMS.XmlClient -h localhost -p 4061 -x "Path to the file to execute."

Parameters are:
  • -h host name or IP address.
  • -p port number or name (Example: 1000).
  • -S Serial port settings (Example: COM1:9600:8None1).
  • -i IEC is a start protocol.
  • -a Authentication (None, Low, High).
  • -P Password for authentication.
  • -c Client address. (Default: 16).
  • -s Server address. (Default: 1).
  • -n Server address as serial number.
  • -r [sn, sn] Short name or Logical Name (default) referencing is used.
  • -w WRAPPER profile is used. HDLC is default.
  • -t [Error, Warning, Info, Verbose] Trace messages.
  • -x input XML file.
Example:
Gurux DLMS Xml Client TCP/IP connection:
Gurux.DLMS.XmlClient -r LN -c 16 -s 1 -h [Meter IP Address] -p [Meter Port No]
Gurux DLMS Xml Client using serial port connection:
Gurux.DLMS.XmlClient -r SN -c 16 -s 1 -S COM1:9600:8None1 -i
Gurux.DLMS.XmlClient -S COM1:9600:8None1 -c 16 -s 1 -a Low -P [password]
Get source codes from Github