当前位置: 首页>>代码示例>>C++>>正文


C++ sptr::get_tx_freq方法代码示例

本文整理汇总了C++中uhd::usrp::multi_usrp::sptr::get_tx_freq方法的典型用法代码示例。如果您正苦于以下问题:C++ sptr::get_tx_freq方法的具体用法?C++ sptr::get_tx_freq怎么用?C++ sptr::get_tx_freq使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在uhd::usrp::multi_usrp::sptr的用法示例。


在下文中一共展示了sptr::get_tx_freq方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: tune_rx_and_tx

/***********************************************************************
 * Tune RX and TX routine
 **********************************************************************/
static double tune_rx_and_tx(uhd::usrp::multi_usrp::sptr usrp, const double tx_lo_freq, const double rx_offset)
{
    //tune the transmitter with no cordic
    uhd::tune_request_t tx_tune_req(tx_lo_freq);
    tx_tune_req.dsp_freq_policy = uhd::tune_request_t::POLICY_MANUAL;
    tx_tune_req.dsp_freq = 0;
    usrp->set_tx_freq(tx_tune_req);

    //tune the receiver
    double rx_freq = usrp->get_tx_freq() - rx_offset;
    double min_fe_rx_freq = usrp->get_fe_rx_freq_range().start();
    double max_fe_rx_freq = usrp->get_fe_rx_freq_range().stop();
    uhd::tune_request_t rx_tune_req(rx_freq);
    rx_tune_req.dsp_freq_policy = uhd::tune_request_t::POLICY_MANUAL;
    rx_tune_req.dsp_freq = 0;
    if (rx_freq < min_fe_rx_freq)
        rx_tune_req.dsp_freq = rx_freq - min_fe_rx_freq;
    else if (rx_freq > max_fe_rx_freq)
        rx_tune_req.dsp_freq = rx_freq - max_fe_rx_freq;
    usrp->set_rx_freq(rx_tune_req);

    //wait for the LOs to become locked
    boost::this_thread::sleep(boost::posix_time::milliseconds(50));
    boost::system_time start = boost::get_system_time();
    while (not usrp->get_tx_sensor("lo_locked").to_bool() or not usrp->get_rx_sensor("lo_locked").to_bool())
    {
        if (boost::get_system_time() > start + boost::posix_time::milliseconds(100))
            throw std::runtime_error("timed out waiting for TX and/or RX LO to lock");
    }

    return usrp->get_tx_freq();
}
开发者ID:211217613,项目名称:uhd,代码行数:35,代码来源:uhd_cal_tx_iq_balance.cpp

示例2: tune_rx_and_tx

/***********************************************************************
 * Tune RX and TX routine
 **********************************************************************/
static double tune_rx_and_tx(
    uhd::usrp::multi_usrp::sptr usrp, const double tx_lo_freq, const double rx_offset)
{
    // tune the transmitter with no cordic
    uhd::tune_request_t tx_tune_req(tx_lo_freq);
    tx_tune_req.dsp_freq_policy = uhd::tune_request_t::POLICY_MANUAL;
    tx_tune_req.dsp_freq        = 0;
    usrp->set_tx_freq(tx_tune_req);

    // tune the receiver
    double rx_freq        = usrp->get_tx_freq() - rx_offset;
    double min_fe_rx_freq = usrp->get_fe_rx_freq_range().start();
    double max_fe_rx_freq = usrp->get_fe_rx_freq_range().stop();
    uhd::tune_request_t rx_tune_req(rx_freq);
    rx_tune_req.dsp_freq_policy = uhd::tune_request_t::POLICY_MANUAL;
    rx_tune_req.dsp_freq        = 0;
    if (rx_freq < min_fe_rx_freq)
        rx_tune_req.dsp_freq = rx_freq - min_fe_rx_freq;
    else if (rx_freq > max_fe_rx_freq)
        rx_tune_req.dsp_freq = rx_freq - max_fe_rx_freq;
    usrp->set_rx_freq(rx_tune_req);

    wait_for_lo_lock(usrp);

    return usrp->get_tx_freq();
}
开发者ID:EttusResearch,项目名称:uhd,代码行数:29,代码来源:uhd_cal_tx_iq_balance.cpp

示例3: setTxFreq

bool uhd_device::setTxFreq(double wFreq)
{
	uhd::tune_result_t tr = usrp_dev->set_tx_freq(wFreq);
	LOG(INFO) << "\n" << tr.to_pp_string();
	tx_freq = usrp_dev->get_tx_freq();

	return true;
}
开发者ID:5728136cs,项目名称:openbts-multi-arfcn,代码行数:8,代码来源:UHDDevice.cpp

示例4: set_optimal_rx_gain

/***********************************************************************
 * Function to find optimal RX gain setting (for the current frequency)
 **********************************************************************/
