2017-12-24 4 views
0

私はRedhawk 2.1.2 FEIデバイスを構築しており、IDE経由で割り当てをしようとすると許容誤差のチェックに失敗します(Pythonインタフェースなどは試していません)。要求は、8MHzのためであり、Iは、20%の許容範囲内にメーリングリストのある7999999.93575246725231409ヘルツの戻り値を取得し、私はまだ、このエラーを取得:Redhawk FEIサンプルレート許容誤差のチェックに失敗しましたか?

2017-12-24 11:27:10 DEBUG FrontendTunerDevice:484 - allocateCapacity - SR requested: 8000000.000000 SR got: 7999999.935752 
2017-12-24 11:27:10 INFO FrontendTunerDevice:490 - allocateCapacity(0): returned sr 7999999.935752 does not meet tolerance criteria of 20.000000 percent 

frontendInterfaces/libsrc/cpp/fe_tuner_device.cppから問題のコード:

// check tolerances 
if((floatingPointCompare(frontend_tuner_allocation.sample_rate,0)!=0) && 
    (floatingPointCompare(frontend_tuner_status[tuner_id].sample_rate,frontend_tuner_allocation.sample_rate)<0 || 
    floatingPointCompare(frontend_tuner_status[tuner_id].sample_rate,frontend_tuner_allocation.sample_rate+frontend_tuner_allocation.sample_rate * frontend_tuner_allocation.sample_rate_tolerance/100.0)>0)) 
{ 
    std::ostringstream eout; 
    eout<<std::fixed<<"allocateCapacity("<<int(tuner_id)<<"): returned sr "<<frontend_tuner_status[tuner_id].sample_rate<<" does not meet tolerance criteria of "<<frontend_tuner_allocation.sample_rate_tolerance<<" percent"; 
    LOG_INFO(FrontendTunerDevice<TunerStatusStructType>, eout.str()); 
    throw std::logic_error(eout.str().c_str()); 
} 

そしてfrontendInterfaces/libsrc/cpp/fe_tuner_device.hから関数:

inline double floatingPointCompare(double lhs, double rhs, size_t places = 1){ 
    return round((lhs-rhs)*pow(10,places)); 
    /*if(round((lhs-rhs)*(pow(10,places))) == 0) 
     return 0; // equal 
    if(lhs<rhs) 
     return -1; // lhs < rhs 
    return 1; // lhs > rhs*/ 
} 

Iは実際に非レッドホークC++ Iデバイスインタフェースをテストするために使用するプログラムと番目にコピーe になります。違いを見つけるためにすべてを壊して、Redhawkでは、デバイスから返されるサンプルレート(または少なくともスクリーンに印刷されたもの)がRedhawk以外のものとわずかに異なります - ちょっとしたHzのように:

// in Redhawk using cout::precision(17) 
Sample Rate: 7999999.93575246725231409 
// outside Redhawk using cout::precision(17) 
Sample Rate: 7999999.96948242187500000 

返された実際のサンプル・レートに差がありますなぜ私は知らないが、レッドホークのバージョンでは、チェックの2番目の部分は失敗にするだけで十分です:

floatingPointCompare(7999999.93575246725231409,8000000.00000000000000000)<0 
1 

基本的理由:

double a = 7999999.93575246725231409 - 8000000.00000000000000000; // = -0.06424753274768591 
double b = pow(10,1); // = 10.00000000000000000 
double c = a*b;  // = -0.6424753274 
double d = round(c); // = -1.00000000000000000 

返されたサンプルレートが要求より0.049999Hz以上小さい場合、許容値%にかかわらず、割り当てに失敗しますか?たぶん私はここで何かを逃しているかもしれない。

答えて

0

詳細を記述するドキュメントがあるはずですが、私はFMRdsSimulatorデバイスのソースに行きました。

// For FEI tolerance, it is not a +/- it's give me this or better. 

    float minAcceptableSampleRate = request.sample_rate; 

    float maxAcceptableSampleRate = (1 + request.sample_rate_tolerance/100.0) * request.sample_rate; 

なぜ割り当てが失敗したのかを説明する必要があります。

関連する問題