Changeset 19584


Ignore:
Timestamp:
Sep 1, 2019, 11:27:41 AM (3 weeks ago)
Author:
tbretz
Message:
Based on changes from Daniela: Set min ADC value to 980 (now both values can be changed via database), rephrased some output and improved some output, added some more warnings.
File:
1 edited

Legend:

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

    r19458 r19584  
    3232    bool fIsVerbose;
    3333    bool fIsAutoReconnect;
     34
     35    uint16_t fTempMin;
     36    uint16_t fTempMax;
    3437
    3538    size_t fNumConsecutiveErrors;   // Number of consecutive messages with errors
     
    253256        //970=-7.6
    254257        //1300=76
     258        //DD 2019/09/01: changed from 970 to 980 as sensor 19 had values slighly larger than -7.6
    255259        for (int *pt=mapt; *pt>=0; pt++)
    256             //temperatures.push_back(resist[*pt]>800&&resist[*pt]<2000 ? GetTempPT1000(resist[*pt]) : 0);
    257             temperatures.push_back(resist[*pt]>970&&resist[*pt]<1300 ? GetTempPT1000(resist[*pt]) : 0);
    258             //temperatures.push_back(resist[*pt]>1019&&resist[*pt]<1300 ? GetTempPT1000(resist[*pt]) : 0);
     260            temperatures.push_back(resist[*pt]>=fTempMin && resist[*pt]<=fTempMax ? GetTempPT1000(resist[*pt]) : 0);
    259261
    260262        // 0 = 3-(3+0)%4
     
    440442        {
    441443            for (size_t i=0; i<resist.size(); i++)
    442                 //if (resist[i]>800 && resist[i]<2000)
    443                 if (resist[i]>970 && resist[i]<1300)
    444                 //if (resist[i]>1019 && resist[i]<1300)
     444                if (resist[i]>=fTempMin && resist[i]<=fTempMax)
    445445                    Out() << setw(2) << i << " - " << setw(4) << (int)resist[i] << ": " << setprecision(1) << fixed << GetTempPT1000(resist[i]) << endl;
    446446                else
     
    562562public:
    563563    ConnectionFSC(ba::io_service& ioservice, MessageImp &imp) : Connection(ioservice, imp()),
    564         fIsVerbose(false), fIsAutoReconnect(false), fReconnectTimeout(ioservice)
     564        fIsVerbose(false), fIsAutoReconnect(false), fTempMin(0), fTempMax(65535), fReconnectTimeout(ioservice)
    565565    {
    566566        SetLogStream(&imp);
     
    580580    {
    581581        fPositionsBias = vec;
     582    }
     583
     584    void SetTempMin(const uint16_t &min)
     585    {
     586        fTempMin = min;
     587    }
     588
     589    void SetTempMax(const uint16_t &max)
     590    {
     591        fTempMax = max;
    582592    }
    583593
     
    627637            if (temp[i]!=0)
    628638            {
     639                if (temp[i]<0)
     640                    Warn(Tools::Form("Temperature sensor %2d has negative temperature (%7.2f deg C)", i, temp[i]));
     641
    629642                T.emplace_back(temp[i]);
    630643                xy.emplace_back(fPositionsSensors[i]);
     
    636649        if (T.size()==0)
    637650        {
    638             Warn("No valid sensor temperatures.");
     651            Warn("No valid temperatures from compartment sensors.");
    639652            return;
    640653        }
     
    649662        const bool reject = rms>4 || (fabs(fLastRms[0]-fLastRms[1])<=cut_val && fabs(rms-fLastRms[0])>cut_val);
    650663
     664        if (reject)
     665            Warn(Tools::Form("RMS of compartment temperature suspicous: T[0]:%6.2f (n=%2d) T[1]:%6.2f T[2]:%6.2f... rejected.", rms, T.size(), fLastRms[0], fLastRms[1]));
     666
    651667        fLastRms[1] = fLastRms[0];
    652668        fLastRms[0] = rms;
    653669
    654670        if (reject)
    655         {
    656             Warn("Suspicious temperature values rejecte for BIAS_TEMP.");
    657671            return;
    658         }
    659672
    660673        // Create interpolator for the corresponding sensor positions
     
    664677        if (!inter.SetOutputGrid(fPositionsBias))
    665678        {
    666             Warn("Temperature values rejecte for BIAS_TEMP (calculation of weights failed).");
     679            Warn("Interpolation for n="+to_string(xy.size())+" grid positions failed... rejected.");
    667680            return;
    668681        }
     
    859872        fFSC.SetVerbose(!conf.Get<bool>("quiet"));
    860873
     874        fFSC.SetTempMin(conf.Get<uint16_t>("temp-adc-min"));
     875        fFSC.SetTempMax(conf.Get<uint16_t>("temp-adc-max"));
     876
    861877        const string fname1 = conf.GetPrefixedString("sensor-pos-file");
    862878        const auto v1 = Interpolator2D::ReadGrid(fname1);
     
    903919        ("patch-pos-file",  var<string>()->required(),  "File with the positions of the 320 bias patches")
    904920        ("quiet,q",       po_bool(true),  "Disable printing contents of all received messages (except dynamic data) in clear text.")
     921        ("temp-adc-min",  var<uint16_t>(uint16_t(980)),  "Minimum ADC value for allowed range of temperature ADCs (default ~ -7.4 deg C)")
     922        ("temp-adc-max",  var<uint16_t>(uint16_t(1300)), "Maximum ADC value for allowed range of temperature ADCs (default ~ 76 deg C)")
    905923        ;
    906924
Note: See TracChangeset for help on using the changeset viewer.