A pure Python software-defined GNSS signal simulator. This project generates GPS L1 C/A baseband signal IQ data, which can be transmitted using Software Defined Radio (SDR) hardware like the HackRF One.
- Multi-Constellation Support:
- GPS L1 C/A (✅ ICD-compliant)
- Galileo E1 (✅ ICD-compliant with CBOC modulation)
- GLONASS G1 FDMA (✅ ICD-compliant with FDMA)
- Ephemeris Handling:
- Automatically downloads and parses RINEX navigation files (from CDDIS/IGS)
- NEW: SGP4 orbit propagation with TLE files for high-fidelity multi-day scenarios
- Orbit Propagation:
- Keplerian orbit propagation for precise satellite positioning (GPS/Galileo)
- GLONASS state-vector propagation
- NEW: SGP4 perturbation model via Skyfield library
- Trajectory Options:
- Static receiver position
- Circular motion (testing)
- NEW: KML file ingestion for realistic flight paths (Google Earth compatible)
- SDR Integration: Direct interface with HackRF and other SDRs via SoapySDR.
| Signal | Center Freq | Status with SDR |
|---|---|---|
| L1 C/A | 1575.42 MHz | ✅ Production (ICD-compliant) |
| E1 | 1575.42 MHz | ✅ Production (ICD-compliant with CBOC, secondary codes) |
| G1 | 1602 + k*0.5625 MHz | ✅ Production (ICD-compliant with FDMA) |
Tip
All signal generators are now ICD-compliant (~95% implementation) with proper PRN code generation, navigation message structures, and error correction codes. See ICD_COMPLIANCE.md for detailed specifications.
-
Clone the repository:
git clone https://github.com/yourusername/gnss_sim.git cd gnss_sim -
Set up the environment:
# Create and activate virtual environment python3 -m venv .venv source .venv/bin/activate # Install dependencies pip install -r requirements.txt
-
Install SoapySDR (Optional): If you plan to use
transmit_iq.py, you need SoapySDR bindings.- macOS:
brew install soapy-sdr - Linux:
sudo apt install python3-soapysdror build from source.
- macOS:
Run the simulation to generate an IQ file. By default, this generates a 1-second GPS L1 C/A signal for San Francisco and saves it to output/gps_sim_test.iq.
export PYTHONPATH=src
python run_sim.pyCustomize with CLI options:
# London, 10 seconds, GPS only
python run_sim.py --lat 51.5074 --lon -0.1278 --duration 10 --constellations G --output output/london.iq
# Tokyo, 30 seconds, all constellations (GPS + Galileo + GLONASS)
python run_sim.py --lat 35.6762 --lon 139.6503 --duration 30 --constellations GER
# Sydney, 60 seconds, with GLONASS FDMA enabled
python run_sim.py --lat -33.8688 --lon 151.2093 --duration 60 --constellations R --glonass-fdma
# Custom sample rate and output file
python run_sim.py --rate 2000000 --output output/my_signal.iq
# 🆕 Use SGP4 orbit propagation with TLE file
python run_sim.py --sgp4 --tle data/ephemeris/gps_sample.tle --duration 60
# 🆕 Load trajectory from Google Earth KML file
python run_sim.py --kml data/trajectory/sf_flight.kml --duration 30
# 🆕 Combine SGP4 + KML for realistic flight simulation
python run_sim.py --kml flight_path.kml --sgp4 --tle gps.tle --duration 300Available options:
--lat/--lon/--alt: Receiver position (lat/lon in degrees, alt in meters)--kml: NEW Load trajectory from KML file (overrides lat/lon/alt)--duration: Signal duration in seconds (default: 1)--rate: Sample rate in Hz (default: 4000000 / 4 MHz)--constellations: Constellation codes to include (G=GPS, E=Galileo, R=GLONASS)--glonass-fdma: Enable GLONASS FDMA mode (wider bandwidth)--sgp4: NEW Use SGP4 propagation (requires --tle)--tle: NEW Path to TLE file for SGP4 mode--6dof: NEW Enable 6DOF motion (acceleration + attitude)--multipath: NEW Multipath environment (open-sky, ground, urban, indoor, severe)--output: Output IQ file name (default: output/gps_sim_test.iq)--ephemeris: Path to RINEX navigation file
See python run_sim.py --help for all options.
Launch the web interface for visual scenario creation:
cd web
./start_server.shThen open http://localhost:5001 in your browser.
Features:
- 🗺️ Interactive map (Leaflet.js) - click to set location
- 🛣️ Trajectory options: static, circular, or KML upload
- ⚙️ Full parameter control: duration, sample rate, constellations
- 🏢 Multipath presets: open-sky, ground, urban, indoor, severe
- 📊 Real-time visualization: spectrum display with Plotly.js
- 📁 File management: browse and download generated signals
- 🚀 One-click generation: no command line needed!
API Access: The web GUI provides RESTful endpoints for programmatic access:
# Generate signal via API
curl -X POST http://localhost:5001/api/simulate \
-H "Content-Type: application/json" \
-d '{"location": {"lat": 37.7749, "lon": -122.4194, "alt": 100},
"duration": 10, "multipath": "urban", "enable_6dof": true}'
# Download file
curl -O http://localhost:5001/api/download/sim_20260216_123045.iq
# Get spectrum data
curl http://localhost:5001/api/spectrum/sim_20260216_123045.iqSee web/README.md for complete documentation.
You can view, analyze, and record IQ files in three ways:
Analyze signal statistics and generate plots:
python tools/verify_iq.py output/gps_sim_test.iq --rate 4000000Generates plots showing:
- Time-domain I/Q signals
- Constellation diagram
- Power spectrum
- Power vs time
- Amplitude distribution
Output: images/gps_sim_test_analysis.png
Capture real signals from your HackRF (or other SDR) to test against the simulation:
./receive.sh output/captured.iq --duration 30 --gain 20Options:
--duration: Recording time in seconds (default: 10)--gain: RX gain in dB (default: 0)--freq: Center frequency (default: 1575.42 MHz = GPS L1)--rate: Sample rate (default: 4 MHz)--device: Device type (default: driver=hackrf)
Then compare generated vs. captured:
python tools/verify_iq.py output/captured.iq --duration 1.0
python tools/verify_iq.py output/gps_sim_test.iq --duration 1.0Use GQRX to visualize and play back signals in real-time:
gqrxIn GQRX:
- Select Device → HackRF One
- File → Open IQ file (select
output/gps_sim_test.iq) - Set frequency to 1575.42 MHz
- Adjust gain to see signal spectrum
Useful for:
- Spectral inspection
- Waterfall visualization
- Real-time frequency analysis
Warning
Legal Warning: Transmitting GNSS signals over the air is illegal in most jurisdictions without a license. Always perform tests in a shielded environment (Faraday cage) or via conducted path (cables + attenuators) to prevent interference with live GPS signals.
Option A: Quick transmission (HackRF only)
Connect your HackRF and run:
./transmit.sh output/gps_sim_test.iq --rate 4000000 --freq 1575420000 --gain 40Option B: Manual transmission (any SoapySDR device)
Identify your device:
SoapySDRUtil --findThen transmit:
python tools/transmit_iq.py output/gps_sim_test.iq --device "driver=hackrf" --rate 4000000 --freq 1575420000 --gain 40Replace driver=hackrf with your device args. Examples:
- USRP:
driver=uhd,serial=XXXX - PlutoSDR:
driver=plutosdr - LimeSDR:
driver=lime - BladeRF:
driver=bladerf
src/gnss_sim/: Core source codeephemeris/: RINEX downloading and parsing, SGP4 propagatortrajectory/: Receiver path generation, KML loader, 6DOF dynamicssignal/: Signal modulation logic, multipath modelnav/: Navigation message generationsdr/: Hardware interface
web/: NEW Flask web GUIapp.py: Web server and API endpointstemplates/index.html: Interactive web interfaceREADME.md: Web GUI documentation
tools/: Utility scriptstransmit_iq.py: Transmit IQ data via SDRreceive_iq.py: Record IQ data from SDRverify_iq.py: Analyze and visualize IQ files
tests/: NEW Automated test suitetest_signal_accuracy.py: 11 validation tests
run_sim.py: Main entry point - Generate GNSS signals (configurable via CLI)output/: Generated IQ filesdata/: Storage for downloaded ephemeris files and trajectoriesephemeris/: RINEX and TLE filestrajectory/: KML trajectory files
For high-fidelity multi-day simulations, use SGP4 with TLE files:
# Download TLE from space-track.org or celestrak.org
python run_sim.py --sgp4 --tle gps_constellation.tle --duration 86400Benefits:
- Accurate long-term propagation (days/weeks)
- Accounts for atmospheric drag and perturbations
- Compatible with all GNSS constellations
Getting TLE files:
- GPS: https://celestrak.org/NORAD/elements/gps-ops.txt
- Galileo: https://celestrak.org/NORAD/elements/galileo.txt
- GLONASS: https://celestrak.org/NORAD/elements/glo-ops.txt
See QUICK_WINS_STATUS.md for more details.
Create realistic flight paths using Google Earth:
- Open Google Earth
- Draw a path with "Add Path" tool
- Right-click → Save Place As → KML
- Use with simulator:
python run_sim.py --kml my_flight_path.kml --duration 600
Features:
- Cubic spline interpolation for smooth motion
- Automatic velocity computation
- Supports arbitrary waypoints
- Compatible with Google Earth, QGIS, etc.
Example: data/trajectory/sf_flight.kml
See IMPLEMENTATION_STATUS.md for complete details on all features:
- ✅ SGP4 orbit propagation
- ✅ KML trajectory ingestion
- ✅ 6DOF motion (acceleration + attitude)
- ✅ Multipath model (5 environment presets)
- ✅ Web GUI (Flask + Leaflet.js + Plotly.js)
- ✅ Automated test suite (11 validation tests)
All quick wins complete! (6/6) 🎉
The simulator now rivals professional systems like CLAW GPS Simulator with production-grade features for research and SDR applications.
MIT