LogoLogo
  • Introduction
  • General platform architecture
    • Platform properties
    • Architecture introduction
    • Architecture functional layers
    • Architecture Principles
    • Platform components description
    • Message flow examples
    • Logical Authorisation Model
    • Non-functional overview
      • TimeBehavior
      • Internationalization and localization
      • Security
      • Scalability
      • Redundancy
      • Performance
    • Technical Overview
      • Web Services Layer
      • Domain Layer
      • Core Layer
      • Protocol Layer
      • Technology Stack
    • Use cases
    • Throttling
  • General User's Guide
    • Installation Guide
      • Installation
        • Vagrant
        • Manual Setup
      • GitHub configuration
      • Platform Setup
      • Test the Platform
        • Using SoapUi
        • Using the Demo App
    • Configuration
      • Add a device
      • Users
      • Add a new organisation
      • Throttling
    • Web Services
    • Deployment
    • FAQ
  • Open Source Community
    • Start contributing
    • Developers 101
    • Contributing to the code
    • Contributing to documentation
    • Communication and Contact
    • Governance
    • Code of Conduct
    • Foundation
  • Domains
    • Admin
    • Smart lighting
      • Use cases
      • Light Schedules
    • Tariff switching
    • Microgrids
    • Distribution automation
    • SmartMetering
      • Web Services
        • bypass retry
        • priority
        • scheduling
        • AdHocManagement
          • GetAssociationLnObjects
          • GetGetAssociationLnObjectsResponse
          • RetrieveConfigurationObjects
          • GetRetrieveConfigurationObjectsResponse
          • SpecificConfigurationObject
          • SynchronizeTime
          • GetSynchronizeTimeResponse
        • Bundle
          • Bundle
          • GetBundleResponse
        • Configuration
          • GetAdministrativeStatus
          • GetGetAdministrativeStatusResponse
          • GetFirmwareVersion
          • GetGetFirmwareVersionResponse
          • UpdateFirmware
          • GetUpdateFirmwareResponse
          • ReplaceKeys
          • GetReplaceKeysResponse
          • GetKeys
          • SetActivityCalendar
          • GetSetActivityCalendarResponse
          • SetAdministrativeStatus
          • GetSetAdministrativeStatusResponse
          • SetAlarmNotifications
          • GetSetAlarmNotificationsResponse
          • SetConfigurationObject
          • GetSetConfigurationObjectResponse
          • SetKeyOnGMeter
          • GetSetKeyOnGMeterResponse
          • SetPushSetupAlarm
          • GetSetPushSetupAlarmResponse
          • SetPushSetupSms
          • GetSetPushSetupSmsResponse
          • SetSpecialDays
          • GetSetSpecialDaysResponse
          • GetConfigurationObject
          • GetConfigurationObjectResponse
          • ConfigureDefinableLoadProfile
          • GetConfigureDefinableLoadProfileResponse
          • SetMbusUserKeyByChannel
          • GetSetMbusUserKeyByChannelResponse
          • GetMbusEncryptionKeyStatus
          • GetGetMbusEncryptionKeyStatusResponse
          • GetMbusEncryptionKeyStatusByChannel
          • GetGetMbusEncryptionKeyStatusByChannelResponse
          • ScanMbusChannels
          • ScanMbusChannelsResponse
        • Installation
          • AddDevice
          • GetAddDeviceResponse
          • CoupleMbusDevice
          • GetCoupleMbusDeviceResponse
          • DeCoupleMbusDevice
          • GetDeCoupleMbusDeviceResponse
        • Management
          • FindEvents
          • GetFindEventsResponse
          • GetDevices
          • SetDeviceLifecycleStatusByChannel
          • SetDeviceLifecycleStatusByChannelResponse
          • EnableDebugging
          • DisableDebugging
          • FindMessageLogs
          • GetGsmDiagnostic
        • Monitoring
          • GetActualMeterReads
          • GetActualMeterReadsResponse
          • GetActualMeterReadsGas
          • GetActualMeterReadsGasResponse
          • GetPeriodicMeterReads
          • GetPeriodicMeterReadsResponse
          • GetPeriodicMeterReadsGas
          • GetPeriodicMeterReadsGasResponse
          • GetProfileGenericData
          • GetProfileGenericDataResponse
          • ReadAlarmRegister
          • GetReadAlarmRegisterResponse
          • RetrievePushNotificationAlarm
        • Notification
          • SendNotification
      • ResponseMessages
      • Use cases
    • Guidelines to add a new domain to GXF
  • Protocols
    • IEC61850
      • SWDevice-010805
        • SWDevice-010805.icd
        • RegisterDevice
        • GetConfiguration
        • SetConfiguration
        • SetEventNotifications
        • EventNotification
        • SetSchedule
        • GetFirmwareVersion
        • UpdateFirmware
        • SetReboot
        • StartSelfTest
        • StopSelfTest
        • SetLight
        • SetTransition
        • GetStatus
        • UpdateDeviceSslCertification
      • FlexOVL_540_171101_2
        • FlexOVL_540_171101_2_out.icd
        • GetStatus
        • EventNotification
    • DLMS / COSEM
      • DLMS protocol adapter configuration
      • DLMS device simulator
    • OSLP
      • OSLP v0.5.1
        • Protobuf Contract
      • OSLP v0.6.1
        • Protobuf Contract
        • RegisterDevice
        • ConfirmRegisterDevice
        • GetConfiguration
        • SetConfiguration
        • SetEventNotifications
        • EventNotification
        • SetSchedule
        • ResumeSchedule
        • GetFirmwareVersion
        • UpdateFirmware
        • SetReboot
        • StartSelfTest
        • StopSelfTest
        • SetLight
        • SetTransition
        • GetStatus
        • UpdateDeviceSslCertification
        • SetDeviceVerificationKey
        • SwitchFirmware
        • SwitchConfiguration
    • MQTT
  • Support
  • License
