Exemple #1
0
        //---------------------------------------------------------------------
        public override void Initialize()
        {
            cohorts        = PlugIn.ModelCore.Landscape.NewSiteVar <ISiteCohorts>();
            BiomassCohorts = new BiomassCohortsSiteVar(cohorts);
            baseCohorts    = new Landis.Library.Biomass.BaseCohortsSiteVar(BiomassCohorts);

            // Counts added cohorts per site and per species
            newcohorts = PlugIn.ModelCore.Landscape.NewSiteVar <Landis.Library.Biomass.Species.AuxParm <int> >();
            foreach (ActiveSite site in PlugIn.ModelCore.Landscape)
            {
                newcohorts[site] = new Landis.Library.Biomass.Species.AuxParm <int>(PlugIn.ModelCore.Species);
            }


            PlugIn.ModelCore.RegisterSiteVar(NewCohorts, "Succession.NewCohorts");
            PlugIn.ModelCore.RegisterSiteVar(cohorts, "Succession.BiomassCohortsPnET");
            PlugIn.ModelCore.RegisterSiteVar(BiomassCohorts, "Succession.BiomassCohorts");

            PlugIn.ModelCore.RegisterSiteVar(baseCohorts, "Succession.AgeCohorts");

            Edu.Wisc.Forest.Flel.Util.Directory.EnsureExists("output");
            CohortOutput.Initialize(parameters);
            SiteOutput.Initialize(parameters);
            CohortBiomass.Initialize(parameters);
            EstablishmentProbability.Initialize(parameters);
            CanopyBiomass.Initialize(parameters);
            Static.Initialize(parameters);
            Hydrology.Initialize(parameters);

            Timestep = parameters.Timestep;
            tstep    = parameters.Timestep;



            // 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(parameters);

            Cohort.DeathEvent += CohortDied;

            // TODO ARJAN !!
            //Landis.Extension.Succession.Biomass.AgeOnlyDisturbances.Module.Initialize(parameters.AgeOnlyDisturbanceParms);

            ForestFloor.Initialize(parameters);

            SiteOutput.Initialize(parameters);



            StartDate = new System.DateTime(parameters.StartYear, 1, 15);

            year  = StartDate.Year;
            month = StartDate.Month;

            InitializeSites(parameters.InitialCommunities, parameters.InitialCommunitiesMap, modelCore);
        }
        //---------------------------------------------------------------------
        public override void Initialize()
        {
            PlugIn.ModelCore.UI.WriteLine("Initializing " + ExtensionName + " version " + typeof(PlugIn).Assembly.GetName().Version);

            /*Testing
             * Landis.Library.BiomassCohorts.Cohort C;
             * Cohort D;
             *
             * C = (Landis.Library.BiomassCohorts.Cohort)D;
             */


            hassiteoutput  = parameters.HasSiteOutput;
            siteconditions = PlugIn.ModelCore.Landscape.NewSiteVar <SiteConditions>();
            Edu.Wisc.Forest.Flel.Util.Directory.EnsureExists("output");

            //CohortOutput.Initialize(parameters);
            Hydrology.Initialize(parameters);
            StaticVariables.InitializeStatic(parameters);
            ForestFloor.Initialize(parameters);
            SiteConditions.Initialize(parameters);
            CohortBiomass.Initialize(parameters);

            Timestep = parameters.Timestep;
            tstep    = parameters.Timestep;

            // Initialize Reproduction routines:
            Reproduction.SufficientResources = SufficientResources;
            Reproduction.Establish           = Establish;
            Reproduction.AddNewCohort        = AddNewCohort;
            Reproduction.MaturePresent       = MaturePresent;
            Reproduction.PlantingEstablish   = PlantingEstablish;
            base.Initialize(modelCore, parameters.SeedAlgorithm);
            Cohort.DeathEvent += CohortDied;

            StartDate = new System.DateTime(parameters.StartYear, 1, 15);

            year  = StartDate.Year;
            month = StartDate.Month;

            InitializeSites(parameters.InitialCommunities, parameters.InitialCommunitiesMap, modelCore);

            EstablishmentProbability.Initialize(parameters);

            ISiteVar <ISiteCohorts> cohorts = PlugIn.ModelCore.Landscape.NewSiteVar <ISiteCohorts>();

            foreach (ActiveSite site in PlugIn.modelCore.Landscape)
            {
                cohorts[site] = siteconditions[site].Cohorts;
            }

            BiomassCohorts = new BiomassCohortsSiteVar(cohorts);
            baseCohorts    = new Landis.Library.Biomass.BaseCohortsSiteVar(BiomassCohorts);

            PlugIn.ModelCore.RegisterSiteVar(BiomassCohorts, "Succession.BiomassCohorts");

            PlugIn.ModelCore.RegisterSiteVar(siteconditions, "Succession.SiteConditionsPnET");
            PlugIn.ModelCore.RegisterSiteVar(baseCohorts, "Succession.AgeCohorts");


            ISiteVar <Pool> WoodyDebris = PlugIn.ModelCore.Landscape.NewSiteVar <Pool>();

            foreach (ActiveSite site in PlugIn.modelCore.Landscape)
            {
                WoodyDebris[site] = siteconditions[site].WoodyDebris;
            }
            PlugIn.ModelCore.RegisterSiteVar(WoodyDebris, "Succession.WoodyDebris");

            ISiteVar <Pool> Litter = PlugIn.ModelCore.Landscape.NewSiteVar <Pool>();

            foreach (ActiveSite site in PlugIn.modelCore.Landscape)
            {
                Litter[site] = siteconditions[site].WoodyDebris;
            }
            PlugIn.ModelCore.RegisterSiteVar(Litter, "Succession.Litter");
        }