Ejemplo n.º 1
0
	def ais_rx(self, src, freq, designator, options, queue):
		self.rate = options.rate
		self.u = src
		self.coeffs = firdes.low_pass(1,self.rate,7000,1000)
		self._filter_decimation = 4
		self.filter = filter.freq_xlating_fir_filter_ccf(self._filter_decimation, 
								 self.coeffs, 
								 freq,
								 self.rate)

		self._bits_per_sec = 9600.0;

		self._samples_per_symbol = self.rate / self._filter_decimation / self._bits_per_sec

		options.samples_per_symbol = self._samples_per_symbol
		options.gain_mu = 0.3
		options.mu=0.5
		options.omega_relative_limit = 0.0001
		options.bits_per_sec = self._bits_per_sec
                #trades off accuracy of freq estimation in presence of noise, vs. delay time.
                options.fftlen = 4096
		options.samp_rate = self.rate / self._filter_decimation
                #ais_demod.py, hierarchical demodulation block, takes in complex baseband and spits out 1-bit packed bitstream
                self.demod = ais_demod(options)
		self.unstuff = unstuff() #ais_unstuff.cc, unstuffs data
                #should mark start of packet
                self.start_correlator = digital.correlate_access_code_tag_bb("1010101010101010", 0, "ais_preamble")
                #should mark start and end of packet
                self.stop_correlator = digital.correlate_access_code_tag_bb("01111110", 0, "ais_frame")
                #ais_parse.cc, calculates CRC, parses data into ASCII message, moves data onto queue
                self.parse = parse(queue, designator, options.verbose, options.lon, options.lat)

		self.connect(self.u, self.filter, self.demod, self.unstuff, self.start_correlator, self.stop_correlator, self.parse) 
Ejemplo n.º 2
0
    def __init__(self, freq, rate, designator):
        gr.hier_block2.__init__(self,
                                "ais_rx",
                                gr.io_signature(1,1,gr.sizeof_gr_complex),
                                gr.io_signature(0,0,0))

        self._bits_per_sec = 9600.0
        self._samples_per_symbol = 5
        self.coeffs = filter.firdes.low_pass(1, rate, 11000, 1000)
        self._filter_decimation = int(rate/(self._bits_per_sec*self._samples_per_symbol))
        self.filter = filter.freq_xlating_fir_filter_ccf(self._filter_decimation,
                                                     self.coeffs,
                                                     freq,
                                                     rate)
#        self.resamp = pfb.arb_resampler_ccf((self._bits_per_sec*self._samples_per_symbol)/int(rate/self._filter_decimation))
        options = {}
        options[ "samples_per_symbol" ] = (rate/self._filter_decimation)/self._bits_per_sec
        options[ "clockrec_gain" ] = 0.04
        options[ "omega_relative_limit" ] = 0.01
        options[ "bits_per_sec" ] = self._bits_per_sec
        options[ "fftlen" ] = 1024 #trades off accuracy of freq estimation in presence of noise, vs. delay time.
        options[ "samp_rate" ] = self._bits_per_sec * self._samples_per_symbol
        self.demod = ais.ais_demod(options) #ais_demod takes in complex baseband and spits out 1-bit unpacked bitstream
        self.deframer = digital.hdlc_deframer_bp(11,64) #takes bytes, deframes, unstuffs, CRCs, and emits PDUs with frame contents
        self.nmea = ais.pdu_to_nmea(designator) #turns data PDUs into NMEA sentences
#        self.msgq = ais.pdu_to_msgq(queue) #posts PDUs to message queue for main program to parse at will
#        self.parse = ais.parse(queue, designator) #ais_parse.cc, calculates CRC, parses data into NMEA AIVDM message, moves data onto queue

        self.connect(self,
                     self.filter,
                     self.demod,
                     self.deframer)
        self.msg_connect(self.deframer, "out", self.nmea, "print")
