Skip to content

SmartGridready/SGrJavaSamples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SmartGridready Java Samples

Index

Summary
Installation
Architecture
Code description

Summary

SGr-JavaSamples provides sample projects that demonstrate the use of the SGr Communication Handler Library. The goal is to set up a test environment that allows to connect SGr components and different 'products' (heat pump, charging station, inverter, battery, electricity meter etc.) through the SGr communication interface.

Installation

Requirements / Prerequisites

  • Java JDK version >= Java 11

Clone

Rem: The folder [your-local-project-folder]/SampleCommunicator/src/main/resources contains the device description XML-files used by the SGrJavaSamples.

Build

  • Open the [your-local-project-folder]/SampleCommunicator with your IDE.
  • Run the Gradle 'build' target in your IDE
  • You can also run Gradle from the command line. Change to the directory [your-local-project-folder]/SampleCommunicator and run: gradlew clean build

Architecture

SGr Architecture Overview

Component: Communicator

Implementor:

Communicator Provider (3rd Party)

Description:

The 'Communicator' communicates with one or more 'Products' through the SGr 'Generic Interface'.

Responsibilities:
  • For each product, the communicator instantiates a Communication Handler to which a description of the product interface in XML is given.
  • The Communicator loads a device driver for the communication interface of the product (e.g. Modbus RTU/TCP, REST...).
  • The communicator reads or sets (analyses and/or controls) the data points.
SGrProject:

SGrJavaSamples/SampleCommunicator

Component: Generic Interface

Implementor:

SGr Core Team

Description:

SGr-defined 'Product'-independent interface.

Responsibilities:

The Generic Interface is used by the Communicator to communicate with the products in the SGr network.

SGrProject:

SmartgridReady/SGrSpecifications/SchemaDatabase/SGr/Generic

Component: Communication Handler

Implementor:

SGr Core Team

Description:

This is the core component of the SGr software and it is responsible for the processing and implementation of the SGr 'Generic Interface' on the 'External Interface' of the 'Product'.
Instantiated by the 'Communicator' and used to communicate with the connected 'Product'.

Responsibilities:

Responsibilities are:

  • Reading the XML device profiles
  • Processing commands of the Generic Interface
  • Execute the commands on the External Interface of the product (device-specific interface)
  • Sending the commands to the Product through the transport service specified by the Product.
Library:

sgr-commhandler

SGrProject:

SmartgridReady/SGrJava/CommHandler

Component: XML (XML-Profile)

Implementor:

Provider of the 'Product'

Description:

The XML file describes the ''function profiles', data points and attributes that can be addressed over the SGr interface. The XML file also provides general information about the 'Product'.

Responsibilities:
  • Providing general data on the Product.
  • Provide the data necessary for mapping the SGr Generic Interface with the External Interface.
SGrProject:

SmartgridReady/SGrSpecifications/XMLInstances/ExtInterfaces

Component: Transport Layer (Transport Service)

Implementor:
  • SGr Core Team
  • 3rd Party Provider
Description:

The 'TransportService' is the link to the physical communication interface of the 'Product'. The SGr Core Team provides the j2mod-based library for Modbus.

Responsibilities:

The SGr Transport Service supports the following communication technologies to provide the following transport services:

  • Modbus, REST/JSON, Sunspec
  • Support is planned for: OCPP 2.0, IEC-61968-9, IEC-608070-5-104
Library:

sgr-driver-j2mod
sgr-driver-apachehttp
sgr-driver-hivemq

SGrProject:

für Modbus: SmartgridReady/SGrJavaDrivers/j2mod

für REST: SmartgridReady/SGrJavaDrivers/ApacheHttp

für MQTT: SmartgridReady/SGrJavaDrivers/HiveMq

Component: External Interface (EI)

Implementor:

Manufacturer of the 'Product'

Description:

The 'External Interface' is the interface provided by the 'Product'.

Responsibilities:

Provides the External Interface of the product. This is described in the Product XML Profile.

Component: Product

Implementor:

Manufacturer of the 'Product'

Description:

The Product is a device that provides properties, data points and control options. E.g. heat pump, charging station, inverter, battery, electricity meter.

Responsibilities:

Product hardware.

Description of the Code Samples

The code samples demonstrate how to use the commhandler library with a communicator application. These samples use mocked devices and run without any real device:

  • BasicSampleCommunicator, demonstrates all common features
  • EnumAndBitmapSampleCommunicator, demonstrates read and write of enums and bitmap registers
  • AsynchronousSampleCommunicatorTest, demonstrates how to read multiple devices in parallel
  • MqttSampleCommunicator, demonstrates subscribe/unsubscribe
  • RestSampleCommunicator, demonstrates read/write on a REST device

This sample runs only with a real WAGO SmartMeter device:

  • WagoSmartMeterCommunicator

BasicSampleCommunicator

This sample code demonstrates all the comm features provided by a generic device.

The complete sample code can be found on github

EnumAndBitmapSampleCommunicator

Sample code on how to read and write enums and bitmap registers using the commhandler library.

You find the sample code on github

AsynchronousSampleCommunicator

Sample code on how to read multiple devices in parallel using the async features of the commhandler library. This sample a JUnit5 test. Use the Junit test runner to run the sample code.

You find the sample code on github

MqttSampleCommunicator

Sample code that demonstrates subscribe/unsubscribe, which is only available with MQTT devices.

You find the sample code on github

RestSampleCommunicator

Sample code that demonstrates read/write on a REST device

You find the sample code on github

WagoSmartMeterCommunicator

If you are happy owner of a WAGO Smart-Meter you can read the read values from the real device with this sample communicator application.

You find the sample code on github

Further information / contact information

Webssite: https://smartgridready.ch/

E-Mail: info@smartgridready.ch

About

SmartGridready starterproject with samples

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 6

Languages