-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
new refactor and USRP implementation from Akshay
- Loading branch information
Showing
59 changed files
with
446 additions
and
3,388,155 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
6 changes: 0 additions & 6 deletions
6
.ipynb_checkpoints/spectrogram testing grounds-checkpoint.ipynb
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
SF = 10; | ||
BW = 1.25e5; | ||
chirp_size=1024; | ||
chirpsize=chirp_size; | ||
preamble_length=20; | ||
extra_sampling_factor = 1; | ||
Fs = BW; | ||
symbol_length=chirp_size; | ||
symbol_length_upsampled = extra_sampling_factor*chirp_size; | ||
freq_shift_per_sample = Fs/symbol_length; % How each frequency bin maps to a difference in frequency | ||
Ts = 1/freq_shift_per_sample; % Symbol Duration | ||
f = linspace(-BW/2,BW/2-freq_shift_per_sample,symbol_length); % The X-Axis | ||
reset_freq = -BW/2; % The initial frequency of the base chirp | ||
final_freq = (BW/2)-freq_shift_per_sample; % The final frequency | ||
[up,down] = my_create_chirpspecial(extra_sampling_factor*Fs,Ts,reset_freq,final_freq,chirp_size); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
SF = 10; | ||
BW = 1.25e5; | ||
chirp_size=1024; | ||
chirpsize=chirp_size; | ||
extra_sampling_factor = 1; | ||
Fs = BW; | ||
symbol_length=chirp_size; | ||
symbol_length_upsampled = extra_sampling_factor*chirp_size; | ||
freq_shift_per_sample = Fs/symbol_length; % How each frequency bin maps to a difference in frequency | ||
Ts = 1/freq_shift_per_sample; % Symbol Duration | ||
f = linspace(-BW/2,BW/2-freq_shift_per_sample,symbol_length); % The X-Axis | ||
reset_freq = -BW/2; % The initial frequency of the base chirp | ||
final_freq = (BW/2)-freq_shift_per_sample; % The final frequency | ||
[up,down] = my_create_chirpspecial(extra_sampling_factor*Fs,Ts,reset_freq,final_freq,chirp_size); | ||
upfft=fft(up); | ||
downfft=fft(down); | ||
up250=(ifft([upfft(1:512);zeros(1024,1);upfft(513:1024)])); | ||
down250=(ifft([downfft(1:512);zeros(1024,1);downfft(513:1024)])); | ||
sig1=read_complex_binary('predabs52_15_04_47.dat'); | ||
sig2=read_complex_binary('predabs3_15_04_47.dat'); | ||
sig3=read_complex_binary('predabs7_15_04_47.dat'); | ||
sig4=read_complex_binary('predabs50_15_04_47.dat'); | ||
|
||
p1=getPacket(sig1,down250,up250); | ||
p2=getPacket(sig2,down250,up250); | ||
p3=getPacket(sig3,down250,up250); | ||
p4=getPacket(sig4,down250,up250); | ||
close all; | ||
figure; hold on; | ||
plot(abs(p1+p2+p3+p4),'Color','black'); | ||
plot(abs(p1),'Color','blue') | ||
plot(abs(p2),'Color','blue') | ||
plot(abs(p3),'Color','blue') | ||
plot(abs(p4),'Color','blue') | ||
|
||
p2=OffsetCorrectorNew(p2,p1); | ||
p3=OffsetCorrectorNew(p3,p1); | ||
p4=OffsetCorrectorNew(p4,p1); | ||
|
||
plot(abs(p1+p2+p3+p4),'Color','red') | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
SF = 10; | ||
BW = 1.25e5; | ||
chirp_size=1024; | ||
chirpsize=chirp_size; | ||
extra_sampling_factor = 1; | ||
Fs = BW; | ||
symbol_length=chirp_size; | ||
symbol_length_upsampled = extra_sampling_factor*chirp_size; | ||
freq_shift_per_sample = Fs/symbol_length; % How each frequency bin maps to a difference in frequency | ||
Ts = 1/freq_shift_per_sample; % Symbol Duration | ||
f = linspace(-BW/2,BW/2-freq_shift_per_sample,symbol_length); % The X-Axis | ||
reset_freq = -BW/2; % The initial frequency of the base chirp | ||
final_freq = (BW/2)-freq_shift_per_sample; % The final frequency | ||
[up,down] = my_create_chirpspecial(extra_sampling_factor*Fs,Ts,reset_freq,final_freq,chirp_size); | ||
upfft=fft(up); | ||
downfft=fft(down); | ||
up250=(ifft([upfft(1:512);zeros(1024,1);upfft(513:1024)])); | ||
down250=(ifft([downfft(1:512);zeros(1024,1);downfft(513:1024)])); | ||
sig1=read_complex_binary('predabs52_15_04_47.dat'); | ||
sig2=read_complex_binary('predabs3_15_04_47.dat'); | ||
sig3=read_complex_binary('predabs7_15_04_47.dat'); | ||
sig4=read_complex_binary('predabs50_15_04_47.dat'); | ||
|
||
frequencyOffsetCorrector=ones(2048*55.25+1,1); | ||
phaseOffsetCorrector=ones(2048*55.25+1,1); | ||
for i=1:2048*55.25 | ||
frequencyOffsetCorrector(i)=exp(1j*i); | ||
phaseOffsetCorrector(i)=exp(1j); | ||
end | ||
|
||
p1=getPacket(sig1,down250,up250); | ||
p2=getPacket(sig2,down250,up250); | ||
p3=getPacket(sig3,down250,up250); | ||
p4=getPacket(sig4,down250,up250); | ||
|
||
p2=OffsetCorrectorNew(p2,p1); | ||
p3=OffsetCorrectorNew(p3,p1); | ||
p4=OffsetCorrectorNew(p4,p1); | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
SF = 10; | ||
BW = 1.25e5; | ||
chirp_size=1024; | ||
chirpsize=chirp_size; | ||
extra_sampling_factor = 1; | ||
Fs = BW; | ||
symbol_length=chirp_size; | ||
symbol_length_upsampled = extra_sampling_factor*chirp_size; | ||
freq_shift_per_sample = Fs/symbol_length; % How each frequency bin maps to a difference in frequency | ||
Ts = 1/freq_shift_per_sample; % Symbol Duration | ||
f = linspace(-BW/2,BW/2-freq_shift_per_sample,symbol_length); % The X-Axis | ||
reset_freq = -BW/2; % The initial frequency of the base chirp | ||
final_freq = (BW/2)-freq_shift_per_sample; % The final frequency | ||
[up,down] = my_create_chirpspecial(extra_sampling_factor*Fs,Ts,reset_freq,final_freq,chirp_size); | ||
upfft=fft(up); | ||
downfft=fft(down); | ||
up250=(ifft([upfft(1:512);zeros(1024,1);upfft(513:1024)])); | ||
down250=(ifft([downfft(1:512);zeros(1024,1);downfft(513:1024)])); | ||
sig1=read_complex_binary('predabs52_15_04_47.dat'); | ||
sig2=read_complex_binary('predabs3_15_04_47.dat'); | ||
sig3=read_complex_binary('predabs7_15_04_47.dat'); | ||
sig4=read_complex_binary('predabs50_15_04_47.dat'); | ||
|
||
|
||
p1=getPacket(sig1,down250,up250); | ||
p2=getPacket(sig2,down250,up250); | ||
p3=getPacket(sig3,down250,up250); | ||
p4=getPacket(sig4,down250,up250); | ||
close all; | ||
figure; hold on; | ||
plot(abs(p1+p2+p3+p4),'Color','black'); | ||
plot(abs(p1),'Color','blue') | ||
plot(abs(p2),'Color','blue') | ||
plot(abs(p3),'Color','blue') | ||
plot(abs(p4),'Color','blue') | ||
|
||
p2=OffsetCorrectorNew(p2,p1); | ||
p3=OffsetCorrectorNew(p3,p1); | ||
p4=OffsetCorrectorNew(p4,p1); | ||
plot(abs(p1+p2+p3+p4),'Color','red') | ||
|
||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
function [p1] = OffsetCorrector(p1,up250) | ||
%UNTITLED5 Summary of this function goes here | ||
% Detailed explanation goes here | ||
ang1=angle(p1(1:8*2048)./repmat(up250,8,1)); | ||
fOffset1=mean(removeoutliers(gradient(unwrap(ang1(512:512+1024))))); | ||
for i=1:2048*55.25 | ||
p1(i)=p1(i)*exp(-1j*i*fOffset1); | ||
end | ||
ang1=angle(p1(1:1*2048)./repmat(up250,1,1)); | ||
p=polyfit([1:1025]',unwrap(ang1(512:512+1024)),1); | ||
for i=1:2048*55.25 | ||
p1(i)=p1(i)*exp(-1j*i*p(1)); | ||
end | ||
ang1=angle(p1(1:1*2048)./repmat(up250,1,1)); | ||
for i=1:2048*55.25 | ||
p1(i)=p1(i)*exp(-1j*mean(ang1(512:512+1024))); | ||
end | ||
|
||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
function [sig] = OffsetCorrectorNew(sig,ref) | ||
%UNTITLED5 Summary of this function goes here | ||
% Detailed explanation goes here | ||
%ang1=angle(p1(1:8*2048)./repmat(up250,8,1)); | ||
fOffset1=mean(removeoutliers(gradient(unwrap(angle(sig./ref))))); | ||
for i=1:2048*55.25 | ||
sig(i)=sig(i)*exp(-1j*i*fOffset1); | ||
end | ||
ang1=angle(sig(1:1*2048)./ref(1:1*2048)); | ||
p=polyfit([1:1025]',unwrap(ang1(512:512+1024)),1); | ||
for i=1:2048*55.25 | ||
sig(i)=sig(i)*exp(-1j*i*p(1)); | ||
end | ||
p=polyfit([1:length(angle(sig./ref))]',unwrap((angle(sig./ref))),1); | ||
for i=1:2048*55.25 | ||
sig(i)=sig(i)*exp(-1j*i*p(1)); | ||
end | ||
ang1=angle(sig./ref); | ||
if(max(ang1(1:1e5))-min(ang1(1:1e5))>6) | ||
ang1=mod(ang1,2*pi); | ||
for i=1:2048*55.25 | ||
sig(i)=sig(i)*exp(-1j*mean(ang1(1:1e5))); | ||
end | ||
else | ||
for i=1:2048*55.25 | ||
sig(i)=sig(i)*exp(-1j*mean(ang1(1:1e5))); | ||
end | ||
|
||
end | ||
|
||
end | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
sudo bash asyncRX3.sh & sudo bash asyncRX7.sh & sudo bash asyncRX50.sh & sudo bash asyncRX52.sh & | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/bash | ||
|
||
while true | ||
do | ||
current_sec=$(date +%S); | ||
current_time=$(date +%H_%M_%S); | ||
mod12=$((10#$current_sec % 12)); | ||
|
||
if [ "$mod12" -eq 11 ]; then | ||
echo $current_time | ||
rx_samples_to_file --args="addr0=192.168.10.3" --freq=915e6 --rate=250e3 --file="predabs3_${current_time}.dat" --type=float --ant=TX/RX --gain=30 --nsamps=250000; | ||
else | ||
echo "waiting" | ||
fi | ||
|
||
done | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/bash | ||
|
||
while true | ||
do | ||
current_sec=$(date +%S); | ||
current_time=$(date +%H_%M_%S); | ||
mod12=$((10#$current_sec % 12)); | ||
|
||
if [ "$mod12" -eq 11 ]; then | ||
echo $current_time | ||
rx_samples_to_file --args="addr0=192.168.10.3" --freq=915e6 --rate=250e3 --file="predabs3_${current_time}.dat" --type=float --ant=TX/RX --gain=30 --nsamps=750000; | ||
else | ||
echo "waiting" | ||
fi | ||
|
||
done | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/bash | ||
|
||
while true | ||
do | ||
current_sec=$(date +%S); | ||
current_time=$(date +%H_%M_%S); | ||
mod12=$((10#$current_sec % 12)); | ||
|
||
if [ "$mod12" -eq 11 ]; then | ||
echo $current_time | ||
rx_samples_to_file --args="addr0=192.168.10.50" --freq=915e6 --rate=250e3 --file="predabs50_${current_time}.dat" --type=float --ant=TX/RX --gain=30 --nsamps=250000; | ||
else | ||
echo "waiting" | ||
fi | ||
|
||
done | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/bash | ||
|
||
while true | ||
do | ||
current_sec=$(date +%S); | ||
current_time=$(date +%H_%M_%S); | ||
mod12=$((10#$current_sec % 12)); | ||
|
||
if [ "$mod12" -eq 11 ]; then | ||
echo $current_time | ||
rx_samples_to_file --args="addr0=192.168.10.50" --freq=915e6 --rate=250e3 --file="predabs50_${current_time}.dat" --type=float --ant=TX/RX --gain=30 --nsamps=750000; | ||
else | ||
echo "waiting" | ||
fi | ||
|
||
done | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/bash | ||
|
||
while true | ||
do | ||
current_sec=$(date +%S); | ||
current_time=$(date +%H_%M_%S); | ||
mod12=$((10#$current_sec % 12)); | ||
|
||
if [ "$mod12" -eq 11 ]; then | ||
echo $current_time | ||
rx_samples_to_file --args="addr0=192.168.10.52" --freq=915e6 --rate=250e3 --file="predabs52_${current_time}.dat" --type=float --ant=TX/RX --gain=30 --nsamps=750000; | ||
else | ||
echo "waiting" | ||
fi | ||
|
||
done | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/bash | ||
|
||
while true | ||
do | ||
current_sec=$(date +%S); | ||
current_time=$(date +%H_%M_%S); | ||
mod12=$((10#$current_sec % 12)); | ||
|
||
if [ "$mod12" -eq 11 ]; then | ||
echo $current_time | ||
rx_samples_to_file --args="addr0=192.168.10.7" --freq=915e6 --rate=250e3 --file="predabs7_${current_time}.dat" --type=float --ant=TX/RX --gain=30 --nsamps=750000; | ||
else | ||
echo "waiting" | ||
fi | ||
|
||
done | ||
|
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.