All guides

Explanations · 6 min

Testing an integration on a device simulator

You can test a battery or load integration without hardware: the deterministic simulator in Wesfin Lab replays the same scenarios, faults and lost connections the same way every time. Profile and logic mistakes show up before a site visit.

Why a simulator if you have a real device

A real device behaves slightly differently each time: the SOC moved, the network is slow, the firmware updated. When a test fails, it is hard to say whether your change caused it. The simulator removes that noise: the same scenario and the same seed give the same result and the same evidence hashes.

More importantly, the simulator lets you safely reproduce what you should not do on live equipment: losing the connection mid-command, a device fault, stale or impossible data.

Virtual time

Tests do not wait for real seconds. The simulator has a virtual clock, so command lifetimes, delays and timeouts are checked instantly and without races. The real queue, start and finish times of a run are stored separately.

Which faults you can reproduce

FaultWhat must happen
Internet or connector disconnectThe local watchdog returns the device to a safe state. After reconnecting the command is not repeated.
Telemetry timeout or stale dataA new command is rejected until the data is fresh.
Impossible values: NaN, SOC out of rangeThe frame is rejected, not silently clipped.
Device faultThe expected outcome is REJECTED, not RESTORED.
Meter unavailableRestoration stays unconfirmed.
Duplicate acknowledgement, delay, clock skewEach case has its own defined outcome in the report.

A profile cannot run arbitrary code, network targets or containers: faults are chosen from a fixed list only.

Your own test vectors

Besides the standard pack, a profile can carry up to 32 of its own vectors: initial SOC, target power, duration, TTL, one listed fault and the expected outcome. A test fails if the outcome does not match the expectation, even when the command itself was safely rejected.

  1. Battery

    Discharge +0.5 kW for 10 s with a 15 s TTL, expect RESTORED: a measured return to zero.

  2. Load

    Curtail to -3 kW for 10 s with a 20 s TTL from a -5 kW baseline, expect RESTORED to -5 kW.

  3. Negative case

    A zero TTL must give EXPIRED, and a target outside the profile limits REJECTED.

What the simulator does not prove

The simulator is a reference model with your limits, not your device. A simulator report is labelled SIMULATOR_ONLY, and physical device recovery after faults is not verified separately. The next step is to connect the real device over MQTT or Home Assistant, observe-only first.