def __init__(self): gr.top_block.__init__(self, "Receiver") ################################################## # Variables ################################################## self.samp_rate = samp_rate = 100000 ################################################## # Blocks ################################################## self.uhd_usrp_source_0 = uhd.usrp_source( device_addr="", stream_args=uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) self.uhd_usrp_source_0.set_samp_rate(samp_rate) self.uhd_usrp_source_0.set_center_freq(2.4e9, 0) self.uhd_usrp_source_0.set_gain(15, 0) self.gr_pll_carriertracking_cc_0 = gr.pll_carriertracking_cc(1.5*3.1459/200, 2, -2) self.gr_head_0 = gr.head(gr.sizeof_gr_complex*1, 1024*100) self.gr_file_sink_0 = gr.file_sink(gr.sizeof_gr_complex*1, "/home/traviscollins/data/Models/USRP_Receiver/received_data_C.txt") self.gr_file_sink_0.set_unbuffered(False) ################################################## # Connections ################################################## self.connect((self.gr_head_0, 0), (self.gr_file_sink_0, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.gr_pll_carriertracking_cc_0, 0)) self.connect((self.gr_pll_carriertracking_cc_0, 0), (self.gr_head_0, 0))
def __init__(self): gr.top_block.__init__(self, "Top Block Ss R") ################################################## # Variables ################################################## self.samp_rate = samp_rate = 100000 ################################################## # Blocks ################################################## self.uhd_usrp_source_0 = uhd.usrp_source( device_addr="", stream_args=uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) self.uhd_usrp_source_0.set_samp_rate(samp_rate) self.uhd_usrp_source_0.set_center_freq(2.4e9, 0) self.uhd_usrp_source_0.set_gain(25, 0) self.gr_pll_carriertracking_cc_0 = gr.pll_carriertracking_cc( 1.5 * 3.1459 / 200, 4, -4) self.gr_head_0 = gr.head(gr.sizeof_gr_complex * 1, 1000000) self.gr_file_sink_0_0 = gr.file_sink( gr.sizeof_float * 1, "/home/sdruser/COLLINS/SS/received_GMSK.txt") self.gr_file_sink_0_0.set_unbuffered(False) self.gr_file_sink_0 = gr.file_sink( gr.sizeof_gr_complex * 1, "/home/sdruser/COLLINS/SS/received.txt") self.gr_file_sink_0.set_unbuffered(False) self.digital_gmsk_demod_0 = digital.gmsk_demod( samples_per_symbol=2, gain_mu=0.175, mu=0.5, omega_relative_limit=0.005, freq_error=0.0, verbose=False, log=False, ) ################################################## # Connections ################################################## self.connect((self.gr_pll_carriertracking_cc_0, 0), (self.gr_file_sink_0, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.gr_head_0, 0)) self.connect((self.gr_head_0, 0), (self.gr_pll_carriertracking_cc_0, 0)) self.connect((self.digital_gmsk_demod_0, 0), (self.gr_file_sink_0_0, 0)) self.connect((self.gr_pll_carriertracking_cc_0, 0), (self.digital_gmsk_demod_0, 0))
def __init__(self): gr.top_block.__init__(self, "Top Block Ss R") ################################################## # Variables ################################################## self.samp_rate = samp_rate = 100000 ################################################## # Blocks ################################################## self.uhd_usrp_source_0 = uhd.usrp_source( device_addr="", stream_args=uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) self.uhd_usrp_source_0.set_samp_rate(samp_rate) self.uhd_usrp_source_0.set_center_freq(2.4e9, 0) self.uhd_usrp_source_0.set_gain(25, 0) self.gr_pll_carriertracking_cc_0 = gr.pll_carriertracking_cc(1.5*3.1459/200, 4, -4) self.gr_head_0 = gr.head(gr.sizeof_gr_complex*1, 1000000) self.gr_file_sink_0_0 = gr.file_sink(gr.sizeof_float*1, "/home/sdruser/COLLINS/SS/received_GMSK.txt") self.gr_file_sink_0_0.set_unbuffered(False) self.gr_file_sink_0 = gr.file_sink(gr.sizeof_gr_complex*1, "/home/sdruser/COLLINS/SS/received.txt") self.gr_file_sink_0.set_unbuffered(False) self.digital_gmsk_demod_0 = digital.gmsk_demod( samples_per_symbol=2, gain_mu=0.175, mu=0.5, omega_relative_limit=0.005, freq_error=0.0, verbose=False, log=False, ) ################################################## # Connections ################################################## self.connect((self.gr_pll_carriertracking_cc_0, 0), (self.gr_file_sink_0, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.gr_head_0, 0)) self.connect((self.gr_head_0, 0), (self.gr_pll_carriertracking_cc_0, 0)) self.connect((self.digital_gmsk_demod_0, 0), (self.gr_file_sink_0_0, 0)) self.connect((self.gr_pll_carriertracking_cc_0, 0), (self.digital_gmsk_demod_0, 0))
def __init__(self): grc_wxgui.top_block_gui.__init__(self, title="Top Block") _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png" self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY)) ################################################## # Variables ################################################## self.samp_rate = samp_rate = 100000 #100k ################################################## # Blocks ################################################## self.wxgui_fftsink2_0_0 = fftsink2.fft_sink_c( self.GetWin(), baseband_freq=0, y_per_div=10, y_divs=10, ref_level=0, ref_scale=2.0, sample_rate=samp_rate, fft_size=1024, fft_rate=15, average=False, avg_alpha=None, title="FFT Plot", peak_hold=False, ) self.Add(self.wxgui_fftsink2_0_0.win) self.wxgui_fftsink2_0 = fftsink2.fft_sink_c( self.GetWin(), baseband_freq=0, y_per_div=10, y_divs=10, ref_level=0, ref_scale=2.0, sample_rate=samp_rate, fft_size=1024, fft_rate=15, average=False, avg_alpha=None, title="FFT Plot", peak_hold=False, ) self.Add(self.wxgui_fftsink2_0.win) self.uhd_usrp_source_0 = uhd.usrp_source( device_addr="", stream_args=uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) self.uhd_usrp_source_0.set_samp_rate(samp_rate) self.uhd_usrp_source_0.set_center_freq(445e6, 0) self.uhd_usrp_source_0.set_gain(10, 0) self.gr_pll_carriertracking_cc_0 = gr.pll_carriertracking_cc(1000, 10500, 10000) ################################################## # Connections ################################################## self.connect((self.uhd_usrp_source_0, 0), (self.gr_pll_carriertracking_cc_0, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.wxgui_fftsink2_0, 0)) self.connect((self.gr_pll_carriertracking_cc_0, 0), (self.wxgui_fftsink2_0_0, 0))
def test_pll_carriertracking(self): expected_result = ( (1.00000238419 + 6.47922693275e-09j), (0.998399555683 + 0.0565364062786j), (0.994261980057 + 0.10695001483j), (0.98843306303 + 0.151648163795j), (0.981579363346 + 0.191063538194j), (0.974212288857 + 0.225630432367j), (0.966734290123 + 0.255773901939j), (0.959442555904 + 0.281897842884j), (0.952551782131 + 0.304379671812j), (0.946205317974 + 0.323566257954j), (0.940503358841 + 0.339778244495j), (0.935505151749 + 0.353307723999j), (0.931235432625 + 0.364419162273j), (0.927616357803 + 0.373535633087j), (0.924710214138 + 0.380666583776j), (0.922494113445 + 0.386005342007j), (0.92093116045 + 0.389725029469j), (0.919974088669 + 0.391981720924j), (0.919572234154 + 0.392916500568j), (0.919680893421 + 0.392660915852j), (0.920248389244 + 0.39133310318j), (0.921222627163 + 0.389039844275j), (0.922548472881 + 0.385877460241j), (0.924184799194 + 0.381939411163j), (0.926086127758 + 0.377309292555j), (0.928135097027 + 0.37224984169j), (0.930293083191 + 0.366814315319j), (0.932614028454 + 0.360868781805j), (0.935064375401 + 0.354473829269j), (0.937613248825 + 0.347684770823j), (0.940225422382 + 0.340550601482j), (0.942881464958 + 0.33312189579j), (0.945559620857 + 0.325443327427j), (0.948240220547 + 0.31755694747j), (0.950899422169 + 0.309499144554j), (0.953524827957 + 0.301307469606j), (0.956105649471 + 0.293015599251j), (0.958630502224 + 0.284654557705j), (0.96103054285 + 0.276443749666j), (0.963361799717 + 0.26819768548j), (0.965623259544 + 0.259936869144j), (0.967810571194 + 0.251679092646j), (0.969916880131 + 0.243440493941j), (0.971936583519 + 0.235235646367j), (0.97387367487 + 0.227080151439j), (0.975726902485 + 0.218987599015j), (0.977494239807 + 0.210969462991j), (0.979169845581 + 0.203035995364j), (0.980761289597 + 0.195199295878j), (0.982269346714 + 0.187469303608j), (0.983659446239 + 0.180052131414j), (0.984931468964 + 0.1729388237j), (0.986136198044 + 0.165923252702j), (0.987275123596 + 0.159012272954j), (0.988349795341 + 0.15221118927j), (0.989354014397 + 0.145524248481j), (0.990296065807 + 0.138957872987j), (0.991178870201 + 0.132516458631j), (0.992005050182 + 0.126204773784j), (0.992770493031 + 0.120025672019j), (0.993480443954 + 0.113984130323j), (0.994139909744 + 0.108083210886j), (0.994751393795 + 0.102326385677j), (0.995293080807 + 0.0969148278236j), (0.995791256428 + 0.091630294919j), (0.996252119541 + 0.0864710733294j), (0.996678769588 + 0.0814334899187j), (0.997069239616 + 0.0765165910125j), (0.997423350811 + 0.071716658771j), (0.997748315334 + 0.0670333206654j), (0.998046517372 + 0.0624645166099j), (0.998317599297 + 0.058009263128j), (0.998557567596 + 0.053665690124j), (0.998775064945 + 0.0494344644248j), (0.998971700668 + 0.0453144386411j), (0.999140620232 + 0.0415064357221j), (0.99927687645 + 0.0379924885929j), (0.999400436878 + 0.0345549099147j), (0.999511957169 + 0.0311931278557j), (0.99961233139 + 0.0279070306569j), (0.999694347382 + 0.0246965941042j), (0.999765276909 + 0.0215622838587j), (0.999826848507 + 0.0185046810657j), (0.999880313873 + 0.0155246723443j), (0.999920129776 + 0.0126227736473j), (0.999949812889 + 0.00980060640723j), (0.99997317791 + 0.00705910893157j), (0.999990820885 + 0.00439921114594j), (0.999998450279 + 0.00202245195396j), (0.999998092651 - 0.00029227725463j), (0.999994516373 - 0.00254815118387j), (0.999988794327 - 0.00474932929501j), (0.999977111816 - 0.00689708162099j), (0.999957799911 - 0.00899503659457j), (0.999936699867 - 0.0110441967845j), (0.999914228916 - 0.0130464555696j), (0.999889075756 - 0.0150024276227j), (0.999855577946 - 0.0169130507857j), (0.999821305275 - 0.0187777336687j), (0.999786794186 - 0.0205969288945j), ) sampling_freq = 10e3 freq = sampling_freq / 100 alpha = 0.1 beta = alpha * alpha / 4.0 maxf = 1 minf = -1 src = gr.sig_source_c(sampling_freq, gr.GR_COS_WAVE, freq, 1.0) pll = gr.pll_carriertracking_cc(alpha, beta, maxf, minf) head = gr.head(gr.sizeof_gr_complex, int(freq)) dst = gr.vector_sink_c() self.fg.connect(src, pll, head) self.fg.connect(head, dst) self.fg.run() dst_data = dst.data() self.assertComplexTuplesAlmostEqual(expected_result, dst_data, 5)
def test_pll_carriertracking(self): expected_result = ( (1.00000238419 + 6.47922693275e-09j), (0.998399555683 + 0.0565364062786j), (0.994261980057 + 0.10695001483j), (0.98843306303 + 0.151648163795j), (0.981579363346 + 0.191063538194j), (0.974212288857 + 0.225630432367j), (0.966734290123 + 0.255773901939j), (0.959442555904 + 0.281897842884j), (0.952551782131 + 0.304379671812j), (0.946205317974 + 0.323566257954j), (0.940503358841 + 0.339778244495j), (0.935505151749 + 0.353307723999j), (0.931235432625 + 0.364419162273j), (0.927616357803 + 0.373535633087j), (0.924710214138 + 0.380666583776j), (0.922494113445 + 0.386005342007j), (0.92093116045 + 0.389725029469j), (0.919974088669 + 0.391981720924j), (0.919572234154 + 0.392916500568j), (0.919680893421 + 0.392660915852j), (0.920248389244 + 0.39133310318j), (0.921222627163 + 0.389039844275j), (0.922548472881 + 0.385877460241j), (0.924184799194 + 0.381939411163j), (0.926086127758 + 0.377309292555j), (0.928135097027 + 0.37224984169j), (0.930293083191 + 0.366814315319j), (0.932614028454 + 0.360868781805j), (0.935064375401 + 0.354473829269j), (0.937613248825 + 0.347684770823j), (0.940225422382 + 0.340550601482j), (0.942881464958 + 0.33312189579j), (0.945559620857 + 0.325443327427j), (0.948240220547 + 0.31755694747j), (0.950899422169 + 0.309499144554j), (0.953524827957 + 0.301307469606j), (0.956105649471 + 0.293015599251j), (0.958630502224 + 0.284654557705j), (0.96103054285 + 0.276443749666j), (0.963361799717 + 0.26819768548j), (0.965623259544 + 0.259936869144j), (0.967810571194 + 0.251679092646j), (0.969916880131 + 0.243440493941j), (0.971936583519 + 0.235235646367j), (0.97387367487 + 0.227080151439j), (0.975726902485 + 0.218987599015j), (0.977494239807 + 0.210969462991j), (0.979169845581 + 0.203035995364j), (0.980761289597 + 0.195199295878j), (0.982269346714 + 0.187469303608j), (0.983659446239 + 0.180052131414j), (0.984931468964 + 0.1729388237j), (0.986136198044 + 0.165923252702j), (0.987275123596 + 0.159012272954j), (0.988349795341 + 0.15221118927j), (0.989354014397 + 0.145524248481j), (0.990296065807 + 0.138957872987j), (0.991178870201 + 0.132516458631j), (0.992005050182 + 0.126204773784j), (0.992770493031 + 0.120025672019j), (0.993480443954 + 0.113984130323j), (0.994139909744 + 0.108083210886j), (0.994751393795 + 0.102326385677j), (0.995293080807 + 0.0969148278236j), (0.995791256428 + 0.091630294919j), (0.996252119541 + 0.0864710733294j), (0.996678769588 + 0.0814334899187j), (0.997069239616 + 0.0765165910125j), (0.997423350811 + 0.071716658771j), (0.997748315334 + 0.0670333206654j), (0.998046517372 + 0.0624645166099j), (0.998317599297 + 0.058009263128j), (0.998557567596 + 0.053665690124j), (0.998775064945 + 0.0494344644248j), (0.998971700668 + 0.0453144386411j), (0.999140620232 + 0.0415064357221j), (0.99927687645 + 0.0379924885929j), (0.999400436878 + 0.0345549099147j), (0.999511957169 + 0.0311931278557j), (0.99961233139 + 0.0279070306569j), (0.999694347382 + 0.0246965941042j), (0.999765276909 + 0.0215622838587j), (0.999826848507 + 0.0185046810657j), (0.999880313873 + 0.0155246723443j), (0.999920129776 + 0.0126227736473j), (0.999949812889 + 0.00980060640723j), (0.99997317791 + 0.00705910893157j), (0.999990820885 + 0.00439921114594j), (0.999998450279 + 0.00202245195396j), (0.999998092651 - 0.00029227725463j), (0.999994516373 - 0.00254815118387j), (0.999988794327 - 0.00474932929501j), (0.999977111816 - 0.00689708162099j), (0.999957799911 - 0.00899503659457j), (0.999936699867 - 0.0110441967845j), (0.999914228916 - 0.0130464555696j), (0.999889075756 - 0.0150024276227j), (0.999855577946 - 0.0169130507857j), (0.999821305275 - 0.0187777336687j), (0.999786794186 - 0.0205969288945j)) sampling_freq = 10e3 freq = sampling_freq / 100 alpha = 0.1 beta = alpha * alpha / 4.0 maxf = 1 minf = -1 src = gr.sig_source_c(sampling_freq, gr.GR_COS_WAVE, freq, 1.0) pll = gr.pll_carriertracking_cc(alpha, beta, maxf, minf) head = gr.head(gr.sizeof_gr_complex, int(freq)) dst = gr.vector_sink_c() self.tb.connect(src, pll, head) self.tb.connect(head, dst) self.tb.run() dst_data = dst.data() self.assertComplexTuplesAlmostEqual(expected_result, dst_data, 5)
def test_pll_carriertracking (self): expected_result = ((1.00000238419+7.21919457547e-09j), (0.998025715351+0.062790453434j), (0.992777824402+0.119947694242j), (0.985192835331+0.171441286802j), (0.976061582565+0.217501848936j), (0.966034710407+0.258409559727j), (0.95565611124+0.294477283955j), (0.945357382298+0.326030552387j), (0.935475051403+0.353395611048j), (0.926258146763+0.376889169216j), (0.917895197868+0.39681750536j), (0.910515546799+0.413470208645j), (0.904196679592+0.427117019892j), (0.898972511292+0.438006043434j), (0.894769787788+0.446523308754j), (0.891652584076+0.452715367079j), (0.8895829916+0.456773489714j), (0.888502895832+0.458873122931j), (0.888343691826+0.459175437689j), (0.889035582542+0.457833081484j), (0.890497922897+0.454985737801j), (0.892645597458+0.450762689114j), (0.895388305187+0.445282936096j), (0.898648142815+0.438664674759j), (0.902342617512+0.431016951799j), (0.906392872334+0.422441422939j), (0.910642921925+0.413191765547j), (0.915039420128+0.403358519077j), (0.919594764709+0.392864197493j), (0.92425006628+0.381792247295j), (0.928944349289+0.370217680931j), (0.933634519577+0.358220815659j), (0.938279032707+0.345874190331j), (0.942840516567+0.333247303963j), (0.947280526161+0.32040438056j), (0.951574921608+0.307409763336j), (0.955703914165+0.294323593378j), (0.959648966789+0.281201630831j), (0.963392794132+0.268095195293j), (0.966880619526+0.255221515894j), (0.970162451267+0.242447137833j), (0.973235487938+0.229809194803j), (0.97609680891+0.217341512442j), (0.978744983673+0.20507311821j), (0.981189727783+0.193033605814j), (0.983436584473+0.181248426437j), (0.985490739346+0.169738590717j), (0.987353682518+0.158523857594j), (0.989041447639+0.147622272372j), (0.990563035011+0.137049794197j), (0.991928339005+0.126818582416j), (0.993117690086+0.117111675441j), (0.994156062603+0.107930034399j), (0.995076179504+0.0990980416536j), (0.995887458324+0.0906178802252j), (0.996591091156+0.0824909061193j), (0.997202515602+0.0747182965279j), (0.997730851173+0.0672992765903j), (0.998185396194+0.0602316558361j), (0.99856698513+0.0535135567188j), (0.998885989189+0.0471420884132j), (0.99915266037+0.0411129891872j), (0.999372899532+0.0354214012623j), (0.999548316002+0.0300626158714j), (0.999680638313+0.0252036750317j), (0.999784469604+0.020652115345j), (0.999865531921+0.0163950324059j), (0.999923825264+0.0124222636223j), (0.999960243702+0.00872156023979j), (0.999983668327+0.00528120994568j), (0.999997138977+0.00209015607834j), (1.00000119209-0.00086285173893j), (0.999992132187-0.00358882546425j), (0.999979138374-0.00609711557627j), (0.999963641167-0.00839691981673j), (0.999947249889-0.0104993218556j), (0.999924004078-0.0122378543019j), (0.999904811382-0.0136305987835j), (0.999888062477-0.0148707330227j), (0.9998742342-0.0159679055214j), (0.999856114388-0.0169314742088j), (0.999839782715-0.0177700817585j), (0.999826967716-0.0184917747974j), (0.999818325043-0.0191045701504j), (0.999807476997-0.0196143388748j), (0.999797284603-0.0200265944004j), (0.999791204929-0.0203481912613j), (0.99978852272-0.0205836892128j), (0.99978530407-0.0207380950451j), (0.999785065651-0.0206423997879j), (0.999787807465-0.0204866230488j), (0.999794304371-0.0202808082104j), (0.999800384045-0.0200312435627j), (0.999803245068-0.0197458267212j), (0.9998087883-0.0194311738014j), (0.999816894531-0.0190933048725j), (0.999825954437-0.0187371373177j), (0.999829888344-0.0183679759502j), (0.999835848808-0.017987690866j), (0.999844014645-0.0176006518304j)) sampling_freq = 10e3 freq = sampling_freq / 100 loop_bw = math.pi/100.0 maxf = 1 minf = -1 src = gr.sig_source_c (sampling_freq, gr.GR_COS_WAVE, freq, 1.0) pll = gr.pll_carriertracking_cc(loop_bw, maxf, minf) head = gr.head (gr.sizeof_gr_complex, int (freq)) dst = gr.vector_sink_c () self.tb.connect (src, pll, head) self.tb.connect (head, dst) self.tb.run () dst_data = dst.data () self.assertComplexTuplesAlmostEqual (expected_result, dst_data, 5)
def test_pll_carriertracking(self): expected_result = ( (1.00000238419 + 7.21919457547e-09j), (0.998025715351 + 0.062790453434j), (0.992777824402 + 0.119947694242j), (0.985192835331 + 0.171441286802j), (0.976061582565 + 0.217501848936j), (0.966034710407 + 0.258409559727j), (0.95565611124 + 0.294477283955j), (0.945357382298 + 0.326030552387j), (0.935475051403 + 0.353395611048j), (0.926258146763 + 0.376889169216j), (0.917895197868 + 0.39681750536j), (0.910515546799 + 0.413470208645j), (0.904196679592 + 0.427117019892j), (0.898972511292 + 0.438006043434j), (0.894769787788 + 0.446523308754j), (0.891652584076 + 0.452715367079j), (0.8895829916 + 0.456773489714j), (0.888502895832 + 0.458873122931j), (0.888343691826 + 0.459175437689j), (0.889035582542 + 0.457833081484j), (0.890497922897 + 0.454985737801j), (0.892645597458 + 0.450762689114j), (0.895388305187 + 0.445282936096j), (0.898648142815 + 0.438664674759j), (0.902342617512 + 0.431016951799j), (0.906392872334 + 0.422441422939j), (0.910642921925 + 0.413191765547j), (0.915039420128 + 0.403358519077j), (0.919594764709 + 0.392864197493j), (0.92425006628 + 0.381792247295j), (0.928944349289 + 0.370217680931j), (0.933634519577 + 0.358220815659j), (0.938279032707 + 0.345874190331j), (0.942840516567 + 0.333247303963j), (0.947280526161 + 0.32040438056j), (0.951574921608 + 0.307409763336j), (0.955703914165 + 0.294323593378j), (0.959648966789 + 0.281201630831j), (0.963392794132 + 0.268095195293j), (0.966880619526 + 0.255221515894j), (0.970162451267 + 0.242447137833j), (0.973235487938 + 0.229809194803j), (0.97609680891 + 0.217341512442j), (0.978744983673 + 0.20507311821j), (0.981189727783 + 0.193033605814j), (0.983436584473 + 0.181248426437j), (0.985490739346 + 0.169738590717j), (0.987353682518 + 0.158523857594j), (0.989041447639 + 0.147622272372j), (0.990563035011 + 0.137049794197j), (0.991928339005 + 0.126818582416j), (0.993117690086 + 0.117111675441j), (0.994156062603 + 0.107930034399j), (0.995076179504 + 0.0990980416536j), (0.995887458324 + 0.0906178802252j), (0.996591091156 + 0.0824909061193j), (0.997202515602 + 0.0747182965279j), (0.997730851173 + 0.0672992765903j), (0.998185396194 + 0.0602316558361j), (0.99856698513 + 0.0535135567188j), (0.998885989189 + 0.0471420884132j), (0.99915266037 + 0.0411129891872j), (0.999372899532 + 0.0354214012623j), (0.999548316002 + 0.0300626158714j), (0.999680638313 + 0.0252036750317j), (0.999784469604 + 0.020652115345j), (0.999865531921 + 0.0163950324059j), (0.999923825264 + 0.0124222636223j), (0.999960243702 + 0.00872156023979j), (0.999983668327 + 0.00528120994568j), (0.999997138977 + 0.00209015607834j), (1.00000119209 - 0.00086285173893j), (0.999992132187 - 0.00358882546425j), (0.999979138374 - 0.00609711557627j), (0.999963641167 - 0.00839691981673j), (0.999947249889 - 0.0104993218556j), (0.999924004078 - 0.0122378543019j), (0.999904811382 - 0.0136305987835j), (0.999888062477 - 0.0148707330227j), (0.9998742342 - 0.0159679055214j), (0.999856114388 - 0.0169314742088j), (0.999839782715 - 0.0177700817585j), (0.999826967716 - 0.0184917747974j), (0.999818325043 - 0.0191045701504j), (0.999807476997 - 0.0196143388748j), (0.999797284603 - 0.0200265944004j), (0.999791204929 - 0.0203481912613j), (0.99978852272 - 0.0205836892128j), (0.99978530407 - 0.0207380950451j), (0.999785065651 - 0.0206423997879j), (0.999787807465 - 0.0204866230488j), (0.999794304371 - 0.0202808082104j), (0.999800384045 - 0.0200312435627j), (0.999803245068 - 0.0197458267212j), (0.9998087883 - 0.0194311738014j), (0.999816894531 - 0.0190933048725j), (0.999825954437 - 0.0187371373177j), (0.999829888344 - 0.0183679759502j), (0.999835848808 - 0.017987690866j), (0.999844014645 - 0.0176006518304j)) sampling_freq = 10e3 freq = sampling_freq / 100 loop_bw = math.pi / 100.0 maxf = 1 minf = -1 src = gr.sig_source_c(sampling_freq, gr.GR_COS_WAVE, freq, 1.0) pll = gr.pll_carriertracking_cc(loop_bw, maxf, minf) head = gr.head(gr.sizeof_gr_complex, int(freq)) dst = gr.vector_sink_c() self.tb.connect(src, pll, head) self.tb.connect(head, dst) self.tb.run() dst_data = dst.data() self.assertComplexTuplesAlmostEqual(expected_result, dst_data, 5)
def test_pll_carriertracking (self): expected_result = ((1.00000238419+7.21919457547e-09j), (0.998025715351+0.062790453434j), (0.992878139019+0.119114711881j), (0.985585451126+0.16916936636j), (0.976963579655+0.21341380477j), (0.967643141747+0.252319812775j), (0.958120942116+0.286356031895j), (0.948766887188+0.315971136093j), (0.939851403236+0.341586351395j), (0.931558966637+0.363589793444j), (0.924019515514+0.382339715958j), (0.917312920094+0.398162424564j), (0.9114767313+0.411352336407j), (0.906515955925+0.422172755003j), (0.902329206467+0.431043088436j), (0.8989828825+0.437978446484j), (0.896438419819+0.443168222904j), (0.894643902779+0.446782171726j), (0.893543541431+0.448972672224j), (0.893085837364+0.449881345034j), (0.893211960793+0.449634194374j), (0.893862366676+0.448344886303j), (0.894974172115+0.446114838123j), (0.89649784565+0.443042784929j), (0.898379862309+0.439216792583j), (0.900570392609+0.434715718031j), (0.902926802635+0.429791986942j), (0.905423760414+0.424503326416j), (0.908115327358+0.418716549873j), (0.910964310169+0.412489384413j), (0.913929581642+0.405871063471j), (0.916985273361+0.398915469646j), (0.920104384422+0.391668856144j), (0.923261523247+0.384174525738j), (0.926428377628+0.376470327377j), (0.929587602615+0.3685952425j), (0.932724237442+0.360585510731j), (0.935822367668+0.352472603321j), (0.938865244389+0.344285786152j), (0.941773712635+0.336241692305j), (0.944620370865+0.328158795834j), (0.94739818573+0.32005661726j), (0.950098872185+0.311952739954j), (0.952714562416+0.303861320019j), (0.955247402191+0.295800030231j), (0.957694888115+0.287783116102j), (0.960053324699+0.279822826385j), (0.962315440178+0.271930038929j), (0.96448802948+0.264117747545j), (0.966570436954+0.256397068501j), (0.968563258648+0.248777091503j), (0.970409572124+0.241460204124j), (0.972127914429+0.234440952539j), (0.97377294302+0.227515518665j), (0.975345790386+0.220690101385j), (0.976839780807+0.213968709111j), (0.978262722492+0.207358703017j), (0.979616940022+0.200864806771j), (0.980905056+0.194491744041j), (0.982122182846+0.188243359327j), (0.983273088932+0.18212479353j), (0.984363257885+0.176140069962j), (0.985394001007+0.170292437077j), (0.986363172531+0.16458517313j), (0.98724168539+0.159217983484j), (0.988072276115+0.153976023197j), (0.988858819008+0.148855358362j), (0.989599764347+0.143855035305j), (0.990294575691+0.138971716166j), (0.990951240063+0.134203910828j), (0.991572141647+0.129550367594j), (0.992157161236+0.125009477139j), (0.992702245712+0.120578929782j), (0.993216574192+0.116259463131j), (0.993701457977+0.112050771713j), (0.994158565998+0.107951454818j), (0.994559407234+0.104160495102j), (0.9949182868+0.100662395358j), (0.995259582996+0.0972395762801j), (0.995584189892+0.0938917249441j), (0.995885193348+0.0906178206205j), (0.99616932869+0.0874189138412j), (0.996438741684+0.0842954516411j), (0.996694862843+0.0812477469444j), (0.996931552887+0.0782764554024j), (0.997152447701+0.0753828883171j), (0.997361660004+0.0725681483746j), (0.997559130192+0.0698337852955j), (0.997741162777+0.067180365324j), (0.99789583683+0.0648084580898j), (0.998042702675+0.0624987781048j), (0.998183488846+0.0602464973927j), (0.998314678669+0.0580499768257j), (0.998434245586+0.0559054017067j), (0.998548746109+0.053810685873j), (0.998658537865+0.0517641305923j), (0.998762428761+0.0497645735741j), (0.998855054379+0.0478102117777j), (0.998943626881+0.0459015443921j), (0.999028742313+0.0440383702517j)) sampling_freq = 10e3 freq = sampling_freq / 100 alpha = 0.1 beta = alpha * alpha / 4.0 maxf = 1 minf = -1 src = gr.sig_source_c (sampling_freq, gr.GR_COS_WAVE, freq, 1.0) pll = gr.pll_carriertracking_cc(alpha, beta, maxf, minf) head = gr.head (gr.sizeof_gr_complex, int (freq)) dst = gr.vector_sink_c () self.tb.connect (src, pll, head) self.tb.connect (head, dst) self.tb.run () dst_data = dst.data () self.assertComplexTuplesAlmostEqual (expected_result, dst_data, 5)
def __init__(self): grc_wxgui.top_block_gui.__init__(self, title="Top Block") _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png" self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY)) ################################################## # Variables ################################################## self.samp_rate = samp_rate = 100000 ################################################## # Blocks ################################################## self.wxgui_fftsink2_0_0 = fftsink2.fft_sink_c( self.GetWin(), baseband_freq=0, y_per_div=10, y_divs=10, ref_level=0, ref_scale=2.0, sample_rate=samp_rate, fft_size=2048, fft_rate=15, average=False, avg_alpha=None, title="FFT Plot", peak_hold=False, ) self.Add(self.wxgui_fftsink2_0_0.win) self.uhd_usrp_source_0 = uhd.usrp_source( device_addr="", stream_args=uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) self.uhd_usrp_source_0.set_samp_rate(samp_rate) self.uhd_usrp_source_0.set_center_freq(2.4e9, 0) self.uhd_usrp_source_0.set_gain(10, 0) self.gr_pll_carriertracking_cc_0 = gr.pll_carriertracking_cc(3.1459/2000, 2, 0) self.gr_file_sink_0_0 = gr.file_sink(gr.sizeof_char*1, "/home/sdruser/Desktop/raw2.txt") self.gr_file_sink_0_0.set_unbuffered(False) self.digital_gmsk_demod_0 = digital.gmsk_demod( samples_per_symbol=2, gain_mu=0.175, mu=0.5, omega_relative_limit=0.005, freq_error=0.0, verbose=True, log=False, ) #Callback global rc_num, c_num rc_num=0 c_num=0 def rx_callback(ok,payload): global rc_num,c_num print "Called" print c_num try: (pktno,) = struct.unpack('!H', payload[0:2]) except: print "Oops" rc_num+=1 if ok: c_num+=1 print payload self.rx_callback=rx_callback #instaniate self.blks2_packet_decoder_0 = grc_blks2.packet_demod_b(grc_blks2.packet_decoder( access_code="", threshold=-1, callback=lambda ok, payload: self.rx_callback(ok, payload), ), ) ################################################## # Working Threads ################################################## def _probe_probe(): offset=0 offset_max=50000 old_c_num=0 while True: time.sleep(4.0/(1)) #print "Power: "+str(self.pll.get_phase()) #print "Power: "+str(self.avg_mag.level()) #print "CC1: "+str(self.gr_pll_carriertracking_cc_0.get_frequency()/(2*math.pi)) #print "CC2: "+str(self.cartrack_2.get_frequency()/(2*math.pi)) #print "Lock: "+str(self.cartrack.lock_detector()) #try: self.set_probe(val) #except AttributeError, e: pass #print c_num if old_c_num==c_num: #Changing offset print "Adjusting Offset" offset=offset+400 self.uhd_usrp_source_0.set_center_freq(2.4e9-offset, 0) if offset>=offset_max: print "Reset Offset" offset=-1*offset_max old_c_num=c_num _probe_thread = threading.Thread(target=_probe_probe) _probe_thread.daemon = True _probe_thread.start() ################################################## # Connections ################################################## #self.connect((self.gr_pll_carriertracking_cc_0, 0), (self.wxgui_fftsink2_0_0, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.gr_pll_carriertracking_cc_0, 0)) self.connect((self.gr_pll_carriertracking_cc_0, 0), (self.digital_gmsk_demod_0, 0)) self.connect((self.digital_gmsk_demod_0, 0), (self.blks2_packet_decoder_0, 0)) self.connect((self.blks2_packet_decoder_0, 0), (self.gr_file_sink_0_0, 0))
def __init__(self): grc_wxgui.top_block_gui.__init__(self, title="Top Block") _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png" self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY)) ################################################## # Variables ################################################## self.samp_rate = samp_rate = 100000 #100k ################################################## # Blocks ################################################## self.wxgui_fftsink2_0_0 = fftsink2.fft_sink_c( self.GetWin(), baseband_freq=0, y_per_div=10, y_divs=10, ref_level=0, ref_scale=2.0, sample_rate=samp_rate, fft_size=1024, fft_rate=15, average=False, avg_alpha=None, title="FFT Plot", peak_hold=False, ) self.Add(self.wxgui_fftsink2_0_0.win) self.wxgui_fftsink2_0 = fftsink2.fft_sink_c( self.GetWin(), baseband_freq=0, y_per_div=10, y_divs=10, ref_level=0, ref_scale=2.0, sample_rate=samp_rate, fft_size=1024, fft_rate=15, average=False, avg_alpha=None, title="FFT Plot", peak_hold=False, ) self.Add(self.wxgui_fftsink2_0.win) self.uhd_usrp_source_0 = uhd.usrp_source( device_addr="", stream_args=uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) self.uhd_usrp_source_0.set_samp_rate(samp_rate) self.uhd_usrp_source_0.set_center_freq(445e6, 0) self.uhd_usrp_source_0.set_gain(10, 0) self.gr_pll_carriertracking_cc_0 = gr.pll_carriertracking_cc( 1000, 10500, 10000) ################################################## # Connections ################################################## self.connect((self.uhd_usrp_source_0, 0), (self.gr_pll_carriertracking_cc_0, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.wxgui_fftsink2_0, 0)) self.connect((self.gr_pll_carriertracking_cc_0, 0), (self.wxgui_fftsink2_0_0, 0))