Changeset 13992 for trunk


Ignore:
Timestamp:
05/30/12 18:16:27 (12 years ago)
Author:
tbretz
Message:
Added TIME_CHECKsome changes to the output structure and file names; used end of astron. twilight not sun-rise
File:
1 edited

Legend:

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

    r13957 r13992  
    193193        const string arr = isday ?
    194194            fSunSetDarkTime.MinutesTo(time)+"↓" :
    195             fSunRiseDayTime.MinutesTo(time)+"↑";
     195            fSunRiseDarkTime.MinutesTo(time)+"↑";
    196196
    197197        description += " ["+arr+"]";
     
    384384
    385385    bool fFtmControlFtuOk;
     386
     387    deque<float> fRateControlThreshold;
    386388
    387389    uint64_t  fRateScanDataId;
     
    414416    DimDescribedState fDimRateScan;
    415417    DimDescribedState fDimChatServer;
     418    DimDescribedState fDimSkypeClient;
    416419
    417420    // -------------------------------------------------------------------
     
    612615        ofstream(fPath+"/"+name+".data") << out.str();
    613616
    614         WriteBinary(d, "magicweather-"+name+"-hist", fMagicWeatherHist[i], max-min, min);
     617        WriteBinary(d, "hist-magicweather-"+name, fMagicWeatherHist[i], max-min, min);
    615618    }
    616619
     
    709712        const double scale = stat.max>0 ? pow(10, ceil(log10(stat.max))) : 0;
    710713
    711         WriteBinary(d, "tng-dust-hist", fTngWeatherDustHist, scale);
     714        WriteBinary(d, "hist-tng-dust", fTngWeatherDustHist, scale);
    712715
    713716        ostringstream out;
     
    776779            fDriveControlTrackingDevHist.pop_front();
    777780
    778         WriteBinary(d, "control-deviation-hist", fDriveControlTrackingDevHist, 120);
     781        WriteBinary(d, "hist-control-deviation", fDriveControlTrackingDevHist, 120);
    779782
    780783        ostringstream out;
     
    873876
    874877        // Write the 160 patch values to a file
    875         WriteBinary(d, "feedback-deviation", dev, 1);
     878        WriteBinary(d, "cam-feedback-deviation", dev, 1);
    876879
    877880        const Statistics stat(dev, 3);
     
    913916
    914917        if (fDimBiasControl.state()==BIAS::State::kVoltageOn)
    915             WriteBinary(d, "biascontrol-voltage", val, 10, 65);
     918            WriteBinary(d, "cam-biascontrol-voltage", val, 10, 65);
    916919        else
    917             WriteBinary(d, "biascontrol-voltage", val, 75);
     920            WriteBinary(d, "cam-biascontrol-voltage", val, 75);
    918921
    919922        ostringstream out;
     
    989992
    990993        // Write the 160 patch values to a file
    991         WriteBinary(d, "biascontrol-current", val, 100);
     994        WriteBinary(d, "cam-biascontrol-current", val, 100);
    992995
    993996        const Statistics stat(v, 0, 3);
     
    10031006
    10041007        // write the history to a file
    1005         WriteBinary(d, "biascontrol-current-hist", fBiasControlCurrentHist, 100);
     1008        WriteBinary(d, "hist-biascontrol-current", fBiasControlCurrentHist, 100);
    10061009
    10071010        const string col0 = cal ? HTML::kGreen : HTML::kWhite;
     
    11481151        // FIXME: Add statistics for all kind of rates
    11491152
    1150         WriteBinary(d, "ftmcontrol-triggerrate-hist",
     1153        WriteBinary(d, "hist-ftmcontrol-triggerrate",
    11511154                    fFtmControlTriggerRateHist, 100);
    1152         WriteBinary(d, "ftmcontrol-boardrates",
     1155        WriteBinary(d, "cam-ftmcontrol-boardrates",
    11531156                    vector<float>(brates, brates+40), 10);
    1154         WriteBinary(d, "ftmcontrol-patchrates",
     1157        WriteBinary(d, "cam-ftmcontrol-patchrates",
    11551158                    vector<float>(prates, prates+160), 10);
    11561159
     
    11941197        vector<uint16_t> vecb(dat.fMultiplicity, dat.fMultiplicity+40);
    11951198
    1196         WriteBinary(d, "ftmcontrol-thresholds-patch", vecp, 1000);
    1197         WriteBinary(d, "ftmcontrol-thresholds-board", vecb, 1000);
     1199        WriteBinary(d, "cam-ftmcontrol-thresholds-patch", vecp, 1000);
     1200        WriteBinary(d, "cam-ftmcontrol-thresholds-board", vecb,  100);
    11981201
    11991202        const Statistics statp(vecp);
     
    12071210        out << HTML::kWhite << '\t' << statb.min << '\n';
    12081211        out << HTML::kWhite << '\t' << statb.med << '\n';
    1209         //out << HTML::kWhite << '\t' << statb.avg << '\n';
    12101212        out << HTML::kWhite << '\t' << statb.max << '\n';
     1213        ofstream(fPath+"/thresholds-board.data") << out.str();
     1214
     1215        ostringstream out;
     1216        out << d.GetJavaDate() << '\n';
    12111217        out << HTML::kWhite << '\t' << statp.min << '\n';
    12121218        out << HTML::kWhite << '\t' << statp.med << '\n';
    1213         //out << HTML::kWhite << '\t' << statp.avg << '\n';
    12141219        out << HTML::kWhite << '\t' << statp.max << '\n';
     1220        ofstream(fPath+"/thresholds-patch.data") << out.str();
     1221
     1222        ostringstream out;
     1223        out << d.GetJavaDate() << '\n';
     1224        out << HTML::kWhite << '\t' << statb.med << '\n';
     1225        out << HTML::kWhite << '\t' << statp.med << '\n';
    12151226        ofstream(fPath+"/thresholds.data") << out.str();
    12161227
     
    13211332        switch (fFadControlDrsStep)
    13221333        {
    1323         case 0:  WriteBinary(d, "fadcontrol-eventdata", max, 2,   -1); break;
    1324         case 1:  WriteBinary(d, "fadcontrol-eventdata", max, 2,    0); break;
    1325         default: WriteBinary(d, "fadcontrol-eventdata", max, 0.25, 0); break;
     1334        case 0:  WriteBinary(d, "cam-fadcontrol-eventdata", max, 2,   -1); break;
     1335        case 1:  WriteBinary(d, "cam-fadcontrol-eventdata", max, 2,    0); break;
     1336        default: WriteBinary(d, "cam-fadcontrol-eventdata", max, 0.25, 0); break;
    13261337        }
    13271338
     
    13841395        ofstream(fPath+"/fsc.data") << out.str();
    13851396
    1386         WriteBinary(d, "fsccontrol-temperature-hist",
     1397        WriteBinary(d, "hist-fsccontrol-temperature",
    13871398                    fFscControlTemperatureHist, 10);
    13881399
     
    14401451        fRateScanBoard %= 40;
    14411452
    1442         WriteBinary(d, "ratescan-hist",  fRateScanDataHist[0],                10, -2);
    1443         WriteBinary(d, "ratescan-board", fRateScanDataHist[fRateScanBoard+1], 10, -4);
     1453        WriteBinary(d, "hist-ratescan",      fRateScanDataHist[0],                10, -2);
     1454        WriteBinary(d, "cam-ratescan-board", fRateScanDataHist[fRateScanBoard+1], 10, -4);
    14441455
    14451456        ostringstream out;
     
    14591470
    14601471        ofstream(fPath+"/ratescan_board.data") << out.str();
     1472
     1473        return GetCurrentState();
     1474    }
     1475
     1476    int HandleRateControlThreshold(const EventImp &d)
     1477    {
     1478        if (!CheckDataSize(d, "RateControl:Threshold", 2))
     1479            return GetCurrentState();
     1480
     1481        const uint16_t th = d.Get<uint16_t>();
     1482
     1483        fRateControlThreshold.push_back(th);
     1484        if (fRateControlThreshold.size()>300)
     1485            fRateControlThreshold.pop_front();
     1486
     1487        WriteBinary(d, "hist-ratecontrol-threshold", fRateControlThreshold, 1000);
    14611488
    14621489        return GetCurrentState();
     
    15021529        Out() << fDimDataLogger   << endl;
    15031530        Out() << fDimDriveControl << endl;
     1531        Out() << fDimTimeCheck    << endl;
    15041532        Out() << fDimFadControl   << endl;
    15051533        Out() << fDimFtmControl   << endl;
     
    15121540        Out() << fDimRateScan     << endl;
    15131541        Out() << fDimChatServer   << endl;
     1542        Out() << fDimSkypeClient  << endl;
    15141543
    15151544        return GetCurrentState();
     
    19621991            out << GetStateHtml(fDimDataLogger,   1);
    19631992            out << GetStateHtml(fDimDriveControl, 2);
     1993            out << GetStateHtml(fDimTimeCheck,    1);
    19641994            out << GetStateHtml(fDimFadControl,   FAD::State::kConnected);
    19651995            out << GetStateHtml(fDimFtmControl,   FTM::State::kConnected);
     
    19722002            out << GetStateHtml(fDimRateScan,     4);
    19732003            out << GetStateHtml(fDimChatServer,   1);
     2004            out << GetStateHtml(fDimSkypeClient,  1);
    19742005
    19752006            out << HTML::kGreen << '\t' << dt.str().substr(0, dt.str().length()-7) << '\n';
     
    20872118            (bind(&StateMachineSmartFACT::HandleFtmFtuList,          this, placeholders::_1));
    20882119
     2120        Subscribe("RATE_CONTROL/THRESHOLD")
     2121            (bind(&StateMachineSmartFACT::HandleRateControlThreshold,this, placeholders::_1));
     2122
    20892123        Subscribe("RATE_SCAN/DATA")
    20902124            (bind(&StateMachineSmartFACT::HandleRateScanData,        this, placeholders::_1));
Note: See TracChangeset for help on using the changeset viewer.