How osqzss/gps-sdr-sim works
Main Components
• Core Simulation Engine: At the heart of the application is the gpssim.c module, which reads satellite navigation (RINEX) files (e.g., “brdc0010.22n”) and user motion files (in CSV or NMEA format) to compute pseudoranges and Doppler shifts.
• Argument Parsing & Configuration: Modules like getopt.c/getopt.h handle command-line arguments that specify simulation parameters, input file paths, sample rates, simulation duration, and output file formats.
• User Motion Processing: There is support for both static (direct location input) and dynamic motion (CSV/NMEA input) to control the simulated user trajectory.
• Signal Generation Module: After processing inputs, the simulation engine computes the necessary GPS signal components (I/Q samples) based on the input ephemeris, and applies modulation schemes to form baseband signals.
• SDR Interface/Player Components: Under the “player” directory (and sub-folders like “limeplayer_win” and “plutoplayer_win”), there are implementations that tailor the output I/Q data for specific SDR hardware platforms. These modules provide the necessary companion utilities to “play back” or transmit the generated GPS signal.
• Additional Support/Utility Modules:
• “extclk” directory – appears to contain configuration or binary files (possibly related to external clock settings).
• “rtk” directory – holds observation files, navigational logs, and possibly RTK post-processing examples.
• “satgen” directory – contains code and assets for satellite generation and/or simulation of satellite data (likely to simulate alternative satellite constellations or provide additional test data).
Component Relationships & Data Flow
• Input Layer: Accepts GPS broadcast ephemeris files, user motion input (CSV, NMEA, or static values), and configuration parameters.
• Processing Layer: The core simulation engine (gpssim.c) reads and parses inputs, applies the GPS signal simulation algorithm (computing pseudoranges, Doppler shifts, etc.), and optionally adjusts its behavior based on user-defined parameters (like simulation time, sample rate, IQ bit-depth, etc.).
• Output Layer: The simulation produces digitized I/Q samples saved to a file (default “gpssim.bin”), which is then piped into one of several “player” utilities. Depending on the target hardware, these utilities (e.g., bladeplayer for bladeRF, plutoplayer for ADALM-Pluto, hackplayer for HackRF) adjust or format the raw data for transmission.
• External Interfaces: The SDR hardware platforms interface with the transmitted I/Q data. Each player module is designed to handle the specific requirements of its target hardware (for example, data bits or sample rate conversions).
Important Architectural Patterns & Design Principles
• Modularity: The system clearly breaks out core simulation tasks from hardware-specific playback/streaming components. Such separation enables independent development and easier extension to support additional SDR platforms.
• Layered System: Consider showing a layered design – inputs (files and arguments), processing (core signal generation algorithm), and outputs (player modules and hardware interfaces).
Relevant Technologies, Frameworks, or Libraries
• C programming language is used for core simulation (gpssim.c).
• GCC for building under Linux, and Visual Studio for Windows builds.
• Makefiles as build scripts are present both at the root and within subdirectories (e.g., in “player” and “satgen”).
• External tools and utilities: Scripts for SDR platforms (bladeRF-cli script, HackRF commands, UHD tools, etc.) which should be mentioned as part of the system integration.
• Input Files (Ephemeris, User Motion, NMEA streams)
• Core Simulation (gpssim.c and supporting modules)
• Data Processing (Argument parsing via getopt, motion file processing, signal generation)
• Output Module (I/Q sample generation – gpssim.bin)
• Player Utility Modules (bladeplayer, hackplayer, plutoplayer, limeplayer, etc.)
• Hardware Interfaces (ADALM-Pluto, bladeRF, HackRF, USRP, LimeSDR)