void decode(char *data, int length, int noisy){ //int i; //for(i=0; i<length; i++){ // fprintf(stderr,"%0.2X ",data[i]); //} //fprintf(stderr,"\n"); */ time_t seconds = time (NULL); //There are two varieties of data, both of them have wind speed // first variety of the data if ((data[2] & 0x0f) == 1){ // this has wind speed, direction and rainfall if(noisy) fprintf(stderr,"Wind Speed: %.1f ",getWindSpeed(data)); weatherData.windSpeed = getWindSpeed(data); weatherData.wsTime = seconds; if(noisy) fprintf(stderr,"Wind Direction: %s ",Direction[getWindDirection(data)]); weatherData.wdTime = seconds; weatherData.windDirection = getWindDirection(data); if(noisy){ fprintf(stderr,"Rain Counter: %d ",getRainCount(data)); fprintf(stderr,"\n"); } weatherData.rainCounter = getRainCount(data); weatherData.rcTime = seconds; reportsSeen |= 0x01; //I've seen report 1 type 2 now } // this is the other variety if ((data[2] & 0x0f) == 8){ // this has wind speed, temp and relative humidity if(noisy) fprintf(stderr,"Wind Speed: %.1f ",getWindSpeed(data)); weatherData.windSpeed = getWindSpeed(data); weatherData.wsTime = seconds; if(noisy) fprintf(stderr,"Temperature: %.1f ",getTemp(data)); weatherData.temperature = getTemp(data); weatherData.tTime = seconds; if(noisy){ fprintf(stderr,"Humidity: %d ", getHumidity(data)); fprintf(stderr,"\n"); } weatherData.humidity = getHumidity(data); weatherData.hTime = seconds; reportsSeen |= 0x02; // I've seen report 1 type 2 now } }
int qml_interface::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QMainWindow::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: itFogz(); break; case 1: destroyAll(); break; case 2: fair(); break; case 3: pCloudy(); break; case 4: cloudy(); break; case 5: rain(); break; case 6: thunder(); break; case 7: snow(); break; case 8: updateSlot(); break; case 9: replyFinished((*reinterpret_cast< QNetworkReply*(*)>(_a[1]))); break; case 10: { QString _r = getWindSpeed(); if (_a[0]) *reinterpret_cast< QString*>(_a[0]) = _r; } break; case 11: { QString _r = getWindDirection(); if (_a[0]) *reinterpret_cast< QString*>(_a[0]) = _r; } break; case 12: { QString _r = getTemperature(); if (_a[0]) *reinterpret_cast< QString*>(_a[0]) = _r; } break; case 13: { QString _r = getTime(); if (_a[0]) *reinterpret_cast< QString*>(_a[0]) = _r; } break; case 14: { QString _r = depsurx(); if (_a[0]) *reinterpret_cast< QString*>(_a[0]) = _r; } break; case 15: { QString _r = arvsurx(); if (_a[0]) *reinterpret_cast< QString*>(_a[0]) = _r; } break; case 16: { QString _r = depsury(); if (_a[0]) *reinterpret_cast< QString*>(_a[0]) = _r; } break; case 17: { QString _r = arvsury(); if (_a[0]) *reinterpret_cast< QString*>(_a[0]) = _r; } break; case 18: { QString _r = depsurz(); if (_a[0]) *reinterpret_cast< QString*>(_a[0]) = _r; } break; case 19: { QString _r = arvsurz(); if (_a[0]) *reinterpret_cast< QString*>(_a[0]) = _r; } break; case 20: { QString _r = getNextUpdate(); if (_a[0]) *reinterpret_cast< QString*>(_a[0]) = _r; } break; case 21: { QString _r = getFrequence(); if (_a[0]) *reinterpret_cast< QString*>(_a[0]) = _r; } break; case 22: { QString _r = getSymbol(); if (_a[0]) *reinterpret_cast< QString*>(_a[0]) = _r; } break; case 23: ItFogs(); break; case 24: { int _r = getPositionCiel(); if (_a[0]) *reinterpret_cast< int*>(_a[0]) = _r; } break; case 25: setSymbol(); break; case 26: { QString _r = getRandomInteger(); if (_a[0]) *reinterpret_cast< QString*>(_a[0]) = _r; } break; default: ; } _id -= 27; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< Forecast*>(_v) = getCurrentForecast(); break; } _id -= 1; } else if (_c == QMetaObject::WriteProperty) { _id -= 1; } else if (_c == QMetaObject::ResetProperty) { _id -= 1; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 1; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 1; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 1; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 1; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 1; } #endif // QT_NO_PROPERTIES return _id; }
int CSimulateVariableWind::CalculateFireSpreading(double fTimeLimit){ int x,y; int x2,y2; int i,j; bool bReturn = false; /* neighbor's address*/ /* N NE E SE S SW W NW */ static int nX[8] = { 0, 1, 1, 1, 0, -1, -1, -1}; static int nY[8] = { 1, 1, 0, -1, -1, -1, 0, 1}; double fDist; /* distance to neighbor */ double fAz; /* compass azimuth to neighbor (0=N) */ size_t modelNumber; /* fuel model number at current cell */ double moisture[6]; /* fuel moisture content at current cell */ double dSpreadRate; /* spread rate in direction of neighbor */ double dSpreadTime; /* time to spread from cell to neighbor */ double dIgnTime; /* time neighbor is ignited by current cell */ double dWindSpd; double dWindDir; int iBurntCells = 0; while (m_CentralPoints.Get_Count()!=0){ for (int iPt=0; iPt<m_CentralPoints.Get_Count();iPt++){ x = m_CentralPoints.Get_X(iPt); y = m_CentralPoints.Get_Y(iPt); if (!m_pDEM->is_NoData(x,y) && !m_pFuelGrid->is_NoData(x,y)){ modelNumber = (size_t) m_pFuelGrid->asInt(x, y); moisture[0] = m_pM1Grid->asDouble(x, y) / 100.; moisture[1] = m_pM10Grid->asDouble(x, y) / 100.; moisture[2] = m_pM100Grid->asDouble(x, y) / 100.; moisture[3] = m_pM100Grid->asDouble(x, y) / 100.; moisture[4] = m_pMHerbGrid->asDouble(x, y) / 100.; moisture[5] = m_pMWoodGrid->asDouble(x, y) / 100.; dWindSpd = getWindSpeed(x, y, m_pTimeGrid->asDouble(x,y)) * KMH2FTMIN; dWindDir = 360. - getWindDirection(x, y, m_pTimeGrid->asDouble(x,y)); Fire_SpreadNoWindNoSlope(m_Catalog, modelNumber, moisture); Fire_SpreadWindSlopeMax(m_Catalog, modelNumber, dWindSpd, dWindDir, tan(m_pSlopeGrid->asDouble(x,y)), m_pAspectGrid->asDouble(x,y)); for (i = -2; i < 3 ; i++){ for (j = -2; j < 3; j++){ if (i!= 0 || j!=0){ x2 = x + i; y2 = y + j; if (m_pTimeGrid->is_InGrid(x2,y2,false)){ fAz = getAzimuth(i,j); Fire_SpreadAtAzimuth(m_Catalog, modelNumber, fAz, FIRE_BYRAMS); dSpreadRate = Fuel_SpreadAny(m_Catalog, modelNumber); // in ft/min (awkward...) dSpreadRate *= FTMIN2MMIN; //a bit better... if (dSpreadRate > Smidgen){ fDist = sqrt(pow(i,2.) + pow(j,2.)) * m_pTimeGrid->Get_Cellsize(); dSpreadTime = fDist / dSpreadRate; dIgnTime = m_pTimeGrid->asDouble(x,y) + dSpreadTime; if (dIgnTime < fTimeLimit){ if (m_pTimeGrid->asDouble(x2,y2) == 0.0 || m_pTimeGrid->asDouble(x2, y2)>dIgnTime){ m_pTimeGrid->Set_Value(x2, y2, dIgnTime); m_AdjPoints.Add(x2,y2); Fire_FlameScorch(m_Catalog, modelNumber, FIRE_FLAME); m_pFlameGrid->Set_Value(x2, y2, Fuel_FlameLength(m_Catalog, modelNumber) * FT2M); m_pIntensityGrid->Set_Value(x2, y2, Fuel_ByramsIntensity(m_Catalog, modelNumber) * BTU2KCAL / FT2M ); m_pReactionIntensityGrid->Set_Value(x2, y2, Fuel_RxIntensity(m_Catalog, modelNumber)); m_pHeatPerUnitAreaGrid->Set_Value(x2, y2, Fuel_HeatPerUnitArea(m_Catalog, modelNumber)); m_pEffectiveWindGrid->Set_Value(x2,y2, Fuel_EffectiveWind(m_Catalog, modelNumber)); }//if }//if }//if }//if }//if }//for }//for }//if }//for m_CentralPoints.Clear(); for (int i=0; i<m_AdjPoints.Get_Count(); i++){ x= m_AdjPoints.Get_X(i); y = m_AdjPoints.Get_Y(i); m_CentralPoints.Add(x, y); iBurntCells++; }//for m_AdjPoints.Clear(); if (fTimeLimit == NO_TIME_LIMIT){ Process_Get_Okay(true); }//if }//while return iBurntCells; }//method