Ejemplo n.º 3
0
    def __init__(self, freq, rate, designator):
        gr.hier_block2.__init__(self,
                                "ais_rx",
                                gr.io_signature(1,1,gr.sizeof_gr_complex),
                                gr.io_signature(0,0,0))

        self._bits_per_sec = 9600.0
        self._samples_per_symbol = 5
        self.coeffs = filter.firdes.low_pass(1, rate, 11000, 1000)
        self._filter_decimation = int(rate/(self._bits_per_sec*self._samples_per_symbol))
        self.filter = filter.freq_xlating_fir_filter_ccf(self._filter_decimation,
                                                     self.coeffs,
                                                     freq,
                                                     rate)
#        self.resamp = pfb.arb_resampler_ccf((self._bits_per_sec*self._samples_per_symbol)/int(rate/self._filter_decimation))
        options = {}
        options[ "samples_per_symbol" ] = (rate/self._filter_decimation)/self._bits_per_sec
        options[ "clockrec_gain" ] = 0.04
        options[ "omega_relative_limit" ] = 0.01
        options[ "bits_per_sec" ] = self._bits_per_sec
        options[ "fftlen" ] = 1024 #trades off accuracy of freq estimation in presence of noise, vs. delay time.
        options[ "samp_rate" ] = self._bits_per_sec * self._samples_per_symbol
        self.demod = ais.ais_demod(options) #ais_demod takes in complex baseband and spits out 1-bit unpacked bitstream
        self.deframer = digital.hdlc_deframer_bp(11,64) #takes bytes, deframes, unstuffs, CRCs, and emits PDUs with frame contents
        self.nmea = ais.pdu_to_nmea(designator) #turns data PDUs into NMEA sentences
#        self.msgq = ais.pdu_to_msgq(queue) #posts PDUs to message queue for main program to parse at will
#        self.parse = ais.parse(queue, designator) #ais_parse.cc, calculates CRC, parses data into NMEA AIVDM message, moves data onto queue

        self.connect(self,
                     self.filter,
                     self.demod,
                     self.deframer)
        self.msg_connect(self.deframer, "out", self.nmea, "print")
Ejemplo n.º 4
0
    def __init__(self, freq, rate, designator, queue, use_viterbi=False):
        gr.hier_block2.__init__(self,
                                "ais_rx",
                                gr.io_signature(1,1,gr.sizeof_gr_complex),
                                gr.io_signature(0,0,0))

        self.coeffs = filter.firdes.low_pass(1, rate, 7000, 1000)
        self._filter_decimation = 12 #fixed, TODO make settable via params or better yet do resampling
        self.filter = filter.freq_xlating_fir_filter_ccf(self._filter_decimation,
                                                     self.coeffs,
                                                     freq,
                                                     rate)

        self._bits_per_sec = 9600.0
        self._samples_per_symbol = rate / self._filter_decimation / self._bits_per_sec
        options = {}
        options[ "viterbi" ] = use_viterbi
        options[ "samples_per_symbol" ] = self._samples_per_symbol
        options[ "gain_mu" ] = 0.3
        options[ "mu" ] = 0.5
        options[ "omega_relative_limit" ] = 0.003
        options[ "bits_per_sec" ] = self._bits_per_sec
        options[ "fftlen" ] = 4096 #trades off accuracy of freq estimation in presence of noise, vs. delay time.
        options[ "samp_rate" ] = rate / self._filter_decimation
        self.demod = ais.ais_demod(options) #ais_demod takes in complex baseband and spits out 1-bit packed bitstream
        self.unstuff = ais.unstuff() #undoes bit stuffing operation
        self.start_correlator = digital.correlate_access_code_tag_bb("1010101010101010", 0, "ais_preamble") #should mark start of packet
        self.stop_correlator = digital.correlate_access_code_tag_bb("01111110", 0, "ais_frame") #should mark start and end of packet
        self.parse = ais.parse(queue, designator) #ais_parse.cc, calculates CRC, parses data into NMEA AIVDM message, moves data onto queue

        self.connect(self,
                     self.filter,
                     self.demod,
                     self.unstuff,
                     self.start_correlator,
                     self.stop_correlator,
                     self.parse) #parse posts messages to the queue, which the main loop reads and prints