Powered by GitBook
On this page
  • General Usage
  • GXF device simulators
  • dlms-device-simulator
  • DLMS Attribute Values REST Resource as used in Cucumber tests with a simulated smart meter

Was this helpful?

Export as PDF
  1. Protocols
  2. DLMS / COSEM

DLMS device simulator

The library that is used to connect to DLMS devices contains functionality to build a simulator for a device. The library offers the following core functionality.

  • zero or more servers can be started on a host (different ports)

  • zero or more logical devices can be registered with a server (different device id)

  • zero or more annotated objects can be registered with a logical device

  • these objects define available dlms classes, ObisCodes, attributeIds and methods for the device and can contain any logic

  • authentication and encryption are supported

If you want to simulate a certain device you will prepare annotated classes and register instances of these with a logical device. Because you create plain Java you can make use of all functionality Java offers, for example databases. To try and make the simulation more realistic you may build in connection timeouts etc.

General Usage

For each combination of a cosem class and obiscode you create a java class that you annotate with @CosemClass(id = ..., obis = "x.x.x.x.x.255")

In these java classes you can add fields of type DataObject that you annotate with @CosemAttribute(id = ..., type = Type.x)

Also you can create getXXX and setXXX methods to intercept getting and setting data on a logical device. XXX will be the name of the corresponding field starting with a capital letter.

For example:

@CosemClass(id = 3, obis = "1.0.1.8.0.255")
public class ImportValue {

    @CosemAttribute(id = 2, type = Type.DOUBLE_LONG_UNSIGNED)
    private DataObject d1 = DataObject.newUInteger32Data(10001);

    @CosemAttribute(id = 3, type = Type.STRUCTURE)
    private DataObject d2 = DataObject.newStructureData(DataObject.newInteger8Data((byte) -2),
            DataObject.newInteger8Data((byte) 30));

    public void setD1(DataObject newData) throws IllegalAttributeAccessException {
      // ....
    }
    public DataObject getD1() throws IllegalAttributeAccessException {
      return d1;
    }
}

The value of the field will be the response to get(AttributeAddress...) that is fired from osgp CommandExecutors. NOTE that these values can also be set! For example using the ClientConsole.

You can also annotate methods with or without a DataObject return value and with or without a DataObject parameter: @CosemMethod(id = ..., consumes = Type.x)

For example:

    @CosemMethod(id = 1)
    public void hello() throws IllegalMethodAccessException {
        System.out.println("Has been called");
        return;
    }

    @CosemMethod(id = 2, consumes = Type.OCTET_STRING)
    public DataObject hello2(DataObject datO) throws IllegalMethodAccessException {
        throw new IllegalMethodAccessException(MethodResultCode.OTHER_REASON);
    }

Such a method will be called when osgp fires ClientConnection.action, the DataObject that may be returned will become available in osgp on the MethodResult object.

GXF device simulators

dlms-device-simulator

This project contains the code to activate a DLMS COSEM server simulating a smart meter by running the DeviceServer Spring Boot Application configure by settings defined in DlmsServerConfig.

The following diagrams provides some insight into the different parts that together provide access to COSEM interface object attributes and methods supported by the server.

Spring configuration classes define beans of type CosemInterfaceObject that are collected for activated Spring profiles to define the objects on the simulated device.

A COSEM interface object like octet-string deviceid1 can have a readable and writable value, that is made available outside the server and DLMS communication as well.

The role the DlmsAttributeValuesClient can play in a scenario where data is read and set from tests is described with the DLMS Attribute Values REST Resource.

DLMS Attribute Values REST Resource as used in Cucumber tests with a simulated smart meter

The Cucumber test implementation using simulated DLMS device for smart metering comprises of a number of classes spread across the following projects:

  • dlms-device-simulator

  • osgp-simulator-dlms-triggered

  • cucumber-tests-platform-smartmetering

Dynamic values in smart meters (changed by DLMS communication or getting/setting values from test code) are implemented by using a REST resource, both from the simulated device and from the code behind Cucumber step definitions.

The following picture describes the REST resource endpoints and the way the resource is used by the different components.

PreviousDLMS protocol adapter configurationNextOSLP

Last updated 1 year ago

Was this helpful?

GXF has an implementation of DLMS device simulators that builds on the DLMS COSEM Server concepts as described in the section.

More details about how to configure and start a simulator can be found in the .

readme documentation for simulators on GitHub
General Usage
Spring configuration and profiles define COSEM interface objects on the server
A COSEM interface object with a readable and writable value
DLMS Attribute Values REST Resource