Resource Manager MQTT bridge reference implementation (Ruby)#5
Conversation
The reference implementation: a Rails app that consumes charger telemetry and lifecycle events from an MQTT broker, translates each message to its S2 counterpart over a WebSocket session (FRBC control type), and turns inbound FRBC.Instruction messages back into MQTT power setpoints. Derived from the S2 bridge Stekker.app runs against its smart-charging platform; the S2 wire types come from the public s2-ruby gem, pinned to an exact revision. Runs stand-alone with docker compose and ships its spec suite. Co-authored-by: Bob Forma <bob@stekker.com> Co-authored-by: Erik de Bruijn <edb@stekker.com> Co-authored-by: Martijn Versluis <martijn@stekker.com>
The bridge needs resource-side traffic to translate, and the real charging platform behind the MQTT contract is not open source. This stand-in bundles the broker and a small panel that publishes the example payloads and shows the power setpoints coming back, so the forward and reverse paths are drivable without any external system. Co-authored-by: Bob Forma <bob@stekker.com> Co-authored-by: Erik de Bruijn <edb@stekker.com> Co-authored-by: Martijn Versluis <martijn@stekker.com>
Stand-alone, the RM has no peer to complete the S2 handshake with. This minimal WebSocket server replies with its own Handshake, selects FILL_RATE_BASED_CONTROL, and sends an FRBC.Instruction built from the FRBC.SystemDescription it received from the RM, so the closed loop runs on real protocol traffic rather than scripted state. Co-authored-by: Bob Forma <bob@stekker.com> Co-authored-by: Erik de Bruijn <edb@stekker.com> Co-authored-by: Martijn Versluis <martijn@stekker.com>
./demo.sh starts the broker, the CEM, the RM and the platform panel, and frames the three applications side by side on a single URL. A viewer presses one button on the MQTT side and watches the message travel through the RM to the CEM and a power setpoint come back, so the closed loop is legible from end to end. Co-authored-by: Bob Forma <bob@stekker.com> Co-authored-by: Erik de Bruijn <edb@stekker.com> Co-authored-by: Martijn Versluis <martijn@stekker.com>
States the terms under which this reference implementation is offered and records copyright. The Apache 2.0 text is verbatim from the canonical source; the NOTICE file carries the Stekker.app B.V. copyright and attribution.
|
Hi @epologee. Thanks a lot! It looks really good. I have commit two changes of which I hope you agree with. |
jorritn
left a comment
There was a problem hiding this comment.
I have request for change. In AdoptS2 we have used a slightly modified version of S2, a measurement timestamp was added to the FRBC.StorageStatus message and instructions have an end time. Those changes also made it into your s2-ruby library and therefore also in the example messages in this reference implementation. However, we cannot have a reference implementation that is not following exactly the official S2 message definition so therefore I would like to ask you if you can revert (of make it optional to use) the changes that I just mentioned.
|
@jorritn We're working on it, this PR reverts the changes on the message specifications: stekker/s2-ruby#18 |
Yes, I think so, thanks! But it could be that there some more leftovers in the library. See my comment there: stekker/s2-ruby#18 (comment) |
Adds
resource-manager-mqtt-bridge-ruby/, a Ruby reference implementation of an S2 Resource Manager. It bridges a charging session's events from an MQTT broker to S2 (FRBC control type) and turns an inboundFRBC.Instructionback into an MQTT message. It is derived from (and nearly identical to) the bridge Stekker runs in production for its smart-charging platform.rm/is the reference and runs on its own withdocker compose up. Three small demo stand-ins next to it (cem/,mqtt/,demo/) make the closed loop visible:./demo.shbrings everything up on one screen at http://localhost:8080, press the buttons in their chronological order to see messages travel from left to right and vice versa:The README contains further info on how to demo the reference implementation.
Greetings from the Stekker S2 team,
@bforma, @ErikDeBruijn, @martijnversluis and @epologee