Summary
Installation
Architecture
Code description
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.
- Java JDK version >= Java 11
- Create a new folder for the project (eg. 'SGrJavaSamples').
- Clone the following project to a new folder: https://github.com/SmartgridReady/SGrJavaSamples.git
Rem: The folder [your-local-project-folder]/SampleCommunicator/src/main/resources contains the device description XML-files used by the SGrJavaSamples.
- 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
| Implementor: | Communicator Provider (3rd Party) |
| Description: | The 'Communicator' communicates with one or more 'Products' through the SGr 'Generic Interface'. |
| Responsibilities: |
|
| SGrProject: |
| 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: |
| 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'. |
| Responsibilities: | Responsibilities are:
|
| Library: | sgr-commhandler |
| SGrProject: |
| 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: |
|
| SGrProject: |
| Implementor: |
|
| 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:
|
| Library: |
sgr-driver-j2mod |
| SGrProject: | für Modbus: SmartgridReady/SGrJavaDrivers/j2mod für REST: SmartgridReady/SGrJavaDrivers/ApacheHttp für MQTT: SmartgridReady/SGrJavaDrivers/HiveMq |
| 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. |
| 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. |
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
This sample code demonstrates all the comm features provided by a generic device.
The complete sample code can be found on github
Sample code on how to read and write enums and bitmap registers using the commhandler library.
You find the sample code on github
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
Sample code that demonstrates subscribe/unsubscribe, which is only available with MQTT devices.
You find the sample code on github
Sample code that demonstrates read/write on a REST device
You find the sample code on github
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
Webssite: https://smartgridready.ch/
E-Mail: info@smartgridready.ch
