### Build and install libad9361-iio with cmake Source: https://github.com/osqzss/gps-sdr-sim/blob/master/player/README.md This snippet outlines the steps to build and install the libad9361-iio library on Linux using Git, CMake, and Make. It includes cloning the repository, configuring the build, compiling, and installing the library. This is a dependency for the ADALM-Pluto player. ```bash $ git clone https://github.com/analogdevicesinc/libad9361-iio.git $ cd libad9361-iio $ cmake ./ $ make all $ sudo make install ``` -------------------------------- ### Configure Custom Scenario Start Time Source: https://context7.com/osqzss/gps-sdr-sim/llms.txt Allows setting a specific start time for the GPS signal simulation using a date/time string or 'now'. This is useful for synchronizing simulations with specific events or current time. The simulation duration and output file are also specified. ```bash # Set specific start time for simulation # Format: YYYY/MM/DD,hh:mm:ss ./gps-sdr-sim -e brdc0010.22n -l 35.681298,139.766247,100 \ -t 2022/01/15,12:30:00 -d 300 -o gpssim.bin # Use current system time as start time ./gps-sdr-sim -e brdc0010.22n -l 35.681298,139.766247,100 \ -T now -d 300 -o gpssim.bin # Overwrite ephemeris TOC and TOE to match start time ``` -------------------------------- ### Set USER_MOTION_SIZE with Make Source: https://github.com/osqzss/gps-sdr-sim/blob/master/README.md Demonstrates how to set the USER_MOTION_SIZE variable when using 'make' to build the project. This allows for user motion files with more than 30000 samples. The example sets the size to 4000 seconds. ```bash make USER_MOTION_SIZE=4000 ``` -------------------------------- ### BladeRF Command-Line Playback Source: https://github.com/osqzss/gps-sdr-sim/blob/master/README.md Configure and load a simulated GPS signal file (gpssim.bin) into a BladeRF device for playback. Sets frequency, samplerate, bandwidth, and gain before starting transmission from the specified binary file. ```shell set frequency 1575.42M set samplerate 2.6M set bandwidth 2.5M set txvga1 -25 cal lms cal dc tx tx config file=gpssim.bin format=bin tx start ``` ```shell > bladeRF-cli -s bladerf.script ``` -------------------------------- ### Compute Satellite Position from Ephemeris Data (C) Source: https://context7.com/osqzss/gps-sdr-sim/llms.txt This C code example shows how to compute a satellite's position, velocity, and clock bias using ephemeris data read from a RINEX navigation file. It utilizes functions like `readRinexNavAll` to parse the file and `satpos` to calculate the satellite's state at a specific GPS time. ```c #include "gpssim.h" // Read ephemeris data from RINEX file ephem_t eph[EPHEM_ARRAY_SIZE][MAX_SAT]; ionoutc_t ionoutc; int neph = readRinexNavAll(eph, &ionoutc, "brdc0010.22n"); if (neph > 0) { // GPS time gpstime_t g; g.week = 2242; g.sec = 518400.0; // Compute position, velocity, and clock for satellite PRN 12 int sv = 11; // PRN 12 (0-indexed) double pos[3], vel[3], clk[2]; if (eph[0][sv].vflg == 1) { satpos(eph[0][sv], g, pos, vel, clk); printf("Satellite PRN %d position:\n", sv+1); printf(" X: %.3f m\n", pos[0]); printf(" Y: %.3f m\n", pos[1]); printf(" Z: %.3f m\n", pos[2]); printf(" Clock bias: %.9e sec\n", clk[0]); } } ``` -------------------------------- ### Get Current UTC Time Source: https://github.com/osqzss/gps-sdr-sim/wiki/Real-Time-Streaming-to-HackRF This command retrieves the current Coordinated Universal Time (UTC) in the format YYYY/MM/DD,HH:MM:SS. This format is required by the GPS-SDR-SIM simulator for the `-t` option. ```bash date -u +%Y/%m/%d,%H:%M:%S ``` -------------------------------- ### ADALM-Pluto Playback Source: https://github.com/osqzss/gps-sdr-sim/blob/master/README.md Transmit simulated GPS signals using the plutoplayer utility on an ADALM-Pluto device. Examples show default playback, setting TX attenuation, and adjusting RF bandwidth. The device needs to be network-accessible. ```shell > plutoplayer -t gpssim.bin ``` ```shell > plutoplayer -t gpssim.bin -a -30.0 ``` ```shell > plutoplayer -t gpssim.bin -b 3.0 ``` -------------------------------- ### Build bladeplayer using make Source: https://github.com/osqzss/gps-sdr-sim/blob/master/player/README.md This snippet demonstrates how to build the bladeplayer software using the `make` command. It assumes the necessary dependencies and build environment are set up. ```bash $ make bladeplayer ``` -------------------------------- ### Build limeplayer using make Source: https://github.com/osqzss/gps-sdr-sim/blob/master/player/README.md This code snippet illustrates how to compile the limeplayer software. The `make` command is used, indicating a standard build process for the LimeSDR player. ```bash $ make limeplayer ``` -------------------------------- ### Build plutoplayer using make Source: https://github.com/osqzss/gps-sdr-sim/blob/master/player/README.md This snippet details the process of building the plutoplayer software. It uses the `make` command, implying a standard build procedure for the ADALM-Pluto player. ```bash $ make plutoplayer ``` -------------------------------- ### Build hackplayer using make Source: https://github.com/osqzss/gps-sdr-sim/blob/master/player/README.md This snippet shows the command to build the hackplayer software. It relies on the `make` utility and pre-configured build system for the hackRF One. ```bash $ make hackplayer ``` -------------------------------- ### Build gps-sdr-sim with Custom User Motion Buffer Size Source: https://context7.com/osqzss/gps-sdr-sim/llms.txt This section shows how to compile the gps-sdr-sim project with a custom user motion buffer size. Increasing this buffer allows for longer dynamic simulations. It demonstrates both the `make` command for custom builds and direct GCC compilation. ```bash # Default maximum duration: 300 seconds (3000 samples at 10 Hz) # Increase buffer for longer dynamic simulations make USER_MOTION_SIZE=6000 ``` ```bash # This allows up to 600 seconds of user motion ./gps-sdr-sim -e brdc0010.22n -u long_trajectory.csv -d 600 -o gpssim.bin ``` ```bash # Direct compilation with GCC gcc gpssim.c -lm -O3 -o gps-sdr-sim -DUSER_MOTION_SIZE=6000 ``` -------------------------------- ### Basic GPS Simulation with Old Ephemeris Source: https://context7.com/osqzss/gps-sdr-sim/llms.txt Simulates GPS signals using an older ephemeris file but with current time. This is useful for testing scenarios where ephemeris data might not be the latest but real-time simulation is desired. It outputs the simulated signal to a binary file. ```bash ./gps-sdr-sim -e brdc0010.22n -l 35.681298,139.766247,100 \ -T 2024/06/20,08:00:00 -d 300 -o gpssim.bin ``` -------------------------------- ### Generate Static GPS Signal File Source: https://context7.com/osqzss/gps-sdr-sim/llms.txt Generates a binary GPS signal file (I/Q samples) for a static location. Requires ephemeris data, latitude, longitude, height, and duration. The output file contains 16-bit signed I/Q samples at 2.6 MHz sampling rate. ```bash # Generate GPS signal for a specific location (Tokyo) # -e: ephemeris file (RINEX navigation data) # -l: latitude,longitude,height in degrees and meters # -d: duration in seconds # -o: output binary file ./gps-sdr-sim -e brdc0010.22n -l 35.681298,139.766247,100 -d 300 -o gpssim.bin # The output file contains 16-bit signed I/Q samples at 2.6 MHz sampling rate # File size: ~300 seconds * 2.6 MHz * 2 channels * 2 bytes = ~3.12 GB ``` -------------------------------- ### Compile GPS-SDR-SIM with GCC Source: https://github.com/osqzss/gps-sdr-sim/blob/master/README.md Compile the gpssim.c file using GCC with optimization flags and link the math library. The output executable is named 'gps-sdr-sim'. ```bash gcc gpssim.c -lm -O3 -o gps-sdr-sim ``` -------------------------------- ### Compile GPS-SDR-SIM with GCC and USER_MOTION_SIZE Source: https://github.com/osqzss/gps-sdr-sim/blob/master/README.md Compile the gpssim.c file using GCC, specifying the USER_MOTION_SIZE using the -D flag. This allows for larger user motion files by defining the maximum time in seconds. ```bash gcc gpssim.c -lm -O3 -o gps-sdr-sim -DUSER_MOTION_SIZE=4000 ``` -------------------------------- ### Advanced GPS Simulation Options Source: https://context7.com/osqzss/gps-sdr-sim/llms.txt Demonstrates advanced configurations for GPS signal simulation. These include disabling ionospheric delay, using fixed gain for constant signal power, enabling verbose output for satellite details, configuring custom leap second events, and piping output to an SDR transmitter. ```bash # Disable ionospheric delay for spacecraft/high-altitude scenarios ./gps-sdr-sim -e brdc0010.22n -c 10000000,5000000,25000000 -i -d 600 -o spacecraft.bin ``` ```bash # Disable path loss and use fixed gain (1-128) # Maintains constant signal power regardless of satellite geometry ./gps-sdr-sim -e brdc0010.22n -l 35.681298,139.766247,100 -p 100 -d 300 -o fixed_gain.bin ``` ```bash # Verbose mode: show satellite details (PRN, azimuth, elevation, range, iono delay) ./gps-sdr-sim -e brdc0010.22n -l 35.681298,139.766247,100 -v -d 60 -o gpssim.bin ``` ```bash # Configure custom leap second event # Format: GPS_week_number,day_number,delta_leap_seconds ./gps-sdr-sim -e brdc0010.22n -l 35.681298,139.766247,100 -L 2347,3,19 -d 300 -o gpssim.bin ``` ```bash # Output to stdout for piping to SDR transmitter ./gps-sdr-sim -e brdc0010.22n -l 35.681298,139.766247,100 -d 60 -o - | hackrf_transfer -t - -f 1575420000 -s 2600000 -a 1 -x 0 ``` -------------------------------- ### Invoke GPS Simulator Source: https://github.com/osqzss/gps-sdr-sim/wiki/Real-Time-Streaming-to-HackRF This command executes the compiled GPS simulator. It specifies the ephemeris file (`-e`), location and altitude (`-l`), sample rate (`-b`), UTC time (`-t`), and output to the FIFO (`-o`). The time is dynamically set to the current UTC date and time using the `date` command. ```bash ./gps-sdr-sim -e brdcXXXX.17X -l 50.059330, 0.008319,100 -b 8 -t $(date -u +%Y/%m/%d,%H:%M:%S) -i -o gpsstream ``` -------------------------------- ### Create FIFO for GPS Simulation Data Source: https://github.com/osqzss/gps-sdr-sim/wiki/Real-Time-Streaming-to-HackRF This command creates a named pipe (FIFO) which will be used to stream GPS simulation data from the simulator to the broadcasting tool. FIFOs are essential for inter-process communication in Unix-like systems. ```bash mkfifo gpsstream ``` -------------------------------- ### Generate Dynamic GPS Signal File with Trajectory Source: https://context7.com/osqzss/gps-sdr-sim/llms.txt Generates a GPS signal file for a moving receiver using a trajectory file. Supports ECEF or lat/lon/height formats for trajectory, or NMEA GGA sentences. Requires ephemeris data and duration. ```bash # Create a user motion file in ECEF (Earth-Centered Earth-Fixed) format # Format: time(s), X(m), Y(m), Z(m) at 10 Hz sampling rate cat > trajectory.csv << EOF 0.0,3967283.15,1022538.18,4872414.48 0.1,3967284.20,1022538.45,4872414.90 0.2,3967285.25,1022538.72,4872415.32 EOF # Generate GPS signal with moving receiver ./gps-sdr-sim -e brdc0010.22n -u trajectory.csv -d 60 -o moving.bin # Alternative: Use lat/lon/height format instead of ECEF # Format: time(s), latitude(deg), longitude(deg), height(m) ./gps-sdr-sim -e brdc0010.22n -x circle_llh.csv -d 60 -o moving.bin # Alternative: Use NMEA GGA sentences as input ./gps-sdr-sim -e brdc0010.22n -g triumphv3.txt -d 60 -o moving.bin ``` -------------------------------- ### GPS-SDR-SIM Basic Usage with HackRF One (8-bit) Source: https://github.com/osqzss/gps-sdr-sim/wiki/Home Demonstrates the basic usage of gps-sdr-sim with HackRF One, explicitly setting the 8-bit mode due to HackRF's hardware limitations. This ensures correct data processing for the 8-bit analog-to-digital converter. ```bash gps-sdr-sim -e brdc3540.14n -u circle.csv -b 8 ``` ```bash gps-sdr-sim -e brdc3540.14n -g triumphv3.txt -b 8 ``` ```bash gps-sdr-sim -e brdc3540.14n -l 30.286502,120.032669,100 -b 8 ``` -------------------------------- ### Compile GPS-SDR-SIM Source: https://context7.com/osqzss/gps-sdr-sim/llms.txt Compiles the GPS-SDR-SIM source code using GCC. It includes optimization flags for better performance. The resulting executable can be used to generate GPS signal files. ```bash # Compile the simulator gcc gpssim.c -lm -O3 -o gps-sdr-sim ``` -------------------------------- ### Generate GPS Signal with User Motion (ECEF) Source: https://github.com/osqzss/gps-sdr-sim/blob/master/README.md Generates a GPS signal using a RINEX navigation file and a user motion file in Earth-Centered, Earth-Fixed (ECEF) format. The output is the simulated I/Q samples. ```bash gps-sdr-sim -e brdc3540.14n -u circle.csv ``` -------------------------------- ### HackRF Transfer Playback Source: https://github.com/osqzss/gps-sdr-sim/blob/master/README.md Transmit a simulated GPS signal file (gpssim.bin) using the hackrf_transfer tool. Requires specifying the input file, center frequency, sample rate, and antenna gain settings. ```shell > gps-sdr-sim -e brdc0010.22n -b 8 ``` ```shell > hackrf_transfer -t gpssim.bin -f 1575420000 -s 2600000 -a 1 -x 0 ``` -------------------------------- ### Generate GPS Signal with NMEA GGA Stream Source: https://github.com/osqzss/gps-sdr-sim/blob/master/README.md Generates a GPS signal using a RINEX navigation file and an NMEA GGA stream for user motion data. This is suitable for simulating dynamic scenarios. ```bash gps-sdr-sim -e brdc3540.14n -g triumphv3.txt ``` -------------------------------- ### Transmit GPS Signal with HackRF Source: https://context7.com/osqzss/gps-sdr-sim/llms.txt Generates 8-bit I/Q samples for HackRF and transmits them. Requires ephemeris data, location, and duration. The transmission uses `hackrf_transfer` with specified frequency, sample rate, and gain settings. A note advises using an attenuator. ```bash # Generate 8-bit I/Q samples for HackRF ./gps-sdr-sim -e brdc0010.22n -l 35.681298,139.766247,100 -b 8 -o gpssim.bin # Transmit using hackrf_transfer # -t: transmit mode with input file # -f: center frequency (GPS L1 = 1575.42 MHz) # -s: sample rate (2.6 MHz) # -a: RF amplifier enable # -x: TX VGA (variable gain amplifier) gain hackrf_transfer -t gpssim.bin -f 1575420000 -s 2600000 -a 1 -x 0 # Note: Use a 50-60 dB attenuator between TX port and GPS receiver # to avoid damage and comply with regulations ``` -------------------------------- ### Transmit GPS Signal with USRP via Python Source: https://context7.com/osqzss/gps-sdr-sim/llms.txt Generates an 8-bit GPS signal file and transmits it using a USRP device via a Python script (`gps-sdr-sim-uhd.py`) or UHD's `tx_samples_from_file` utility. Requires specific sample rate settings for USRP2. ```python #!/usr/bin/env python3 # Generate 8-bit signal for USRP # ./gps-sdr-sim -e brdc0010.22n -l 35.681298,139.766247,100 -b 8 -s 2500000 -o gpssim.bin # Run the provided Python script # -t: input filename # -s: sample rate (must be even divisor of 100 MHz for USRP2) # -x: transmit gain (dB) # -f: center frequency (GPS L1) ./gps-sdr-sim-uhd.py -t gpssim.bin -s 2500000 -x 0 -f 1575420000 # Alternative: Use UHD's built-in tx_samples_from_file tx_samples_from_file --file gpssim.bin --type short --rate 2500000 --freq 1575420000 --gain 0 ``` -------------------------------- ### Generate GPS Signal with User Motion (Lat/Lon/Height) Source: https://github.com/osqzss/gps-sdr-sim/blob/master/README.md Generates a GPS signal using a RINEX navigation file and a user motion file in Latitude, Longitude, and Height (LLH) format. This command is used for dynamic mode simulation. ```bash gps-sdr-sim -e brdc3540.14n -x circle_llh.csv ``` -------------------------------- ### Generate GPS Signal with Static Location (Lat/Lon/Height) Source: https://github.com/osqzss/gps-sdr-sim/blob/master/README.md Generates a GPS signal using a RINEX navigation file and a static location defined by Latitude, Longitude, and Height (LLH). This command is used for static mode simulation. ```bash gps-sdr-sim -e brdc3540.14n -l 30.286502,120.032669,100 ``` -------------------------------- ### Compute Pseudorange and Doppler (C) Source: https://context7.com/osqzss/gps-sdr-sim/llms.txt This C code snippet demonstrates the computation of pseudorange and Doppler shift for a GPS satellite. It involves setting up receiver position, reading ephemeris data, defining GPS time, and using the `computeRange` function to calculate signal properties including geometric distance, ionospheric delay, azimuth, and elevation. ```c #include "gpssim.h" // Setup receiver position (Tokyo) double xyz_rcv[3] = {-3959993.3, 3352998.5, 3697154.0}; // Read ephemeris ephem_t eph[EPHEM_ARRAY_SIZE][MAX_SAT]; ionoutc_t ionoutc; ionoutc.enable = TRUE; readRinexNavAll(eph, &ionoutc, "brdc0010.22n"); // GPS time gpstime_t grx; grx.week = 2242; grx.sec = 518400.0; // Compute range to satellite PRN 5 range_t rho; int sv = 4; // PRN 5 (0-indexed) computeRange(&rho, eph[0][sv], &ionoutc, grx, xyz_rcv); printf("Satellite PRN %d:\n", sv+1); printf(" Pseudorange: %.3f m\n", rho.range); printf(" Range rate: %.3f m/s\n", rho.rate); printf(" Geometric distance: %.3f m\n", rho.d); printf(" Azimuth: %.1f deg\n", rho.azel[0] * R2D); printf(" Elevation: %.1f deg\n", rho.azel[1] * R2D); printf(" Ionospheric delay: %.3f m\n", rho.iono_delay); ``` -------------------------------- ### LimeSDR 1 Msps Playback Source: https://github.com/osqzss/gps-sdr-sim/blob/master/README.md Play a 1 Msps, 1-bit simulated GPS signal file using limeplayer for LimeSDR. This configuration aims for full baseband dynamic range and low RF power. ```shell > limeplayer -s 1000000 -b 1 -d 2047 -g 0.1 < ../circle.1b.1M.bin ``` -------------------------------- ### Transmit GPS Signal with BladeRF Source: https://context7.com/osqzss/gps-sdr-sim/llms.txt Generates GPS signal files and transmits them using BladeRF. It involves creating a configuration script for `bladeRF-cli` and executing it. Supports 1-bit compressed format for smaller file sizes, transmitted via `bladeplayer`. ```bash # Generate signal file ./gps-sdr-sim -e brdc0010.22n -l 35.681298,139.766247,100 -o gpssim.bin # Create BladeRF configuration script cat > bladerf.script << EOF set frequency 1575.42M set samplerate 2.6M set bandwidth 2.5M set txvga1 -25 cal lms cal dc tx tx config file=gpssim.bin format=bin tx start EOF # Execute script bladeRF-cli -s bladerf.script # Alternative: Use 1-bit compressed format to reduce file size ./gps-sdr-sim -e brdc0010.22n -l 35.681298,139.766247,100 -b 1 -o gpssim.1bit.bin ./bladeplayer -s 2600000 -b 1 gpssim.1bit.bin ``` -------------------------------- ### Generate C/A Code Sequence (C) Source: https://context7.com/osqzss/gps-sdr-sim/llms.txt This C code snippet demonstrates the generation of a C/A code sequence for a specified PRN (Pseudo-Random Noise) using the `codegen` function from the gps-sdr-sim library. The generated sequence, stored in an integer array, consists of 0s and 1s representing the chips of the C/A code. The code repeats every 1 millisecond at a chip rate of 1.023 MHz, with a full sequence length of 1023 chips. Ensure the `gpssim.h` header is included and `CA_SEQ_LEN` is defined. ```c #include "gpssim.h" // Generate C/A code sequence for PRN 7 int prn = 7; int ca[CA_SEQ_LEN]; // CA_SEQ_LEN = 1023 chips codegen(ca, prn); // ca[] now contains the C/A code sequence // Each element is 0 or 1 printf("C/A code for PRN %d (first 20 chips):\n", prn); for (int i = 0; i < 20; i++) { printf("%d ", ca[i]); } printf("\n"); // The C/A code repeats every 1 millisecond at 1.023 MHz chip rate // Full sequence length is 1023 chips ``` -------------------------------- ### Transmit GPS Signal with ADALM-Pluto Source: https://context7.com/osqzss/gps-sdr-sim/llms.txt Generates GPS signal files and transmits them using ADALM-Pluto (PlutoSDR) via the `plutoplayer` utility. Supports default 16-bit I/Q format and allows custom TX attenuation and RF bandwidth settings. ```bash # Generate signal file with default 16-bit I/Q format ./gps-sdr-sim -e brdc0010.22n -l 35.681298,139.766247,100 -o gpssim.bin # Transmit using plutoplayer (from player/ directory) # Default settings (2.6 MHz, -20 dB attenuation) ./plutoplayer -t gpssim.bin # Set custom TX attenuation (0.0 to -80.0 dB in 0.25 dB steps) ./plutoplayer -t gpssim.bin -a -30.0 # Set custom RF bandwidth (1.0 to 5.0 MHz) ./plutoplayer -t gpssim.bin -b 3.0 -a -25.0 ``` -------------------------------- ### Broadcast GPS Simulation Data Source: https://github.com/osqzss/gps-sdr-sim/wiki/Real-Time-Streaming-to-HackRF This command uses `hackrf_transfer` to broadcast the simulated GPS data from the `gpsstream` FIFO. It specifies the input data source (`-t`), the center frequency (`-f`), sample rate (`-s`), antenna gain (`-a`), and digital gain (`-x`). ```bash hackrf_transfer -t ./gpsstream -f 1575420000 -s 2600000 -a 1 -x 0 ``` -------------------------------- ### USRP UHD Playback Source: https://github.com/osqzss/gps-sdr-sim/blob/master/README.md Playback simulated GPS signals on UHD-supported devices, specifically tested with USRP2. This can be done using a Python script or the tx_samples_from_file utility provided with UHD. ```shell > gps-sdr-sim-uhd.py -t gpssim.bin -s 2500000 -x 0 ``` ```shell > tx_samples_from_file --file gpssim.bin --type short --rate 2500000 --freq 1575420000 --gain 0 ``` -------------------------------- ### Modify GPS-SDR-SIM C Source Code Source: https://github.com/osqzss/gps-sdr-sim/wiki/Real-Time-Streaming-to-HackRF This section details modifications required in the `gpssim.c` source file to correctly handle ephemeris data. It involves commenting out a block of code and inserting a new conditional statement to ensure accurate satellite position estimation based on current time. This requires recompiling the source code afterwards. ```c if (subGpsTime(gmax,g0) < 0.0) { ieph = neph -1; } ``` -------------------------------- ### Convert ECEF Coordinates to Latitude, Longitude, Height (C) Source: https://context7.com/osqzss/gps-sdr-sim/llms.txt This C code snippet demonstrates how to convert Earth-Centered, Earth-Fixed (ECEF) Cartesian coordinates (X, Y, Z) into geodetic coordinates (latitude, longitude, height) using the `xyz2llh` function from the gpssim library. The output includes conversion to degrees for easier interpretation. ```c #include "gpssim.h" // Convert ECEF (X, Y, Z) to geodetic coordinates (lat, lon, height) double xyz[3] = {3967283.15, 1022538.18, 4872414.48}; double llh[3]; xyz2llh(xyz, llh); // llh[0] = latitude in radians // llh[1] = longitude in radians // llh[2] = height in meters // Convert to degrees double lat_deg = llh[0] * R2D; // R2D = 57.2957795131 double lon_deg = llh[1] * R2D; double height = llh[2]; printf("Latitude: %.6f deg\n", lat_deg); printf("Longitude: %.6f deg\n", lon_deg); printf("Height: %.1f m\n", height); ``` -------------------------------- ### Convert Latitude, Longitude, Height to ECEF Coordinates (C) Source: https://context7.com/osqzss/gps-sdr-sim/llms.txt This C code snippet illustrates how to convert geodetic coordinates (latitude, longitude, height) into Earth-Centered, Earth-Fixed (ECEF) Cartesian coordinates (X, Y, Z) using the `llh2xyz` function from the gpssim library. It requires input latitude and longitude in radians. ```c #include "gpssim.h" // Convert geodetic coordinates to ECEF (X, Y, Z) double llh[3]; llh[0] = 35.681298 / R2D; // latitude in radians llh[1] = 139.766247 / R2D; // longitude in radians llh[2] = 100.0; // height in meters double xyz[3]; llh2xyz(llh, xyz); // xyz[0] = X coordinate in meters // xyz[1] = Y coordinate in meters // xyz[2] = Z coordinate in meters printf("X: %.2f m\n", xyz[0]); printf("Y: %.2f m\n", xyz[1]); printf("Z: %.2f m\n", xyz[2]); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.