def __init__(self, svn, fs): """ """ gr.hier_block2.__init__(self, "ca_code", gr.io_signature(0, 0, 0), gr.io_signature(1, 1, gr.sizeof_float)) #self._svn = svn self._code = gps.ca_code(svn=svn, fs=fs) self.code = gr.vector_source_f(self._code, True) self.connect(self.code, self)
def __init__(self, svn, fs): """ """ gr.hier_block2.__init__( self, "ca_code", gr.io_signature( 0,0,0), gr.io_signature( 1,1,gr.sizeof_float)) #self._svn = svn self._code = gps.ca_code(svn=svn, fs=fs) self.code = gr.vector_source_f(self._code, True) self.connect( self.code, self)
def __init__(self, svn, fs, fd): # Compute local code in advance to reduce the number of runtime # calculations required. code = ca_code(svn=svn, fs=fs) n = arange(len(code)) f = e**(2j*pi*fd*n/fs) lc = conj(fft.fft(code * f)) gr.hier_block2.__init__(self, "local_code", gr.io_signature(0,0,0), gr.io_signature(1,1, len(lc)*gr.sizeof_gr_complex)) src = gr.vector_source_c(lc, True) s2v = gr.stream_to_vector(gr.sizeof_gr_complex, len(lc)) self.connect( src, s2v, self)
def __init__(self, N, fs, fd, ca_shift, snr=0): gr.hier_block2.__init__(self, "simulated_source", gr.io_signature(0, 0, 0), gr.io_signature(1, 1, gr.sizeof_gr_complex)) code = ca_code(svn=1, fs=fs, ca_shift=ca_shift) code = ravel(array([code for _ in range(N)])) n = arange(len(code)) f = e**(2j * pi * fd * n / fs) x = (code * f) # Add noise. signal_power = sum(sqrt(abs(x))) / len(x) noise_voltage = sqrt(signal_power / 10**(snr / 10.0)) src = gr.vector_source_c(x) noise = gr.noise_source_c(gr.GR_UNIFORM, noise_voltage) add = gr.add_cc() self.connect(src, (add, 0)) self.connect(noise, (add, 1)) self.connect(add, self)
def __init__(self, N, fs, fd, ca_shift, snr=0 ): gr.hier_block2.__init__(self, "simulated_source", gr.io_signature(0,0,0), gr.io_signature(1,1, gr.sizeof_gr_complex)) code = ca_code(svn=1, fs=fs, ca_shift=ca_shift) code = ravel(array([ code for _ in range(N)])) n = arange(len(code)) f = e**( 2j*pi*fd*n/fs ) x = (code * f) # Add noise. signal_power = sum( sqrt(abs(x)))/len(x) noise_voltage = sqrt(signal_power/10**(snr/10.0)) src = gr.vector_source_c(x) noise = gr.noise_source_c(gr.GR_UNIFORM, noise_voltage) add = gr.add_cc() self.connect(src, (add,0)) self.connect(noise, (add,1)) self.connect(add, self)