Git Product home page Git Product logo

gps-sdr-sim's Introduction

GPS-SDR-SIM

GPS-SDR-SIM generates GPS baseband signal data streams, which can be converted to RF using software-defined radio (SDR) platforms, such as ADALM-Pluto, bladeRF, HackRF, and USRP.

Windows build instructions

  1. Start Visual Studio.
  2. Create an empty project for a console application.
  3. On the Solution Explorer at right, add "gpssim.c" and "getopt.c" to the Souce Files folder.
  4. Select "Release" in Solution Configurations drop-down list.
  5. Build the solution.

Building with GCC

$ gcc gpssim.c -lm -O3 -o gps-sdr-sim

Using bigger user motion files

In order to use user motion files with more than 30000 samples (at 10Hz), the USER_MOTION_SIZE variable can be set to the maximum time of the user motion file in seconds. It is advisable to do this using make so gps-sdr-bin can update the size when needed. e.g:

$ make USER_MOTION_SIZE=4000

This variable can also be set when compiling directly with GCC:

$ gcc gpssim.c -lm -O3 -o gps-sdr-sim -DUSER_MOTION_SIZE=4000

Generating the GPS signal file

A user-defined trajectory can be specified in either a CSV file, which contains the Earth-centered Earth-fixed (ECEF) user positions, or an NMEA GGA stream. The sampling rate of the user motion has to be 10Hz. The user is also able to assign a static location directly through the command line.

The user specifies the GPS satellite constellation through a GPS broadcast ephemeris file. The daily GPS broadcast ephemeris file (brdc) is a merge of the individual site navigation files into one. The archive for the daily file can be downloaded from: https://cddis.nasa.gov/archive/gnss/data/daily/. Access to this site requires registration, which is free.

These files are then used to generate the simulated pseudorange and Doppler for the GPS satellites in view. This simulated range data is then used to generate the digitized I/Q samples for the GPS signal.

The bladeRF and ADALM-Pluto command line interface requires I/Q pairs stored as signed 16-bit integers, while the hackrf_transfer and gps-sdr-sim-uhd.py support signed bytes.

HackRF, bladeRF and ADALM-Pluto can accept the default sample rate of 2.6MHz, while the USRP2 requires an even integral decimator of 100 MHz, i.e. 2.5MHz.

The simulation start time can be specified if the corresponding set of ephemerides is available. Otherwise the first time of ephemeris in the RINEX navigation file is selected.

The maximum simulation duration time is defined by USER_MOTION_SIZE to prevent the output file from getting too large.

The output file size can be reduced by using "-b 1" option to store four 1-bit I/Q samples into a single byte. You can use bladeplayer for bladeRF to playback the compressed file.

Usage: gps-sdr-sim [options]
Options:
  -e <gps_nav>     RINEX navigation file for GPS ephemerides (required)
  -u <user_motion> User motion file in ECEF x, y, z format (dynamic mode)
  -x <user_motion> User motion file in lat, lon, height format (dynamic mode)
  -g <nmea_gga>    NMEA GGA stream (dynamic mode)
  -c <location>    ECEF X,Y,Z in meters (static mode) e.g. 3967283.15,1022538.18,4872414.48
  -l <location>    Lat,Lon,Hgt (static mode) e.g. 30.286502,120.032669,100
  -L <wnslf,dn,dtslf> User leap future event in GPS week number, day number, next leap second e.g. 2347,3,19
  -t <date,time>   Scenario start time YYYY/MM/DD,hh:mm:ss
  -T <date,time>   Overwrite TOC and TOE to scenario start time
  -d <duration>    Duration [sec] (dynamic mode max: 300 static mode max: 86400)
  -o <output>      I/Q sampling data file (default: gpssim.bin ; use - for stdout)
  -s <frequency>   Sampling frequency [Hz] (default: 2600000)
  -b <iq_bits>     I/Q data format [1/8/16] (default: 16)
  -i               Disable ionospheric delay for spacecraft scenario
  -p [fixed_gain]  Disable path loss and hold power level constant
  -v               Show details about simulated channels

The user motion can be specified in either dynamic or static mode:

> gps-sdr-sim -e brdc3540.14n -u circle.csv
> gps-sdr-sim -e brdc3540.14n -x circle_llh.csv
> gps-sdr-sim -e brdc3540.14n -g triumphv3.txt
> gps-sdr-sim -e brdc3540.14n -l 30.286502,120.032669,100

Transmitting the samples

The TX port of a particular SDR platform is connected to the GPS receiver under test through a DC block and a fixed 50-60dB attenuator.

BladeRF:

The simulated GPS signal file, named "gpssim.bin", can be loaded into the bladeRF for playback as shown below:

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

You can also execute these commands via the bladeRF-cli script option as below:

> bladeRF-cli -s bladerf.script

HackRF:

The output data have to be 8-bit signed I/Q samples.

> gps-sdr-sim -e brdc0010.22n -b 8

You can use hackrf_transfer tool in the HackRF host software.

> hackrf_transfer -t gpssim.bin -f 1575420000 -s 2600000 -a 1 -x 0

UHD supported devices (tested with USRP2 only):

> gps-sdr-sim-uhd.py -t gpssim.bin -s 2500000 -x 0

You can also use tx_samples_from_file tool included in the UHD examples:

> tx_samples_from_file --file gpssim.bin --type short --rate 2500000 --freq 1575420000 --gain 0

LimeSDR (in case of 1 Msps 1-bit file, to get full BaseBand dynamic and low RF power):

> limeplayer -s 1000000 -b 1 -d 2047 -g 0.1 < ../circle.1b.1M.bin

ADALM-Pluto (PlutoSDR):

