2017-12-24 4 views
0

Redhawk 2.1.2 FEI 장치를 구축하고 IDE를 통해 할당을 시도 할 때 허용 오차 검사 오류가 발생했습니다 (Python 인터페이스 나 다른 것을 사용해 보지 않았습니다). 요청은 8 메가 헤르츠를 위해 내가 20 %의 허용 오차 내에서 waaaay를하다 7999999.93575246725231409 Hz의 반환 값을 얻을,하지만, 난 여전히이 오류를 얻을 :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는 디바이스 인터페이스 및 제를 테스트하는 데 사용하는 비 Redhawk이 C++ 프로그램에 복사 e 입니다. 차이점을 찾기 위해 모든 것을 망 쳤고 Redhawk에서 Device (또는 적어도 화면에 인쇄 된 것)에서 반환되는 샘플 속도가 Redhawk 외부의 것과 약간 다름을 알았습니다 - Hz의 아주 작은 부분처럼 :

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

반환되는 실제 샘플 속도에 차이가 왜 모르겠어요하지만 Redhawk이 버전은 수표의 두 번째 부분은 실패 할 충분한입니다 :

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; 

왜 할당이 실패했는지 설명해야합니다.