Changeset 19585 for trunk


Ignore:
Timestamp:
09/01/19 12:23:53 (5 years ago)
Author:
tbretz
Message:
Print a warning rather when the reading is close to the lower liit rather than temperature below 0degC, further improved output
File:
1 edited

Legend:

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

    r19584 r19585  
    6161    }
    6262
    63 private:
     63public:
    6464    //
    6565    // From: http://de.wikipedia.org/wiki/Pt100
    6666    //
    67     double GetTempPT1000(double R) const
     67    static double GetTempPT1000(double R)
    6868    {
    6969        // This is precise within the range 5degC and 25degC
     
    8383    }
    8484
     85private:
    8586    bool CheckChecksum()
    8687    {
     
    252253            humidities.push_back((volt[*ph]-offrh[idx])*0.0313);
    253254
     255
    254256        //1019=4.8
    255257        //1005=1.3
     
    257259        //1300=76
    258260        //DD 2019/09/01: changed from 970 to 980 as sensor 19 had values slighly larger than -7.6
     261
     262        const auto min = GetTempPT1000(fTempMin);
     263
    259264        for (int *pt=mapt; *pt>=0; pt++)
    260             temperatures.push_back(resist[*pt]>=fTempMin && resist[*pt]<=fTempMax ? GetTempPT1000(resist[*pt]) : 0);
     265        {
     266            const bool valid = resist[*pt]>=fTempMin && resist[*pt]<=fTempMax;
     267            temperatures.push_back(valid ? GetTempPT1000(resist[*pt]) : 0);
     268
     269            if (valid && temperatures.back()<min+1)
     270                Warn(Tools::Form("Temperature sensor %2d has reading (%d=%.2f degC) closer than 1K to lower limit (%d=%.2f degC)",
     271                                 temperatures.size()-1, resist[*pt], temperatures.back(), fTempMin, min));
     272
     273        }
    261274
    262275        // 0 = 3-(3+0)%4
     
    592605    }
    593606
     607    uint16_t GetTempMin() const
     608    {
     609        return fTempMin;
     610    }
     611
     612    uint16_t GetTempMax() const
     613    {
     614        return fTempMax;
     615    }
     616
    594617    bool IsOpen() const
    595618    {
     
    637660            if (temp[i]!=0)
    638661            {
    639                 if (temp[i]<0)
    640                     Warn(Tools::Form("Temperature sensor %2d has negative temperature (%7.2f deg C)", i, temp[i]));
    641 
    642662                T.emplace_back(temp[i]);
    643663                xy.emplace_back(fPositionsSensors[i]);
     
    875895        fFSC.SetTempMax(conf.Get<uint16_t>("temp-adc-max"));
    876896
     897        T::Info(Tools::Form("Accepting temperatures between %.2f degC (%d) and %.2f degC (%d)",
     898                        S::GetTempPT1000(fFSC.GetTempMin()), fFSC.GetTempMin(),
     899                        S::GetTempPT1000(fFSC.GetTempMax()), fFSC.GetTempMax()));
     900
    877901        const string fname1 = conf.GetPrefixedString("sensor-pos-file");
    878902        const auto v1 = Interpolator2D::ReadGrid(fname1);
     
    919943        ("patch-pos-file",  var<string>()->required(),  "File with the positions of the 320 bias patches")
    920944        ("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)")
     945        ("temp-adc-min",  var<uint16_t>(uint16_t(980)),  "Minimum ADC value for allowed range of temperature ADCs (default ~ -7.4 degC)")
     946        ("temp-adc-max",  var<uint16_t>(uint16_t(1300)), "Maximum ADC value for allowed range of temperature ADCs (default ~ 76 degC)")
    923947        ;
    924948
Note: See TracChangeset for help on using the changeset viewer.