The ADALM-Pluto device is expected to have its network interface up and running and is accessible via "pluto.local" by default.

Default settings:

> plutoplayer -t gpssim.bin

Set TX attenuation:

> plutoplayer -t gpssim.bin -a -30.0

Default -20.0dB. Applicable range 0.0dB to -80.0dB in 0.25dB steps.

Set RF bandwidth:

> plutoplayer -t gpssim.bin -b 3.0

Default 3.0MHz. Applicable range 1.0MHz to 5.0MHz.

License

Copyright © 2015-2023 Takuji Ebinuma
Distributed under the MIT License.

gps-sdr-sim's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gps-sdr-sim's Issues

Exiting... hackrf_is_streaming() result: streaming terminated (-1004)

your project is great. when i test it ,with hackrf it return after some second below errors....
and i can not see changed location with gsp-receiver??
best regards stackprogramer

root@debian:/home/admin/Documents/gps-sdr-sim-master# hackrf_transfer -t gpssim.bin -f 1575420000 -s 2600000 -a 1 -x 0
call hackrf_set_sample_rate(2600000 Hz/2.600 MHz)
call hackrf_set_freq(1575420000 Hz/1575.420 MHz)
call hackrf_set_amp_enable(1)
Stop with Ctrl-C
5.2 MiB / 1.015 sec = 5.2 MiB/second
5.2 MiB / 1.016 sec = 5.2 MiB/second

5.2 MiB / 1.016 sec = 5.2 MiB/second
1.0 MiB / 1.016 sec = 1.0 MiB/second

Exiting... hackrf_is_streaming() result: streaming terminated (-1004)
Total time: 4.06246 s
hackrf_stop_tx() done
hackrf_close() done
hackrf_exit() done
fclose(fd) done

Error with my usrp n210

i run gps-sdr-sim on ubuntu 14.04 64bit
when i generate the gpssim.bin,
gps-sdr-sim -e brdc3540.14n -l 30.286502,120.032669,100 -s 2500000 -b 8
every thing seems work fine

However, when i execute
gps-sdr-sim-uhd.py -t gpssim.bin -s 2500000 -x 0
it throw a error
it says
**xiaofei@drone:~/Desktop/gps-sdr-sim-master$ sudo ./gps-sdr-sim-uhd.py -s 2500000 -x 0
linux; GNU C++ version 4.8.2; Boost_105400; UHD_003.005.005-0-unknown

-- Opening a USRP2/N-Series device...
-- Current recv frame size: 1472 bytes
-- Current send frame size: 1472 bytes
Using Volk machine: avx_64_mmx_orc
Traceback (most recent call last):
File "./gps-sdr-sim-uhd.py", line 70, in
tb = top_block(options)
File "./gps-sdr-sim-uhd.py", line 41, in init
self.blocks_interleaved_short_to_complex = blocks.interleaved_short_to_complex(False, False)
TypeError: make() takes at most 1 argument (2 given)**

what's wrong with that?
can anyone help me?

Makefile issue on OSX (OpenMP workaround) 'omp.h' file not found

: fatal error: 'omp.h' file not found
#include <omp.h>

Some people need to use gcc version 6 in order to compile on OSX.
"brew reinstall gcc --without-multilib"

This is an easy workaround...

diff --git a/Makefile b/Makefile
index 4f6933f..b260604 100644
--- a/Makefile
+++ b/Makefile
@@ -4,7 +4,12 @@
all: gps-sdr-sim

SHELL=/bin/bash
-CC=gcc
+OS := $(shell uname)
+ifeq ($(OS),Darwin)

  •   CC=gcc-6
    

+else

  •   CC=gcc
    

+endif
CFLAGS=-O3 -Wall
LDFLAGS=-lm

Bug about stimulating GPS timing

hello, i use this project to stimulate the process of GPS timing for my device.
I used the brdc in the project and i successfully set my time to 2014/12/20
however, i download a brdc file of 1997. Bug encoutered. I found that the time was set to 2097

So i read the sourcecode of gpssim.c
i found this in LINE 936
// EPOCH t.y = atoi(tmp) + 2000;

so I change the 2000 to 1900 in order to stimulate the years in 1900s

but it seems dont work?

Can anyone help me?

Add use nav file from RTKLIB

Dear OSQZSS !
Many thanks to you for hard work.

Is it possible to add the option to gpssim use raw-data ublox instead BRDC (brdcXXXX.XXn)
or instead use BRDC add use nav file from RTKLIB ?

RTKLIB can make from "raw-data" ublox 6,7,8 RINEX files like BRDC.

Problem with running

Hi
I have compiled everything correctly.
Here are my checklist to ensure everything's ok:
1- hackrf_info detects my HackRF
2- I can both receive and transmit with my HackRF (I use a simple FM transmitter in GNU Radio to make sure my HackRF's TX board is working)

I run the gps-sdr-sim program with this command line:
gps-sdr-sim -e brdc3540.14n -u circle.csv -b 16
I have to use "Ctrl+C" to stop it after a while.
Then I use hackrf_transfer, like your ReadMe.
The problem is, none of my phones' GPS, lock to this (I've got a HTC One M8 and an iPhone)
I also use another SDR to receive this GPS signal, but turning it on or off (running hackrf_transfer or closing it) does not affect my spectrum.

What could be wrong?

Thanks
Mehdi

SIGNAL STRENGTH

Hello,

First of all, bright software tks.

I have made it work fine with the BladeRF40x.

However, I dont know why my SNR values (signal strength) is that different for each satellite(between 41-50 for twelve fixed satellites), and it is not the same value as it should be, considering this is an emulation-simulation of satellites, so I would think that the strength must be the same because it is only one source (In all the pictures and screenshots I have seen, the values are for ex. 42-44 for eighth sats or 39 for eleven sats)

