Changeset 12457 for trunk/FACT++


Ignore:
Timestamp:
11/09/11 00:10:43 (13 years ago)
Author:
tbretz
Message:
A few small fixes, a more strict condition to find outliers, changed default rate to 75Hz
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/src/ratecontrol.cc

    r12441 r12457  
    268268        for (int i=0; i<40; i++)
    269269        {
    270             if ( fabs(sdata.fBoardRate[i]-mb)<3*db)
     270            if ( fabs(sdata.fBoardRate[i]-mb)<2.5*db)
    271271            {
    272272                avg += sdata.fBoardRate[i];
     
    275275        }
    276276
    277         fTriggerRate = avg / num * 40;
     277        fTriggerRate = avg/num * 40;
    278278
    279279        if (fVerbose)
     
    284284        }
    285285
     286        if (sdata.fTriggerRate<0)
     287            fTriggerRate = sdata.fTriggerRate;
     288
    286289        // ----------------------
    287290
    288         if (fTriggerRate>0 && fTriggerRate<fTargetRate)
     291        /*
     292        if (avg>0 && avg<fTargetRate)
    289293        {
    290294            // I am assuming here (and at other places) the the answer from the FTM when setting
    291295            // the new threshold always arrives faster than the next rate update.
    292296            fThresholdMin = fThresholds[0];
     297            Out() << "Setting fThresholdMin to " << fThresholds[0] << endl;
     298        }
     299        */
     300
     301        if (fTriggerRate>0 && fTriggerRate<fTargetRate)
     302        {
     303            fThresholds.assign(160, fThresholdMin);
    293304            return;
    294305        }
     
    298309        const float step = (log10(fTriggerRate)-log10(fTargetRate))/0.039 + 1;
    299310
    300         const uint16_t diff = fThresholds[0]+int16_t(truncf(step));
    301 
    302         cout << diff << endl;
    303 
    304         if (diff==fThresholds[0])
     311        const uint16_t diff = fThresholdMin+int16_t(truncf(step));
     312        if (diff<=fThresholdMin)
    305313            return;
    306314
     
    308316        {
    309317            //Out() << idx/40 << "|" << (idx/4)%10 << "|" << idx%4;
    310             Out() << fThresholds[0];
     318            Out() << fThresholdMin;
    311319            Out() << (step>0 ? " += " : " -= ");
    312320            Out() << step << " (" << diff << ")" << endl;
     
    315323        const uint32_t val[2] = { -1,  diff };
    316324        DimClient::sendCommandNB("FTM_CONTROL/SET_THRESHOLD", (void*)val, 8);
     325
     326        fThresholdMin = diff;
    317327    }
    318328
     
    580590
    581591        fThresholdReference = 300;
    582         fTargetRate         =  70;
     592        fTargetRate         =  75;
    583593
    584594        return -1;
Note: See TracChangeset for help on using the changeset viewer.