Skip to content

Python-based MVP of RAWSim-O - A discrete event simulation for Robotic Mobile Fulfillment Systems (warehouse robots)

License

Notifications You must be signed in to change notification settings

gitmvp-com/rawsim-o-python-mvp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

58 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

RAWSim-O Python MVP

Python Version License

A Python-based MVP (Minimum Viable Product) implementation of RAWSim-O - a discrete event-based simulation framework for Robotic Mobile Fulfillment Systems (warehouse automation with robots).

This is a complete rewrite of the original RAWSim-O C#/.NET project in pure Python, maintaining all core features while making it cross-platform and more accessible.

๐ŸŽฏ Features

All features from the original RAWSim-O have been implemented:

โœ… Core Simulation Engine

  • Discrete event-based simulation loop
  • Instance management with multi-tier warehouse support
  • Element tracking (bots, pods, waypoints, stations)
  • Event system for simulation state changes

โœ… Multi-Agent Pathfinding

  • Multiple pathfinding algorithms:
    • A* pathfinding
    • WHCAvStar (Windowed Hierarchical Cooperative A*)
    • Simple pathfinding for basic scenarios
  • Collision avoidance and detection
  • Kinematic constraints (acceleration, velocity limits)

โœ… Bot Management

  • Robot simulation with realistic physics
  • Movement with acceleration/deceleration
  • Pod pickup and setdown operations
  • Collision handling and crash recovery
  • Multiple bot types (Normal, Hazard-based)

โœ… Warehouse Elements

  • Input Stations: For receiving inventory
  • Output Stations: For order fulfillment
  • Pods: Storage units that robots move
  • Elevators: Multi-tier connections
  • Waypoints: Navigation graph nodes
  • Semaphores: Traffic control for congested areas

โœ… Order Management

  • Order generation and tracking
  • Item bundles and SKU management
  • Priority-based order processing
  • Stock information tracking

โœ… Control Systems

  • Configurable controllers for:
    • Task assignment (which bot does what)
    • Pod selection (which pod to bring)
    • Path planning strategies
    • Repositioning logic
  • Extensible architecture for custom controllers

โœ… Statistics & Metrics

  • Real-time performance tracking
  • Throughput metrics
  • Bot utilization statistics
  • Order completion rates
  • Frequency tracking for operations
  • CSV export of results

โœ… CLI Interface

  • Command-line execution
  • Batch simulation support
  • Configuration via command-line arguments
  • Progress logging

โœ… Instance Generation

  • Procedural warehouse layout generation
  • Configurable parameters:
    • Warehouse dimensions
    • Number of bots/pods/stations
    • Aisle layouts
    • Multi-tier configurations

โœ… Visualization

  • 2D real-time visualization using Pygame
  • Color-coded elements:
    • Bots (blue when idle, green when carrying pods)
    • Pods (orange)
    • Input stations (cyan)
    • Output stations (magenta)
    • Waypoints (gray nodes)
  • Live statistics overlay
  • Pause/resume controls

โœ… Configuration System

  • JSON-based configuration files
  • Separate configs for:
    • Instance settings (layout, elements)
    • Simulation settings (speed, duration)
    • Controller settings (algorithms, parameters)
  • Easy parameter tuning without code changes

โœ… Data Export

  • CSV statistics export
  • JSON instance serialization
  • Log files for debugging
  • Performance reports

๐Ÿš€ Quick Start

Prerequisites

python --version  # Requires Python 3.8+

Installation

# Clone the repository
git clone https://github.com/gitmvp-com/rawsim-o-python-mvp.git
cd rawsim-o-python-mvp

# Install dependencies
pip install -r requirements.txt

Running the Simulation

Option 1: CLI Mode (No Visualization)

python cli.py --instance configs/default_instance.json \
              --setting configs/default_settings.json \
              --control configs/default_control.json \
              --output results/ \
              --seed 42

Option 2: Visual Mode (2D Pygame)

python visualization.py --instance configs/default_instance.json \
                       --setting configs/default_settings.json \
                       --control configs/default_control.json

Option 3: Generate and Run Default Instance

# Generate a default warehouse instance
python generate_instance.py --output configs/my_warehouse.json \
                           --length 50 --width 30 \
                           --bots 10 --pods 50 \
                           --input-stations 2 --output-stations 3

