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

        public override void Initialize()
        {
            Timestep      = Parameters.Timestep;
            time          = Timestep;
            CalibrateMode = Parameters.CalibrateMode;
            CohortBiomass.SpinupMortalityFraction = Parameters.SpinupMortalityFraction;

            //Initialize climate.
            if (Parameters.ClimateConfigFile != null)
            {
                Climate.Initialize(Parameters.ClimateConfigFile, false, modelCore);
                FutureClimateBaseYear = Climate.Future_MonthlyData.Keys.Min();
                ClimateRegionData.Initialize(Parameters);
            }

            sufficientLight = Parameters.LightClassProbabilities;

            SpeciesData.Initialize(Parameters);
            EcoregionData.Initialize(Parameters);
            DynamicInputs.Initialize(Parameters.DynamicInputFile, false);
            SpeciesData.ChangeDynamicParameters(0);  // Year 0
            FireEffects.Initialize(Parameters);
            //Outputs.Initialize(parameters);

            MetadataHandler.InitializeMetadata(summaryLogFileName);

            //  Cohorts must be created before the base class is initialized
            //  because the base class' reproduction module uses the core's
            //  SuccessionCohorts property in its Initialization method.
            Landis.Library.BiomassCohorts.Cohorts.Initialize(Timestep, new CohortBiomass());

            // Initialize Reproduction routines:
            Reproduction.SufficientResources = SufficientLight;
            Reproduction.Establish           = Establish;
            Reproduction.AddNewCohort        = AddNewCohort;
            Reproduction.MaturePresent       = MaturePresent;
            Reproduction.PlantingEstablish   = PlantingEstablish;
            base.Initialize(modelCore, Parameters.SeedAlgorithm);

            InitialBiomass.Initialize(Timestep);

            Landis.Library.BiomassCohorts.Cohort.DeathEvent        += CohortTotalMortality;
            Landis.Library.BiomassCohorts.Cohort.PartialDeathEvent += CohortPartialMortality;

            InitializeSites(Parameters.InitialCommunities, Parameters.InitialCommunitiesMap, modelCore);
        }
示例#2
0
        //---------------------------------------------------------------------
        /// <summary>
        /// Grows all cohorts at a site for a specified number of years.  The
        /// dead pools at the site also decompose for the given time period.
        /// </summary>
        public static void GrowCohorts(
            ActiveSite site,
            int years,
            bool isSuccessionTimestep)
        {
            //PlugIn.ModelCore.Log.WriteLine("years = {0}, successionTS = {1}.", years, successionTimestep.Value);

            for (int y = 1; y <= years; ++y)
            {
                if (PlugIn.ModelCore.CurrentTime > 0)
                {
                    SpeciesData.ChangeDynamicParameters(PlugIn.ModelCore.CurrentTime + y - 1);
                }

                SiteVars.ResetAnnualValues(site);
                CohortBiomass.SubYear = y - 1;

                SiteVars.Cohorts[site].Grow(site, (y == years && isSuccessionTimestep));
                SiteVars.WoodyDebris[site].Decompose();
                SiteVars.Litter[site].Decompose();
            }
        }