//--------------------------------------------------------------------- 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"); }
//--------------------------------------------------------------------- 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); }
//--------------------------------------------------------------------- /// <summary> /// Initializes the module. /// </summary> public static void Initialize() { numberofcanopylayers = PlugIn.ModelCore.Landscape.NewSiteVar <int>(); cohorts = PlugIn.ModelCore.Landscape.NewSiteVar <ISiteCohorts>(); BiomassCohortsSiteVar = new BiomassCohortsSiteVar(cohorts); baseCohortsSiteVar = new Landis.Extension.Succession.Biomass.BaseCohortsSiteVar(BiomassCohortsSiteVar); woodyDebris = PlugIn.ModelCore.Landscape.NewSiteVar <Pool>(); litter = PlugIn.ModelCore.Landscape.NewSiteVar <Pool>(); HasSiteOutput = PlugIn.ModelCore.Landscape.NewSiteVar <bool>(); SnowPack = PlugIn.ModelCore.Landscape.NewSiteVar <float>(); Water = PlugIn.ModelCore.Landscape.NewSiteVar <float>(); Infiltration = PlugIn.ModelCore.Landscape.NewSiteVar <float>(); establishments = PlugIn.ModelCore.Landscape.NewSiteVar <Landis.Extension.Succession.Biomass.Species.AuxParm <bool> >(); pest = PlugIn.ModelCore.Landscape.NewSiteVar <Landis.Extension.Succession.Biomass.Species.AuxParm <float> >(); TotalBiomass = PlugIn.ModelCore.Landscape.NewSiteVar <int>(); AnnualTranspiration = PlugIn.ModelCore.Landscape.NewSiteVar <float>(); CanopyLAI = PlugIn.ModelCore.Landscape.NewSiteVar <float>(); GrossPsn = PlugIn.ModelCore.Landscape.NewSiteVar <float>(); NetPsn = PlugIn.ModelCore.Landscape.NewSiteVar <float>(); transpiration = PlugIn.ModelCore.Landscape.NewSiteVar <float>(); AutotrophicRespiration = PlugIn.ModelCore.Landscape.NewSiteVar <float>(); HeterotrophicRespiration = PlugIn.ModelCore.Landscape.NewSiteVar <float>(); WFPS = PlugIn.ModelCore.Landscape.NewSiteVar <float>(); CanopyLAImax = PlugIn.ModelCore.Landscape.NewSiteVar <float>(); SubCanopyPAR = PlugIn.ModelCore.Landscape.NewSiteVar <float>(); SubCanopyPARmax = PlugIn.ModelCore.Landscape.NewSiteVar <float>(); foreach (ActiveSite site in PlugIn.ModelCore.Landscape) { // site cohorts are initialized by the PlugIn.InitializeSite method woodyDebris[site] = new Pool(); litter[site] = new Pool(); HasSiteOutput[site] = false; SnowPack[site] = 0; Water[site] = 0; Infiltration[site] = 0; TotalBiomass[site] = 0; numberofcanopylayers[site] = 0; GrossPsn[site] = 0; NetPsn[site] = 0; AutotrophicRespiration[site] = 0; HeterotrophicRespiration[site] = 0; transpiration[site] = 0; WFPS[site] = 0; establishments[site] = new Landis.Extension.Succession.Biomass.Species.AuxParm <bool>(PlugIn.ModelCore.Species); pest[site] = new Landis.Extension.Succession.Biomass.Species.AuxParm <float>(PlugIn.ModelCore.Species); AnnualTranspiration[site] = 0; CanopyLAI[site] = 0; SubCanopyPAR[site] = 0; SubCanopyPARmax[site] = 0; foreach (ISpecies spc in PlugIn.ModelCore.Species) { establishments[site][spc] = false; pest[site][spc] = 0; } } PlugIn.ModelCore.RegisterSiteVar(cohorts, "Succession.BiomassCohortsPnET"); PlugIn.ModelCore.RegisterSiteVar(BiomassCohortsSiteVar, "Succession.BiomassCohorts"); PlugIn.ModelCore.RegisterSiteVar(baseCohortsSiteVar, "Succession.AgeCohorts"); PlugIn.ModelCore.RegisterSiteVar(SiteVars.Establishments, "Succession.Establishments"); PlugIn.ModelCore.RegisterSiteVar(SiteVars.WoodyDebris, "Succession.WoodyDebris"); PlugIn.ModelCore.RegisterSiteVar(SiteVars.Litter, "Succession.Litter"); PlugIn.ModelCore.RegisterSiteVar(SiteVars.HasSiteOutput, "Succession.HasSiteOutput"); PlugIn.ModelCore.RegisterSiteVar(SiteVars.Water, "Succession.SoilWater"); PlugIn.ModelCore.RegisterSiteVar(SiteVars.AnnualTranspiration, "Succession.AnnualTranspiration"); PlugIn.ModelCore.RegisterSiteVar(SiteVars.SubCanopyPAR, "Succession.SubCanopyPARmax"); PlugIn.ModelCore.RegisterSiteVar(SiteVars.CanopyLAImax, "Succession.CanopyLAImax"); }