예제 #1
0
        //---------------------------------------------------------------------

        protected override void InitializeSite(ActiveSite site,
                                               ICommunity initialCommunity)
        {
            InitialBiomass initialBiomass = InitialBiomass.Compute(site, initialCommunity);

            SiteVars.MineralN[site] = Parameters.InitialMineralN;
        }
        //---------------------------------------------------------------------

        /// <summary>
        /// Initializes this class.
        /// </summary>
        /// <param name="timestep">
        /// The plug-in's timestep.  It is used for growing biomass cohorts.
        /// </param>
        //public static void Initialize(int timestep)
        //{
        //    //successionTimestep = (ushort) timestep;
        //}

        //---------------------------------------------------------------------

        /// <summary>
        /// Computes the initial biomass at a site.
        /// </summary>
        /// <param name="site">
        /// The selected site.
        /// </param>
        /// <param name="initialCommunity">
        /// The initial community of age cohorts at the site.
        /// </param>
        public static InitialBiomass Compute(ActiveSite site,
                                             ICommunity initialCommunity)
        {
            IEcoregion ecoregion = PlugIn.ModelCore.Ecoregion[site];

            if (!ecoregion.Active)
            {
                string mesg = string.Format("Initial community {0} is located on a non-active ecoregion {1}", initialCommunity.MapCode, ecoregion.Name);
                throw new System.ApplicationException(mesg);
            }

            InitialBiomass initialBiomass;

            List <Landis.Library.LeafBiomassCohorts.ICohort> sortedAgeCohorts = SortCohorts(initialCommunity.Cohorts);

            ISiteCohorts cohorts = MakeBiomassCohorts(sortedAgeCohorts, site);

            initialBiomass = new InitialBiomass(cohorts);

            return(initialBiomass);
        }