TopBlock(double centerFreq, double sampleRate, double freqRes, double cycFreqRes, std::string fileName) : gr_top_block("Top Block"), Np(pow2roundup((int)sampleRate/freqRes)), L(Np/4), P(pow2roundup(sampleRate/cycFreqRes/L)), N(P*L), vector_length(N), source(osmosdr_make_source_c()), /* OsmoSDR Source */ fileSource(gr_make_file_source(sizeof(float)*2, "/home/ylb/QAM16_44_1k.dat", false)), stv(gr_make_stream_to_vector(sizeof(float)*2, vector_length)), /* Stream to vector */ /* autoFam - this does most of the interesting work */ sink(make_autofam_sink(source, vector_length, centerFreq, sampleRate, freqRes, cycFreqRes, fileName)) { /* Set up the OsmoSDR Source */ source->set_sample_rate(sampleRate); source->set_center_freq(centerFreq); source->set_freq_corr(0.0); source->set_gain_mode(false); source->set_gain(30); source->set_if_gain(25.0); /* Set up the connections */ connect(fileSource, 0, stv, 0); connect(stv, 0, sink, 0); }
TopBlock(double centre_freq_1, double centre_freq_2, double sample_rate, double fft_width, double bandwidth1, double bandwidth2, double step, unsigned int avg_size, double spread, double threshold, double ptime, float gain, float ppm) : gr_top_block("Top Block"), vector_length(sample_rate/fft_width), window(GetWindow(vector_length)), source(osmosdr_make_source_c()), /* OsmoSDR Source */ stv(gr_make_stream_to_vector(sizeof(float)*2, vector_length)), /* Stream to vector */ /* Based on the logpwrfft (a block implemented in python) */ fft(gr_make_fft_vcc_fftw(vector_length, true, window, false, 1)), ctf(gr_make_complex_to_mag_squared(vector_length)), iir(gr_make_single_pole_iir_filter_ff(1.0, vector_length)), lg(gr_make_nlog10_ff(10, vector_length, -20 * log10(vector_length) -10 * log10(GetWindowPower()/vector_length))), /* Sink - this does most of the interesting work */ sink(make_scanner_sink(source, vector_length, centre_freq_1, centre_freq_2, sample_rate, bandwidth1, bandwidth2, step, avg_size, spread, threshold, ptime, gain, ppm)) { /* Set up the OsmoSDR Source */ source->set_sample_rate(sample_rate); source->set_center_freq(centre_freq_1); source->set_freq_corr(ppm); source->set_gain_mode(false); source->set_gain(gain); source->set_if_gain(20.0); /* Set up the connections */ connect(source, 0, stv, 0); connect(stv, 0, fft, 0); connect(fft, 0, ctf, 0); connect(ctf, 0, iir, 0); connect(iir, 0, lg, 0); connect(lg, 0, sink, 0); }
void stream_to_vector_ff_i::createBlock() { // // gr_sptr = xxx_make_xxx( args ); // try{ this->gr_sptr = gr_make_stream_to_vector(this->item_size, this->nitems_per_block); } catch(...){ return; } // // Use setThrottle method to enable the throttling of consumption/production of data by the // service function. The affect of the throttle will try to pause the execution of the // service function for a specified duration. This duration is calculated using the getTargetDuration() method // and the actual processing time to perform the work method. // // This is turned ON by default for "output" only components // // setThrottle( bool onoff ); // // Use maintainTimeStamp to enable proper data flow of timestamp with input and output data. // if turned on (true) // The timestamp from the input source will be used and maintained based on the output rate and // the number of samples produced // if turned off // then the timestamp from the input source is passed through if available or the time of day // // maintainTimestamp( bool onoff ); setupIOMappings(); }