Skip to content

wldt/plotjuggler-digital-adapter-java

Repository files navigation

PlotJuggler Digital Adapter Java

Digital Adapter for the WLDT (White Label Digital Twin) framework that streams Digital Twin data - state, properties, relationships and events - towards PlotJuggler for real-time visualization. The adapter is visualization-only: it is strictly one-directional (Digital Twin -> PlotJuggler) and never models any action back into the twin.

dt_wldt_plotjuggler_1.png

It is built around three independent, pluggable concerns:

  • a transport (how bytes reach PlotJuggler)
  • wire format (how the payload is encoded)
  • and channels (what data is sent, under which name).

Any transport can be combined with any wire format, and channels are configured independently of both.

Documentation

  • Channels - the four channel types, and how to reshape outgoing data with custom payload functions.
  • Supported protocols - MQTT, WebSocket, UDP: configuration options and transport-specific behavior.
  • Supported formats - JSON, CBOR, MessagePack, BSON, Protobuf (experimental).
  • Usage example - a full worked example, plus the ready-to-run test scenarios under src/test.
  • Extending the adapter - how to add a new connection/transport or a new message format.
  • Architecture reference - class diagram and runtime flow.

Quick start

DigitalTwin digitalTwin = new DigitalTwin("my-digital-twin", new DefaultShadowingFunction());

// Add a Physical Adapter to the DT
[...]

PlotJugglerDigitalAdapterConfiguration configuration = PlotJugglerDigitalAdapterConfiguration
        .builder(new UdpConnectionConfiguration("127.0.0.1", 9870), PlotJugglerMessageFormat.JSON)
        .withStateChannel("dt-state")
        .addPropertyChannel("x", "state/properties/x")
        .addEventChannel("alarm", "state/events/alarm")
        .build();

digitalTwin.addDigitalAdapter(new PlotJugglerDigitalAdapter("plotjuggler-da", configuration));

DigitalTwinEngine digitalTwinEngine = new DigitalTwinEngine();
digitalTwinEngine.addDigitalTwin(digitalTwin);
digitalTwinEngine.startAll();

The shape of every configuration is always the same:

  1. Pick a transport by instantiating its configuration class (MqttConnectionConfiguration, WebSocketConnectionConfiguration or UdpConnectionConfiguration) and a PlotJugglerMessageFormat, and pass both to PlotJugglerDigitalAdapterConfiguration.builder(...).
  2. Declare channels on the returned builder: withStateChannel(...) (at most one), and any number of addPropertyChannel(...), addRelationshipChannel(...), addEventChannel(...) calls - see docs/channels.md for the full list and custom payload functions.
  3. .build() the configuration and pass it to new PlotJugglerDigitalAdapter(id, configuration), then attach it to your DigitalTwin as usual.

WLDT-Core version compatibility

plotjuggler-digital-adapter wldt-core 0.4.0
0.1.0

About

Digital Adapter to connect a WLDT based DT instance to the PlotJugger Application through multiple possible protocols and supporting different Data Formats

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages