# Low-Cost COTS GNSS Interference Monitoring, Detection, and Classification System +
## 4 Software Design  
The software architecture changed from an integrated system to multiple micro-services connected via persistent storage to allow modularity, expandability, and robustness. All the components are connected to a Redis data structure server, where data are stored for logging or configuration purposes. The updated structure in Figure 7 consists of six major modules: the GNSS receiver interface and data extraction (red), the NeSDR RFFE receiver interface and SDR pre-processing (green), the ML detection model (orange), the data logging and uploading infrastructure (blue), the web application programming interface (API) and interface (purple), and in the Redis database that binds all the components (white). All the modules were implemented in Python 3.8 and executed as services with \"systemd\". Figure 7: Software flow diagram and interconnections. The GNSS interface connects to the GNSS pHat via the Unix-based GPSD service. GPSD interfaces the GNSS pHat, decodes the NMEA messages, and extracts the GNSS measurements, including the receiver fix status, the position, velocity, and time (PVT) solution, the expected PVT error, the number of satellites in tracking and used for PVT, the dilution of precision (DOP) of the current constellation, the pseudo-random noise (PRN) code of the satellites in track, the CN0 of each satellite, the satellite elevation, and azimuth. The values are parsed and saved in the Redis database as they arrive from the GNSS pHat. The NMEA messages are configured at a 1 Hz update rate. The SDR processing connects to the NeSDR and records data with a center frequency of 1575.42 MHz, a sample rate of 2.56 MHz (higher sample rates resulted in instabilities with recording, such as dropped samples), and 8-bit I/Q data. For efficient batch processing, the data are segmented into 1 s snapshots. The snapshots are passed through a moving average (MA) DC-blocker and de-interleaved with a polyphase quadrature filter (PQF) into 64 channels with 40 kHz bandwidth. The PQF block (_pfb_channelizer_cc_) in the current implementation is the same as a windowed short-time Fourier transform (STFT), but it is implemented more efficiently in the GNU Radio architecture. The SDR processing utilizes GNU Radio for the signal processing components. The energy and kurtosis statistics of each channel and the spectral entropy over all channels are determined. Recently, similar preprocessing approaches for interference classification in GNSS have been proposed [67; 95]. The gain calibration of the RFFE for the correct gain settings is still challenging. Thus, the current model performs a software auto-calibration when the monitoring station ensures no interference signals are present through a feedback loop from the ML detection. Finally, the spectral features are saved in the Redis database at 1 Hz (i.e., synchronized to the batches). A local ML interference detection inference runs in real-time using a buffer of 5 s (i.e., a delay of up to 5 s may occur) of the spectral features recorded from the SDR and realizing a detection prediction at 1 Hz. The ML consists of a histogram-based gradient boosting classification tree trained on a measurement campaign (see Section 6) and has shown good detection results previously [96]. The prediction is sent to Redis to log and activate hardware alarms in the form of a LED and a buzzer. A separate micro-service is responsible for collecting the relevant data from the Redis data structure server, saving it locally for long-term storage, and uploading it to the external server at 1 min intervals. The latter is done for further ML classification inference with more computationally demanding models and to enable collaborative detection and interference localization. The uncompressed data rate is low (about 4.6 MByte/h, or 3.3 GByte/month). An adequate data compression (to a few characteristic features) reduces the data throughput by a factor of about four. An essential feature of the updated version is the web server, which includes an interface, data extraction, and configuration.