avob / OpenADR

OpenADR protocol java implementation: https://www.openadr.org/
Apache License 2.0
50 stars 23 forks source link
demand-response java openadr

OpenADR Build Status codecov

OpenADR protocol java implementation: https://www.openadr.org/

Provides a standalone VTN 2.0b implementation and APIs to implements demand-response program and device management. Provides a VEN 2.0b library which can be used to implements a VEN 2.0b.

Module Description
OpenADRSecurity OADR security framework (PKI RSA/ECC, XmlSignature)
OpenADRModel20b OADR 2.0b model java classes generated from XSDL definition file
OpenADRServerVEN20b OADR 2.0b VEN library
OpenADRServerVTN20b OADR 2.0b VTN implementation + Control API / UI
DummyVEN20b Dummy OADR 2.0b VEN implementation based on OpenADRServerVEN20b
DummyVTN20bController Dummy OADR 2.0b VTN controller implementation acting DRProgram and device manager. Leverage OpenADRServerVTN20b APIs.

Certificates

Tests certificates are required to test project or run demo:

    ./generate_test_cert.sh

This command will create several VTN / VEN / User / App certificates upon a self-signed generated authority. This authority has to be installed to disable insecure https warning when using VTN Control API / UI in a browser. VTN certificate uses the following Common Name, which need to be added to the local DNS configuration.

Oadr demo

Run a demo of a full 2.0b OADR stack infrastructure interacting with a dummy VEN and a dummy VTN controller. OpenADR communications between VEN and VTN are transported by XMPP. VEN authentication use x509 client certificates and payloads are secured with XML signatures.

The VTN controller is acting as both a device manager by creating VEN authorization / subscribing to VEN reports, and a DemandResponseProgram manager by creating DREvents. The dummy VEN implementation will simulate data reading using information gathered in DREvents and continuously push them to the VTN.

The VTN controller is notified by VTN using AMQP when VTN receive payload from VEN (createRegistrationParty, registerReport, updateReports).

Requirement

Run

    docker-compose up --build

Endpoints

Components diagram

PlantUML components diagram ``` @startuml demo_component_diagram package "Demand / Production" { rectangle "dummy-ven20b" as dummyVen #FFF } package "OADR Provider" { rectangle "vtn20b" as vtn #FFF database postgres node rabbitmq node openfire } package "DemandResponseProgram" { rectangle "dummy-drprogram" as dummyDRProgram #FFF } vtn <-up-> openfire #line:red;line.bold;text:red : OADR(XMPP) openfire -> vtn #green;line.bold;text:green : AUTH(HTTP) vtn -down-> rabbitmq #blue;line.bold;text:blue : DATA(AMQP) dummyVen <--> vtn #green;line.bold;text:green : OADR(HTTP) dummyVen <-> openfire #line:red;line.bold;text:red : OADR(XMPP) openfire -> postgres #black;line.dotted;text:black vtn -> postgres #black;line.dotted;text:black rabbitmq -down-> vtn #green;line.bold;text:green : AUTH(HTTP) dummyDRProgram -up-> vtn #green;line.bold;text:green : DATA(HTTP) dummyDRProgram <-- rabbitmq #blue;line.bold;text:blue : DATA(AMQP) @enduml ```

Sequence diagram

PlantUML sequence diagram ``` @startuml demo_sequence_diagram participant "dummy-ven20b" as dummyVen #FFF participant "vtn20b" as vtn #FFF participant "dummy-drprogram" as dummyDRProgram #FFF group Device provisionning dummyDRProgram -[#green]> vtn: Creates MarketContext / VEN dummyDRProgram -[#green]> vtn: Enrolls VEN to MarketContext end group Device registration dummyVen -[#red]> vtn: Creates registration party vtn -[#blue]> dummyDRProgram: Notify registration dummyVen -[#red]> vtn: Registers reports vtn -[#blue]> dummyDRProgram: Notify register reports dummyDRProgram-[#green]> vtn: Subscribes reports vtn -[#red]> dummyVen: Creates reports subscription end group Normal workflow group DRProgram dummyDRProgram -[#green]> vtn: Creates DREvents in MarketContext dummyVen <[#red]- vtn: Send DREvents end group Data reading dummyVen -[#black]-> dummyVen: Simulate data readings\n based on received DREvents dummyVen -[#red]> vtn: Updates reports vtn -[#blue]> dummyDRProgram: Notify data update end end @enduml ```

Test / build project

Requirements

Test

    mvn clean verify

Compile for external use (AMQP broker and DB middleware must be provided)

    mvn clean package -P external,frontend 

Compile for standalone use (in-memory AMQP broker and DB)

    mvn clean package

Links