fms

Simulator

Run seven feeder scenarios with simulated loads, delayed measurements and lossy command delivery.

The feeder🔗

The generated feeder has a 400 kVA transformer and four branches of NAYY 4×150 turning into 4×95, with three households per node. Each seed gives another feeder. Households have:

Heat that was not delivered is half made up later. The truth is the loss-corrected flow model that the grid oracle test checks.

What the FMS sees🔗

The other end🔗

Each household has a simulated Steuerbox. It applies commands, loses 2 % of them and of the acknowledgements, and falls back to its failsafe on a lost channel. Behind it, a household guard applies the simulated Steuerbox limit locally, and counts every limit below the floor it computes itself.

The days🔗

DayWhat it shows
cold-snaprelief at the transformer
wallbox-eveninga cable and the voltage at the end of one branch, measured per feeder
pv-noonno intervention on a quiet feeder
channel-outageplanning with the failsafe
lying-sensorrejection of implausible station and meter readings
beyond-14aa shortfall, and Netzausbau proposed
blind-feederpräventiv control and its rebound

cargo test runs every day on four seeds. It asserts:

Develop with a mock household🔗

From an FMS checkout, run the offline protocol demo:

scripts/mock-hems demo

The demo discovers an LPC Controllable System, binds it, applies a limit, then stops heartbeats and advances virtual time into failsafe. The first invocation needs Git, Cargo and internet access to build the pinned EEBUS 0.13.1 examples with the FMS development patch. When a SHIP session ends, the patch tells the LPC actor which bindings expired so it can subscribe to the returning guard’s heartbeat. Subsequent invocations reuse the binaries under target/mock-hems/.

Verify a real FMS command on two receivers🔗

scripts/mock-hems check
scripts/mock-hems check --peer go --json

The check runs the cold-snap simulation with seed 1, takes its first command, converts kW to watts and preserves the duration between issue and expiry. On the current reference day that is 10,500 W for 3,600 seconds. It sends the command through a simulated Steuerbox to locally launched Rust and Go peers over SHIP/TLS. Each run uses disposable identities, explicit peer trust, and dynamic ports.

What the check observesRust householdGo EVSE
Acknowledgement of a timed write, the FMS command and explicit releaseSender’s write counterSender’s write counter
Expiry after a three-second limitReceiver leaves active stateOnly the acknowledgement is checked
Missing heartbeat and recoveryReceiver falls back to 4,200 W, then accepts 6,500 W on reconnectOutside this example’s checks
Write below the configured floorSender receives a refusalExample approves all writes

Allow about three to four minutes after the first build for the full check. The Rust run waits for a real heartbeat timeout. Python 3.11+ runs the check; Cargo builds the pinned Rust peers and FMS. The Go check also needs Go 1.24.4+ and builds the enbility EVSE example. Use --peer rust for a Rust-only run. A missing expected response, early exit or timeout fails the command. JSON output distinguishes protocol acknowledgements from local mock observations. Physical power delivery requires a separate measurement.

Pair an interactive peer🔗

For a network test, start the household in one terminal:

scripts/mock-hems household

Start the simulated Steuerbox in another:

scripts/mock-hems steuerbox --dial 127.0.0.1:4712 --limit 6000 --for 120

The peers listen on all interfaces, advertise over mDNS and print their certificate identifiers (SKIs). Compare the displayed SKIs before approving pairing. The household shows the decision and its effective limit. It models a consumer with a 4,200 W floor and a 4,200 W failsafe. To exercise refusal, restart the Steuerbox with --limit 3000; to release, restart it with --release. The two roles keep separate identities and trust stores under target/mock-hems/. To run another household, supply a distinct --state DIR, --name and --port.

Either peer can be replaced by a compatible external LPC implementation. These development peers exercise the household protocol independently of the FMS reference-day simulator and the separate-process MSB development exchange.

From a feeder decision to a protocol order🔗

The simulator compares the same demand with control enabled and disabled. Inspect congestion minutes, peak loading, curtailed energy and the most affected household together. On the seed-1 cold-snap day, control reduces simulated congestion from 135 minutes to zero and peak loading from 125.3% to 92.8%. It curtails 513.2 kWh across the feeder, with zero simulated floor violations.

A separate development exercise takes measurements from the installed mixed-feeder fixture and sends the resulting EMS ceiling over Control Measures v1. Start the synthetic MSB, then run the controller with --grid-result-age 30. The default exchange starts from an operator request. Both exercises send an operator release. The desk distinguishes the HTTP receipt and the MSB’s final reply. Assessing actual feeder relief requires subsequent timestamped measurements. Run the peer and controller · Use the measurement-derived limit

The closed-loop scenario follows successive measurements through automatic restoration. To compare allocator policies on a larger feeder, run the same day and seed under both policies.

fms sim wallbox-evening --seed 1 --selection netzbereich --json > netzbereich.json
fms sim wallbox-evening --seed 1 --selection downstream --json > downstream.json

Both runs start from the same uncontrolled baseline of 50 congested minutes and 112.6% peak loading on L4-01.

Seed-1 resultNetzbereichDownstream
Congested minutes with control00
Peak loading with control93.6%94.6%
Curtailed energy, all households423.8 kWh253.4 kWh
Most curtailed household23.3 kWh23.9 kWh
Floor violations00
Relief / renewal / restoration commands147 / 215 / 267102 / 59 / 172

On this fixture, downstream selection curtails 170.4 kWh less in total. Its most affected household gives up 0.6 kWh more. These two measures expose a trade-off that congestion minutes alone would hide. Run the closed-loop MSB scenarios

Check a CLS.EEDI dispatch🔗

Run the CLS.EEDI equipment check from the workspace root. It uses an in-process backend, a simulated device and a virtual clock.

just cls-eedi-check

The test selects H405c’s original limit from the seed-1 cold-snap day. A synthetic registration maps H405c to SR-ID C1137355923 and device route lab-ems-405c. The published Control Measures HTTP router decodes the FMS order inside the process. The receiving fixture then exchanges encoded CLS.EEDI messages with the local-device simulator on a virtual clock.

Time after issueWhat the check verifies
0 sThe MSB accepts a 10.500 kW order with an absolute end one hour later. Its preliminary reply leaves the equipment outcome pending.
7 sThe commissioned device receives a 10,500 W ceiling with 3,593 seconds left. Another route refuses the delivery.
17 sAfter a lost acknowledgement, the identical control returns the cached equipment reply. A device state read reports 3,583 seconds remaining.
3,600 sThe device reports the limit inactive at the original FMS deadline.

Two further runs check the FMS message and target for a refusal and an unsupported equipment operation. A positive result establishes simulated equipment acceptance. Physical delivery requires independently observed power. KEO CLS.EEDI 1.2.0 control limits and state reads

The two-target MSB rehearsal couples modeled household power to individually confirmed ceilings. At the same initial 35 kW, a refused first limit leaves the next aggregate reading at 30.2 kW. Both successes yield 23.76 kW. Compare the two runs