Giter Club home page Giter Club logo

gps-sdr-sim-realtime's Introduction

GPS-SDR-SIM realtime

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.

Building with make

$ make

Realtime by Gnuradio

Use -n option can connect to a TCP source in Gnuradio for realtime simulation.

The tcp source should be set in "Server" mode.

See tcp.grc as an example.

Map

Run gps-sdr-sim with -w option, and

cd into /mapserver, and run

python mapper.py

Then visit http://127.0.0.1:8080/static/baidumap.html to use the Online map.

Or visit http://127.0.0.1:8080/static/googlemap.html to use the google Online map.

You can also write an map which can POST data to http://127.0.0.1:8080/post like this

lon=116&lat=39&hgt=10

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 require 2.6 MHz sample rate, while the USRP2 requires 2.5 MHz (an even integral decimator of 100 MHz).

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 (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
  -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
  -v               Show details about simulated channels
  -n <port>        Use TCP connection to Gnuradio TCP-Source for realtime simulation.
  -w <port>        Connect with map server(/mapserver/mapper.py) by UDP (default port 5678).

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 -g triumphv3.txt
> gps-sdr-sim -e brdc3540.14n -l 30.286502,120.032669,100

Use Gnuradio to realtime simulate 3000s:

> gps-sdr-sim -e brdc3540.14n -l 30.286502,120.032669,100 -n 1234 -d 3000

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:

> 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-2022 Takuji Ebinuma
Distributed under the MIT License.

gps-sdr-sim-realtime's People

Contributors

alkuna avatar bitdust avatar dmay31 avatar edy555 avatar gym487 avatar ingenico-zanetti avatar kaback avatar laf0rge avatar madengr avatar maximevince avatar mictronics avatar mzollin avatar osqzss avatar sa0mad avatar scateu avatar sgk avatar stefanoschaliasos avatar sundw2014 avatar

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

gps-sdr-sim-realtime's Issues

GNU Radio Missing Block (tcp source)

Hi,
thank you for your work on the real-time version of the gps-sdr-sim library!

I am trying to get the gnu radio part running, but ran into a problem there The source is marked as 'missing block' for me. Is there some kind of libraries required to run it? (3rd party sdr lib for instance..)

Updating gnuradio to 3.9 did not help, but now I can say that it is not one of the newer tcp server/client nodes..

Thanks!

The problem of signal interruption

Hello, I set the maximum duration to 86400 seconds. The signal will be interrupted after about 3 hours of operation, and the signal will be restored after about two hours. During this period, the command has been running all the time. This has been the case several times. What is the problem?

Any ideas?

[chown@mbp ~/Downloads/gps-sdr-sim-realtime (master *)]$ bladeRF-cli -s bladerf.script

For best results, it is not recommended to set both RX and TX to the
same frequency. Instead, consider offsetting them by at least 1 MHz
and mixing digitally.

For the above reason, 'set frequency ` is deprecated and
scheduled for removal in future bladeRF-cli versions.

Please use 'set frequency rx' and 'set frequency tx' to configure
channels individually.

RX1 Frequency: 1575419998 Hz (Range: [70000000, 6000000000])
RX2 Frequency: 1575419998 Hz (Range: [70000000, 6000000000])
TX1 Frequency: 1575419998 Hz (Range: [47000000, 6000000000])
TX2 Frequency: 1575419998 Hz (Range: [47000000, 6000000000])

Setting RX1 sample rate - req: 2600000 0/1Hz, actual: 2600000 0/1Hz
Setting RX2 sample rate - req: 2600000 0/1Hz, actual: 2600000 0/1Hz
Setting TX1 sample rate - req: 2600000 0/1Hz, actual: 2600000 0/1Hz
Setting TX2 sample rate - req: 2600000 0/1Hz, actual: 2600000 0/1Hz

RX1 Bandwidth: 2500000 Hz (Range: [200000, 56000000])
RX2 Bandwidth: 2500000 Hz (Range: [200000, 56000000])
TX1 Bandwidth: 2500000 Hz (Range: [200000, 56000000])
TX2 Bandwidth: 2500000 Hz (Range: [200000, 56000000])

Error (bladerf.script:3): Invalid operation or parameter

compiling gps-sdr-sim-realtime using usrp X310

when i try to compile with "$ gcc gpssim.c -lm -O3 -o gps-sdr-sim" compiler on ubuntu using usrp X310, the following error generated.....the error is pointing in to "socket.c" which is about connecting to TCP.......

$ gcc gpssim.c -lm -O3 -o gps-sdr-sim
In file included from gpssim.c:14:0:
socket.c: In function ‘timem’:
socket.c:41:2: warning: implicit declaration of function ‘gettimeofday’ [-Wimplicit-function-declaration]
gettimeofday(&t, NULL);
^~~~~~~~~~~~
socket.c: In function ‘udprecv’:
socket.c:60:41: warning: passing argument 6 of ‘recvfrom’ makes pointer from integer without a cast [-Wint-conversion]
return recvfrom(s, dataa, siz, 0,&from,sizeof(from));
^~~~~~
In file included from /usr/include/x86_64-linux-gnu/sys/socket.h:269:0,
from socket.c:2,
from gpssim.c:14:
/usr/include/x86_64-linux-gnu/bits/socket2.h:64:1: note: expected ‘socklen_t * restrict {aka unsigned int * restrict}’ but argument is of type ‘long unsigned int’
recvfrom (int __fd, void *__restrict __buf, size_t __n, int __flags,
^~~~~~~~
In file included from gpssim.c:14:0:
socket.c: At top level:
socket.c:63:30: warning: excess elements in array initializer
double llhr[3]={39.68,139,76,10};
^~
socket.c:63:30: note: (near initialization for ‘llhr’)
gpssim.c: In function ‘usage’:
gpssim.c:1651:9: warning: format ‘%f’ expects argument of type ‘double’, but argument 2 has type ‘char *’ [-Wformat=]
printf("Usage: gps-sdr-sim [options]\n"
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gpssim.c:1665:3:
" -n Use TCP connect to Gnuradio TCP-Source for\n realtime simulation.\n",

在windows下打包后,使用Gnuradio 3.9,替换了TCP source报以下错误

master\top_block.py", line 234, in
main()
File "op_block.py", line 212, in main
tb = top_block_cls()
File "top_block.py", line 172, in init
self.network_tcp_source_0 = network.tcp_source.tcp_source(itemsize=gr.sizeof_gr_complex*1,addr='127.0.0.1',port=1234,server=True)
File "C:\Program Files\PothosSDR\lib\python3.9\site-packages\gnuradio\network\tcp_source.py", line 86, in init
self.connect(blocks.file_descriptor_source(itemsize, fd), self)
TypeError: init(): incompatible constructor arguments. The following argument types are supported:
1. gnuradio.blocks.blocks_python.file_descriptor_source(itemsize: int, fd: int, repeat: bool = False)

Invoked with: 8, None

GPS signal does not work

I am using hackrf.
With the original gps-sdr-sim I can successfully transmit GPS signals that are detected by test units. So the hardware looks OK.

With this project I can connect to gnuradio and show the waterfall and frequency graph:
image

But no signal gets detected by the GPS units.
If I can help debugging in any way please just tell me.
Thanks,

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.