diff options
6 files changed, 116 insertions, 117 deletions
diff --git a/gnuradio-core/src/lib/general/gr_pll_carriertracking_cc.cc b/gnuradio-core/src/lib/general/gr_pll_carriertracking_cc.cc index 583e0eb70..e8ec1e235 100644 --- a/gnuradio-core/src/lib/general/gr_pll_carriertracking_cc.cc +++ b/gnuradio-core/src/lib/general/gr_pll_carriertracking_cc.cc @@ -101,15 +101,15 @@ gr_pll_carriertracking_cc::work (int noutput_items, float t_imag, t_real; for (int i = 0; i < noutput_items; i++){ + gr_sincosf(d_phase, &t_imag, &t_real); + optr[i] = iptr[i] * gr_complex(t_real, -t_imag); + error = phase_detector(iptr[i],d_phase); advance_loop(error); phase_wrap(); frequency_limit(); - gr_sincosf(d_phase, &t_imag, &t_real); - optr[i] = iptr[i] * gr_complex(t_real, -t_imag); - d_locksig = d_locksig * (1.0 - d_alpha) + \ d_alpha*(iptr[i].real() * t_real + iptr[i].imag() * t_imag); diff --git a/gnuradio-core/src/lib/general/gr_pll_freqdet_cf.cc b/gnuradio-core/src/lib/general/gr_pll_freqdet_cf.cc index 0ae773e6e..aa0d67855 100644 --- a/gnuradio-core/src/lib/general/gr_pll_freqdet_cf.cc +++ b/gnuradio-core/src/lib/general/gr_pll_freqdet_cf.cc @@ -78,13 +78,13 @@ gr_pll_freqdet_cf::work (int noutput_items, int size = noutput_items; while (size-- > 0) { + *optr++ = d_freq; + error = phase_detector(*iptr++,d_phase); advance_loop(error); phase_wrap(); frequency_limit(); - - *optr++ = d_freq; } return noutput_items; } diff --git a/gnuradio-core/src/lib/general/gr_pll_refout_cc.cc b/gnuradio-core/src/lib/general/gr_pll_refout_cc.cc index 2b480fcf1..dfd5079da 100644 --- a/gnuradio-core/src/lib/general/gr_pll_refout_cc.cc +++ b/gnuradio-core/src/lib/general/gr_pll_refout_cc.cc @@ -80,14 +80,14 @@ gr_pll_refout_cc::work (int noutput_items, int size = noutput_items; while (size-- > 0) { + gr_sincosf(d_phase,&t_imag,&t_real); + *optr++ = gr_complex(t_real,t_imag); + error = phase_detector(*iptr++,d_phase); advance_loop(error); phase_wrap(); frequency_limit(); - - gr_sincosf(d_phase,&t_imag,&t_real); - *optr++ = gr_complex(t_real,t_imag); } return noutput_items; } diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_pll_carriertracking.py b/gnuradio-core/src/python/gnuradio/gr/qa_pll_carriertracking.py index 4c12924ec..5977c1b52 100755 --- a/gnuradio-core/src/python/gnuradio/gr/qa_pll_carriertracking.py +++ b/gnuradio-core/src/python/gnuradio/gr/qa_pll_carriertracking.py @@ -32,106 +32,106 @@ class test_pll_carriertracking (gr_unittest.TestCase): self.tb = None def test_pll_carriertracking (self): - expected_result = ((1.00000238419+6.57831922268e-09j), - (0.998351693153+0.0573740489781j), - (0.994012773037+0.109242096543j), - (0.987789511681+0.155784770846j), - (0.980356454849+0.197242289782j), - (0.972262203693+0.233890414238j), - (0.963963091373+0.266027569771j), - (0.955816328526+0.293958544731j), - (0.948096513748+0.31798568368j), - (0.941002130508+0.338400006294j), - (0.934680581093+0.355482578278j), - (0.929229319096+0.369498342276j), - (0.924701035023+0.380694836378j), - (0.921043872833+0.389459967613j), - (0.918319702148+0.395834594965j), - (0.91650646925+0.400014132261j), - (0.915561556816+0.40217769146j), - (0.915425121784+0.402490824461j), - (0.916029334068+0.401106894016j), - (0.917308092117+0.39817237854j), - (0.919185698032+0.393822491169j), - (0.921583771706+0.388183712959j), - (0.924419641495+0.381372988224j), - (0.927624821663+0.373506993055j), - (0.93112629652+0.364693939686j), - (0.934793651104+0.355197936296j), - (0.938562095165+0.345107495785j), - (0.942447602749+0.33434677124j), - (0.946396291256+0.323003143072j), - (0.950359642506+0.311159342527j), - (0.954286515713+0.298890888691j), - (0.958144724369+0.286276459694j), - (0.961902141571+0.273387700319j), - (0.96553081274+0.260292351246j), - (0.969001471996+0.247053653002j), - (0.972298383713+0.233733415604j), - (0.975410103798+0.220389455557j), - (0.978325486183+0.207074314356j), - (0.981000483036+0.194007188082j), - (0.983471632004+0.181051760912j), - (0.985742926598+0.168245732784j), - (0.987816333771+0.155622571707j), - (0.989693164825+0.143212914467j), - (0.991374969482+0.131043404341j), - (0.992875099182+0.119139909744j), - (0.994201719761+0.107524067163j), - (0.995362222195+0.0962148010731j), - (0.996359944344+0.0852287560701j), - (0.997212648392+0.0745811164379j), - (0.997930467129+0.0642844736576j), - (0.998514950275+0.0545224510133j), - (0.998972594738+0.0452938191593j), - (0.999334216118+0.0364210158587j), - (0.99960911274+0.0279066264629j), - (0.999806642532+0.0197515785694j), - (0.99992787838+0.0119558870792j), - (0.999987542629+0.00451827049255j), - (0.999994814396-0.00256353616714j), - (0.999957740307-0.00929233431816j), - (0.999877095222-0.0156717002392j), - (0.999762177467-0.0217055380344j), - (0.999622702599-0.0273993015289j), - (0.999463677406-0.0327589809895j), - (0.999292552471-0.0376165211201j), - (0.999108791351-0.0421659946442j), - (0.998919844627-0.0464186370373j), - (0.998729586601-0.0503882467747j), - (0.998537421227-0.0540841519833j), - (0.998342692852-0.0575186908245j), - (0.9981533885-0.0607041418552j), - (0.997971534729-0.063651651144j), - (0.997796595097-0.0663715749979j), - (0.997623920441-0.0688742175698j), - (0.997461974621-0.0711689144373j), - (0.997311413288-0.0732654929161j), - (0.997185945511-0.0749996080995j), - (0.997077047825-0.0763883292675j), - (0.996980309486-0.0776248201728j), - (0.996895432472-0.0787187665701j), - (0.996822297573-0.0796797126532j), - (0.996752738953-0.0805156230927j), - (0.996692657471-0.0812350511551j), - (0.996642947197-0.0818456709385j), - (0.996603965759-0.0823540389538j), - (0.996568918228-0.0827651321888j), - (0.996540248394-0.0830852389336j), - (0.996520996094-0.0833202600479j), - (0.996510386467-0.0834743082523j), - (0.996518313885-0.0833787024021j), - (0.996529102325-0.083223849535j), - (0.996545791626-0.0830176770687j), - (0.99656867981-0.0827698707581j), - (0.996593296528-0.0824855566025j), - (0.99661642313-0.0821713805199j), - (0.996643543243-0.081834435463j), - (0.996674180031-0.0814796686172j), - (0.996706545353-0.0811114609241j), - (0.996734440327-0.0807323306799j), - (0.996764600277-0.0803465023637j), - (0.996797323227-0.0799564495683j)) + 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 @@ -150,7 +150,6 @@ class test_pll_carriertracking (gr_unittest.TestCase): self.tb.run () dst_data = dst.data () - self.assertComplexTuplesAlmostEqual (expected_result, dst_data, 5) if __name__ == '__main__': diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_pll_freqdet.py b/gnuradio-core/src/python/gnuradio/gr/qa_pll_freqdet.py index b84299a94..152026c35 100755 --- a/gnuradio-core/src/python/gnuradio/gr/qa_pll_freqdet.py +++ b/gnuradio-core/src/python/gnuradio/gr/qa_pll_freqdet.py @@ -31,8 +31,9 @@ class test_pll_freqdet (gr_unittest.TestCase): def tearDown (self): self.tb = None - def test_pll_refout (self): - expected_result = (4.33888922882e-08, + def test_pll_freqdet (self): + expected_result = (0.0, + 4.33888922882e-08, 0.367369994515, 1.08135249597, 2.10983253908, @@ -130,8 +131,7 @@ class test_pll_freqdet (gr_unittest.TestCase): 101.93218978, 101.824958181, 101.72159228, - 101.622151366, - 101.526623582) + 101.622151366) sampling_freq = 10e3 freq = sampling_freq / 100 @@ -153,7 +153,7 @@ class test_pll_freqdet (gr_unittest.TestCase): # convert it from normalized frequency to absolute frequency (Hz) dst_data = [i*(sampling_freq/(2*math.pi)) for i in dst_data] - + self.assertFloatTuplesAlmostEqual (expected_result, dst_data, 3) if __name__ == '__main__': diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_pll_refout.py b/gnuradio-core/src/python/gnuradio/gr/qa_pll_refout.py index 14f9ab877..4d82ed692 100755 --- a/gnuradio-core/src/python/gnuradio/gr/qa_pll_refout.py +++ b/gnuradio-core/src/python/gnuradio/gr/qa_pll_refout.py @@ -32,7 +32,8 @@ class test_pll_refout (gr_unittest.TestCase): self.tb = None def test_pll_refout (self): - expected_result = ((1+6.4087357643e-10j), + expected_result = ((1+0j), + (1+6.4087357643e-10j), (0.999985277653+0.00542619498447j), (0.999868750572+0.0162021834403j), (0.99948567152+0.0320679470897j), @@ -130,8 +131,7 @@ class test_pll_refout (gr_unittest.TestCase): (0.973072886467-0.230497643352j), (0.985563337803-0.169307261705j), (0.9942086339-0.1074674353j), - (0.9989772439-0.0452152714133j), - (0.999851942062+0.0172088555992j)) + (0.9989772439-0.0452152714133j)) sampling_freq = 10e3 freq = sampling_freq / 100 |