kopia lustrzana https://github.com/projecthorus/radiosonde_auto_rx
				
				
				
			Merge branch 'testing' into experimental
						commit
						55a976fa0b
					
				| 
						 | 
				
			
			@ -249,10 +249,19 @@ class SondeDecoder(object):
 | 
			
		|||
            else:
 | 
			
		||||
                _rs92_gps_data = "-e %s" % self.rs92_ephemeris
 | 
			
		||||
 | 
			
		||||
            # Adjust the receive bandwidth based on the band the scanning is occuring in.
 | 
			
		||||
            if self.sonde_freq < 1000e6:
 | 
			
		||||
                # 400-406 MHz sondes - use a 12 kHz FM demod bandwidth.
 | 
			
		||||
                _rx_bw = 12000
 | 
			
		||||
            else:
 | 
			
		||||
                # 1680 MHz sondes - use a 28 kHz FM demod bandwidth.
 | 
			
		||||
                # NOTE: This is a first-pass of this bandwidth, and may need to be optimized.
 | 
			
		||||
                _rx_bw = 28000
 | 
			
		||||
 | 
			
		||||
            # Now construct the decoder command.
 | 
			
		||||
            # rtl_fm -p 0 -g 26.0 -M fm -F9 -s 12k -f 400500000 | sox -t raw -r 12k -e s -b 16 -c 1 - -r 48000 -b 8 -t wav - highpass 20 lowpass 2500 2>/dev/null | ./rs92ecc -vx -v --crc --ecc --vel -e ephemeris.dat
 | 
			
		||||
            decode_cmd = "%s %s-p %d -d %s %s-M fm -F9 -s 12k -f %d 2>/dev/null |" % (self.sdr_fm, bias_option, int(self.ppm), str(self.device_idx), gain_param, self.sonde_freq)
 | 
			
		||||
            decode_cmd += "sox -t raw -r 12k -e s -b 16 -c 1 - -r 48000 -b 8 -t wav - lowpass 2500 highpass 20 2>/dev/null |"
 | 
			
		||||
            decode_cmd = "%s %s-p %d -d %s %s-M fm -F9 -s %d -f %d 2>/dev/null |" % (self.sdr_fm, bias_option, int(self.ppm), str(self.device_idx), gain_param, _rx_bw, self.sonde_freq)
 | 
			
		||||
            decode_cmd += "sox -t raw -r %d -e s -b 16 -c 1 - -r 48000 -b 8 -t wav - lowpass 2500 highpass 20 2>/dev/null |" % _rx_bw
 | 
			
		||||
            decode_cmd += "./rs92ecc -vx -v --crc --ecc --vel --json %s 2>/dev/null" % _rs92_gps_data
 | 
			
		||||
 | 
			
		||||
        elif self.sonde_type == "DFM":
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -191,15 +191,23 @@ def detect_sonde(frequency, rs_path="./", dwell_time=10, sdr_fm='rtl_fm', device
 | 
			
		|||
    else:
 | 
			
		||||
        gain_param = ''
 | 
			
		||||
 | 
			
		||||
    # Adjust the detection bandwidth based on the band the scanning is occuring in.
 | 
			
		||||
    if frequency < 1000e6:
 | 
			
		||||
        # 400-406 MHz sondes - use a 22 kHz detection bandwidth.
 | 
			
		||||
        _rx_bw = 22000
 | 
			
		||||
    else:
 | 
			
		||||
        # 1680 MHz sondes - use a 28 kHz detection bandwidth.
 | 
			
		||||
        # NOTE: This is an initial stab in the dark at a setting for this band.
 | 
			
		||||
        _rx_bw = 28000
 | 
			
		||||
 | 
			
		||||
    # Sample Source (rtl_fm)
 | 
			
		||||
    rx_test_command = "timeout %ds %s %s-p %d -d %s %s-M fm -F9 -s 22k -f %d 2>/dev/null |" % (dwell_time, sdr_fm, bias_option, int(ppm), str(device_idx), gain_param, frequency) 
 | 
			
		||||
    rx_test_command = "timeout %ds %s %s-p %d -d %s %s-M fm -F9 -s %d -f %d 2>/dev/null |" % (dwell_time, sdr_fm, bias_option, int(ppm), str(device_idx), gain_param, _rx_bw, frequency) 
 | 
			
		||||
    # Sample filtering
 | 
			
		||||
    rx_test_command += "sox -t raw -r 22k -e s -b 16 -c 1 - -r 48000 -t wav - highpass 20 2>/dev/null |"
 | 
			
		||||
    rx_test_command += "sox -t raw -r %d -e s -b 16 -c 1 - -r 48000 -t wav - highpass 20 2>/dev/null |" % _rx_bw
 | 
			
		||||
    # Sample decoding / detection
 | 
			
		||||
    rx_test_command += os.path.join(rs_path,"dft_detect") + " 2>/dev/null"
 | 
			
		||||
 | 
			
		||||
    #print(rx_test_command)
 | 
			
		||||
 | 
			
		||||
    logging.debug("Scanner #%s - Using detection command: %s" % (str(device_idx), rx_test_command))
 | 
			
		||||
    logging.debug("Scanner #%s - Attempting sonde detection on %.3f MHz" % (str(device_idx), frequency/1e6))
 | 
			
		||||
 | 
			
		||||
    try:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -40,7 +40,8 @@ SAMPLES = [
 | 
			
		|||
    ['rs41_96k_float.bin', 4800, -20.0, 96000], 
 | 
			
		||||
    ['rs92_96k_float.bin', 2400, -100, 96000], # No threshold set, as signal is continuous.
 | 
			
		||||
    ['dfm09_96k_float.bin', 2500, -100, 96000], # Weird baud rate. No threshold set, as signal is continuous.
 | 
			
		||||
    ['m10_96k_float.bin', 9616, -10.0, 96000]  # Really weird baud rate.
 | 
			
		||||
    ['m10_96k_float.bin', 9616, -10.0, 96000],  # Really weird baud rate.
 | 
			
		||||
    #['rsngp_96k_float.bin', 2400, -100.0, 96000]  # RS92-NGP - wider bandwidth.
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -246,6 +246,37 @@ processing_type['rs92_rtlfm'] = {
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# RS92-NGP (wider bandwidth)
 | 
			
		||||
_fm_rate = 28000
 | 
			
		||||
# Calculate the necessary conversions
 | 
			
		||||
_rtlfm_oversampling = 8.0 # Viproz's hacked rtl_fm oversamples by 8x.
 | 
			
		||||
_shift = -2.0*_fm_rate/_sample_fs # rtl_fm tunes 'up' by rate*2, so we need to shift the signal down by this amount.
 | 
			
		||||
 | 
			
		||||
_resample = (_fm_rate*_rtlfm_oversampling)/_sample_fs
 | 
			
		||||
 | 
			
		||||
if _resample != 1.0:
 | 
			
		||||
    # We will need to resample.
 | 
			
		||||
    _resample_command = "csdr convert_f_s16 | ./tsrc - - %.4f | csdr convert_s16_f |" % _resample
 | 
			
		||||
    _shift = (-2.0*_fm_rate)/(_sample_fs*_resample)
 | 
			
		||||
else:
 | 
			
		||||
    _resample_command = ""
 | 
			
		||||
 | 
			
		||||
_demod_command = "| %s csdr shift_addition_cc %.5f 2>/dev/null | csdr convert_f_u8 |" % (_resample_command, _shift)
 | 
			
		||||
_demod_command += " ./rtl_fm_stdin -M fm -f 401000000 -F9 -s %d  2>/dev/null|" % (int(_fm_rate))
 | 
			
		||||
_demod_command += " sox -t raw -r %d -e s -b 16 -c 1 - -r 48000 -b 8 -t wav - highpass 20 2>/dev/null |" % int(_fm_rate)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
processing_type['rs92ngp_rtlfm'] = {
 | 
			
		||||
    'demod': _demod_command,
 | 
			
		||||
    # Decode using rs92ecc
 | 
			
		||||
    'decode': "../rs92ecc -vx -v --crc --ecc --vel 2>/dev/null",
 | 
			
		||||
    #'decode': "../rs92ecc -vx -v --crc --ecc -r --vel 2>/dev/null", # For measuring No-ECC performance
 | 
			
		||||
    # Count the number of telemetry lines.
 | 
			
		||||
    "post_process" : "| grep P3213708 | wc -l",
 | 
			
		||||
    #"post_process" : " | grep \"errors: 0\" | wc -l",
 | 
			
		||||
    'files' : "./generated/rsngp*.bin" 
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# DFM
 | 
			
		||||
_fm_rate = 20000
 | 
			
		||||
# Calculate the necessary conversions
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Ładowanie…
	
		Reference in New Issue