Changeset 19015 for trunk/FACT++/src
- Timestamp:
- 05/24/18 10:07:45 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/smartfact.cc
r18972 r19015 44 44 #include "HeadersMagicWeather.h" 45 45 #include "HeadersTemperature.h" 46 #include "HeadersRainSensor.h" 46 47 47 48 #include <boost/filesystem.hpp> … … 545 546 Time fTngWeatherDustTime; 546 547 548 deque<float> fRainSensorDataHist; 549 Time fRainSensorDataTime; 550 547 551 vector<float> fBiasControlVoltageVec; 548 552 … … 633 637 DimDescribedState fDimTngWeather; 634 638 DimDescribedState fDimTemperature; 639 DimDescribedState fDimRainSensor; 635 640 DimDescribedState fDimFeedback; 636 641 DimDescribedState fDimBiasControl; … … 1057 1062 1058 1063 ofstream(fPath+"/tngdust.data") << out.str(); 1064 1065 return GetCurrentState(); 1066 } 1067 1068 int HandleRainSensorData(const EventImp &d) 1069 { 1070 if (!CheckDataSize(d, "RainSensor:Data", 12)) // F:1;X:1 1071 return GetCurrentState(); 1072 1073 fRainSensorDataTime = d.GetTime(); 1074 1075 fRainSensorDataHist.push_back(d.GetFloat()); 1076 if (fRainSensorDataHist.size()>300) 1077 fRainSensorDataHist.pop_front(); 1078 1079 const Statistics stat(fRainSensorDataHist); 1080 1081 const double scale = stat.max>0 ? pow(10, ceil(log10(stat.max))) : 0; 1082 1083 WriteHist(d, "hist-rain-sensor-data", fRainSensorDataHist, scale); 1084 1085 ostringstream out; 1086 out << d.GetJavaDate() << '\n'; 1087 1088 ofstream(fPath+"/rainsensor.data") << out.str(); 1059 1089 1060 1090 return GetCurrentState(); … … 2246 2276 Out() << fDimMagicLidar << endl; 2247 2277 Out() << fDimTemperature << endl; 2278 Out() << fDimRainSensor << endl; 2248 2279 Out() << fDimRateScan << endl; 2249 2280 Out() << fDimChat << endl; … … 3071 3102 col = HTML::kRed; 3072 3103 3073 out << col << '\t'; 3074 out << fMagicWeatherHist[kHum].back() << '\t'; 3104 if (fDimRainSensor.state()==RainSensor::State::kValid && !fRainSensorDataHist.empty() && fRainSensorDataHist.back()>0) 3105 { 3106 out << HTML::kRed << '\t'; 3107 out << "RAIN" << '\t'; 3108 } 3109 else 3110 { 3111 out << col << '\t'; 3112 out << fMagicWeatherHist[kHum].back() << '\t'; 3113 } 3075 3114 out << setprecision(2); 3076 3115 out << fMagicWeatherHist[kGusts].back() << '\n'; … … 3204 3243 out << GetStateHtml(fDimMagicLidar, MagicLidar::State::kConnected); 3205 3244 out << GetStateHtml(fDimTemperature, Temperature::State::kValid); 3245 out << GetStateHtml(fDimRainSensor, RainSensor::State::kValid); 3206 3246 out << GetStateHtml(fDimChat, 0); 3207 3247 out << GetStateHtml(fDimSkypeClient, 1); … … 3271 3311 fDimTngWeather ("TNG_WEATHER"), 3272 3312 fDimTemperature ("TEMPERATURE"), 3313 fDimRainSensor ("RAIN_SENSOR"), 3273 3314 fDimFeedback ("FEEDBACK"), 3274 3315 fDimBiasControl ("BIAS_CONTROL"), … … 3300 3341 fDimTngWeather.Subscribe(*this); 3301 3342 fDimTemperature.Subscribe(*this); 3343 fDimRainSensor.Subscribe(*this); 3302 3344 fDimFeedback.Subscribe(*this); 3303 3345 fDimBiasControl.Subscribe(*this); … … 3371 3413 Subscribe("TNG_WEATHER/DUST") 3372 3414 (bind(&StateMachineSmartFACT::HandleTngWeatherDust, this, placeholders::_1)); 3415 Subscribe("RAIN_SENSOR/DATA") 3416 (bind(&StateMachineSmartFACT::HandleRainSensorData, this, placeholders::_1)); 3373 3417 3374 3418 Subscribe("FEEDBACK/CALIBRATED_CURRENTS")
Note:
See TracChangeset
for help on using the changeset viewer.