feat(phase-6): implement analytics, kpi calculator, event store, heatmaps, and experiment runner
This commit is contained in:
+64
-51
@@ -1,7 +1,7 @@
|
||||
# Project Status: Warehouse Robot Fleet Digital Twin
|
||||
|
||||
**Last Updated**: October 21, 2026
|
||||
**Current Phase**: **Phase 5: Charging and Operational Constraints (COMPLETED)**
|
||||
**Current Phase**: **Phase 6: Analytics and Experiment Framework (COMPLETED)**
|
||||
**Status**: Ready for User Review and Approval
|
||||
|
||||
---
|
||||
@@ -15,55 +15,54 @@
|
||||
| **Phase 2** | **Robot and task models** | **COMPLETED** | **56 passed** |
|
||||
| **Phase 3** | **Discrete-event simulation** | **COMPLETED** | **72 passed** |
|
||||
| **Phase 4** | **Routing and fleet assignment** | **COMPLETED** | **95 passed** |
|
||||
| **Phase 5** | **Charging and operational constraints** | **COMPLETED** | **110 passed (100%)** |
|
||||
| Phase 6 | Analytics and experiment framework | Planned (Next) | - |
|
||||
| Phase 7 | Omniverse USD visualization | Planned | - |
|
||||
| **Phase 5** | **Charging and operational constraints** | **COMPLETED** | **110 passed** |
|
||||
| **Phase 6** | **Analytics and experiment framework** | **COMPLETED** | **129 passed (100%)** |
|
||||
| Phase 7 | Omniverse USD visualization | Planned (Next) | - |
|
||||
| Phase 8 | Operational dashboard | Planned | - |
|
||||
| Phase 9 | Optimization and final demonstration | Planned | - |
|
||||
|
||||
---
|
||||
|
||||
## 2. Completed Tasks (Phase 5)
|
||||
## 2. Completed Tasks (Phase 6)
|
||||
|
||||
- [x] Implemented Physics-Informed Battery Model (`src/warehouse_twin/fleet/battery_model.py`):
|
||||
- Mode-specific power draw computation (`idle`, `moving_empty`, `moving_loaded`, `handling`).
|
||||
- Load-dependent consumption model: Linear scaling between empty and loaded draw based on carried payload.
|
||||
- Complete mission energy feasibility validator: guarantees robots have sufficient battery for empty transit, pick handling, loaded transit, drop handling, and travel to nearest compatible charging bay, while maintaining a strict 20% minimum reserve threshold.
|
||||
- Charger plug-in and duration calculator factoring in 95% electrical conversion efficiency.
|
||||
- Unit test suite: 6 passed in `tests/unit/test_battery_model.py`.
|
||||
- [x] Implemented Capacity-Constrained Charging Queue Manager (`src/warehouse_twin/fleet/charging_manager.py`):
|
||||
- Wrapped charging bays in SimPy `Resource(capacity=1)` to model physical plug-in bottlenecks and real-world queueing.
|
||||
- Compatibility-aware station selection ($50\,\text{kW}$ for Heavy AMRs, $25\,\text{kW}$ for Light AMRs) prioritized by shortest queue and Euclidean distance.
|
||||
- Opportunistic charging triggering ($<40\%$ battery) during idle periods with a minimum charge duration ($180\,\text{s}$) to avoid rapid cycling.
|
||||
- Comprehensive bay metrics: occupancy rate, active charging duration, queue wait duration, and total energy delivered.
|
||||
- Unit test suite: 3 passed in `tests/unit/test_charging_manager.py`.
|
||||
- [x] Implemented Safe Task Reassignment & Preemption (`src/warehouse_twin/fleet/task_reassigner.py`):
|
||||
- Safely detaches un-started tasks from robots dropping below critical reserve thresholds.
|
||||
- Releases spatial reservations in `TimeSpaceReservationGrid`, returns tasks to `PENDING`, and re-enqueues for dispatch.
|
||||
- Preempts un-started low-priority picking tasks when urgent production-line feeder tasks arrive.
|
||||
- Unit test suite: 2 passed in `tests/unit/test_task_reassignment.py`.
|
||||
- [x] Implemented Production-Line Delivery Deadlines & Stock-out Tracking:
|
||||
- Tight SLA tracking for assembly line replenishment tasks with lateness and on-time compliance reporting.
|
||||
- Real-time inventory depletion checks triggering urgent replenishment upon crossing minimum reorder thresholds.
|
||||
- Unit test suites: 3 passed in `tests/unit/test_production_deadlines.py`, 1 passed in `tests/unit/test_stockout_and_replenishment.py`.
|
||||
- [x] Integrated Fleet Charging & Battery System into `SimulationEnvironment` (`src/warehouse_twin/simulation/sim_engine.py`):
|
||||
- Dynamic battery depletion across all mission legs with load-dependent adjustments.
|
||||
- Low battery abort logic prior to pick handling to prevent mid-aisle stranding.
|
||||
- SimPy capacity-constrained charging process with queue wait time metrics.
|
||||
- Enhanced KPI tracking: energy consumed/charged, bay occupancy, charging wait times, deadline compliance.
|
||||
- [x] Enhanced OpenUSD scene export (`omniverse/scenes/warehouse_phase5.usda`):
|
||||
- Updated scene with high-power charging bays, navigation mesh, and fleet visual cues.
|
||||
- [x] Test Suite: Expanded to **110 passed unit tests (100% pass rate in 0.70s)**.
|
||||
- [x] Documentation: Created `docs/phases/phase_5_charging_and_operational_constraints.md`.
|
||||
- [x] Implemented Comprehensive KPI Calculator (`src/warehouse_twin/analytics/kpi_calculator.py`):
|
||||
- Linear rank-interpolated percentile calculation ($p_{50}$, $p_{90}$, $p_{95}$, $p_{99}$) and `DistributionStats` computation.
|
||||
- Strict isolation of incomplete tasks (pending and in-progress) from completed turnaround and execution latency metrics.
|
||||
- Throughput, turnaround time, queue waiting time, mission execution time, and on-time SLA compliance tracking.
|
||||
- Fleet operational efficiency: utilization percentage, loaded vs. empty distance traveled, loaded ratio %, and energy intensity ($\text{kWh}/\text{task}$).
|
||||
- Charging bay occupancy, charging wait times, and per-task-type performance breakdowns (`ORDER_PICK`, `PRODUCTION_LINE_FEED`, `REPLENISHMENT`).
|
||||
- Unit test suite: 5 passed in `tests/unit/test_kpi_calculator.py`.
|
||||
- [x] Implemented Dual-Path Telemetry & Event Storage (`src/warehouse_twin/storage/event_store.py`):
|
||||
- Event streaming and file export: `events.jsonl`, `tasks.csv`, `robots.csv`, `aisle_congestion.csv`, and `kpi_summary.json`.
|
||||
- Typed reader utilities (`load_events`, `load_tasks`, `load_kpis`) for automated post-simulation reporting.
|
||||
- Unit test suite: 4 passed in `tests/unit/test_event_store.py`.
|
||||
- [x] Implemented Spatial Congestion Heatmap & Bottleneck Diagnosis (`src/warehouse_twin/analytics/heatmap.py`):
|
||||
- Composite congestion scoring ($[0.0, 1.0]$) weighting 40% traversal density and 60% delay wait time.
|
||||
- Scalable 2D SVG heatmap generator (`congestion_heatmap.svg`) displaying warehouse zones (A, B, C), stations, charging bays, and color-graded edges (green $\rightarrow$ red).
|
||||
- Terminal-friendly ASCII grid floorplan renderer (`congestion_heatmap.txt`).
|
||||
- Automated corridor bottleneck diagnostic engine identifying hot spots with severity classifications (`INFO`, `WARNING`, `CRITICAL`) and actionable mitigation strategies.
|
||||
- Unit test suite: 4 passed in `tests/unit/test_heatmap.py`.
|
||||
- [x] Implemented Audit-Ready Executive Report Generator (`src/warehouse_twin/analytics/report_generator.py`):
|
||||
- Structured GitHub-flavored Markdown reports (`report.md`) containing executive summary tables, distribution percentiles, individual AMR telemetry matrices, and corridor bottleneck diagnosis.
|
||||
- [x] Implemented Repeatable Experiment & Scenario Comparison Framework (`src/warehouse_twin/analytics/experiment_runner.py`):
|
||||
- Deterministic PRNG seed control for single-seed and multi-seed Monte Carlo evaluations with 95% confidence intervals.
|
||||
- Scenario parameter sweeps for fleet sizing ($2, 4, 6, 8$ AMRs) and dispatch policies (`priority_nearest_idle`, `nearest_idle`, `balanced_utilization`).
|
||||
- Markdown comparison tables highlighting trade-offs between fleet size, throughput, fleet utilization, and corridor contention.
|
||||
- Unit test suites: 4 passed in `tests/unit/test_experiment_runner.py`, 2 passed in `tests/unit/test_scenario_comparison.py`.
|
||||
- [x] CLI Subcommands Added (`src/warehouse_twin/cli.py`):
|
||||
- `warehouse-twin run-experiment --config ... --duration ... --seed ... --output-dir ...`
|
||||
- `warehouse-twin compare-scenarios --config ... --output-dir ...`
|
||||
- [x] Documentation & Changelog: Created `docs/phases/phase_6_analytics_and_experiment_framework.md`, updated `CHANGELOG.md` and `README.md`.
|
||||
- [x] Test Suite: Expanded to **129 passed unit tests (100% pass rate in 0.99s)**.
|
||||
|
||||
---
|
||||
|
||||
## 3. Test & Validation Summary
|
||||
|
||||
- **Total Unit Tests Executed**: 110
|
||||
- **Passed**: 110
|
||||
- **Total Unit Tests Executed**: 129
|
||||
- **Passed**: 129
|
||||
- **Failed**: 0
|
||||
- **Execution Time**: ~0.70 seconds
|
||||
- **Execution Time**: ~0.99 seconds
|
||||
- **Test Suites**:
|
||||
- `test_environment.py`: 5 passed
|
||||
- `test_logging.py`: 3 passed
|
||||
@@ -85,25 +84,39 @@
|
||||
- `test_stockout_and_replenishment.py`: 1 passed
|
||||
- `test_sim_engine.py`: 5 passed
|
||||
- `test_trajectory_export.py`: 1 passed
|
||||
- `test_kpi_calculator.py`: 5 passed
|
||||
- `test_event_store.py`: 4 passed
|
||||
- `test_heatmap.py`: 4 passed
|
||||
- `test_experiment_runner.py`: 4 passed
|
||||
- `test_scenario_comparison.py`: 2 passed
|
||||
|
||||
---
|
||||
|
||||
## 4. Benchmark Performance (1-Hour Simulation Run)
|
||||
## 4. Benchmark Performance (Baseline 1-Hour Run vs. Fleet Sweep)
|
||||
|
||||
### Baseline 1-Hour Run (4 AMRs, Seed 42)
|
||||
- **Simulated Duration**: 3,600.0s (1.00 hour)
|
||||
- **Wall-clock Execution Time**: ~2.60s
|
||||
- **Wall-clock Execution Time**: 0.272s
|
||||
- **Tasks Created**: 86
|
||||
- **Tasks Completed**: 85
|
||||
- **Tasks Completed**: 85 (1 in progress at cutoff)
|
||||
- **Throughput**: 85.00 tasks/hr
|
||||
- **Average Turnaround Time**: 91.2s
|
||||
- **Average Execution Time**: 61.3s
|
||||
- **On-Time Delivery Rate**: 100.0% (0 deadline violations)
|
||||
- **Turnaround Latency**: Mean: 91.2s | $p_{50}$: 74.4s | $p_{90}$: 167.3s | $p_{95}$: 194.2s | $p_{99}$: 216.5s
|
||||
- **Queue Waiting Time**: Mean: 29.8s | $p_{50}$: 11.2s | $p_{90}$: 108.4s
|
||||
- **Execution Latency**: Mean: 61.3s | $p_{50}$: 57.0s | $p_{90}$: 83.2s
|
||||
- **On-Time Delivery Rate**: 100.0% (0 SLA deadline violations)
|
||||
- **Fleet Utilization**: 50.9%
|
||||
- **Total Energy Consumed**: 7.82 kWh
|
||||
- **Total Energy Charged**: 21.55 kWh (across stress test runs)
|
||||
- **Charging Sessions**: 4 sessions completed
|
||||
- **Charging Queue Wait Time**: 0.0s (optimal station capacity)
|
||||
- **Deadlocks Prevented**: 0 (zero deadlocks occurred)
|
||||
- **Head-on Collisions**: 0 (100% collision-free)
|
||||
- **Stranded Robots**: 0 (100% mission feasibility validation)
|
||||
- **Loaded Distance Ratio**: 58.7% (2,430.0m loaded / 4,140.0m total)
|
||||
- **Energy Intensity**: 0.092 kWh / task (7.82 kWh total consumed)
|
||||
- **Charging Sessions**: 4 completed (Queue wait time: 0.0s)
|
||||
|
||||
### Fleet Sizing Parameter Sweep Findings
|
||||
| Metric | 2 AMRs | 4 AMRs (Baseline) | 6 AMRs | 8 AMRs |
|
||||
| :--- | :---: | :---: | :---: | :---: |
|
||||
| **Throughput (tasks/hr)** | 77.00 | **85.00** | 85.00 | 85.00 |
|
||||
| **Fleet Utilization** | 95.6% (Saturated) | **50.9% (Optimal)** | 32.7% | 23.4% |
|
||||
| **Mean Turnaround** | 315.6s | **91.2s** | 63.8s | 61.5s |
|
||||
| **Mean Queue Time** | 253.9s | **29.8s** | 2.5s | 0.2s |
|
||||
| **On-Time SLA %** | 71.4% (Severe delays) | **100.0%** | 100.0% | 100.0% |
|
||||
| **Corridor Conflicts** | 17 | 36 | 45 | 51 |
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user