This project is a C++-based cellular network simulator that models cellular communication systems using key OOP principles — inheritance, polymorphism, abstraction, and data hiding.
The simulator represents a simplified cellular framework consisting of:
- UserDevice — Represents individual user connections with service types (DATA/VOICE).
- CellTower — Manages frequency allocation and user capacity per channel.
- CellularCore — Handles message generation and overall communication control with capacity limits.
- UserDevice: Encapsulates user information with private data members and getter/setter methods.
- CellTower: Manages connected users and channel allocation tracking.
- CellularCore: Handles message capacity and user management.
- TwoG Class: Derived from CellularSystem.
- TDMA: 16 users per 200 kHz frequency band.
- Capacity: 80 users (1 MHz total / 200 kHz * 16 users).
- Messages: 5 (Data), 15 (Voice).
- ThreeG Class: Derived from CellularSystem.
- CDMA: 32 users per 200 kHz frequency band.
- Capacity: 160 users (1 MHz total / 200 kHz * 32 users).
- Messages: 10 per user.
- FourG Class: Derived from CellularSystem.
- OFDM: 30 users per 10 kHz sub-channel.
- MIMO: Supports up to 4 antennas in parallel.
- Capacity: 12,000 users (1 MHz / 10 kHz * 30 users * 4 antennas).
- Messages: 10 per user.
- FiveG Class: Derived from CellularSystem.
- High Frequency: Operates at 1800 MHz with 10 MHz bandwidth.
- Massive MIMO: Supports up to 16 antennas.
- Capacity: 4,800 users (10 MHz / 1 MHz * 30 users * 16 antennas).
- Messages: 10 per user.
- Encapsulation: Private data members with getter/setter methods
- Inheritance: CellularSystem base class with specific generation derived classes
- Polymorphism: Virtual functions for generation-specific behavior (e.g.,
calculateMaxUsers) - Exception Handling: Custom
SimulatorExceptionfor error management - Templates: Custom
Vector<T>andSharedPtr<T>classes
- C++17 compatible compiler (g++ recommended)
- Make utility
# Build debug version (with debug symbols)
make debug
# Build optimized version (with -O3 optimization)
make release
# Build both versions
make all
# Clean build artifacts
make clean
# Run the simulator (builds release if needed)
make runAfter compilation, you can run the simulator directly using the generated binaries:
Release Version (Recommended):
./build/release/cellular_simDebug Version:
./build/debug/cellular_sim_debug- Debug build:
build/debug/cellular_sim_debug - Release build:
build/release/cellular_sim
The program uses an interactive command-line interface:
- Select Generation: Choose between 2G, 3G, 4G, or 5G.
- Core Capacity: Enter the message processing capacity (messages/sec) or
0to auto-calculate for full potential. - Number of Users: Enter the total number of users to simulate.
- Data Users: Enter the number of users requesting DATA service (remaining will be VOICE).
Select generation:
1) 2G
2) 3G
3) 4G
4) 5G
Enter choice (1-4): 1
Enter core capacity (messages/sec) or 0 to auto-calc for full support: 0
Enter number of users: 50
Enter number of DATA users (0 - 50): 25
The simulation outputs:
- System Configuration: Bandwidth, channels, and theoretical capacity.
- Allocation Results: Number of successfully connected users and core utilization.
- Required Cores: Calculation of cores needed for full potential (for 4G/5G).
- Channel Allocation: Detailed breakdown of users per channel.
- First Channel Details: Specific list of users in the first frequency band.
- User Details: List of all connected users with their assigned channels and frequencies.
cellular_network/
├── header/ # Header files
│ ├── UserDevice.h
│ ├── CellTower.h
│ ├── CellularCore.h
│ ├── CellularSystem.h
│ ├── TwoG.h, ThreeG.h, FourG.h, FiveG.h
│ ├── String.h # Custom string class
│ ├── Vector.h # Custom vector template
│ ├── SharedPtr.h # Custom smart pointer template
│ ├── Thread.h # Threading support
│ └── Mutex.h # Synchronization primitives
├── src/ # Source files
│ ├── UserDevice.cpp
│ ├── CellTower.cpp
│ ├── CellularCore.cpp
│ ├── CellularSystem.cpp
│ ├── TwoG.cpp, ThreeG.cpp, FourG.cpp, FiveG.cpp
│ ├── String.cpp
│ └── syscall_wrapper.cpp
├── io_files/ # I/O library
│ ├── basicIO.h
│ ├── basicIO.cpp
│ └── syscall.S
├── main.cpp # Main simulation program
├── Makefile # Build configuration
└── README.md # This file
This project implements all required functionality from scratch:
- String class: Custom implementation replacing
std::string - Vector class: Template-based dynamic array replacing
std::vector - SharedPtr class: Smart pointer implementation replacing
std::shared_ptr - Threading: Custom wrapper classes for pthread
- basicIO: Custom I/O library
This code is original work. No external code sources were used.
