Changeset 13675 for trunk/FACT++/src/smartfact.cc
- Timestamp:
- 05/12/12 18:05:53 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/smartfact.cc
r13643 r13675 19 19 #include "HeadersFTM.h" 20 20 21 namespace ba = boost::asio;22 namespace bs = boost::system;23 namespace dummy = ba::placeholders;24 25 21 using namespace std; 26 22 … … 60 56 Time fMcpConfigurationRunStart; 61 57 62 enum weather_t { kWeatherBegin=0, kTemp = kWeatherBegin, kDew, kHum, kPress, kWind, kGusts, kDir, kWeatherEnd = kDir };63 deque<float> fMagicWeatherHist[kWeatherEnd +1];58 enum weather_t { kWeatherBegin=0, kTemp = kWeatherBegin, kDew, kHum, kPress, kWind, kGusts, kDir, kWeatherEnd = kDir+1 }; 59 deque<float> fMagicWeatherHist[kWeatherEnd]; 64 60 65 61 vector<float> fFeedbackCalibration; … … 240 236 241 237 ofstream fout("www/"+fname+".bin"); 238 fout << offset << '\n'; 239 fout << offset+scale << '\n'; 242 240 fout.write(ptr, val.size()*sizeof(uint8_t)); 243 241 } … … 255 253 template<class T> 256 254 Statistics(const T &t, size_t offset_min=0, size_t offset_max=0) 257 { 255 : min(0), max(0), med(0), avg(0) 256 { 257 if (t.size()==0) 258 return; 259 258 260 T copy(t); 259 261 sort(copy.begin(), copy.end()); … … 294 296 ostringstream out; 295 297 out << setprecision(3); 296 out << uint64_t(d.time.UnixTime()*1000) << '\n';298 out << d.time.JavaDate() << '\n'; 297 299 298 300 out << "#ffffff\t" << fMagicWeatherHist[i].back() << '\n'; … … 312 314 313 315 // Store a history of the last 300 entries 314 for (int i=kWeatherBegin; i< =kWeatherEnd; i++)316 for (int i=kWeatherBegin; i<kWeatherEnd; i++) 315 317 { 316 318 fMagicWeatherHist[i].push_back(d.ptr<float>(2)[i]); … … 330 332 331 333 ostringstream out; 332 out << uint64_t(d.time.UnixTime()*1000) << '\n';334 out << d.time.JavaDate() << '\n'; 333 335 for (int i=0; i<6; i++) 334 336 out << "#ffffff\t" << fMagicWeatherHist[i].back() << '\n'; … … 367 369 368 370 ostringstream out; 369 out << uint64_t(d.time.UnixTime()*1000) << '\n';371 out << d.time.JavaDate() << '\n'; 370 372 371 373 out << setprecision(5); … … 373 375 out << az << '\n'; 374 376 375 ofstream fout("www/drive-pointing.txt"); 376 fout << out.str(); 377 ofstream("www/drive-pointing.txt") << out.str(); 377 378 } 378 379 … … 411 412 412 413 ostringstream out; 413 out << uint64_t(d.time.UnixTime()*1000) << '\n';414 out << d.time.JavaDate() << '\n'; 414 415 415 416 out << "#ffffff\t" << fDriveControlSourceName << '\n'; … … 421 422 out << "#ffffff\t" << wang << '\n'; 422 423 423 ofstream fout("www/drive.txt"); 424 fout << out.str(); 424 ofstream("www/drive.txt") << out.str(); 425 425 } 426 426 … … 462 462 ostringstream out; 463 463 out << setprecision(3); 464 out << uint64_t(d.time.UnixTime()*1000) << '\n';464 out << d.time.JavaDate() << '\n'; 465 465 out << kHtmlWhite << '\t' << stat.min << '\n'; 466 466 out << kHtmlWhite << '\t' << stat.med << '\n'; … … 513 513 ostringstream out; 514 514 out << setprecision(3); 515 out << uint64_t(d.time.UnixTime()*1000) << '\n';515 out << d.time.JavaDate() << '\n'; 516 516 out << kHtmlWhite << '\t' << stat.min << '\n'; 517 517 out << kHtmlWhite << '\t' << stat.med << '\n'; … … 524 524 { 525 525 if (!CheckDataSize(d, "FtmControl:TriggerRates", 24+160+640+8)) 526 return; 527 528 // New run started 529 if (d.get<float>(20)<0) 526 530 return; 527 531 … … 547 551 ostringstream out; 548 552 out << setprecision(3); 549 out << uint64_t(d.time.UnixTime()*1000) << '\n';553 out << d.time.JavaDate() << '\n'; 550 554 out << "#ffffff\t" << fFtmControlTriggerRateCam << '\n'; 551 555 … … 556 560 557 561 out.str(""); 558 out << uint64_t(d.time.UnixTime()*1000) << '\n';562 out << d.time.JavaDate() << '\n'; 559 563 out << kHtmlWhite << '\t' << bstat.min << '\n'; 560 564 out << kHtmlWhite << '\t' << bstat.med << '\n'; … … 564 568 565 569 out.str(""); 566 out << uint64_t(d.time.UnixTime()*1000) << '\n';570 out << d.time.JavaDate() << '\n'; 567 571 out << kHtmlWhite << '\t' << pstat.min << '\n'; 568 572 out << kHtmlWhite << '\t' << pstat.med << '\n'; … … 570 574 out << kHtmlWhite << '\t' << pstat.max << '\n'; 571 575 ofstream("www/patchrates.txt") << out.str(); 572 573 574 576 } 575 577 … … 584 586 //const float *pos = d.ptr<float>(1440*sizeof(float)*3); 585 587 586 vector<float> max(320, -2 000);588 vector<float> max(320, -2); 587 589 for (int i=0; i<1440; i++) 588 590 { … … 591 593 592 594 const int idx = (fPixelMap.hw(i).hw()/9)*2+fPixelMap.hw(i).group(); 593 if (dat[i]>max[idx]) 594 max[idx]=dat[i]; 595 const double v = dat[i]/1000; 596 if (v>max[idx]) 597 max[idx]=v; 595 598 } 596 599 597 600 switch (d.qos) 598 601 { 599 case 0: WriteBinary("fadcontrol-eventdata", max, 2 000, -1000); break;600 case 1: WriteBinary("fadcontrol-eventdata", max, 2 000,0); break;601 default: WriteBinary("fadcontrol-eventdata", max, 250,0); break;602 case 0: WriteBinary("fadcontrol-eventdata", max, 2, -1); break; 603 case 1: WriteBinary("fadcontrol-eventdata", max, 2, 0); break; 604 default: WriteBinary("fadcontrol-eventdata", max, 0.25, 0); break; 602 605 } 603 606 } … … 646 649 ostringstream out; 647 650 out << setprecision(3); 648 out << uint64_t(d.time.UnixTime()*1000) << '\n';651 out << d.time.JavaDate() << '\n'; 649 652 out << "#ffffff\t" << min << '\n'; 650 653 out << "#ffffff\t" << avg << '\n'; … … 815 818 816 819 ostringstream out; 817 out << uint64_t(nearbyint(now.UnixTime()*1000)) << '\n';820 out << now.JavaDate() << '\n'; 818 821 out << setprecision(3); 819 822 … … 897 900 898 901 // --------------- MagicWeather ------------- 899 if (fDimMagicWeather.state()==3 )902 if (fDimMagicWeather.state()==3 && fMagicWeatherHist[kWeatherBegin].size()>0) 900 903 { 901 904 /* … … 938 941 939 942 // --------------- BiasControl ------------- 940 if (fDimBiasControl.state()==5 || // Ramping 941 fDimBiasControl.state()==7 || // On 942 fDimBiasControl.state()==9) // Off 943 if (fDimBiasControl.state()==BIAS::kRamping || 944 fDimBiasControl.state()==BIAS::kOverCurrent || 945 fDimBiasControl.state()==BIAS::kVoltageOn || 946 fDimBiasControl.state()==BIAS::kVoltageOff) 943 947 { 944 948 string col = fBiasControlVoltageMed>3?kHtmlGreen:kHtmlWhite; … … 950 954 if (fFeedbackCalibration.size()==0) 951 955 col = kHtmlBlue; 956 if (fDimBiasControl.state()==BIAS::kOverCurrent) 957 col = kHtmlRed; 952 958 953 959 if (fDimFeedback.state()==13) … … 956 962 out << "***\t"; 957 963 out << "***\t"; 958 out << "---\n";959 964 } 960 965 else … … 963 968 out << fBiasControlCurrentMed << '\t'; 964 969 out << fBiasControlCurrentMax << '\t'; 965 out << fBiasControlVoltageMed << '\n';966 970 } 971 out << fBiasControlVoltageMed << '\n'; 967 972 } 968 973 else … … 977 982 978 983 out.str(""); 979 out << uint64_t(nearbyint(now.UnixTime()*1000)) << '\n';984 out << now.JavaDate() << '\n'; 980 985 981 986 if (fDim.state()==0)
Note:
See TracChangeset
for help on using the changeset viewer.