This repository contains research work combining ns-3 network simulator with Machine Learning in the Physical Layer (MLPL) techniques. The project aims to integrate modern ML approaches into network simulation to improve channel modeling, PHY layer performance, and overall network efficiency.
- ns-3 Integration: Custom modules and helpers for ns-3
- ML-Enhanced PHY Layer: Python-based ML models for channel prediction and optimization
- Modular Design: Reusable components for different research scenarios
- Comprehensive Documentation: API docs, user guides, and developer documentation
- Reproducible Experiments: Scripts and configurations for reproducing results
ns3-mlpl-research/
├── src/ # Source code
│ ├── modules/ # ns-3 modules
│ ├── examples/ # Example applications
│ └── helper/ # Helper classes and utilities
├── docs/ # Documentation
│ ├── api/ # API documentation
│ ├── user-guide/ # User guides and tutorials
│ └── developer-guide/ # Developer documentation
├── scripts/ # Build and utility scripts
│ ├── build/ # Build automation scripts
│ ├── experiments/ # Experiment execution scripts
│ └── analysis/ # Data analysis and plotting
├── data/ # Data files
│ ├── input/ # Input datasets
│ └── preprocessed/ # Processed data
├── results/ # Results and outputs
│ ├── experiments/ # Experiment results
│ ├── plots/ # Generated figures
│ └── logs/ # Execution logs
├── config/ # Configuration files
└── tests/ # Unit and integration tests
- ns-3 Simulator (version 3.x or later)
- Python (3.8 or later)
- Required Python packages (see requirements.txt)
- C++ Compiler (GCC or Clang)
- CMake (for building)
- Clone the repository:
git clone https://github.com/your-username/ns3-mlpl-research.git
cd ns3-mlpl-research- Set up Python environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt- Install ns-3:
3.1. Install dependencies:
# Update package list
sudo apt update
# Install essential build tools and dependencies
sudo apt install -y \
build-essential \
cmake \
git \
python3-dev \
python3-pip \
libgsl-dev \
libgtk-3-dev \
libxml2-dev \
sqlite3 \
libsqlite3-dev \
qtbase5-dev \
qtchooser \
qt5-qmake \
qtbase5-dev-tools \
mercurial \
bzr3.2. Download and decompress ns-3
# Navigate to your workspace (or wherever you want ns-3)
cd ~/
# Download ns-3 (using the latest stable version)
wget https://www.nsnam.org/releases/ns-allinone-3.41.tar.bz2
# Extract the archive
tar -xjf ns-allinone-3.41.tar.bz2
# Navigate to the ns-3 directory
cd ns-allinone-3.41/ns-3.413.3. Configure and build
# Configure ns-3 with Python bindings enabled
./ns3 configure --enable-examples --enable-tests
# Build ns-3 (this will take several minutes)
./ns3 build3.4. Test the installation
# Run a simple test to verify everything works
./ns3 run hello-simulator
# If that works, try a more complex example
./ns3 run first3.5. Set up environment
# Add to your ~/.bashrc for permanent setup
echo 'export NS3_HOME=~/ns-allinone-3.41/ns-3.41' >> ~/.bashrc
echo 'export PYTHONPATH=$PYTHONPATH:$NS3_HOME/build/bindings/python' >> ~/.bashrc
source ~/.bashrc3.6. Verification commands
# List available examples
./ns3 run --list
# Run the WiFi example
./ns3 run wifi-simple-adhoc
# Check if Python bindings work
python3 -c "import ns3; print('ns-3 Python bindings work!')"- Build the project:
./scripts/build/build.sh- Run a basic example:
python src/examples/basic_mlpl_example.py- Execute a simulation:
./scripts/experiments/run_simulation.sh config/basic_config.yaml- Analyze results:
python scripts/analysis/analyze_results.py results/latest/To run a simulation with ML-enhanced PHY layer:
# Basic usage
python -m mlpl_sim --config config/simulation.yaml
# With custom parameters
python -m mlpl_sim --channels 10 --ml-model lstm --epochs 100- Create a new model class in
src/ml_models/ - Implement the required interface methods
- Register the model in the model factory
- Update configuration files as needed
- Add new C++ classes in
src/modules/ - Update the waf build configuration
- Include Python bindings if needed
- Add unit tests
Configuration files are stored in the config/ directory. Key configuration files:
simulation.yaml: Main simulation parametersml_config.yaml: ML model configurationschannel_models.yaml: Channel model parameters
Results are automatically saved to results/ with timestamps. Use the analysis scripts to:
- Generate performance plots
- Export data to various formats
- Create publication-ready figures
- Fork the repository
- Create a feature branch (
git checkout -b feature/your-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin feature/your-feature) - Create a Pull Request
If you use this work in your research, please cite:
@software{ns3_mlpl_research,
title = {ns-3 + MLPL Research Framework},
author = {Your Name and Contributors},
year = {2025},
url = {https://github.com/your-username/ns3-mlpl-research}
}See CITATION.cff for more citation formats.
This project is licensed under the MIT License - see the LICENSE file for details.
- ns-3 Project Team
- Machine Learning community
- Research collaborators and contributors
- Primary Author: Lucas Mendes dpmendes@gmail.com
- Project Link: https://github.com/dpmendes/ns3-mlpl-research
- Basic project structure
- Initial ns-3 integration
- Example ML models for PHY layer
- Basic simulation framework