How ntutangyun/ai-ran-sim works
Project Type & Purpose
• Type: Full-stack simulation & visualization tool.
• Purpose: Simulate an O-RAN network (base stations, cells, UEs, Core, RIC, edge), integrate AI “xApps” for control/monitoring, and provide a web UI for interactive visualization and chat.
High-Level Components
A. Frontend (Next.js)
– User Browser (React UI)
– HTTP / WebSocket Client
B. Backend (Python)
1. WebSocket Server (main.py)
2. Simulation Engine (network_layer)
3. Knowledge Layer (knowledge_layer)
4. Intelligence Layer (intelligence_layer + xApps)
5. Configuration Module (settings)
6. Utility Modules (utils)
7. Evaluations & Logging (evaluations, assets)
C. External Services
– AI Model Providers (e.g., OpenAI APIs)
– Docker (for containerized backend)
Relationships & Data Flow
1. User Interaction → Frontend UI
• HTTP for page load
• WebSocket for real-time commands & simulation events
2. Frontend → Backend
• “Connect” via WebSocket
• Send user/chat commands, AI service requests
3. Backend WebSocket Server
• Receives UI events → routes to appropriate backend layers
4. Backend Simulation Engine (network_layer)
• Maintains O-RAN state (base stations, cells, UEs, core, RIC, xApps)
• Emits state updates & metrics
5. Backend Knowledge Layer
• Consumes raw simulation data
• Builds knowledge entries, routes queries
6. Backend Intelligence Layer
• Hosts AI pipeline & chat agents
• Invokes external AI services via client_ai_service_deployer
• Feeds AI output back into network decisions or chat responses
7. Backend → Frontend
• Pushes simulation state snapshots & AI chat events over WebSocket
• Frontend renders dashboards & chat components
Architectural Patterns & Principles
• Layered Architecture: clear separation of network simulation, knowledge aggregation, and AI logic.
• Event-Driven / Message-Driven: WebSocket events trigger simulation steps and AI workflows.
• Configuration-Driven: all network, slice, RIC, AI service parameters live in settings/*.
• Modular & Extensible: xApps can be dropped into network_layer/xApps, new knowledge sources in knowledge_layer/knowledge_sources.