Is it possible to adjust this SNR values??

FIG. 5 https://www.blackhat.com/docs/eu-15/materials/eu-15-Kang-Is-Your-Timespace-Safe-Time-And-Position-Spoofing-Opensourcely-wp.pdf

SLIDE 42 and 43 https://media.defcon.org/DEF%20CON%2023/DEF%20CON%2023%20presentations/DEFCON-23-Lin-Huang-Qing-Yang-GPS-Spoofing.pdf

Data inconsistency issue

Hi, @osqzss

I met some data inconsistency issues when I tried to ''catenate“ different IQ waveforms. In one word, the waveform that is generated for certern duration is not equal to the waveform that is generated and catenated for the portion of that duration.
(I think it is a useful feature to this project because it enables the program to generate waveforms for infinite duration, not limited to memory size.)

Here is what I do and some analysis:

For example, I generate two bin files (waveform) and each duration is 1 second, using the following commands:

GpsSdrSim.exe  -d 1.1 -e .\ephemerides\brdc0010.15n -b 8 -l 18.227617,109.524737,100.000000 -s 1023000 -T 2016/11/01,23:59:30 -o gpssim_1.bin
GpsSdrSim.exe  -d 1.1 -e .\ephemerides\brdc0010.15n -b 8 -l 18.227617,109.524737,100.000000 -s 1023000 -T 2016/11/01,23:59:31 -o gpssim_2.bin

Notice that the waveforms should seamlessly cover the time from 30'' to 31'' for 2 seconds.

Then I generate another bin file whose duration is 2 second, same start time, using the following commands:

GpsSdrSim.exe -d 2.1 -e .\ephemerides\brdc0010.15n -b 8 -l 18.227617,109.524737,100.000000 -s 1023000 -T 2016/11/01,23:59:30 -o gpssim_1and2.bin

Then I compare (abs(difference)) the catenated one [gpssim_1.bin, gpssim_2.bin] with gpssim_1and2.bin. I found that the first second waveforms are the same but the last second waveforms are different as you can see from the matlab figure below.

1

Some further analysis:

I did cross-correlation between the 1s waveforms and the 2s waveform.
Xcorr between the first 1s waveform and the 2s waveform
2
As expected, the peak appears at Time 0 ms.

Then, Xcorr between the second 1s waveform and the 2s waveform
3
However, the peak appears at 1009ms (not 1000ms if there is only phase difference)

It seems that there is not only phase difference but also time difference. I did some more tests and found the time error are not always the same value. (sometimes minus and sometimes plus, but the peak appears around the expected time lag)

Could someone fix this bug or give some more clues? Thanks!

OpenMP hurting performance (inverse scaling)

While seeing if #10 was due to some kind of nondeterminism caused by OpenMP, I observed the running time for the test is significantly faster for OMP_NUM_THREADS=1 than with any increased number of threads, and appears to exhibit inverse scaling. Ubuntu 12.04, GCC 4.6.3. GCC 4.8.2 on the same system gives about the same results.

OMP_NUM_THREADS wall clock time
1 1m12.271s
2 1m54.911s
4 2m13.468s
8 2m26.595s

time convert

dear osqzss:
thanks for your great job. i have a question when i read the rtkcmn.c of gnss-sdrlib and the gpssim.c of gps-sdr-sim. in #178 date2gps and #gps2date , have you ever considered the leap second. can you tell me the difference between rtkcmn.c and gpssim.c about the time convert. thank you.

USER_MOTION_SIZE (3000)change ERROR

/*! \brief Maximum number of user motion points */

define USER_MOTION_SIZE (3000) // max duration at 10Hz

I change 3000 to 18000. but the final gpssim.bin is only 2.1G.How is it going?

I want to something about gps signal record in bladeRF.

