/* -*- c++ -*- */ /* * Copyright 2014 <+YOU OR YOUR COMPANY+>. * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this software; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "newblock_impl.h" #include float G_n1; namespace gr { namespace agcs { newblock::sptr newblock::make() { return gnuradio::get_initial_sptr (new newblock_impl()); } /* * The private constructor */ newblock_impl::newblock_impl() : gr::sync_block("newblock", gr::io_signature::make(1, 1, sizeof(float)), gr::io_signature::make(1, 1, sizeof(float))) { G_n1=1; } /* * Our virtual destructor. */ newblock_impl::~newblock_impl() { } int newblock_impl::work(int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { float *in = (float *) input_items[0]; float *out = (float *) output_items[0]; float ad, G_n; float alfa=0.001; float Ref=1; // Do <+signal processing+> ad=log2(Ref*in[0]); G_n=(ad*alfa)+G_n1; out[0]=powf(2,G_n1); //(unsigned int*) 10*log10(2^(G_n1)); G_n1=G_n; // Tell runtime system how many output items we produced. return noutput_items; } } /* namespace agcs */ } /* namespace gr */