How yutailin1993/ns3-wifi-multilateration works
Project Type and Purpose
• CO2P is a domain-specific extension of the NS-3 network simulator, not a web app or microservices system. It injects new positioning algorithms (centralizedCP, centralizedIP, distributedCP) into the NS-3 simulation framework.
• The goal is to simulate “communication-aware collaborative positioning” in FutureG wireless networks, using C++ modules under NS-3 and a Python helper (graph.py) for topology and MDS localization.
High-Level File Structure Analysis
• NS-3 Core & Modules (src/, bindings/, examples/, scratch/, build-support/, utils/, etc.)
• src/*: hundreds of standard NS-3 C++ modules (core, internet, wifi, mobility, propagation, etc.)
• bindings/python: Python support for NS-3 modules
• build-support: CMake macros and templates for building NS-3
• Application-Specific Code
• scratch/
– multilateration.cc – entry point for all paradigms
– multilateralation-core.{cc,h} – shared core functions
• graph.py – Python script for graph operations (rigid topology, MDS)
• Configuration & Build
• CMakeLists.txt at root and under scratch/
• ./ns3 build multilateration – custom NS-3 build invocation
• Documentation & README
• README.md explains branches, build and run steps
• README.md points to paper, NS-3 docs and wifi-ftm-ns3 repository
Key Components
A. CO2P User Code
• Entry Layer: scratch/multilateration.cc
• Core Library: scratch/multilateration-core.{cc,h}
• Graph Module: graph.py (Python process)
B. NS-3 Simulation Framework
• NS-3 Core Engine (src/core, src/network, src/mobility, etc.)
• NS-3 Protocol Modules (wifi, propagation, internet, etc.)
C. Build & Execution
• Build System: CMake + ns3 build scripts
• Runtime: ./ns3 run multilateration
D. External Dependencies
• Python runtime for graph.py
• NS-3 libraries (linked at build time)
Relationships and Data Flows
• Build Phase:
[CMakeLists.txt] → generates build targets → compiles NS-3 modules + scratch code → links into ns3 executable
• Runtime Phase:
1. User invokes ./ns3 run multilateration
2. multilateration.cc initializes NS-3 simulator
3. When graph operations are needed:
→ calls out to Python interpreter running graph.py (via system call or embedded Python binding)
→ Python script computes rigid topology or MDS positions → returns data (via file, stdout or API)
4. NS-3 simulation uses computed positions, mobility models, wifi propagation modules to run experiments
5. Results (traces, logs) are output by NS-3 trace sinks
Architectural Patterns and Principles
• Plug-in Architecture: CO2P logic plugs into NS-3 core as “scratch” modules
• Separation of Concerns:
• C++ for high-performance simulation
• Python for high-level graph computations
• Modular Design: leverage existing NS-3 modules (mobility, wifi, propagation) without modifying them