4 July 2018

TDoA howto (tested on Ubuntu Linux 12.04)

howto compute TDoA maps with GPS enabled KiwiSDR servers around the world using Christoph Mayer TDoA scripts and his forked "kiwiclient" python stuff https://github.com/hcab14/TDoA
00=00
prerequisites:
GNU Octave (>= 4.2.2)  https://www.gnu.org/software/octave/download.html
python 2.x (mine is version 2.7.3)
git

After downloaded/installed octave and git, use git to clone TDoA repository
#cd <your_octave_directory>
#git clone --recursive https://github.com/hcab14/TDoA.git
#git pull --recurse-submodules


make a copy of TDoA procedure and symlink to kiwiSDRs positions:
#cd TDoA
#cp proc_tdoa_DCF77.m proc_tdoa.m
#cd kiwiclient
#ln -s ../gnss_pos/ gnss_pos


in kiwiclient subdirectory there should be the file read_kiwi_iq_wav.oc, if not tryto compile:
#mkoctfile kiwiclient/read_kiwi_iq_wav.cc
check if read_kiwi_iq_wav.oc has been produced then leave the directory and back home:
#cd

run octave from <your_octave_directory>:
#cd <your_octave_directory>
#octave --no-gui


install some needed packages

>pkg install -forge control;
>pkg install -forge signal;


and run the example:

>cd TDoA
>[tdoa,input]=proc_tdoa_DCF77;

this should produce two files in the png and pdf subdirectories
exit from octave:
>exit

== now you are ready==

From kiwiSDR map https://sdr.hu/map select the better SDRs for your target ( >=3 SDRs), check if they receive the target and if they are GPS'ed. Write down their URL (without the port 8073 indication) and their station-name, eg:
hsouthwest.ddns.net G8JNJ
sdr.telcosol.gr SV3EXP
sm2byc.ddns.net SM2BYC
(you have to give each station a name, I just use the KiwiDSDR name).
Also write down the central frequency in KHz of the target signal, eg: 5200.20

Now cd to kiwiclient and run the command to start the IQ recorders
the command has the format:
python kiwirecorder.py -s sdr1,sdr2,...,sdrn -f fc -w --station= S1,S2,...,Sn --log_level info -m iq -L -f1 -H f2
where:
sdr<n> = URL of the KiwiSDR #<n>
fc = central frequency of the target signal
S<n> = station name of KiwiSDR #<n>
f1 =  lower limit of the bandwidth to record in KHz
f2 =  upper limit of the bandwidth to record in Khz

so in our example, using 10 KHz badwidth (center 5200.20 KHz):

#cd <your_octave_directory>/TDoA/kiwiclient
#python kiwirecorder.py -s hsouthwest.ddns.net,sdr.telcosol.gr,sm2byc.ddns.net \
-f 5200.20 -w --station= G8JNJ,SV3EXP,SM2BYC --log_level info -m iq -L -5000 -H 5000


Stop the n-recorders using CTRL-C (it should be enough to record 30sec to 2 min). You will get three wav files (as the number of the used KiwiSDRs) with different filenames which you have to move to the 'iq/' folder !!! and three new files in 'gnss_pos/' folder which contain the coordinates of the used KiwiSDRs.

Now you have to edit the TDoA/proc_tdoa.m file and change the filenames to process, eg:
  ...
  ...
  input(1).fn    = 'iq/20180703T074355Z_8022000_G8JNJ_iq.wav';
  input(2).fn    = 'iq/20180703T074355Z_8022000_SV3EXP_iq.wav';
  input(3).fn    = 'iq/20180703T074356Z_8022000_SM2BYC_iq.wav';
if you used five KiwiSDRs you will add new lines as:
  input(4).fn    = 'iq/..._iq.wav';
  input(5).fn    = 'iq/..._iq.wav';

then edit the titles of the plots (title) and jpg/pdf output files (plotname), as well as the limits of the maps and a known-location coordinates:
  ...
  ...
  plot_info = struct('lat', [ 30:0.05:70],
                     'lon', [ -5:0.05:70],
                     'plotname', 'TDoA_8020',
                     'title', '8020 kHz 20180703T072736Z',
                     'known_location', struct('coord', [55.751244 37.618423],
                                              'name',  'MOSCOW')
                    );

save the edited file and run it in octave (as the example above):
#cd <your_octave_directory>
#octave --no-gui

>cd TDoA
>[tdoa,input]=proc_tdoa;


if everything went well you will have results files in the png and pdf subdirectories, exit from octave and browse the results.
>exit
Repeat from == now you are ready== for a new TDoA multilateration.


You might also try hf_linkz directTDoA, a python GUI interface to TDoA
http://81.93.247.141/~linkz/directTDoA/

 Have fun!