Changeset 18338
- Timestamp:
- 09/30/15 10:51:13 (9 years ago)
- Location:
- trunk/FACT++/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/HeadersTNGWeather.h
r16960 r18338 18 18 DimWeather() { memset(this, 0, sizeof(DimWeather)); } 19 19 20 float fTemp10M; 21 float fTemp5M; 22 float fTemp2M; 23 float fTempGround; 24 float fDewPoint; 25 float fHumidity; 26 float fAirPressure; 27 float fWindSpeed; 28 float fWindDirection; 29 float fDeltaM1; 30 float fDustTotal; 31 float fSeeingMed; 32 float fSeeingStdev; 33 float fSolarimeter; 20 float fTemperature; 21 float fDewPoint; 22 float fHumidity; 23 float fAirPressure; 24 float fTrend; 25 float fWindSpeed; 26 float fWindDirection; 27 float fDustTotal; 28 double fSeeingMjd; 29 float fSeeing; 30 float fSeeingMed; 31 float fSeeingStdev; 32 float fSolarimeter; 34 33 35 34 } __attribute__((__packed__)); -
trunk/FACT++/src/tngweather.cc
r16955 r18338 138 138 Out() << "Parsed:\n-------\n" << doc.toString().toStdString() << endl; 139 139 140 const QDomElement root = doc.documentElement(); 141 const QDomElement item = root.firstChildElement("item"); 142 140 const QDomElement root = doc.documentElement(); 141 const QDomElement channel = root.firstChildElement("channel"); 142 const QDomElement item = channel.firstChildElement("item"); 143 144 const QDomElement see = item.firstChildElement("tngw:dimmSeeing"); 145 const QDomElement mjd = item.firstChildElement("tngw:dimmSeeing.date"); 143 146 const QDomElement med = item.firstChildElement("tngw:dimmSeeing.median"); 144 147 const QDomElement sdev = item.firstChildElement("tngw:dimmSeeing.stdev"); 145 148 const QDomElement dust = item.firstChildElement("tngw:dustTotal"); 146 const QDomElement delta = item.firstChildElement("tngw:deltaM1");149 const QDomElement trend = item.firstChildElement("tngw:trend"); 147 150 const QDomElement pres = item.firstChildElement("tngw:airPressure"); 148 151 const QDomElement dew = item.firstChildElement("tngw:dewPoint"); … … 150 153 const QDomElement speed = item.firstChildElement("tngw:windSpeed"); 151 154 const QDomElement hum = item.firstChildElement("tngw:hum"); 152 const QDomElement tmp0 = item.firstChildElement("tngw:tempGround"); 153 const QDomElement tmp2 = item.firstChildElement("tngw:temp2M"); 154 const QDomElement tmp5 = item.firstChildElement("tngw:temp5M"); 155 const QDomElement tmp10 = item.firstChildElement("tngw:temp10M"); 155 const QDomElement tmp = item.firstChildElement("tngw:temperature"); 156 156 const QDomElement solar = item.firstChildElement("tngw:solarimeter"); 157 157 const QDomElement date = item.firstChildElement("tngw:date"); 158 158 159 if ( med.isNull() || sdev.isNull() || dust.isNull() || delta.isNull() ||160 pres.isNull() || dew.isNull() || wdir.isNull() || speed.isNull()||161 hum.isNull() || hum.isNull() || tmp0.isNull() || tmp2.isNull() ||162 tmp5.isNull() || tmp10.isNull() || solar.isNull()|| date.isNull())159 if (see.isNull() || mjd.isNull() || med.isNull() || sdev.isNull() || 160 dust.isNull() || trend.isNull() || pres.isNull() || dew.isNull() || 161 wdir.isNull() || speed.isNull() || hum.isNull() || tmp.isNull() || 162 solar.isNull()|| date.isNull()) 163 163 { 164 164 Warn("Parsing of xml failed [1]."); … … 168 168 169 169 DimWeather w; 170 w.fSeeingMjd = Time(mjd.text().toStdString()).Mjd(); 171 w.fSeeing = see .text().toFloat(); 170 172 w.fSeeingMed = med .text().toFloat(); 171 173 w.fSeeingStdev = sdev .text().toFloat(); 172 174 w.fDustTotal = dust .text().toFloat(); 173 w.f DeltaM1 = delta.text().toFloat();175 w.fTrend = trend.text().toFloat(); 174 176 w.fAirPressure = pres .text().toFloat(); 175 177 w.fDewPoint = dew .text().toFloat(); … … 177 179 w.fWindSpeed = speed.text().toFloat()*3.6; 178 180 w.fHumidity = hum .text().toFloat(); 179 w.fTempGround = tmp0 .text().toFloat(); 180 w.fTemp2M = tmp2 .text().toFloat(); 181 w.fTemp5M = tmp5 .text().toFloat(); 182 w.fTemp10M = tmp10.text().toFloat(); 181 w.fTemperature = tmp .text().toFloat(); 183 182 w.fSolarimeter = solar.text().toFloat(); 184 183 … … 203 202 Out() << endl; 204 203 Out() << "Date: " << time << endl; 204 Out() << "Seeing: " << w.fSeeing << " [" << Time(w.fSeeingMjd) << "]" << endl; 205 205 Out() << "Seeing: " << w.fSeeingMed << " +- " << w.fSeeingStdev << endl; 206 206 Out() << "DustTotal: " << w.fDustTotal << endl; 207 Out() << "DeltaM1: " << w.fDeltaM1 << endl;208 207 Out() << "AirPressure: " << w.fAirPressure << endl; 208 Out() << "Trend: " << w.fTrend << endl; 209 209 Out() << "DewPoint: " << w.fDewPoint << endl; 210 210 Out() << "WindDirection: " << w.fWindDirection << endl; 211 211 Out() << "WindSpeed: " << w.fWindSpeed << endl; 212 212 Out() << "Humidity: " << w.fHumidity << endl; 213 Out() << "TempGround: " << w.fTempGround << endl; 214 Out() << "Temp2M: " << w.fTemp2M << endl; 215 Out() << "Temp5M: " << w.fTemp5M << endl; 216 Out() << "Temp10M: " << w.fTemp10M << endl; 213 Out() << "Temperature: " << w.fTemperature << endl; 217 214 Out() << "Solarimeter: " << w.fSolarimeter << endl; 218 215 Out() << endl; … … 247 244 const string cmd = 248 245 "GET "+fSite+" HTTP/1.1\r\n" 246 "User-Agent: FACT tngweather\r\n" 249 247 "Accept: */*\r\n" 250 "Content-Type: application/octet-stream\r\n" 248 "Host: "+Address()+"\r\n" 249 "Connection: close\r\n"//Keep-Alive\r\n" 250 "Content-Type: application/rss+xml\r\n" 251 251 "User-Agent: FACT\r\n" 252 "Host: www.fact-project.org\r\n"253 252 "Pragma: no-cache\r\n" 254 253 "Cache-Control: no-cache\r\n" 255 254 "Expires: 0\r\n" 256 "Connection: Keep-Alive\r\n"257 255 "Cache-Control: max-age=0\r\n" 258 256 "\r\n"; … … 378 376 ConnectionDimWeather(ba::io_service& ioservice, MessageImp &imp) : 379 377 ConnectionWeather(ioservice, imp), 380 fDimWeather("TNG_WEATHER/DATA", "F:1;F:1;F:1;F:1;F:1;F:1;F:1;F:1;F:1;F:1;F:1;F:1;F:1;F:1", 381 "|T_10M[deg C]:Temperature 10m above ground" 382 "|T_5M[deg C]:Temperature 5m above ground" 383 "|T_2M[deg C]:Temperature 2m above ground" 384 "|T_0[deg C]:Temperature at ground" 378 fDimWeather("TNG_WEATHER/DATA", "F:1;F:1;F:1;F:1;F:1;F:1;F:1;F:1;D:1;F:1;F:1;F:1;F:1", 379 "|T[deg C]:Temperature" 385 380 "|T_dew[deg C]:Dew point" 386 381 "|H[%]:Humidity" 387 382 "|P[mbar]:Air pressure" 383 "|Trend" 388 384 "|v[km/h]:Wind speed" 389 385 "|d[deg]:Wind direction (N-E)" 390 "|DeltaM1"391 386 "|Dust[ug/m^3]:Dust (total)" 387 "|SeeingDate[mjd]:Seeing MJD" 388 "|Seeing[arcsec]:Seeing" 392 389 "|Seeing[arcsec]:Seeing Median" 393 390 "|SeeingStdev[arcsec]:Seeing Stdev" … … 522 519 ("no-dim,d", po_switch(), "Disable dim services") 523 520 ("addr,a", var<string>("tngweb.tng.iac.es:80"), "Network address of Cosy") 524 ("url,u", var<string>("/ weather/rss/"), "File name and path to load")521 ("url,u", var<string>("/api/meteo/weather/feed.xml"), "File name and path to load") 525 522 ("quiet,q", po_bool(true), "Disable printing contents of all received messages (except dynamic data) in clear text.") 526 523 ("interval,i", var<uint16_t>(300), "Interval between two updates on the server in seconds")
Note:
See TracChangeset
for help on using the changeset viewer.