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: Yan Huang
Subject: Re: [Discuss-gnuradio] error while making detector
Date: Wed, 25 Nov 2015 16:43:45 +0000

Hi Marcus,

 

Actually, I need to do the spectrum management and interference identification using GNU radio and USRP, and I’ve read some articles about them, but I still don’t know how to realize them, so I want to find some examples about this area. Unfortunately, I first find was an energy detector to create an Out-Of-Tree module by C++.

 

Could you recommend some examples that I can follow?

 

Thank you,

Yan

 

From: Marcus Müller [mailto:address@hidden
Sent: 25 November 2015 16:05
To: Yan Huang; GNURadio Discussion List
Subject: Re: [Discuss-gnuradio] error while making detector

 

Hi Yan,


If I want to add more functions can I add them to existing blocks?

You could do that; often, functionality is cleaner implemented by adding further blocks, but if you need something that needs a modified block, creating your own might really be the best way. I'd really recommend doing that in python for a start, though.

I really just was recommending using existing blocks because I felt that getting C++ problems right at the beginning might have been frustrating; the usual way we try to introduce new people to GNU Radio development really is taking the road from the GNU Radio companion, combining existing blocks, over gr_modtool to create an Out-Of-Tree module for python blocks to C++ blocks in that same gr_modtool created module. Now, gr_modtool usually creates block "stubs" that just work, and all the errors you were getting were indicative of you not including the right headers and maybe not linking against GSL.

Also, the code line the compiler output showed contained a lot of bugs (mainly integer division where you'd want to have proper float division, and a lot of basic syntax errors), so to be honest: you should not start with writing a C++ block before you're really somewhat used to writing C++ code. Python blocks are slower than C++ blocks in many cases, but the speed up might not really worth the labour here, until you have tried and figured out which actually become problematic (and if the reduced computational performance is a problem at all). Python is super easy to learn if you've ever saw any imperative programming language, be that matlab, ruby, PHP, or anything else.

So: I don't really know what your energy detector should do, or what your current implementation's purpose is exactly, so I'm not really fit to say "that can be solved with existing blocks only", but energy detection is a very common problem, and hence, chances are that most of the functionality can be done by existing blocks. You seem to be using a rather fair amount of linear algebra in your block, judging by the amount of GSL calls you do.

Maybe you'd want to describe your problem, so that the mailing list (hint: try to reply to the mailing list instead of individuals; then more people can be helpful; and also, that's proper mailing list etiquette) can come up with a suitable approach.

Best regards,
Marcus

On 25.11.2015 16:45, Yan Huang wrote:

Thank you very much, I guess I’d better use the existing blocks to implement energy detection. If I want to add more functions can I add them to existing blocks?

 

Thank you,

Yan

From: Marcus Müller [mailto:address@hidden]
Sent: 25 November 2015 15:23
To: Yan Huang; GNURadio Discussion List
Subject: Re: [Discuss-gnuradio] error while making detector

 

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 Mag Decimating FIR Filter Probe 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 Mag Moving Average Probe 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: discuss-gnuradio-bounces+address@hidden [mailto:discuss-gnuradio-bounces+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.

 

 
 
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.

 



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]