Inheritance: ICohortDisturbance
コード例 #1
0
        //---------------------------------------------------------------------

        public static Event Initiate(ActiveSite site,
                                     int        currentTime,
                                     int        timestep)
        {
            IFireRegion ecoregion = SiteVars.FireRegion[site];
            
            //Adjust ignition probability (measured on an annual basis) for the 
            //user determined fire time step.
            double ignitionProb = ecoregion.IgnitionProbability * timestep;

            //The initial site must exceed the probability of initiation and
            //have a severity > 0 and exceed the ignition threshold:

            if (PlugIn.ModelCore.GenerateUniform() <= ignitionProb
                && PlugIn.ModelCore.GenerateUniform() <= ComputeFireInitSpreadProb(site, currentTime)
                && CalcSeverity(site, currentTime) > 0) 
            {
                Event FireEvent = new Event(site);
                FireEvent.Spread(currentTime);
                return FireEvent;
            }
            else
                return null;
        }
コード例 #2
0
        //---------------------------------------------------------------------

        private void LogEvent(int   currentTime,
                              Event FireEvent)
        {
            int totalSitesInEvent = 0;
            if (FireEvent.Severity > 0)
            {
                log.Write("{0},{1},{2},{3},{4},{5:0.0}",
                          currentTime,
                          FireEvent.StartLocation.Row,
                          FireEvent.StartLocation.Column,
                          FireEvent.NumSiteChecked,
                          FireEvent.CohortsKilled,
                          FireEvent.Severity);

                foreach (IFireRegion fireregion in FireRegions.Dataset)
                {
                    log.Write(",{0}", FireEvent.SitesInEvent[fireregion.Index]);
                    totalSitesInEvent += FireEvent.SitesInEvent[fireregion.Index];
                    summaryFireRegionEventCount[fireregion.Index] += FireEvent.SitesInEvent[fireregion.Index];
                }
                summaryTotalSites += totalSitesInEvent;
                log.Write(", {0}", totalSitesInEvent);
                log.WriteLine("");
            }
        }