How v2xgithub/wilabv2xsim works
Project type and purpose
• This is an open-source MATLAB/Octave simulator (WiLabV2Xsim) for vehicular sidelink communications (LTE-V2V, 5G-V2X, IEEE 802.11p).
• It provides a dynamic, modular framework to investigate resource-allocation algorithms, channel modeling (SINR, PER), mobility, and KPI extraction.
High-level architecture and file-structure analysis
• Top-level directories:
• ConfigFiles – user-editable .cfgs for scenarios (highway, urban, RSU…).
• MainFiles (with subfolders MainFilesCV2X, MainFilesIEEE802.11p) – core simulation loop and protocol-specific handlers for TX/RX events.
• MatFilesInit – initialization routines (parameters, random seed, reading cfg).
• MatFilesPosition – mobility and trace‐based position updates.
• MatFilesSINR – channel gain and path-loss/PER lookups.
• MatFilesResourceAllocationCV2X – 5G-V2X resource-allocation procedures.
• MatCBRcalculations – channel busy ratio computations.
• MatFilesCoexistence – cross-technology coexistence logic.
• MatFilesUtility (plus subfolders for LTE, 5G, IEEE802.11p) – shared math/helpers (distance, angles, neighbor detection, RB tables).
• MatFilesOut – output writers (PRR, delays, power, neighbor stats).
• DebugFiles – debugging plots and print routines.
• PERcurves – precomputed PER curves and lookup scripts.
• codeForPaper – example scripts & configs used in publications.
• Root scripts: WiLabV2Xsim.m, Simulations.m orchestrate runs.
README for insights
• Confirms MATLAB ≥2021b requirement, GPLv3 license, focus on sidelink C-V2X with backward support for 802.11p.
• Defines dependency on Statistics and ML Toolbox for traffic generation.
• Points to Wiki for detailed docs.
1. Input & Configuration Manager (reads ConfigFiles/*.cfg)
2. Initialization Module (MatFilesInit)
3. Mobility/Position Module (MatFilesPosition)
4. Channel Model & SINR/PER (MatFilesSINR + PERcurves)
5. Resource-Allocation Module (MatFilesResourceAllocationCV2X)
6. Protocol Engines
– CV2X Engine (MainFilesCV2X)
– IEEE 802.11p Engine (MainFilesIEEE802.11p)
7. CBR & Coexistence Module (MatCBRcalculations + MatFilesCoexistence)
8. Metrics & Output Module (MatFilesOut)
9. Debug & Visualization (DebugFiles)
10. Orchestrator (WiLabV2Xsim.m, mainInit.m, mainV2X.m)
• Config → Init
• Init → Orchestrator
• Orchestrator invokes Mobility → provides positions → Channel Model
• Channel Model uses PERcurves → computes link quality → passes SINR to Protocol Engines
• Orchestrator calls Resource-Allocation → schedules transmissions
• Protocol Engines handle TX/RX events → update CBR/Coexistence → feed back into Resource-Allocation and Channel Model
• After each time step, Metrics Module gathers KPIs → writes outputs
• Debug Module can tap any data pipe for plots/logs
c. Architectural patterns & design principles:
• Layered pipeline: Configuration → Init → Simulation Loop → Output
• Modular decomposition by functionality (mobility, PHY channel, MAC/RA, metrics)
• Data-driven: cfg files, trace files, PER tables
• Extensible: separate subfolders for each radio technology, easy to plug new algorithms
d. Key technologies & frameworks:
• MATLAB (scripts & functions)
• Statistics & Machine Learning Toolbox (traffic generation)
• PER lookup via text-based curves
• Octave compatibility on separate branch
Detailed capture of essential elements
• Break the core simulation loop into four sub-steps: position update, channel computation, RA & TX/RX, KPI update.
• Explicitly show Inter-module dependencies: e.g., CBR module reading TX history, coexistence adjusting NAV parameters in RA.
• Reference config inputs feeding both Init and mobility modules.