Hello, everyone.
I am graduate student and I am very interested in GPS security. I will study the gps record&replay, spoofing, countermeasure. Firstly, I will implement a gps record&replay. So, I buy the BladeRFx115, bias-tee, LNA, gps active antenna like unicorn team in DEF CON 23 (https://www.youtube.com/watch?v=jwJKMti_aw0)
I connected a tools like this to record the GPS signal.
<Antenna == Bias-Tee == LNA == BladeRF == Notebook>
But, I could't received the gps signal enough to positioning. My rx is average I/Q= 130, 122.
So, I think that the active antenna isn't operate well. After that, I connected the USB-DC cable to Bias-Tee to energize a DC to the antenna. Therefore, I get the I/Q = 270, 224. And I tested the rx-tx using this command and configures.

  1. rx command : rx config file=gpssim.bin format=bin n=20M
  2. tx command : tx config file=gpssim.bin format=bin
  3. configure
    set frequency 1575.42M
    set samplerate 2M
    set bandwidth 2M
    set config format=csv n=8M

So, how can I solve this problem and I want to know about your tips please .
thank you.

Some devices can not positioning

Hello,
The project is useful for me.Thanks for your great job. I use this simulator to send gps signal by USRPB200. But some devices are not effective.
I found that N5,Pixel,Car can get the spoofed position, but the HuaWei, XiaoMi,ViVo are not effective. What is wrong here? Can you provide some advice to solve it or let me know where the problem is? Thanks.

Variable used before set.

Hi Guys,
I think I have detected a small bug at "readRinexNavAll" line 983.
The variable "v" is being used before being correctly set by the PRN. Its is ;
// Date and time
eph[ieph][sv].t = t;
// PRN
strncpy(tmp, str, 2);
tmp[2] = 0;
sv = atoi(tmp)-1;

Shouldn't be like
// PRN
strncpy(tmp, str, 2);
tmp[2] = 0;
sv = atoi(tmp)-1;
// Date and time
eph[ieph][sv].t = t;
Is that correct ?

Thank you for the fantastic GPS sim.
Luis

Not working on hardware with ADRF6755

Hello,

I'm trying to simulate GPS in real time, (without creating files). All "time-machine" issues I solved already, 260k samples I generate in 50mS only! But GPS receiver (android phone with AndroiTS GPS Test) does not understand it. 

My hardware is based on ADRF6755 I/Q modulator.
I compared my generated digits with gpssim.bin. Content is identical. I used the last brdc3090.16n RINEX file. Reference clock is 2.5ppm
Tryed to use various attenuators upto 47dB (integrated in ADRF6755).
Here is a spectrum, connected directly to the output with 40dB attenuator:
https://drive.google.com/file/d/0B-O8KdbrAqdCNVVwVk5Bbk9OYXM/
https://drive.google.com/file/d/0B-O8KdbrAqdCOVNxSEwwY1RqUXc/

The location is fixed (option-l in gps-sdr-sim).
I update my DAC at 2.6MHz sample rate. What could be wrong?

Thanks in advance for any comments.

Testing leapsecond issues

The software is working nicely with HackRF + ext sync - tested with 4 different GPS receiver, but I would like to test equipments for the previous 30.06.2015 and the upcoming 31.12.2016 leapseconds.
Even with the correct brdc1810.15n ephemeris file I don't get the leap second - which is natural since the generator is not handling this - but it is beyond my ability to find the right place in the code to add.

For upcoming leapsecond I need a helping idea, how to generate files for the future.
Every good answer is appreciated!

GPS Satellites same position?

I am running gps-sdr-sim with a BladeRF with 60dB attenuator. The satellites that my phone is fixing to are all exactly the satellites that are listed when I run gps-sdr-sim, however when my phone thinks they are all in the same place and will not lock. SNR levels are pretty good (30-40 depending on distance from antenna).

I tried with both the provided brdc file and a brdc file from today. Also tried using ECEF location near to me currently and the coordinated provided.

TX Antenna

Hi all,

I want to test this software, so I would like to know what antenna I should use to transmit the signals. Could anybody recommend me an antenna to do this, or at least tell me what features should I look for in an antenna to fix this purpose?

Thanks in advance!!

Something problem about spoof signals

This project is very nice, it is useful for me. Now, I have some problem, any people can help me?

  1. I find that the subframe4 and subframe5 are missing about almanacs. Has any plan to add it to the gps signals? how to download it?
  2. I look up the code, but I don't catch the mainly idea of how to generate spoof signals by given receiver location.
    Thanks.

GLONASS support?

Can this code work with GLONASS if the proper ephemerides are used?

Wrong Date Time

Hi, does the brdc file need to be modified to get the correct time? I've tried to use the original and downloaded the latest from the archive, the location is working great but the time is exact -49 hours of EST(where the simulated gps location is). thanks

Edit: tried couple of different continents, actually it's -49 hours of anywhere it's simulated.

limitation to 300 seconds

The code contains some static array of user motion data for 300 seconds at 0.1 Hz rate. This restricts the use case to very short time frames only.
I would want to modify the code to accept a stream of user motion data (without limit in time). The array would be gone, and instead motion data be read 'as needed' rather than pre-reading + buffering all of it during start-up.
Would you be interested in merging such a patch?

visibility of satellite only checked in static mode

As far as I can tell, the visibility check of a satellite seems to be performed only once at startup of the program, and not continuously during dynamic mode with user motion data.

This means that a satellite might disappear behind the horizon during runtime, but we still generate its PRN sequence and report it to the receiver.

multi-threaded implementation

Hello!

Is it correct that gps-sdr-sim uses 1 core only on multi-core platforms? Or did I miss something?

I've stumbled on a study that showed a CUDA-based real-time solution. Nice work.

Kind Regards,

Bert

Problem simulating when using USRP B200

Hello Takuji,

I am trying to use pgs-sdr-sim using USRP B200. I was able to compile your code, generate gpssim.bin file for static location and tried to transmit it using both gps-sdr-sim-uhd.py and tx_samples_from_file. When I start transmission process my B200 shows red light next to RX/TX antenna so I assume it does transmit something. I do not get any error and only UHD thread priority warning message during all my steps but when I use AndroidTS GPS Test or another android app called GPS Test by Chartcross Limited both of these apps shows me zero satellites (see screen shots). I am very new to SDR – that is my first real SDR project.

I was trying to follow instructions from your README.md file and then all advices and commands discussed in the ticket 31 (#31) but still no success – my phone (actually couple of phones) do not show any satellites.

screenshot1
screenshot2

In addition to your advice I would like to get your help with several more questions that might be helpful and relevant to my situation:

  1. Is is mandatory to use attenuator?
  2. Does it really matter what antenna to use if my B200 and phone are 1 m from each other?
  3. Generically speaking what is the troubleshooting process for that type of issues? Is it possible to use same USRP device to transmit and receive so I can at least see that I am transmitting something?
  4. Does it really matter what brdc file to use during generation of the gpssim.bin file?
  5. Do I have to use different brdc files for different geographical area (for example can I use same file for North America and Europe) during real simulation?

Below are commands and their outputs that might give you clues into what I am doing wrong

  1. Generation of the gpssim.bin file:
./gps-sdr-sim -v -e brdc0420.16n -b 16 -s 2461538 -l 1.362334,103.992769,100
Using static location mode.
     1.583e-08   -7.451e-09   -5.960e-08    5.960e-08
     1.229e+05   -6.554e+04   -1.311e+05   -6.554e+04
     3.72529029846e-09   1.42108547152e-14     589824      1883
    17
Start time = 2016/02/11,00:00:00 (1883:345600)
Duration = 300.0 [sec]
02   65.2  36.0  22208138.2   4.9
05   20.0  18.7  23768071.9   6.7
12  207.1  29.2  23017076.1   5.2
13   39.9  58.7  20900389.1   3.4
18  269.8  10.7  24775535.2   6.4
19  145.6   6.4  25367843.4  10.1
20  326.8  30.7  22614357.9   4.8
24  181.8  26.8  23065651.5   5.7
25  248.3  22.3  23610114.8   5.5
29  324.2  32.7  22593974.7   4.6
32   34.2   3.1  25710384.1  10.2
Time into run = 30.0

…

Time into run = 270.0
02   67.9  36.3  22173139.1   5.0
05   21.6  17.8  23856379.3   7.0
12  205.0  28.3  23089866.9   5.4
13   37.6  56.8  20987167.9   3.5
18  271.8  11.0  24764817.0   6.5
19  146.0   4.8  25536818.2  10.7
20  329.0  30.2  22649745.7   5.0
24  180.2  28.0  22954061.2   5.7
25  246.1  22.0  23635617.4   5.7
29  323.1  34.5  22447713.4   4.6
32   34.1   1.5  25886836.8  10.8
Time into run = 300.0
Done!
Process time = 54.5 [sec]
  1. Transmission of the generated data

2.1 using tx_samples_from_file program:

/usr/lib/uhd/examples/tx_samples_from_file --args="master_clock_rate=50e6" --file gpssim.bin --type short --rate 2500000 --freq 1575420000 --gain 0 --repeat
linux; GNU C++ version 5.3.1 20151219; Boost_105800; UHD_003.009.002-0-unknown


UHD Warning:
    Unable to set the thread priority. Performance may be negatively affected.
    Please see the general application notes in the manual for instructions.
    EnvironmentError: OSError: error in pthread_setschedparam

Creating the usrp device with: master_clock_rate=50e6...
-- Detected Device: B200
-- Operating over USB 3.
-- Initialize CODEC control...
-- Initialize Radio control...
-- Performing register loopback test... pass
-- Performing CODEC loopback test... pass
-- Asking for clock rate 50.000000 MHz... 
-- Actually got clock rate 50.000000 MHz.
-- Performing timer loopback test... pass
Using Device: Single USRP:
  Device: B-Series Device
  Mboard 0: B200
  RX Channel: 0
    RX DSP: 0
    RX Dboard: A
    RX Subdev: FE-RX2
  TX Channel: 0
    TX DSP: 0
    TX Dboard: A
    TX Subdev: FE-TX2

Setting TX Rate: 2.500000 Msps...
Actual TX Rate: 2.500000 Msps...

Setting TX Freq: 1575.420000 MHz...
Actual TX Freq: 1575.420000 MHz...

Setting TX Gain: 0.000000 dB...
Actual TX Gain: 0.000000 dB...

Checking TX: LO: locked ...
Press Ctrl + C to stop streaming...
^C
Done!

2.2 using gps-sdr-sim-uhd.py script:

python gps-sdr-sim-uhd.py -t gpssim.bin -s 2500000 -x 0linux; GNU C++ version 5.3.1 20151219; Boost_105800; UHD_003.009.002-0-unknown

-- Detected Device: B200
-- Operating over USB 3.
-- Initialize CODEC control...
-- Initialize Radio control...
-- Performing register loopback test... pass
-- Performing CODEC loopback test... pass
-- Asking for clock rate 16.000000 MHz... 
-- Actually got clock rate 16.000000 MHz.
-- Performing timer loopback test... pass
-- Setting master clock rate selection to 'automatic'.
-- Asking for clock rate 40.000000 MHz... 
-- Actually got clock rate 40.000000 MHz.
-- Performing timer loopback test... pass
Using Volk machine: avx_64_mmx_orc
Press Enter to quit:

Thank you
Andrey

GNSS Support - Realtime GPS Data

Hello,

Have you considered adding support for GNSS to gps-sdr-sim to include the option for realtime GPS data?

http://gnss-sdr.org/

Otherwise, does anyone know how you might precompute the brdc rinex files for future times?

Thanks!

not sure if compatible with hackrf

I gave it a go and can see the snr increase on about 11 satellites but get
no location data. I used the rocket.csv file that was in the repository and
the latest ephemeris file.

I let the gps-sdr-sim.exe run for around 3-4 min, file was around 900MB in
length.

not sure if it has something to do with the generated bin file, i believe hackrf requires 8bit signed files.

TOW update in navigation message

Hello,

the navigation message in the simulation is updated every 30 s by the generateNavMsg function (see lines 2264 - 2271 of gpssim.c)

		if (igrx%300==0) // Every 30 seconds
		{
			// Update navigation message
			for (i=0; i<MAX_CHAN; i++)
			{
				if (chan[i].prn>0)
					generateNavMsg(grx, &chan[i], 0);
			}
(...)

However, according to GPS specification, the TOW is updated every 6 seconds.

line 1481 of the same file:
tow = ((unsigned long)g0.sec)/6UL;

Just a remark.

interactive mode

Would be nice to have an interactive mode, where you can enter (or pipe) the latitude/longitude/height with stdin. I hacked this feature in the existing version, see here: https://github.com/FrankBuss/gps-sdr-sim , where you can click with the mouse on Google Maps and then it should send the new GPS coordinate. I tried to test it, but the GPS receiver doesn't like my HackRF, it works very seldom. I ordered a better internal TCXO crystal from eBay.

Maybe someone can test it and if it works, I can cleanup the source code to integrate it more nicely in the existing app.

Usage:

  • compile the modified gps-sdr-sim app:
gcc gpssim.c -lm -lpthread -O3 -o gps-sdr-sim
  • download the latest GPS broadcast ephemers file (brdc) from
    ftp://cddis.gsfc.nasa.gov/gnss/data/daily/ , e.g.:
wget ftp://cddis.gsfc.nasa.gov/gnss/data/daily/2016/brdc/brdc2040.16n.Z
gzip -d brdc2040.16n.Z
  • create a FIFO:
mkfifo gpssim.bin
  • start the nodejs app, piping the coordinate output to the (modified) gps-srd-sim, which writes the SDR data to the FIFO (you might need to install nodejs first with apt-get install nodejs and then socket.io with npm install socket.io) :
nodejs maps/app.js | ./gps-sdr-sim -b 8 -e brdc2040.16n -l 50.9413,6.9583,157
  • open another terminal and start the HackRF (or other SDR) transfer program:
hackrf_transfer -t gpssim.bin -f 1575423000 -s 2600000 -a 1 -x 0
  • open the address "http://localhost:4242/index.html" in a web browser. You should see Google maps, centered around the Cologne Cathedral. Click with the mouse to the position where you want to go. Each mouse click should be displayed in the nodejs application, e.g.
new coordinate: 50.935397 6.960944 157.100000

The third parameter is fixed and the height. The data is streamed to the FIFO and the modified GPS signal is sent continuously.

PS: works only on fast computers where the signal generation is faster than real-time.

Trying to use USRP B100...

Hi,
I generated my gpssim.bin using this command:
./gps-sdr-sim -v -e brdc0400.16n -l 1.362334,103.992769,100
(Using a recent ephemeris, and a location near where I live).
I am trying to use a USRP B100, with gps-sdr-sim. I can see the satellites on "AndroiTS Test", with signal strengths of 30..32, but the phones do not sync to it at all. The angles are given as 0, and no "tick".
When I run
python2.7 gps-sdr-sim-uhd.py -t gpssim.bin -s 2500000 -x 20
I get this:

Hughs-MacBook-Pro:gps-sdr-sim-master hugh$ python2.7 gps-sdr-sim-uhd.py -t gpssim.bin -s 2500000 -x 20
Mac OS; Clang version 6.1.0 (clang-602.0.53); Boost_105700; UHD_003.008.001-MacPorts-Release

-- USRP-B100 clock control: 10
--   r_counter: 2
--   a_counter: 0
--   b_counter: 20
--   prescaler: 8
--   vco_divider: 5
--   chan_divider: 5
--   vco_rate: 1600.000000MHz
--   chan_rate: 320.000000MHz
--   out_rate: 64.000000MHz
-- 
gr::log :WARN: gr uhd usrp sink0 - Sensor 'lo_locked' failed to lock within timeout on channel 0.

UHD Warning:
    The hardware does not support the requested TX sample rate:
    Target sample rate: 2.500000 MSps
    Actual sample rate: 2.461538 MSps
-- Tune Request: 1575.420000 MHz
--   The RF LO does not support the requested frequency:
--     Requested LO Frequency: 1575.420000 MHz
--     RF LO Result: 1575.421083 MHz
--   Attempted to use the DSP to reach the requested frequency:
--     Desired DSP Frequency: -0.001083 MHz
--     DSP Result: -0.001083 MHz
--   Successfully tuned to 1575.420000 MHz
-- 
Using Volk machine: avx_64_mmx_orc
Press Enter to quit:

I wondered if the error in the sampling rate is making the system not work?, and if so is there a fix/workaround?
Cheers Hugh

Not compile on Linux

for (int i=1;i<numd;i++)

The declaration in the "for" directive requires C99 or C11 compiler. Do you accept this?

latest build fails

Build fails with following warnings on 14.04 and 16.04
fails on a machine with older working install

gpssim.c: In function ‘allocateChannel’:
gpssim.c:1580:33: warning: passing argument 3 of ‘eph2sbf’ from incompatible pointer type [-Wincompatible-pointer-types]
eph2sbf(eph[sv], ionoutc, chan[i].sbf);
^
gpssim.c:491:6: note: expected ‘long int ()[10]’ but argument is of type ‘long unsigned int ()[10]’
void eph2sbf(const ephem_t eph, const ionoutc_t ionoutc, long sbf[5][N_DWRD_SBF])

Don't work with Hackrf one

I download and tried these great codes. But encountered some problem while trying to send signals through Hackrf one. I generated gpssim.bin through
./gps-sdr-sim -b 8 -e brdc3540.14n -u circle.csv
(I also tried with fixed location -l option and latest brdc file, results were the same)
Then I tried to let Hackrf to send the signal:
sudo hackrf_transfer -t gpssim.bin -f 1575420000 -s 2600000 -a 1 -x 0
(I tried it on both Mac and a Linux virtual machine, results were the same)

Before I start hackrf's transfer, my android phone caught some gps signal leaked from the window:
screenshot_2016-02-22-14-02-01

After I start Hackrf's transfer, in about 30 seconds, I got this:
screenshot_2016-02-22-14-02-58
No any bars at all! The Hackrf looks like a signal jammer here.

When I stop the Hackrf's transfer, the bars were back:
screenshot_2016-02-22-14-03-46

The Hackrf one was using the antenna came with it. The phone running AndroiTS was located about 0.4 meter from the antenna.
Did anyone encounter the same problem?

Generating ECEF

This is not an issue more a question, what are you using to generate the ecef data? are there any programs that are freely available that can do it?
Ill close this once you reply.

Thanks

`make test` fails (checksum does not match)

Ubuntu 12.04 system, built a16fd8e from git. Quad-core, and the generator is using OpenMP (which is nice!)

@ubuntu:~/gps-sdr-sim$ make test
time ./gps-sdr-sim -e brdc3540.14n -u circle.csv -b 8
User motion data = 3000
xyz =  -3813478.0,   3554276.6,   3662785.2
llh =   35.274016,  137.014864,       100.0
Start Time = 1823:518400.0
01   75.5  19.0
02  278.2   8.6
03   44.8  38.2
06  298.1  43.4
09  144.3  29.1
10  222.8  34.6
11   98.7   7.0
12  326.9   5.0
17  350.8  83.8
20   47.2  49.4
23  106.0  35.7
28  201.9  27.9
32   43.1   2.2
Number of channels = 13
Generating baseband signals...
Time = 300.0
Done!
Process time = 845.140[sec]

real    2m23.036s
user    14m3.674s
sys     0m1.646s
test "$(md5sum gpssim.bin | awk '{print $1}')" == "1a1aa6de6ee7faf58c1544a62aabc900"
make: *** [test] Error 1

I don't have the hardware to know if the resulting .bin file is a valid trajectory.

I get the checksum 717f3c820cd62f0d5cd7050be7090f9b for this build.

hackrf_start_?x() failed: USB error (-1000)

Hello,
Thanks for your great job. My hackrf one meets a problem, how can I slove it?

sudo hackrf_transfer -t gpssim.bin -f 1575420000 -s 2600000 -a 1 -x 0 -R
call hackrf_set_sample_rate(2600000 Hz/2.600 MHz)
hackrf_start_?x() failed: USB error (-1000)
Usage:
-h # this help
[-d serial_number] # Serial number of desired HackRF.
-r # Receive data into file (use '-' for stdout).
-t # Transmit data from file (use '-' for stdin).
-w # Receive data into file with WAV header and automatic name.
# This is for SDR# compatibility and may not work with other software.
[-f freq_hz] # Frequency in Hz [0MHz to 7250MHz].
[-i if_freq_hz] # Intermediate Frequency (IF) in Hz [2150MHz to 2750MHz].
[-o lo_freq_hz] # Front-end Local Oscillator (LO) frequency in Hz [84MHz to 5400MHz].
[-m image_reject] # Image rejection filter selection, 0=bypass, 1=low pass, 2=high pass.
[-a amp_enable] # RX/TX RF amplifier 1=Enable, 0=Disable.
[-p antenna_enable] # Antenna port power, 1=Enable, 0=Disable.
[-l gain_db] # RX LNA (IF) gain, 0-40dB, 8dB steps
[-g gain_db] # RX VGA (baseband) gain, 0-62dB, 2dB steps
[-x gain_db] # TX VGA (IF) gain, 0-47dB, 1dB steps
[-s sample_rate_hz] # Sample rate in Hz (4/8/10/12.5/16/20MHz, default 10MHz).
[-n num_samples] # Number of samples to transfer (default is unlimited).
[-S buf_size] # Enable receive streaming with buffer size buf_size.
[-c amplitude] # CW signal source mode, amplitude 0-127 (DC value to DAC).
[-R] # Repeat TX mode (default is off)
[-b baseband_filter_bw_hz] # Set baseband filter bandwidth in Hz.
Possible values: 1.75/2.5/3.5/5/5.5/6/7/8/9/10/12/14/15/20/24/28MHz, default <= 0.75 * sample_rate_hz.
[-C ppm] # Set Internal crystal clock error in ppm.
[-H hw_sync_enable] # Synchronise USB transfer using GPIO pins.

Beyond above, when I make it, something happened:

gps-sdr-sim# make
gcc -O3 -Wall -c -o gpssim.o gpssim.c
gpssim.c: In function ‘main’:
gpssim.c:1860:65: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]
if (duration<0.0 || duration>((double)USER_MOTION_SIZE) / 10.0 && !staticLocationMode || duration>STATIC_MAX_DURATION && staticLocationMode)
^
gpssim.c:1860:120: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]
if (duration<0.0 || duration>((double)USER_MOTION_SIZE) / 10.0 && !staticLocationMode || duration>STATIC_MAX_DURATION && staticLocationMode)
^
gcc gpssim.o -lm -o gps-sdr-sim

Some information about my hackrf one:

hackrf_info
hackrf_info version: unknown
libhackrf version: unknown (0.5)
Found HackRF
Index: 0
Serial number: 0000000000000000443464c021651617
Board ID Number: 2 (HackRF One)
Firmware Version: 2017.02.1 (API:1.02)
Part ID Number: 0xa000cb3c 0x005e4f58

Can we merge in the FrankBuss STDIN fixes sans the nodeJS?

Can we just make this a standard feature? https://github.com/FrankBuss/gps-sdr-sim

We can leave out @FrankBuss JavaScript stuff in the maps folder, then anyone wanting to use it can make use of what ever front end they chose to.

https://github.com/FrankBuss/gps-sdr-sim/tree/master/maps

I wanted to get his fixed put in place for the current version of code, but am not really interested in doing that for every chance you make.

Can we get some IF statements, and command line statements to accommodate his modifications?

THIS https://github.com/FrankBuss/gps-sdr-sim is way more practical than THIS for example...

https://www.douban.com/note/572829951/

This guy completely hijacks all of fopen as a fix... https://www.douban.com/note/572588515/

Surely we can just accommodate folks that use this functionality over STDIN?

ERROR with USRP N210

hello, i generate the bin with
sudo ./gps-sdr-sim -e brdc3540.14n -l 11.111111,11.111111,100 -s 2500000 -b 8
every thing works fine
but when i load it into usrp. it went into an error

~/Desktop/gps-sdr-sim-master$ sudo ./gps-sdr-sim-uhd.py -t gpssim.bin -s 2500000 -x 0
linux; GNU C++ version 4.8.2; Boost_105400; UHD_003.005.005-0-unknown

-- Opening a USRP2/N-Series device...
-- Current recv frame size: 1472 bytes
-- Current send frame size: 1472 bytes
Using Volk machine: avx_64_mmx_orc
Traceback (most recent call last):
File "./gps-sdr-sim-uhd.py", line 70, in
tb = top_block(options)
File "./gps-sdr-sim-uhd.py", line 41, in init
self.blocks_interleaved_short_to_complex = blocks.interleaved_short_to_complex(False, False)
TypeError: make() takes at most 1 argument (2 given)
xiaofei@drone:~/Desktop/gps-sdr-sim-master$

i am new to SDR. Can anyone help me?

A couple of doubts about the code

Hello,
I am looking at these great codes, and I have found some trouble trying to understand a couple of things. I would be very grateful if someone could give me a hand with these topics, which are:

1.- I dont understand why, to calculate phase_ini, this expression is used: "phase_ini = (2.0r_ref - r_xyz)/LAMBDA_L1;". I don't understand the part "2.0r_ref", being r_ref the range between the satellite and (0,0,0) position (I think).

2.- In computeCodePhase, in the expression "ms = (((chan->rho0.g.sec-chan->g0.sec)+6.0) - chan->rho0.range/SPEED_OF_LIGHT)*1000.0;", I don't understand why 6 seconds are added. I guess it is necessary to skip the first 10 words, but I would like to know what exactly those words are, and what they are useful for (I have seen that dwrd has 60 elements, and I would like to understand why it doesn't have only the 50 words contained in 5 subframes).

Thank you very much

What is the format of the csv file

Hi,

I'm looking at the circle.csv file and was wondering what each column was and what format it is in. Is there any documentation for it anywhere? I would like to make my own shape.

Thanks

Doppler shift

Hello,
does gps-sdr-sim introduce the doppler effect in GPS signal?

Trouble locking in with HackRF

I am getting high 40s and some 50s, but I can't seem to lock in with the hackrf. Tried a few different phones with no success. LG G2, iPhone 5s, nexus 5, and iPhone 6s Plus. I am using a vat30 and the small orange antenna from digikey. Have tried the ant500 as well. I am using this tcxo from eBay. http://m.ebay.com/itm/HackRF-one-external-TCXO-clock-PPM-0-1-for-GPS-Applications-GSM-WCDMA-LTE-/272320312607?txnId=1688277940017

Getting 0x01 with it in. Any ideas? I am using -b 8.

Wrote a parsing method for LLH CSV

Hi,

I have written a method that will take a lat, long, height csv and generate the file. It is based on NEMA method but designed for the following CSV:

0.1,41.259519,174.813354,100
0.2,41.259519,174.813354,100
0.3,41.259519,174.813354,100
0.4,41.259519,174.813354,100
0.5,41.259519,174.813354,100
0.6,41.259519,174.813354,100
0.7,41.259519,174.813354,100
0.8,41.259519,174.813354,100
0.9,41.259519,174.813354,100
1,41.259519,174.813354,100

Time, Latitude, Longitude, Height

It would be great if you could include the following in the application:

int readLLH(double xyz[USER_MOTION_SIZE][3], const char *filename)
{

    FILE *fp;
    int numd = 0;
    char str[MAX_CHAR];
    char *token;
    double llh[3],pos[3];
    char tmp[8];

    if (NULL==(fp=fopen(filename,"rt")))
        return(-1);

    while (1)
    {
        if (fgets(str, MAX_CHAR, fp)==NULL)
            break;

        token = strtok(str, ","); //Take out leading time

        token = strtok(NULL, ","); // Latitude
        strncpy(tmp, token, 2);
        tmp[2] = 0;

        llh[0] = atof(tmp) + atof(token+2)/60.0;

        llh[0] /= R2D; // in radian

        token = strtok(NULL, ","); // Longitude
        strncpy(tmp, token, 3);
        tmp[3] = 0;

        llh[1] = atof(tmp) + atof(token+3)/60.0;

        llh[1] /= R2D; // in radian

        token = strtok(NULL, ","); // Altitude above mean sea level

        llh[2] = atof(token);

        // Convert geodetic position into ECEF coordinates
        llh2xyz(llh, pos);

        xyz[numd][0] = pos[0];
        xyz[numd][1] = pos[1];
        xyz[numd][2] = pos[2];

        // Update the number of track points
        numd++;

        if (numd>=USER_MOTION_SIZE)
            break;

    }

    fclose(fp);

    return (numd);
}

One thing I have noticed with a Lat of "41.259519" comes up correctly yet "-41.259519" is coming up a 3 deg North. Not sure where that is happening? Maybe the llh2xyz method?

Live spoofing question

Hello, I am a research student in a US university and I have been tasked to create a live spoofer. I have been able to successfully run the code for a spoofed static location and predefined trajectory. My next scenario is receiving a live signal and manipulating it live. Much like the notable boating demonstration done by another research group which did it to a yacht. My scenario includes me being in a vehicle and my spoofing target being a few meters away. One of the problems I foresee is after the spoofing is activated I fear that I will spoof my own receiver.

From my knowledge as it stand now I feel that I may be able to modify the code to work with a live stream of data but I am very short on time and don't have the liberty to explore hunches.

My question is;
With modification can this code read a live stream of data and in what format?
I feel that is possible because an option in the code is to receive a NMEA GGA stream

I am very new to this area of research and lack a professor with expertise in the subject matter at my university so anyone with any knowledge or assistance they can offer is greatly appreciated.

Thank you

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.