feat(fire-sim): Modbus TCP simulator for 100-building load tests#1
Open
kiro-agent[bot] wants to merge 4 commits into
Open
feat(fire-sim): Modbus TCP simulator for 100-building load tests#1kiro-agent[bot] wants to merge 4 commits into
kiro-agent[bot] wants to merge 4 commits into
Conversation
… tests
- Async Modbus TCP servers (one per simulated building, ports 5020+)
- Input register map matching the planned STM32 firmware contract
(fire/supervisory/power state, 32-bit heartbeat, uptime, fw version)
- HTTP control plane (FastAPI) for scripted scenarios:
* per-building: fire/supervisory/power/frozen/offline
* fleet: storm, random-offline, random-freeze, chaos, reset
- Failure injection covers all the modes the central poller must detect:
* fire alarm / fault / supervisory / power loss
* MCU freeze (server up, heartbeat stops)
* network down (server stops listening)
- Bundled async load-test client reports per-round p50/p95/p99 latency
- Smoke test on a single host: 100 buildings, full poll round in ~130ms,
p99 ~5-9ms, fault injection observed correctly by the polling client
- Docker + docker-compose for reproducible runs
Co-authored-by: maheshkumar-iisc <74917498+maheshkumar-iisc@users.noreply.github.com>
Comprehensive reference for firmware engineers, poller developers, and QA. Covers: - Input registers (FC 04): fire/supervisory/power state, 32-bit heartbeat, uptime, zone masks, detector counts, voltages, temperatures, events - Holding registers (FC 03): building identity, serial, HW revision, config - Write register (FC 06): optional reverse-heartbeat watchdog kick - Timing & performance requirements - Error handling matrix - Safety/compliance notes - Visual register map diagram
Complementary reference to the register map spec, covering: - High-level system topology (panel/STM32 server <-> central poller client) - Modbus TCP frame anatomy (MBAP header + PDU) - Sequence diagram of a full read transaction with TCP handshake - Byte-level worked example: reading the first 8 input registers - Exception/error response format - Function code cheat sheet (FC 03/04/06 used in this project) - Address-space conventions (1-based notation vs 0-based on-wire offsets) - Healthy connection state machine with circuit-breaker behaviour - Where Modbus stops and the rest of the architecture takes over
3 files only: config.py — all settings (buildings, ports, timeouts, register offsets) poller.py — reads one building, decodes registers, detects state changes main.py — asyncio loop, one task per building, signal handling - Clear heading comments explain what each file owns - Inline TODO markers show exactly where DB / NATS code gets added later - Tested against fire-sim: detects NORMAL→ALARM and MAINS→BATTERY in real time
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request was created by @kiro-agent on behalf of @maheshkumar-iisc 👻
Comment with /kiro fix to address specific feedback or /kiro all to address everything.
Learn about Kiro autonomous agent
What
A Modbus TCP simulator that mimics 100 STM32-backed fire panels on one machine, so the central poller, time-series pipeline, and dashboard can be developed and load-tested without 100 real buildings.
Key features
fire,supervisory,power,frozen,offlinestorm,random-offline,random-freeze,chaos,resetVerification
Tested on a single host with all 100 panels:
Try it
Or
docker compose up --build.Known limitations
Next steps once this lands
This is the load-test bed. Logical follow-ups: