discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Discuss-gnuradio] error while making detector


From: Marcus Müller
Subject: Re: [Discuss-gnuradio] error while making detector
Date: Wed, 25 Nov 2015 16:22:35 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0

There's already blocks that do energy calculation, so you really don't have to implement this yourself.
In fact, I wrote a short answer on a similar question just yesterday. The question there was how to add a method "get_bandpower" to a C++ block, so here's the excerpt from
http://stackoverflow.com/a/33901845/4433386
where I explained other ways than implementing this yourself:

Other than that, there's already blocks that can do what you want:

three ways
            to probe signal

  • Probe Avg Mag²: has a method level() which does the same as your get_bandpower (aside from the √(.) )
  • Complex to MagDecimating FIR FilterProbe Signal: does the √(Re²+Im²), before passing it on to a filter with 123 (that was just my arbitrary fixed length) taps of 1/length, and decimating it to one value every average. Result get send to the Signal Probe, which has a signal() method, which does what your get_bandpower does. CPU load of this is relatively small -- it's really just the magnitude finding for every sample, and then 123 real multiplications + 123 real additions per 123 samples,in the filter, all SIMD increased, so basically, less than 1 FMAC per sample.
  • Complex to MagMoving AverageProbe Signal: Names say it all. Nothing magical here.

Best regards,
Marcus

On 25.11.2015 16:19, Yan Huang wrote:

Hi Marcus,

 

I have followed the URL you recommended, but  I want to use gnuradio to do energy detection , so I follow the howto infrastructure and want to learn more about  it by building a new block. Is there any suggestion about how to make anergy detection?

 

Thanks,

 

Yan

 

From: address@hidden [mailto:address@hidden] On Behalf Of Marcus Müller
Sent: 25 November 2015 15:10
To: address@hidden
Subject: Re: [Discuss-gnuradio] error while making detector

 

Hi Yan,

which tutorial exactly where you following (URL)?
I recommend using the Guided Tutorials for beginners; they are much better illustrated, and they don't need the sometimes broken howto infrastructure.
https://gnuradio.org/redmine/projects/gnuradio/wiki/Guided_Tutorials

Best regards,
Marcus

On 25.11.2015 15:45, Yan Huang wrote:

Hey,

I’m a new to use gnuradio and USRP B210, now I want to generate my OOT module start with the example ‘howto_detect’, and I followed guided tutorial in gnuradio.org. But there are still some problems as follows.

 

[  6%] Building CXX object lib/CMakeFiles/gnuradio-howto.dir/howto_detect_ff_impl.cc.o
/home/mint/Documents/gr-howto/lib/howto_detect_ff_impl.cc:32:5: error: prototype for ‘gr::howto::howto_detect_ff::sptr gr::howto::howto_detect_ff::make(float, int, int)’ does not match any in class ‘gr::howto::howto_detect_ff’
     howto_detect_ff::make(float pfa, int L, int samples)
     ^
In file included from /home/mint/Documents/gr-howto/lib/howto_detect_ff_impl.h:24:0,
                 from /home/mint/Documents/gr-howto/lib/howto_detect_ff_impl.cc:26:
/home/mint/Documents/gr-howto/include/howto/howto_detect_ff.h:49:19: error: candidate is: static gr::howto::howto_detect_ff::sptr gr::howto::howto_detect_ff::make()
       static sptr make();
                   ^
/home/mint/Documents/gr-howto/lib/howto_detect_ff_impl.cc: In constructor ‘gr::howto::howto_detect_ff_impl::howto_detect_ff_impl(float, int, int)’:
/home/mint/Documents/gr-howto/lib/howto_detect_ff_impl.cc:52:24: error: _expression_ cannot be used as a function
               d_pfa(pfa), d_L(L), d_samples(samples))
                        ^
/home/mint/Documents/gr-howto/lib/howto_detect_ff_impl.cc:52:32: error: _expression_ cannot be used as a function
               d_pfa(pfa), d_L(L), d_samples(samples))
                                ^
/home/mint/Documents/gr-howto/lib/howto_detect_ff_impl.cc:52:52: error: _expression_ cannot be used as a function
               d_pfa(pfa), d_L(L), d_samples(samples))
                                                    ^
/home/mint/Documents/gr-howto/lib/howto_detect_ff_impl.cc: In function ‘float gr::howto::TracyWidom(float)’:
/home/mint/Documents/gr-howto/lib/howto_detect_ff_impl.cc:71:46: error: ‘printf’ was not declared in this scope
 tw = 18*(pd - (17/75)); printf("a - %f\n", tw);
                                              ^
/home/mint/Documents/gr-howto/lib/howto_detect_ff_impl.cc:73:47: error: ‘printf’ was not declared in this scope
 tw = 8*(pd - (179/400)); printf("b - %f\n", tw);
                                               ^
/home/mint/Documents/gr-howto/lib/howto_detect_ff_impl.cc:75:53: error: ‘printf’ was not declared in this scope
 tw = (87/20)*(pd - (643/870)); printf("c - %f\n", tw);
                                                     ^
/home/mint/Documents/gr-howto/lib/howto_detect_ff_impl.cc:77:52: error: ‘printf’ was not declared in this scope
 tw = (16/5)*(pd - (287/320)); printf("d - %f\n", tw);
                                                    ^
/home/mint/Documents/gr-howto/lib/howto_detect_ff_impl.cc:79:52: error: ‘printf’ was not declared in this scope
 tw = (17/5)*(pd - (297/340)); printf("e - %f\n", tw);
                                                    ^
/home/mint/Documents/gr-howto/lib/howto_detect_ff_impl.cc:81:49: error: ‘printf’ was not declared in this scope
 tw = (5.2)*(pd - (0.813)); printf("f - %f\n", tw);
                                                 ^
/home/mint/Documents/gr-howto/lib/howto_detect_ff_impl.cc:83:53: error: ‘printf’ was not declared in this scope
 tw = (53/5)*(pd - (909/1060)); printf("g - %f\n", tw);
                                                     ^
/home/mint/Documents/gr-howto/lib/howto_detect_ff_impl.cc:85:48: error: ‘printf’ was not declared in this scope
 tw = 26*(pd - (593/650)); printf("h - %f\n", tw);
                                                ^
/home/mint/Documents/gr-howto/lib/howto_detect_ff_impl.cc:87:56: error: ‘printf’ was not declared in this scope
 printf ("wrong pfa value: it must be between 0 and 1\n");
                                                        ^
/home/mint/Documents/gr-howto/lib/howto_detect_ff_impl.cc: In member function ‘virtual int gr::howto::howto_detect_ff_impl::general_work(int, gr_vector_int&, gr_vector_const_void_star&, gr_vector_void_star&)’:
/home/mint/Documents/gr-howto/lib/howto_detect_ff_impl.cc:141:9: error: ‘gsl_matrix’ was not declared in this scope
         gsl_matrix * hankel = gsl_matrix_alloc (lenght,d_L);
         ^
/home/mint/Documents/gr-howto/lib/howto_detect_ff_impl.cc:141:22: error: ‘hankel’ was not declared in this scope
         gsl_matrix * hankel = gsl_matrix_alloc (lenght,d_L);
                      ^
/home/mint/Documents/gr-howto/lib/howto_detect_ff_impl.cc:141:59: error: ‘gsl_matrix_alloc’ was not declared in this scope
         gsl_matrix * hankel = gsl_matrix_alloc (lenght,d_L);
                                                           ^
/home/mint/Documents/gr-howto/lib/howto_detect_ff_impl.cc:142:22: error: ‘V’ was not declared in this scope
         gsl_matrix * V = gsl_matrix_alloc (d_L,d_L);
                      ^
/home/mint/Documents/gr-howto/lib/howto_detect_ff_impl.cc:143:9: error: ‘gsl_vector’ was not declared in this scope
         gsl_vector * S = gsl_vector_alloc (d_L);
         ^
/home/mint/Documents/gr-howto/lib/howto_detect_ff_impl.cc:143:22: error: ‘S’ was not declared in this scope
         gsl_vector * S = gsl_vector_alloc (d_L);
                      ^
/home/mint/Documents/gr-howto/lib/howto_detect_ff_impl.cc:143:47: error: ‘gsl_vector_alloc’ was not declared in this scope
         gsl_vector * S = gsl_vector_alloc (d_L);
                                               ^
/home/mint/Documents/gr-howto/lib/howto_detect_ff_impl.cc:144:22: error: ‘temp’ was not declared in this scope
         gsl_vector * temp = gsl_vector_alloc (d_ L);
                      ^
/home/mint/Documents/gr-howto/lib/howto_detect_ff_impl.cc:144:47: error: ‘d_’ was not declared in this scope
         gsl_vector * temp = gsl_vector_alloc (d_ L);
                                               ^
/home/mint/Documents/gr-howto/lib/howto_detect_ff_impl.cc:147:36: error: ‘gsl_matrix_set_zero’ was not declared in this scope
         gsl_matrix_set_zero (hankel);
                                    ^
/home/mint/Documents/gr-howto/lib/howto_detect_ff_impl.cc:156:47: error: ‘fopen’ was not declared in this scope
             story = fopen("filestory.txt", "a");
                                               ^
/home/mint/Documents/gr-howto/lib/howto_detect_ff_impl.cc:159:60: error: ‘gsl_matrix_set’ was not declared in this scope
                     gsl_matrix_set (hankel, p, j, vett[p+j]);
                                                            ^
/home/mint/Documents/gr-howto/lib/howto_detect_ff_impl.cc:162:57: error: ‘gsl_linalg_SV_decomp’ was not declared in this scope
                 gsl_linalg_SV_decomp (hankel, V, S, temp);
                                                         ^
/home/mint/Documents/gr-howto/lib/howto_detect_ff_impl.cc:163:43: error: ‘gsl_vector_get’ was not declared in this scope
                 lmax = gsl_vector_get(S, 0);
                                           ^
/home/mint/Documents/gr-howto/lib/howto_detect_ff_impl.cc:167:79: error: ‘fprintf’ was not declared in this scope
                 fprintf(story, "%f - ratio=%f - soglia=%f\n ", mem, ratio, thr);
                                                                               ^
/home/mint/Documents/gr-howto/lib/howto_detect_ff_impl.cc:168:29: error: ‘fclose’ was not declared in this scope
                 fclose(story);
                             ^
make[2]: *** [lib/CMakeFiles/gnuradio-howto.dir/howto_detect_ff_impl.cc.o] Error 1
make[1]: *** [lib/CMakeFiles/gnuradio-howto.dir/all] Error 2
make: *** [all] Error 2

 

Any solution to sort an error will be appreciated.

 

Thanks a lot,

 

Yan

 

 
 
This message and any attachment are intended solely for the addressee
and may contain confidential information. If you have received this
message in error, please send it back to me, and immediately delete it. 
 
Please do not use, copy or disclose the information contained in this
message or in any attachment.  Any views or opinions expressed by the
author of this email do not necessarily reflect the views of the
University of Nottingham.
 
This message has been checked for viruses but the contents of an
attachment may still contain software viruses which could damage your
computer system, you are advised to perform your own checks. Email
communications with the University of Nottingham may be monitored as
permitted by UK legislation.




_______________________________________________
Discuss-gnuradio mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

 


This message and any attachment are intended solely for the addressee
and may contain confidential information. If you have received this
message in error, please send it back to me, and immediately delete it. 

Please do not use, copy or disclose the information contained in this
message or in any attachment.  Any views or opinions expressed by the
author of this email do not necessarily reflect the views of the
University of Nottingham.

This message has been checked for viruses but the contents of an
attachment may still contain software viruses which could damage your
computer system, you are advised to perform your own checks. Email
communications with the University of Nottingham may be monitored as
permitted by UK legislation.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]