Пример #1
0
        //---------------------------------------------------------------------

        private void RemoveCohort(int index,
                                  ICohort cohort,
                                  ActiveSite site,
                                  ExtensionType disturbanceType)
        {
            if (isDebugEnabled)
            {
                log.DebugFormat("  cohort removed: {0}, {1} yrs, {2} Mg/ha ({3})",
                                cohort.Species.Name, cohort.Age, cohort.Treenumber,
                                disturbanceType != null
                                    ? disturbanceType.Name
                                    : cohort.Age >= species.Longevity
                                        ? "senescence"
                                        : cohort.Treenumber == 0
                                            ? "attrition"
                                            : "UNKNOWN");
            }

            cohortData.RemoveAt(index);
            Cohort.Died(this, cohort, site, disturbanceType);
        }
Пример #2
0
        //---------------------------------------------------------------------

        /// <summary>
        /// Grows an individual cohort for a year, incrementing its age by 1
        /// and updating its biomass for annual growth and mortality.
        /// </summary>
        /// <param name="index">
        /// The index of the cohort to grow; it must be between 0 and Count - 1.
        /// </param>
        /// <param name="site">
        /// The site where the species' cohorts are located.
        /// </param>
        /// <param name="siteBiomass">
        /// The total biomass at the site.  This parameter is changed by the
        /// same amount as the current cohort's biomass.
        /// </param>
        /// <param name="prevYearSiteMortality">
        /// The total mortality at the site during the previous year.
        /// </param>
        /// <param name="cohortMortality">
        /// The total mortality (excluding annual leaf litter) for the current
        /// cohort.
        /// </param>
        /// <returns>
        /// The index of the next younger cohort.  Note this may be the same
        /// as the index passed in if that cohort dies due to senescence.
        /// </returns>
        public int GrowCohort(int index,
                              ActiveSite site)
        {
            Debug.Assert(0 <= index && index <= cohortData.Count);
            Debug.Assert(site != null);

            Cohort cohort = new Cohort(species, cohortData[index]);

            if (isDebugEnabled)
            {
                log.DebugFormat("  grow cohort: {0}, {1} yrs, {2} Mg/ha",
                                cohort.Species.Name, cohort.Age, cohort.Treenumber);
            }

            //  Check for senescence
            if (cohort.Age >= species.Longevity)
            {
                RemoveCohort(index, cohort, site, null);
                return(index);
            }

            cohort.IncrementAge();

            //return index + 1;

            if (cohort.Treenumber > 0)
            {
                cohortData[index] = cohort.Data;
                return(index + 1);
            }
            else
            {
                RemoveCohort(index, cohort, site, null);
                return(index);
            }
        }
Пример #3
0
        //---------------------------------------------------------------------

        public void Accumulate(Cohort c)
        {
            data.Treenumber += c.data.Treenumber;
        }