Fixed some bugs where I was treating sample data as an integer. Allows use with UHD without multiplying everything up by 64K. =)
Also changed the reference level printout to show dB instead of sample value. This seems more useful. 0dB is full scale.
This commit is contained in:
parent
13c5acca52
commit
7727b7c902
@ -39,7 +39,7 @@ int air_modes_framer::work(int noutput_items,
|
||||
|
||||
int size = noutput_items - d_check_width; //need to be able to look ahead a full frame
|
||||
|
||||
int reference_level = 0;
|
||||
float reference_level = 0;
|
||||
framer_packet_type packet_attrib;
|
||||
|
||||
for(int i = 0; i < size; i++) {
|
||||
@ -67,7 +67,7 @@ int air_modes_framer::work(int noutput_items,
|
||||
//NOTE: you can change the default here to be short packet, and then check for a long packet. don't know which way is better.
|
||||
|
||||
for(int j = (65 * d_samples_per_symbol); j < (70 * d_samples_per_symbol); j += d_samples_per_symbol) {
|
||||
int t_max = (bit_energy(&inraw[i+j], d_samples_per_chip) > bit_energy(&inraw[i+j+d_samples_per_chip], d_samples_per_chip)) ? bit_energy(&inraw[i+j], d_samples_per_chip) : bit_energy(&inraw[i+j+d_samples_per_chip], d_samples_per_chip);
|
||||
float t_max = (bit_energy(&inraw[i+j], d_samples_per_chip) > bit_energy(&inraw[i+j+d_samples_per_chip], d_samples_per_chip)) ? bit_energy(&inraw[i+j], d_samples_per_chip) : bit_energy(&inraw[i+j+d_samples_per_chip], d_samples_per_chip);
|
||||
if(t_max < (reference_level / 2)) packet_attrib = Short_Packet;
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,7 @@ int air_modes_preamble::work(int noutput_items,
|
||||
|
||||
int size = noutput_items - d_check_width;
|
||||
int pulse_offsets[4];
|
||||
int bit_energies[4];
|
||||
float bit_energies[4];
|
||||
|
||||
for(int i = d_samples_per_chip; i < size; i++) {
|
||||
float pulse_threshold = bit_energy(&inavg[i], d_samples_per_chip) * d_threshold;
|
||||
|
@ -90,7 +90,7 @@ int air_modes_slicer::work(int noutput_items,
|
||||
// confidence = bool(int(firstchip_inref) + int(secondchip_inref)); //one and only one chip in the reference zone
|
||||
|
||||
//below is the Lincoln Labs slicer. it may produce greater bit errors. supposedly it is more resistant to mode A/C FRUIT.
|
||||
|
||||
//see http://adsb.tc.faa.gov/WG3_Meetings/Meeting8/Squitter-Lon.pdf
|
||||
if(firstchip_inref && !secondchip_inref) {
|
||||
slice = 1;
|
||||
confidence = 1;
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
#betcha this would be faster if you used a table for mode C
|
||||
#you could strip out D1 since it's never used, that leaves 11 bits (table is 2048 entries)
|
||||
#on the other hand doing it this way is educational for others
|
||||
def decode_alt(alt, bit13):
|
||||
if alt & 0x40 and bit13 is True:
|
||||
return "METRIC ERROR"
|
||||
|
Binary file not shown.
@ -2,12 +2,15 @@
|
||||
#from string import split, join
|
||||
#from math import pi, floor, cos, acos
|
||||
import math, time
|
||||
#this implements CPR position decoding. local only for now.
|
||||
#this implements CPR position decoding.
|
||||
|
||||
latz = 15
|
||||
nbits = 17
|
||||
my_lat = 37.76225 #update these later!
|
||||
my_lon = -122.44254
|
||||
#my_lat = 37.76225 #update these later!
|
||||
#my_lon = -122.44254
|
||||
#ER
|
||||
my_lat = 37.40889176297184
|
||||
my_lon = -122.07765340805054
|
||||
|
||||
|
||||
def nz(ctype):
|
||||
@ -229,8 +232,8 @@ def range_bearing(loc_a, loc_b):
|
||||
|
||||
avg_lat = (a_lat + b_lat) / 2.0
|
||||
|
||||
R1 = earth_radius_mi*(1.0-esquared)/pow((1.0-esquared*pow(math.sin(avg_lat),2)),1.5)
|
||||
|
||||
R1 = earth_radius_mi*(1.0-esquared)/pow((1.0-esquared*pow(math.sin(avg_lat),2)),1.5)
|
||||
|
||||
R2 = earth_radius_mi/math.sqrt(1.0-esquared*pow(math.sin(avg_lat),2))
|
||||
|
||||
distance_North = R1*delta_lat
|
||||
|
Binary file not shown.
@ -33,7 +33,7 @@ def modes_print(message):
|
||||
else:
|
||||
output = "No handler for message type " + str(msgtype) + " from " + str(ecc)
|
||||
|
||||
output = "(%.0f) " % float(reference) + output
|
||||
output = "(%.0f) " % (10.0*math.log10(float(reference))) + output
|
||||
|
||||
return output
|
||||
|
||||
|
@ -33,7 +33,7 @@ The following are optional command line parameters:
|
||||
-R SUBDEV Daughter board specification, defaults to first found
|
||||
-f FREQ USRP receive frequency (1090 MHz Default)
|
||||
-g GAIN Daughterboard gain setting. Defaults to mid-range.
|
||||
-d DECIM USRP decimation rate
|
||||
-r RATE USRP sample rate
|
||||
-t THRESH Receiver valid pulse threshold
|
||||
-a Output all frames. Defaults only output frames
|
||||
|
||||
@ -80,7 +80,6 @@ class adsb_rx_block (gr.top_block):
|
||||
if options.output_all :
|
||||
pass_all = 1
|
||||
|
||||
self.gain = gr.multiply_const_cc(1000000)
|
||||
self.demod = gr.complex_to_mag()
|
||||
self.avg = gr.moving_average_ff(100, 1.0/100, 400);
|
||||
self.preamble = air.modes_preamble(rate, options.threshold)
|
||||
@ -95,7 +94,7 @@ class adsb_rx_block (gr.top_block):
|
||||
# else:
|
||||
self.filt = self.u
|
||||
|
||||
self.connect(self.filt, self.gain, self.demod)
|
||||
self.connect(self.filt, self.demod)
|
||||
self.connect(self.demod, self.avg)
|
||||
self.connect(self.demod, (self.preamble, 0))
|
||||
self.connect(self.avg, (self.preamble, 1))
|
||||
|
Loading…
Reference in New Issue
Block a user