Changeset 19712 for trunk/FACT++


Ignore:
Timestamp:
10/03/19 12:23:30 (5 years ago)
Author:
tbretz
Message:
Added GTC dust measurements
Location:
trunk/FACT++
Files:
1 added
3 edited

Legend:

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

    r19559 r19712  
    4343#include "HeadersRateControl.h"
    4444#include "HeadersTNGWeather.h"
     45#include "HeadersGTC.h"
    4546#include "HeadersMagicLidar.h"
    4647#include "HeadersMagicWeather.h"
     
    548549    Time  fTngWeatherDustTime;
    549550
     551    deque<float> fGtcDustHist;
     552    Time  fGtcDustTime;
     553
    550554    deque<float> fRainSensorDataHist;
    551555    Time  fRainSensorDataTime;
     
    638642    DimDescribedState fDimMagicLidar;
    639643    DimDescribedState fDimTngWeather;
     644    DimDescribedState fDimGtcDust;
    640645    DimDescribedState fDimTemperature;
    641646    DimDescribedState fDimRainSensor;
     
    10301035        else
    10311036            out << "\t\n";
     1037        out << HTML::kWhite << '\t';
     1038        if (!fGtcDustHist.empty())
     1039            out << fGtcDustHist.back() << '\t' << fGtcDustTime.GetAsStr("%H:%M") << '\n';
     1040        else
     1041            out << "\t\n";
    10321042
    10331043        ofstream(fPath+"/weather.data") << out.str();
     
    10921102        return GetCurrentState();
    10931103    }
     1104
     1105    int HandleGtcDustData(const EventImp &d)
     1106    {
     1107        if (!CheckDataSize(d, "GtcDust:Data", 4))
     1108            return GetCurrentState();
     1109
     1110        fGtcDustTime = d.GetTime();
     1111
     1112        fGtcDustHist.push_back(d.GetFloat());
     1113        if (fGtcDustHist.size()>300)
     1114                fGtcDustHist.pop_front();
     1115
     1116        const Statistics stat(fGtcDustHist);
     1117
     1118        const double scale = stat.max>0 ? pow(10, ceil(log10(stat.max))) : 0;
     1119
     1120        WriteHist(d, "hist-gtc-dust", fGtcDustHist, scale);
     1121
     1122        ostringstream out;
     1123        out << d.GetJavaDate() << '\n';
     1124
     1125        ofstream(fPath+"/gtcdust.data") << out.str();
     1126
     1127        return GetCurrentState();
     1128    }
     1129
    10941130
    10951131    int HandleRainSensorData(const EventImp &d)
     
    23012337        Out() << fDimMagicWeather   << endl;
    23022338        Out() << fDimTngWeather     << endl;
     2339        Out() << fDimGtcDust        << endl;
    23032340        Out() << fDimMagicLidar     << endl;
    23042341        Out() << fDimTemperature    << endl;
     
    32683305            out << GetStateHtml(fDimMagicWeather,   MagicWeather::State::kConnected);
    32693306            out << GetStateHtml(fDimTngWeather,     TNGWeather::State::kConnected);
     3307            out << GetStateHtml(fDimGtcDust,        GTC::State::kReceiving);
    32703308            out << GetStateHtml(fDimMagicLidar,     MagicLidar::State::kConnected);
    32713309            out << GetStateHtml(fDimTemperature,    Temperature::State::kValid);
     
    33183356        fLastRunFinishedWithZeroEvents(false),
    33193357        fTngWeatherDustTime(Time::none),
     3358        fGtcDustTime(Time::none),
    33203359        fBiasControlVoltageMed(0),
    33213360        fBiasControlCurrentMed(0),
     
    33373376        fDimMagicLidar    ("MAGIC_LIDAR"),
    33383377        fDimTngWeather    ("TNG_WEATHER"),
     3378        fDimGtcDust       ("GTC_DUST"),
    33393379        fDimTemperature   ("TEMPERATURE"),
    33403380        fDimRainSensor    ("RAIN_SENSOR"),
     
    33673407        fDimMagicLidar.Subscribe(*this);
    33683408        fDimTngWeather.Subscribe(*this);
     3409        fDimGtcDust.Subscribe(*this);
    33693410        fDimTemperature.Subscribe(*this);
    33703411        fDimRainSensor.Subscribe(*this);
     
    34423483        Subscribe("TNG_WEATHER/DATA")
    34433484            (bind(&StateMachineSmartFACT::HandleTngWeatherData,      this, placeholders::_1));
     3485        Subscribe("GTC_DUST/DATA")
     3486            (bind(&StateMachineSmartFACT::HandleGtcDustData,         this, placeholders::_1));
    34443487        Subscribe("RAIN_SENSOR/DATA")
    34453488            (bind(&StateMachineSmartFACT::HandleRainSensorData,      this, placeholders::_1));
  • trunk/FACT++/www/smartfact/struct/status.page

    r19557 r19712  
    2424|Magic Weather|$0|
    2525|TNG Weather|$0|tngdata
     26|GTC Dust|$0|gtcdust
    2627|Magic Lidar|$0|
    2728|Temperature|$0|temperature
  • trunk/FACT++/www/smartfact/struct/weather.page

    r14623 r19712  
    1010|Wind direction|$0
    1111|Dust (TNG)|$0 &micro;g/m&sup3; [$1]|tngdust
     12|Dust (GTC)|$0 &micro;g/m&sup3; [$1]|gtcdust
    1213
Note: See TracChangeset for help on using the changeset viewer.