Changeset 15029


Ignore:
Timestamp:
03/11/13 22:32:33 (12 years ago)
Author:
tbretz
Message:
Some fixes to get the new calibrate_by_currents working.
File:
1 edited

Legend:

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

    r15027 r15029  
    393393        // Keep all median currents of the past 10 seconds
    394394        fCurrents.push_back(make_pair(time, med));
    395         while (fCurrents.size()>0)
    396             if (time-fCurrents.front().first>boost::posix_time::seconds(10))
    397                 fCurrents.pop_front();
     395        while (!fCurrents.empty())
     396        {
     397            if (time-fCurrents.front().first<boost::posix_time::seconds(10))
     398                break;
     399
     400            fCurrents.pop_front();
     401        }
    398402
    399403        // If we are not doing a calibration no further action necessary
     
    422426
    423427        fThresholdMin = 36.0833*pow(avg, 0.638393)+184.037;
     428        fThresholdReference = fThresholdMin;
    424429        fThresholds.assign(160, fThresholdMin);
    425430
     
    471476        }
    472477
     478        cout << "-1-" << endl;
     479
    473480        if (fDimDrive.state()<Drive::State::kMoving)
    474481            Warn("Drive not even moving...");
     482
     483        cout << "-2-" << endl;
    475484
    476485        fCounter = 0;
     
    478487        fCalibrationTimeStart = Time();
    479488
     489        cout << "-3-" << endl;
     490
    480491        ostringstream out;
    481492        out << "Rate calibration by current " << fThresholdReference << " with a target rate of " << fTargetRate << " Hz";
    482493        Info(out);
    483494
     495        cout << "START" << endl;
     496
    484497        return RateControl::State::kSettingGlobalThreshold;
    485498    }
     
    514527    int Print() const
    515528    {
     529        cout << "PRINT" << endl;
    516530        Out() << fDim << endl;
    517531        Out() << fDimFTM << endl;
     
    566580        fDimRS("RATE_SCAN"),
    567581        fDimDrive("DRIVE_CONTROL"),
    568 
    569582        fDimThreshold("RATE_CONTROL/THRESHOLD", "S:1;D:1;D:1",
    570583                      "Resulting threshold after calibration"
     
    583596        fDimFTM.Subscribe(*this);
    584597        fDimRS.Subscribe(*this);
     598        fDimDrive.Subscribe(*this);
    585599
    586600        Subscribe("FTM_CONTROL/TRIGGER_RATES")
Note: See TracChangeset for help on using the changeset viewer.