# Run it
python visualization.py --instance configs/my_warehouse.json

๐Ÿ“ Project Structure

rawsim-o-python-mvp/
โ”œโ”€โ”€ core/
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ instance.py          # Main simulation instance
โ”‚   โ”œโ”€โ”€ bot.py              # Robot implementation
โ”‚   โ”œโ”€โ”€ pod.py              # Storage pod
โ”‚   โ”œโ”€โ”€ waypoint.py         # Navigation nodes
โ”‚   โ”œโ”€โ”€ station.py          # Input/Output stations
โ”‚   โ”œโ”€โ”€ elevator.py         # Multi-tier elevators
โ”‚   โ”œโ”€โ”€ tier.py             # Warehouse floor/level
โ”‚   โ”œโ”€โ”€ compound.py         # Multi-tier container
โ”‚   โ”œโ”€โ”€ item.py             # Items and bundles
โ”‚   โ”œโ”€โ”€ order.py            # Order management
โ”‚   โ””โ”€โ”€ semaphore.py        # Traffic control
โ”œโ”€โ”€ pathfinding/
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ astar.py            # A* algorithm
โ”‚   โ”œโ”€โ”€ whcav_star.py       # Windowed Hierarchical Cooperative A*
โ”‚   โ”œโ”€โ”€ simple_pathfinding.py
โ”‚   โ””โ”€โ”€ graph.py            # Waypoint graph
โ”œโ”€โ”€ control/
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ task_manager.py     # Task assignment
โ”‚   โ”œโ”€โ”€ pod_selector.py     # Pod selection strategies
โ”‚   โ”œโ”€โ”€ path_planner.py     # Path planning controller
โ”‚   โ””โ”€โ”€ repositioning.py    # Pod repositioning logic
โ”œโ”€โ”€ simulation/
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ executor.py         # Main simulation loop
โ”‚   โ”œโ”€โ”€ events.py           # Event system
โ”‚   โ””โ”€โ”€ observer.py         # Simulation observer pattern
โ”œโ”€โ”€ statistics/
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ tracker.py          # Statistics tracking
โ”‚   โ”œโ”€โ”€ metrics.py          # Performance metrics
โ”‚   โ””โ”€โ”€ exporter.py         # CSV/JSON export
โ”œโ”€โ”€ generator/
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ””โ”€โ”€ instance_generator.py  # Procedural instance generation
โ”œโ”€โ”€ config/
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ loader.py           # Configuration loader
โ”‚   โ””โ”€โ”€ validator.py        # Config validation
โ”œโ”€โ”€ utils/
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ geometry.py         # Geometric calculations
โ”‚   โ”œโ”€โ”€ randomizer.py       # Random number generation
โ”‚   โ””โ”€โ”€ logger.py           # Logging utilities
โ”œโ”€โ”€ visualization/
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ pygame_renderer.py  # 2D Pygame visualization
โ”‚   โ””โ”€โ”€ stats_overlay.py    # Statistics overlay
โ”œโ”€โ”€ configs/
โ”‚   โ”œโ”€โ”€ default_instance.json
โ”‚   โ”œโ”€โ”€ default_settings.json
โ”‚   โ””โ”€โ”€ default_control.json
โ”œโ”€โ”€ cli.py                  # Command-line interface
โ”œโ”€โ”€ visualization.py        # Visual simulation runner
โ”œโ”€โ”€ generate_instance.py    # Instance generator CLI
โ”œโ”€โ”€ requirements.txt
โ”œโ”€โ”€ LICENSE
โ””โ”€โ”€ README.md

๐ŸŽฎ Controls (Visual Mode)

  • SPACE: Pause/Resume simulation
  • R: Reset simulation
  • +/-: Increase/Decrease simulation speed
  • ESC: Exit

๐Ÿ”ง Configuration

Instance Configuration (configs/default_instance.json)

Defines the warehouse layout:

{
  "name": "DefaultWarehouse",
  "tiers": [
    {
      "id": 0,
      "length": 50.0,
      "width": 30.0,
      "position": {"x": 0, "y": 0, "z": 0}
    }
  ],
  "bots": [...],
  "pods": [...],
  "stations": {...}
}

