feat(phase3): implement SimPy discrete-event simulation engine, multi-zone order generation, fleet dispatcher, and wider Zone B aisles
This commit is contained in:
+47
-36
@@ -1,7 +1,7 @@
|
||||
# Project Status: Warehouse Robot Fleet Digital Twin
|
||||
|
||||
**Last Updated**: October 19, 2026
|
||||
**Current Phase**: **Phase 2: Robot and Task Models (COMPLETED)**
|
||||
**Current Phase**: **Phase 3: Discrete-Event Simulation Engine (COMPLETED)**
|
||||
**Status**: Ready for User Review and Approval
|
||||
|
||||
---
|
||||
@@ -12,9 +12,9 @@
|
||||
| :--- | :--- | :--- | :--- |
|
||||
| **Phase 0** | **Environment and project foundation** | **COMPLETED** | **17 passed** |
|
||||
| **Phase 1** | **Warehouse model** | **COMPLETED** | **26 passed** |
|
||||
| **Phase 2** | **Robot and task models** | **COMPLETED** | **56 passed (100%)** |
|
||||
| Phase 3 | Discrete-event simulation | Planned (Next) | - |
|
||||
| Phase 4 | Routing and fleet assignment | Planned | - |
|
||||
| **Phase 2** | **Robot and task models** | **COMPLETED** | **56 passed** |
|
||||
| **Phase 3** | **Discrete-event simulation** | **COMPLETED** | **72 passed (100%)** |
|
||||
| Phase 4 | Routing and fleet assignment | Planned (Next) | - |
|
||||
| Phase 5 | Charging and operational constraints | Planned | - |
|
||||
| Phase 6 | Analytics and experiment framework | Planned | - |
|
||||
| Phase 7 | Omniverse USD visualization | Planned | - |
|
||||
@@ -23,54 +23,65 @@
|
||||
|
||||
---
|
||||
|
||||
## 2. Completed Tasks (Phase 2)
|
||||
## 2. Completed Tasks (Phase 3)
|
||||
|
||||
- [x] Defined complete robot domain models in `src/warehouse_twin/domain/robot.py`:
|
||||
- `RobotState` enum (`IDLE`, `DISPATCHED`, `PICKING`, `LOADED_TRANSIT`, `DROPPING`, `TRANSIT_TO_CHARGE`, `CHARGING`, `MAINTENANCE`).
|
||||
- `LEGAL_ROBOT_TRANSITIONS` lookup table enforcing valid state machine jumps.
|
||||
- `RobotTypeSpec` data model parsing `config/robots.json`.
|
||||
- `Robot` model tracking position, SoC battery level, energy consumption, kinematics, active tasks, and routes.
|
||||
- `Robot.validate_task_compatibility()` enforcing payload capacity limits and zone accessibility.
|
||||
- `Robot.assign_task()` and `Robot.complete_task()`.
|
||||
- Linear energy consumption and fast-charging modeling.
|
||||
- [x] Defined warehouse task models in `src/warehouse_twin/domain/task.py`:
|
||||
- `TaskType` enum (`INBOUND_TRANSPORT`, `OUTBOUND_PICKING`, `PRODUCTION_FEED`, `REPLENISHMENT`, `CHARGING`).
|
||||
- `TaskStatus` enum (`PENDING`, `ASSIGNED`, `IN_PROGRESS`, `COMPLETED`, `CANCELLED`, `FAILED`).
|
||||
- `LEGAL_TASK_TRANSITIONS` table preventing invalid state jumps.
|
||||
- `Task` dataclass tracking turnaround time, queue waiting time, execution duration, and SLA deadline overdues.
|
||||
- [x] Defined inventory models in `src/warehouse_twin/domain/inventory.py`:
|
||||
- `InventoryItem` tracking stock levels, reservations, reorder thresholds, and restocking amounts.
|
||||
- `InventoryCatalog` loading 13 SKUs across Fast Moving, Slow Moving/Heavy, and Raw Material categories.
|
||||
- [x] Defined simulation telemetry in `src/warehouse_twin/domain/events.py`:
|
||||
- `SimulationEventType` enum and `SimulationEvent` dataclass with JSONL serialization.
|
||||
- [x] Integrated AMR fleet into 3D OpenUSD generator (`src/warehouse_twin/interfaces/usd_generator.py`):
|
||||
- Added visual prims for `light_amr` (pearl white chassis, cyan status dome) and `heavy_amr` (industrial amber chassis, emerald status dome).
|
||||
- Exported OpenUSD scene `omniverse/scenes/warehouse_phase2.usda`.
|
||||
- [x] Added 30 new unit tests (56 total unit tests passing in 0.24s).
|
||||
- [x] Created `docs/phases/phase_2_robot_and_task_models.md`.
|
||||
- [x] Modified Zone B (slow-moving specialized inventory) with **wider aisles ($4.0\text{m}$ width)**:
|
||||
- Updated `config/warehouse.json` with `aisle_width: 4.0`.
|
||||
- Configured `WarehouseGraphBuilder` with $4.0\text{m}$ column spacing across Zone B ($x \in [32.0, 36.0, 40.0, 44.0]$).
|
||||
- Added unit test `test_slow_moving_zone_b_has_wider_aisles` verifying $4.0\text{m}$ vs $2.0\text{m}$ aisle spacing.
|
||||
- [x] Implemented multi-zone order generator (`src/warehouse_twin/simulation/order_generator.py`):
|
||||
- Zone A: Poisson process (`expovariate`) for fast-moving components.
|
||||
- Zone B: Gaussian distribution (`gauss`) for heavy parts, targeting Zone B's wider aisles.
|
||||
- Zone C: Deterministic scheduled batch deliveries feeding production line dropoff.
|
||||
- Automated stock replenishment order generation when inventory dips below minimum threshold.
|
||||
- [x] Implemented fleet dispatcher (`src/warehouse_twin/simulation/dispatcher.py`):
|
||||
- Priority task queue sorting by `(priority, deadline, release_time)`.
|
||||
- AMR payload compatibility filtering and Zone B heavy AMR restriction enforcement.
|
||||
- Minimum battery headroom ($20\%$) filtering.
|
||||
- NetworkX shortest-path distance calculation for nearest idle robot allocation.
|
||||
- [x] Implemented SimPy discrete-event simulation engine (`src/warehouse_twin/simulation/sim_engine.py`):
|
||||
- Master clock coordinator and discrete process manager.
|
||||
- Full AMR mission lifecycle: empty transit, picking, stock reservation, loaded transit, dropoff.
|
||||
- Battery discharge and automated fast-recharging at charging bays.
|
||||
- Real-time telemetry streaming to `logs/simulation_events.jsonl`.
|
||||
- Comprehensive KPI metrics collection (throughput, turnaround time, wait time, utilization, energy).
|
||||
- [x] Added `run-sim` CLI subcommand to `src/warehouse_twin/cli.py`.
|
||||
- [x] Expanded test suite to **72 unit tests** (100% pass rate in 0.37s).
|
||||
- [x] Created `docs/phases/phase_3_simulation_engine.md`.
|
||||
|
||||
---
|
||||
|
||||
## 3. Test & Validation Summary
|
||||
|
||||
- **Total Unit Tests Executed**: 56
|
||||
- **Passed**: 56
|
||||
- **Total Unit Tests Executed**: 72
|
||||
- **Passed**: 72
|
||||
- **Failed**: 0
|
||||
- **Execution Time**: ~0.24 seconds
|
||||
- **Execution Time**: ~0.37 seconds
|
||||
- **Test Suites**:
|
||||
- `test_environment.py`: 5 passed
|
||||
- `test_logging.py`: 3 passed
|
||||
- `test_config_loader.py`: 9 passed
|
||||
- `test_warehouse_graph.py`: 11 passed
|
||||
- `test_warehouse_graph.py`: 12 passed
|
||||
- `test_robot_model.py`: 14 passed
|
||||
- `test_task_model.py`: 9 passed
|
||||
- `test_inventory_model.py`: 4 passed
|
||||
- `test_events_model.py`: 1 passed
|
||||
- `test_order_generator.py`: 6 passed
|
||||
- `test_dispatcher.py`: 4 passed
|
||||
- `test_sim_engine.py`: 5 passed
|
||||
|
||||
---
|
||||
|
||||
## 4. Environment & Constraints Compliance
|
||||
## 4. Benchmark Performance (1-Hour Simulation Run)
|
||||
|
||||
- **Storage**: Root NVMe partition at 99% capacity (~8.8 GB available). Maintained zero uncontrolled growth.
|
||||
- **USD Export**: `omniverse/scenes/warehouse_phase2.usda` (19 KB) generated cleanly without GPU dependencies.
|
||||
- **Active Omniverse Kit Instance**: Running PID 74367 (`warehouse_twin.kit`) on RTX 5090.
|
||||
- **Simulated Duration**: 3,600.0s (1.00 hour)
|
||||
- **Wall-clock Execution Time**: ~0.45s
|
||||
- **Tasks Created**: 86
|
||||
- **Tasks Completed**: 84
|
||||
- **Throughput**: 84.00 tasks/hr
|
||||
- **Average Turnaround Time**: 96.3s
|
||||
- **Average Waiting Time**: 31.9s
|
||||
- **Average Execution Time**: 64.4s
|
||||
- **On-Time Delivery Rate**: 100.0%
|
||||
- **Fleet Utilization**: 53.2%
|
||||
- **Replenishment Triggers**: 1
|
||||
|
||||
Reference in New Issue
Block a user