//--------------------------------------------------------------------- public MoreEcoregionParameters( double meanSize, double standardDeviation, int springFMCLo, int springFMCHi, double springFMCHiProp, int summerFMCLo, int summerFMCHi, double summerFMCHiProp, int fallFMCLo, int fallFMCHi, double fallFMCHiProp, FuelTypeCode openFuelType, double ecoIgnitionProb ) { this.meanSize = meanSize; this.standardDeviation = standardDeviation; this.springFMCLo = springFMCLo; this.springFMCHi = springFMCHi; this.springFMCHiProp = springFMCHiProp; this.summerFMCLo = summerFMCLo; this.summerFMCHi = summerFMCHi; this.summerFMCHiProp = summerFMCHiProp; this.fallFMCLo = fallFMCLo; this.fallFMCHi = fallFMCHi; this.fallFMCHiProp = fallFMCHiProp; this.openFuelType = openFuelType; this.ecoIgnitionProb = ecoIgnitionProb; this.ecoregionSites = new List<Location>(); }
//--------------------------------------------------------------------- public MoreEcoregionParameters() { this.meanSize = 0.0; this.standardDeviation = 0.0; this.springFMCLo = 0; this.springFMCHi = 0; this.springFMCHiProp = 0.0; this.summerFMCLo = 0; this.summerFMCHi = 0; this.summerFMCHiProp = 0.0; this.fallFMCLo = 0; this.fallFMCHi = 0; this.fallFMCHiProp = 0.0; this.openFuelType = FuelTypeCode.O1a; this.ecoIgnitionProb = 1.0; this.ecoregionSites = new List<Location>(); }
//--------------------------------------------------------------------- private bool Spread(ActiveSite initiationSite, SizeType fireSizeType, bool BUI) { //First, check for fire overlap: if(SiteVars.Event[initiationSite] != null) return false; UI.WriteLine(" Fire spreading... "); IEcoregion ecoregion = SiteVars.Ecoregion[initiationSite]; this.initiationEcoregion = (int) ecoregion.MapCode; IMoreEcoregionParameters fireParms = ecoregion.MoreEcoregionParameters; int totalSiteSeverities = 0; int siteCohortsKilled = 0; totalSitesDamaged = 1; //Calculate Size or Duration: this.maxFireParameter = ComputeSize(fireParms.MeanSize, fireParms.StandardDeviation, fireSizeType); //FuelTypeCode activeFT = (FuelTypeCode) SiteVars.CFSFuelType[initiationSite]; this.initiationFuel = (FuelTypeCode) SiteVars.CFSFuelType[initiationSite]; this.initiationPercentConifer = SiteVars.PercentConifer[initiationSite]; //UI.WriteLine(" Calculated max fire size or duration = {0:0.0}", maxFireParameter); //UI.WriteLine(" Fuel Type = {0}", activeFT.ToString()); //Next, calculate the fire area: List<Site> FireLocations = new List<Site>(); //-----Edited by BRM----- FireLocations = EventRegion.SizeFireCostSurface(this, fireSizeType); //---------- //Attach travel time weights here List<WeightedSites> FireCostSurface = new List<WeightedSites>(0); foreach(Site site in FireLocations) { FireCostSurface.Add(new WeightedSites(site, SiteVars.TravelTime[site])); } FireCostSurface.Sort(CompareWeights); FireLocations = new List<Site>(); double cellArea = (Model.Core.CellLength * Model.Core.CellLength) / 10000; //convert to ha double totalArea = 0.0; int cellCnt = 0; //-----Added by BRM----- double durMax = 0; //---------- int weightInd = 0; if (fireSizeType == SizeType.size_based) { foreach(WeightedSites weighted in FireCostSurface) { //weightCnt++; cellCnt++; if(totalArea > this.maxFireParameter) { //-----Added by BRM----- if (durMax == 0) { foreach (WeightedSites testweight in FireCostSurface) { if (weightInd == 1) { durMax = SiteVars.TravelTime[testweight.Site]; } else { if (testweight == weighted) { weightInd = 1; } } } } //---------- SiteVars.TravelTime[weighted.Site] = Double.PositiveInfinity; SiteVars.Event[weighted.Site] = null; } else { totalArea += cellArea; FireLocations.Add(weighted.Site); //-----Added by BRM----- if (SiteVars.TravelTime[weighted.Site] > durMax) durMax = SiteVars.TravelTime[weighted.Site]; //---------- } } //-----Added by BRM----- this.maxDuration = durMax; //---------- //UI.WriteLine(" CellCnt = {0}, BurnedArea = {1:0.0} (ha), targetArea = {2:0.0} (ha).", cellCnt, totalArea, this.maxFireParameter); if(totalArea < this.maxFireParameter) UI.WriteLine("POSSIBLE ERROR: Check map for partial area!"); } else if (fireSizeType == SizeType.duration_based) { foreach(WeightedSites weighted in FireCostSurface) { cellCnt++; if(weighted.Weight > this.maxFireParameter) { SiteVars.TravelTime[weighted.Site] = Double.PositiveInfinity; SiteVars.Event[weighted.Site] = null; } else { totalArea += cellArea; FireLocations.Add(weighted.Site); //-----Added by BRM----- if (SiteVars.TravelTime[weighted.Site] > durMax) durMax = SiteVars.TravelTime[weighted.Site]; //---------- } } //-----Added by BRM----- this.maxDuration = durMax; //---------- UI.WriteLine(" CellCnt = {0}, BurnedArea = {1:0.0} (ha), target duration = {2:0.0}.", cellCnt, totalArea, this.maxFireParameter); } foreach(Site site in FireLocations) { currentSite = site as ActiveSite; if(currentSite.IsActive) { this.numSitesChecked++; this.siteSeverity = FireSeverity.CalcFireSeverity(currentSite, this); siteCohortsKilled = Damage(currentSite); //if (siteCohortsKilled > 0) //{ //UI.WriteLine(" Damaged Cohorts = {0}, Severity = {1}.", siteCohortsKilled, siteSeverity); this.totalSitesDamaged++; totalSiteSeverities += this.siteSeverity; IEcoregion siteEcoregion = SiteVars.Ecoregion[site]; sitesInEvent[siteEcoregion.Index]++; SiteVars.Disturbed[currentSite] = true; SiteVars.Severity[currentSite] = (byte) siteSeverity; //} } } if (this.totalSitesDamaged == 0) this.eventSeverity = 0; else this.eventSeverity = ((double) totalSiteSeverities) / this.totalSitesDamaged; return true; }