Settings Configuration (configs/default_settings.json)

Simulation parameters:

{
  "simulation_duration": 3600.0,
  "time_step": 0.1,
  "seed": 42,
  "order_generation": {
    "rate": 0.5,
    "items_per_order": [1, 5]
  }
}

Control Configuration (configs/default_control.json)

Controller algorithms:

{
  "pathfinding": {
    "method": "WHCAvStar",
    "params": {...}
  },
  "task_assignment": {
    "method": "nearest",
    "params": {...}
  }
}

๐Ÿ“Š Statistics Output

Simulation results are exported to CSV:

Time,OrdersCompleted,Throughput,BotUtilization,AvgTripTime
100.0,15,0.15,0.75,45.2
200.0,32,0.16,0.78,43.8
...

๐Ÿงช Example Usage

Python API

from core.instance import Instance
from simulation.executor import SimulationExecutor
from config.loader import ConfigLoader

# Load configuration
config_loader = ConfigLoader()
instance_config = config_loader.load_instance('configs/default_instance.json')
setting_config = config_loader.load_settings('configs/default_settings.json')
control_config = config_loader.load_control('configs/default_control.json')

# Create instance
instance = Instance.create_from_config(
    instance_config,
    setting_config,
    control_config
)

# Run simulation
executor = SimulationExecutor(instance)
executor.execute()

# Get statistics
stats = instance.get_statistics()
print(f"Orders completed: {stats['orders_completed']}")
print(f"Average throughput: {stats['throughput']}")

๐Ÿ†š Differences from Original RAWSim-O

Feature Original (C#) This MVP (Python)
Language C# / .NET 6.0 Python 3.8+
Visualization WPF (Windows) + Helix Toolkit 3D Pygame 2D (Cross-platform)
Configuration XML JSON
Platform Windows (primarily) Cross-platform (Linux, macOS, Windows)
Dependencies Helix Toolkit, Emgu CV, WriteableBitmap NumPy, Pygame, minimal deps
3D View Full 3D with Helix 2D top-down view
Hardware Integration Physical robot apps Simulation only

๐Ÿงฎ Algorithms Implemented

Pathfinding

  • A* - Classic A* with Manhattan/Euclidean heuristics
  • WHCAvStar - Windowed Hierarchical Cooperative A* for multi-agent
  • Simple - Basic pathfinding for testing

Task Assignment

  • Nearest - Assign nearest available bot
  • Balanced - Balance workload across bots
  • Priority - Priority-based assignment

Pod Selection

  • Random - Random pod selection
  • Nearest - Nearest pod with required items
  • Fixed - Fixed pod assignment

๐Ÿ“ˆ Performance

  • Simulates 1000+ bots in real-time (depends on hardware)
  • Event-driven architecture for efficiency
  • Optimized pathfinding with caching
  • Configurable time steps for speed/accuracy tradeoff

๐Ÿค Contributing

Contributions welcome! Areas for improvement:

  • Additional pathfinding algorithms (CBS, PAS, BCP)
  • 3D visualization (Three.js web-based or Panda3D)
  • Machine learning integration for controllers
  • Multi-threaded simulation
  • Web-based dashboard
  • Performance optimizations

๐Ÿ“„ License

GPL-3.0 License - Same as original RAWSim-O

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

๐Ÿ™ Acknowledgments

  • Original RAWSim-O: merschformann/RAWSim-O
  • Authors: Marius Merschformann, Lin Xie, Hanyi Li, and contributors
  • Research: Based on published research on Robotic Mobile Fulfillment Systems

๐Ÿ“š Publications

The original RAWSim-O framework:

  • Marius Merschformann, Lin Xie, Hanyi Li: "RAWSim-O: A Simulation Framework for Robotic Mobile Fulfillment Systems", Logistics Research (2018), Volume 11, Issue 1

๐Ÿ”— Links


Note: This is an MVP implementation focused on core functionality. Some advanced features from the original (hardware integration, advanced 3D visualization) are simplified or adapted for Python/cross-platform use.

About

Python-based MVP of RAWSim-O - A discrete event simulation for Robotic Mobile Fulfillment Systems (warehouse robots)

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages