Forgot to say that I get the same values when I pass samples one by one from my OOT block to the filter (instead of passing them in vectors of 8 samples)
On Wed, Jan 8, 2020 at 2:24 PM Laura Arjona <arjo...@uw.edu> wrote: > Hi community! First, thanks for dedicating time to help me > > I have a problem with using an *IIR filter* in my OOT module, which > cannot solve > I get different outputs using the > a)IIR_filter in grc and > b)using the filter as a block in my OOT module. > A > nd the outputs I get with b) are wrong. > > Any advice or hint why I get wrong IIR-filter output values with my OOT > module design? > > ------------------ > > In both scenarios, I set the input vector and taps to be the same. I have > checked that.* The input is a vector with 8 float values* > The only difference is that in a) the input is a *vector_source block*, > and in b) the input is the output of an OOT block that I created in C++. > > > *a) **top_block.py* > self.iir_filter_xxx_0 = filter.iir_filter_ffd(((0.0173, 0,-0.0520, > 0,0.0520,0,-0.0173)), ((1.0000,-3.0140,4.8671,-4.8327,3.2074 > ,-1.2968,0.2844)), False) > self.blocks_vector_source_x_0 = blocks.vector_source_f((-7.82476e-06 , > 6.03754e-06 , -4.76197e-06 , -2.3359e-05 , 4.91579e-06 , -9.69721e-06 , > -5.10805e-06 , 2.64173e-05 ), False, 1, []) > self.connect((self.blocks_vector_source_x_0, 0), > (self.iir_filter_xxx_0, 0)) > self.connect((self.iir_filter_xxx_0, 0), (self.blocks_file_sink_0, 0)) > > *b) **/apps/main.py* > self.bpf_filter0 = filter.iir_filter_ffd(((0.0173, 0,-0.0520, > 0,0.0520,0,-0.0173)), ((1.0000,-3.0140,4.8671,-4.8327,3.2074 > ,-1.2968,0.2844)), False) > self.connect((self.my_OOT_block,0), (self.bpf_filter0,0)) > > * /lib/my_OOT_block_Impl.cc* > //main parts of my OOT block > void > my_OOT_block_impl::forecast (int noutput_items, gr_vector_int > &ninput_items_required) > { > ninput_items_required[0] = noutput_items; > } > > int > car_filter_impl::general_work (int noutput_items, > gr_vector_int &ninput_items, > gr_vector_const_void_star &input_items, > gr_vector_void_star &output_items) > { > const float *in0 = (const float *) input_items[0]; > float *out0 = (float *) output_items[0]; > int consumed = ninput_items[0]; > int written = 0; > > //Send 8 float values to the filter > for (int i = 0; i<8; i ++){ > out0[i] = my_vector[i]; > written ++; > > } > > produce(0,written); > consume_each (consumed); > > return WORK_CALLED_PRODUCE; > } > > > > -- > *Laura Arjona * > Washington Research Foundation Innovation Postdoctoral Fellow in > Neuroengineering > > *Paul G. Allen School of Computer Science & Engineering* > 185 E Stevens Way NE > University of Washington > Seattle, WA 98195-2350 > -- *Laura Arjona * Washington Research Foundation Innovation Postdoctoral Fellow in Neuroengineering *Paul G. Allen School of Computer Science & Engineering* 185 E Stevens Way NE University of Washington Seattle, WA 98195-2350