UHD_INLINE void set_optimal_rx_gain(
    uhd::usrp::multi_usrp::sptr usrp,
    uhd::rx_streamer::sptr rx_stream,
    double wave_freq = 0.0)
{
    const double gain_step = 3.0;
    const double gain_compression_threshold = gain_step * 0.5;
    const double actual_rx_rate = usrp->get_rx_rate();
    const double actual_tx_freq = usrp->get_tx_freq();
    const double actual_rx_freq = usrp->get_rx_freq();
    const double bb_tone_freq = actual_tx_freq - actual_rx_freq + wave_freq;
    const size_t nsamps = size_t(actual_rx_rate / default_fft_bin_size);

    std::vector<samp_type> buff(nsamps);
    uhd::gain_range_t rx_gain_range = usrp->get_rx_gain_range();
    double rx_gain = rx_gain_range.start() + gain_step;
    double curr_dbrms = 0.0;
    double prev_dbrms = 0.0;
    double delta = 0.0;

    // No sense in setting the gain where this is no gain range
    if (rx_gain_range.stop() - rx_gain_range.start() < gain_step)
        return;

    // The algorithm below cycles through the RX gain range
    // looking for the point where the signal begins to get
    // clipped and the gain begins to be compressed.  It does
    // this by looking for the gain setting where the increase
    // in the tone is less than the gain step by more than the
    // gain compression threshold (curr - prev < gain - threshold).

    // Initialize prev_dbrms value
    usrp->set_rx_gain(rx_gain);
    capture_samples(usrp, rx_stream, buff, nsamps);
    prev_dbrms = compute_tone_dbrms(buff, bb_tone_freq/actual_rx_rate);
    rx_gain += gain_step;

    // Find RX gain where signal begins to clip
    while (rx_gain <= rx_gain_range.stop())
    {
        usrp->set_rx_gain(rx_gain);
        capture_samples(usrp, rx_stream, buff, nsamps);
        curr_dbrms = compute_tone_dbrms(buff, bb_tone_freq/actual_rx_rate);
        delta = curr_dbrms - prev_dbrms;

        // check if the gain is compressed beyone the threshold
        if (delta < gain_step - gain_compression_threshold)
            break;  // if so, we are done

        prev_dbrms = curr_dbrms;
        rx_gain += gain_step;
    }

    // The rx_gain value at this point is the gain setting where clipping
    // occurs or the gain setting that is just beyond the gain range.
    // The gain is reduced by 2 steps to make sure it is within the range and
    // under the point where it is clipped with enough room to make adjustments.
    rx_gain -= 2 * gain_step;

    // Make sure the gain is within the range.
    rx_gain = rx_gain_range.clip(rx_gain);

    // Finally, set the gain.
    usrp->set_rx_gain(rx_gain);
}
开发者ID:dkozel,项目名称:uhd,代码行数:68,代码来源:usrp_cal_utils.hpp

示例5: get_tx_parameters

void get_tx_parameters(uhd::usrp::multi_usrp::sptr usrp, size_t mboard, std::ostream & os)
{
	using namespace std;
	namespace radio = uhd::usrp;

	size_t nchan = 0;

	// CONFIGURATION SUB_DEVICE
	
	os << std::endl << "********** TX Sub Device ***********" << std::endl;
	// Get sub device specification
	os << std::endl << "-----> Get TX Subdevice" << std::endl;
	try
	{
	os << "TX Subdevice Specification: ";
	radio::subdev_spec_t tx_subdev = usrp->get_tx_subdev_spec(mboard);
	os << tx_subdev.to_pp_string() << endl;
	}
	catch(uhd::runtime_error &e)
	{
		os << " Exception occurred : " << e.code() << endl;
	}
	
	// Number of tx channels
	os << std::endl << "-----> Get number of TX channels" << std::endl;
	try
	{
	size_t num_tx = usrp->get_tx_num_channels();
	os << "Number of TX channels: " ;
	os << num_tx << endl;
	}
	catch (uhd::runtime_error &e)
	{
		os << " Exception occurred : " << e.code() << endl;
	}
	
	// TX Device Name
	os << std::endl << "-----> Get TX Subdevice Name" << std::endl;
	try
	{
	os << "TX Subdevice Name: ";
	string tx_name = usrp->get_tx_subdev_name(nchan);
	os << tx_name << endl;
	}
	catch (uhd::runtime_error &e)
	{
		os << " Exception occurred : " << e.code() << endl;
	}
	
	// TX SAMPLE RATE
	
	os << std::endl << "********** TX Sample Rate ***********" << std::endl;
	
	// Get Current TX rate
	os << std::endl << "-----> Get TX Rate" << std::endl;
	try
	{
		os << "TX Rate: " ;
		double tx_rate = usrp->get_tx_rate(nchan);
		os << tx_rate << endl;
	}
	catch (uhd::runtime_error &e)
	{
		os << " Exception occurred : " << e.code() << endl;
	}
	
	// Get list of TX rates
	os << std::endl << "-----> Get TX Rate List" << std::endl;
	try
	{
		os << "TX Rate List: " ;
		uhd::meta_range_t tx_rates = usrp->get_tx_rates(nchan);
		os << "Start: " << tx_rates.start() << "   Stop: " << tx_rates.stop() << "   Step: " << tx_rates.step() << endl;
		os << tx_rates.to_pp_string() << endl;
	}
	catch (uhd::runtime_error &e)
	{
		os << " Exception occurred : " << e.code() << endl;
	}

	// TX FREQUENCIES
	
	os << std::endl << "********** TX Frequencies ***********" << std::endl;
	
	// Current TX frequency
	os << std::endl << "-----> Get TX Center Frequency" << std::endl;
	try
	{
		os << "TX Freq: ";
		double tx_freq = usrp->get_tx_freq(nchan);
		os << tx_freq << endl;
	}
	catch (uhd::runtime_error &e)
	{
		os << " Exception occurred : " << e.code() << endl;
	}

	// TX Frequency Range
	os << std::endl << "-----> Get TX Center Frequency Range" << std::endl;
	try
//.........这里部分代码省略.........
开发者ID:Radioguy00,项目名称:E100_Og2Modem,代码行数:101,代码来源:uhd_utilities.cpp


注:本文中的uhd::usrp::multi_usrp::sptr::get_tx_freq方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。