//--------------------------------------------------------------------- public static void LogEvent(int currentTime, FireEvent fireEvent) { PlugIn.eventLog.Clear(); EventsLog el = new EventsLog(); el.SimulationYear = currentTime; el.InitRow = fireEvent.initiationSite.Location.Row; el.InitColumn = fireEvent.initiationSite.Location.Column; el.InitialFireWeatherIndex = fireEvent.InitiationFireWeatherIndex; el.IgnitionType = fireEvent.IgnitionType.ToString(); el.InitialDayOfYear = fireEvent.IgnitionDay; el.NumberOfDays = fireEvent.NumberOfDays; el.MeanSpreadProbability = fireEvent.MeanSpreadProbability / (double)fireEvent.TotalSitesDamaged; el.MeanFWI = fireEvent.MeanFWI / (double)fireEvent.TotalSitesDamaged; el.TotalSitesBurned = fireEvent.TotalSitesDamaged; el.CohortsKilled = fireEvent.CohortsKilled; el.MeanSeverity = fireEvent.MeanSeverity / (double)fireEvent.TotalSitesDamaged; el.MeanWindDirection = fireEvent.MeanWindDirection / (double)fireEvent.TotalSitesDamaged; el.MeanWindSpeed = fireEvent.MeanWindSpeed / (double)fireEvent.TotalSitesDamaged; el.MeanEffectiveWindSpeed = fireEvent.MeanEffectiveWindSpeed / (double)fireEvent.TotalSitesDamaged; el.MeanSuppressionEffectiveness = fireEvent.MeanSuppression / (double)fireEvent.TotalSitesDamaged; el.TotalBiomassMortality = fireEvent.TotalBiomassMortality; el.NumberCellsSeverity1 = fireEvent.NumberCellsSeverity1; el.NumberCellsSeverity2 = fireEvent.NumberCellsSeverity2; el.NumberCellsSeverity3 = fireEvent.NumberCellsSeverity3; PlugIn.eventLog.AddObject(el); PlugIn.eventLog.WriteToFile(); }
//--------------------------------------------------------------------- public static FireEvent Initiate(ActiveSite initiationSite, int timestep, int day, IgnitionType ignitionType) { //PlugIn.ModelCore.UI.WriteLine(" Fire Event initiated. Day = {0}, IgnitionType = {1}.", day, ignitionType); if (isDebugEnabled) { PlugIn.ModelCore.UI.WriteLine(" Fire event started at {0} ...", initiationSite.Location); } FireEvent fireEvent = new FireEvent(initiationSite, day, ignitionType); PlugIn.EventID++; ActiveSite[] initialSites = new ActiveSite[2]; initialSites[0] = (ActiveSite)initiationSite; initialSites[1] = (ActiveSite)initiationSite; fireSites = new List <ActiveSite[]>(); fireSites.Add(initialSites); // desitination and source are the same for ignition site fireEvent.Spread(PlugIn.ModelCore.CurrentTime, day); LogEvent(PlugIn.ModelCore.CurrentTime, fireEvent, PlugIn.EventID); return(fireEvent); }
//--------------------------------------------------------------------- // Ignites and Spreads a fire private static bool Ignite(IgnitionType ignitionType, ActiveSite site, int day, double fireWeatherIndex) { if (SiteVars.Disturbed[site]) { return(false); } FireEvent fireEvent = FireEvent.Initiate(site, modelCore.CurrentTime, day, ignitionType); totalBurnedSites[(int)ignitionType] += fireEvent.TotalSitesBurned; numberOfFire[(int)ignitionType]++; totalBiomassMortality[(int)ignitionType] += (int)fireEvent.TotalBiomassMortality; dNBR[(int)ignitionType] += (int)fireEvent.SiteMortality; return(true); }
//--------------------------------------------------------------------- // Ignites and Spreads a fire private static void Ignite(Ignition ignitionType, List <ActiveSite> shuffledFireSites, int day, double fireWeatherIndex) { while (shuffledFireSites.Count() > 0 && SiteVars.Disturbed[shuffledFireSites.First()] == true) { shuffledFireSites.Remove(shuffledFireSites.First()); } if (shuffledFireSites.Count() > 0) { FireEvent fireEvent = FireEvent.Initiate(shuffledFireSites.First(), modelCore.CurrentTime, day, ignitionType); totalBurnedSites[(int)ignitionType] += fireEvent.TotalSitesDamaged; numberOfFire[(int)ignitionType]++; totalBiomassMortality[(int)ignitionType] += (int)fireEvent.TotalBiomassMortality; numCellsSeverity1 += fireEvent.NumberCellsSeverity1; numCellsSeverity2 += fireEvent.NumberCellsSeverity2; numCellsSeverity3 += fireEvent.NumberCellsSeverity3; } }
//--------------------------------------------------------------------- public static void LogEvent(int currentTime, FireEvent fireEvent, int eventID) { PlugIn.eventLog.Clear(); EventsLog el = new EventsLog(); el.EventID = eventID; el.SimulationYear = currentTime; el.InitRow = fireEvent.initiationSite.Location.Row; el.InitColumn = fireEvent.initiationSite.Location.Column; el.InitialFireWeatherIndex = fireEvent.InitiationFireWeatherIndex; el.IgnitionType = fireEvent.IgnitionType.ToString(); el.InitialDayOfYear = fireEvent.IgnitionDay; el.NumberOfDays = fireEvent.NumberOfDays; el.MaximumSpreadArea = fireEvent.MaxSpreadArea; el.MeanSpreadProbability = fireEvent.MeanSpreadProbability / (double)fireEvent.TotalSitesSpread; el.MeanFWI = fireEvent.MeanFWI / (double)fireEvent.TotalSitesBurned; el.TotalSitesBurned = fireEvent.TotalSitesBurned; el.CohortsKilled = fireEvent.CohortsKilled; el.AvailableCohorts = fireEvent.AvailableCohorts; el.MeanSeverity = fireEvent.MeanIntensity / (double)fireEvent.TotalSitesBurned; el.MeanPET = fireEvent.MeanPET / (double)fireEvent.TotalSitesBurned; el.MeanWD = fireEvent.MeanWD / (double)fireEvent.TotalSitesBurned; el.MeanClay = fireEvent.MeanClay / (double)fireEvent.TotalSitesBurned; el.MeanFineFuels = fireEvent.MeanFineFuels / (double)fireEvent.TotalSitesBurned; el.MeanLadderFuels = fireEvent.MeanLadderFuels / (double)fireEvent.TotalSitesBurned; el.MeanDNBR = fireEvent.MeanDNBR / (double)fireEvent.TotalSitesBurned; el.MeanWindDirection = fireEvent.MeanWindDirection / (double)fireEvent.TotalSitesBurned; el.MeanWindSpeed = fireEvent.MeanWindSpeed / (double)fireEvent.TotalSitesBurned; el.MeanEffectiveWindSpeed = fireEvent.MeanEffectiveWindSpeed / (double)fireEvent.TotalSitesBurned; el.MeanSuppressionEffectiveness = fireEvent.MeanSuppression / (double)fireEvent.TotalSitesSpread; el.TotalBiomassMortality = fireEvent.TotalBiomassMortality; //el.NumberCellsSeverity1 = fireEvent.NumberCellsSeverity1; //el.NumberCellsSeverity2 = fireEvent.NumberCellsSeverity2; //el.NumberCellsSeverity3 = fireEvent.NumberCellsSeverity3; //el.NumberCellsSeverity4 = fireEvent.NumberCellsSeverity4; //el.NumberCellsSeverity5 = fireEvent.NumberCellsSeverity5; //el.PercentsCellsIntensityFactor1 = (double) fireEvent.NumberCellsIntensityFactor1 / (double)fireEvent.TotalSitesBurned; //el.PercentsCellsIntensityFactor2 = (double)fireEvent.NumberCellsIntensityFactor2 / (double)fireEvent.TotalSitesBurned; //el.PercentsCellsIntensityFactor3 = (double)fireEvent.NumberCellsIntensityFactor3 / (double)fireEvent.TotalSitesBurned; PlugIn.eventLog.AddObject(el); PlugIn.eventLog.WriteToFile(); }