Skip to main content
Version: 4.0

Run the Example

Project Content

The Demo example can be found in examples/at-modem/gurux-dlms folder inside the project on Acklio's GitLab repository.

It contains two sub-folders.

FolderDescription
cloudThe Python source files for the DLMS application, including the Gurux component to simulate the Head End System (HES)
deviceThe Python source files for the device, i.e. the code to deploy on the PC connected to the AT Modem board, which includes the Tun controller and the Gurux component to simulate the DLMS server.

Dependencies

The Demo example has the following dependencies.

AT Modem Firmware

The UDP client depends on the AT Modem that integrates Acklio FullSDK.

ResourceLink
GitLab Repository (binary)https://gitlab.acklio.cloud/acklio-opensource/at-modem-firmware
GitLab Repository (LBM reference design)https://gitlab.acklio.cloud/acklio-opensource/lbm-fullsdk-reference-implementation
Build & Flash DocumentationThe AT Modem Firmware page explains in detail how to build and flash the device for the UDP Client demo

Gurux

It also depends on the Gurux DLMS/COSEM protocol component. This component has its own requirements (Java and Maven).

ResourceLink
Gurux Official Websitehttps://www.gurux.fi/Gurux.DLMS
Gurux Respository on GitHubhttps://github.com/gurux

The Demo requires Python 3 to run.

Run the Demo Example

Cloud Side

info

The Cloud application must run on the same machine as the VPN agent.

Run the following command in cloud/dlms-python-client in order to install the dependencies of the DLMS client.

./setup.sh

The Cloud application requires an IPv6 address to start. To assign it to one of the network interfaces on your machine, run the following sudo command:

sudo ip -6 address add <app_ipv6_addr> dev <network_interface>

where <network_interface> is the name of your network interface.

info

Do not use the loopback interface for binding the application.

Then, run the Cloud application with the following command:

env DLMS_SERVER_ADDRESS=<dev_ipv6_addr> DLMS_SERVER_PORT=4063 DLMS_CLIENT_ADDRESS=<app_ipv6_addr> DLMS_CLIENT_PORT=<app_port> DLMS_READ_TIMEOUT=<timeout> DLMS_SESSION_INTERVAL=<interval> python3 main.py

Where:

  • DLMS_SERVER_ADDRESS is the IPv6 address of the device.
  • DLMS_SERVER_PORT is the port that the device listens (it should always be 4063).
  • DLMS_CLIENT_ADDRESS is the IPv6 address of the Cloud application.
  • DLMS_CLIENT_PORT is the port that the Cloud application listens.
  • DLMS_READ_TIMEOUT is the delay (in milliseconds) during which the application will wait for a response before sending the next request.
  • DLMS_SESSION_INTERVAL is the delay (in seconds) between two DLMS sessions.

Device Side

The process starts with the TUN controller. Go to the "device" folder on the Demo repository and run the tun_script.sh script by using the following command:

sudo ./tun_script.sh <tun_name> <dev_ipv6> <app_ipv6_prefix>/64

Where:

  • <tun_name> is the name of the TUN interface to create.
  • <dev_ipv6> is the IPv6 address of the device, as configured in IPCore.
  • <app_ipv6_prefix> is the prefix of the IPv6 address of the Cloud application, as configured in Acklio IPCore.

The process continues with the build of the DLMS server. Go to "gurux" subfolder and run the following command:

mvn package

Now start the DLMS server. Connect the board, then run the following command:

java -jar target/gurux.dlms.server-1.jar

Finally, bind the TUN interface with the AT Modem by running the following command in the "device" directory.

python3 -m tun_app -template rules.bin -dev-eui <dev_eui> -app-eui <app-eui> -app-key <app_key> -ipv6-dev-prefix 5454:0000:0000:0000 -tun-name <tun_name>

where:

  • <dev_eui> is the device DevEUI (in hexadecimal format xx:xx:xx:xx:xx:xx:xx:xx)
  • <app_eui> is the device AppEUI (in hexadecimal format xx:xx:xx:xx:xx:xx:xx:xx)
  • <app_key> is the device AppKey (in hexadecimal format xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx)
  • 5454:0000:0000:0000 is the IPv6 prefix of the device, as configured in Acklio IPCore.
  • <tun_name> is the name of the TUN interface that the device will listen.