public static void Initialize(IInputParameters parameters) { Canopy.Initialize(parameters); TOroot = parameters.TOroot; TOwood = parameters.TOwood; TOfol = parameters.TOfol; FolRet = parameters.FolRet; HalfSat = parameters.HalfSat; PsnTMin = parameters.PsnTMin; GrMstSens = parameters.GrMstSens; SLWmax = parameters.SLWmax; SLWDel = parameters.SLWDel; k = parameters.K; CDDFolEnd = parameters.CDDFolEnd; PsnAgeRed = parameters.PsnAgeRed; GDDFolSt = parameters.GDDFolSt; RtStRatio = parameters.RtStRatio; MaintRespFrac = parameters.MaintResp; DNSC = parameters.DNSC; BFolResp = parameters.BFolResp; Porosity = parameters.Porosity; }
public SiteConditions(ActiveSite site, ICommunity initialCommunity) { cohorts = new SiteCohorts(); canopy = new Canopy(); if (PlugIn.HasSiteOutput[site] == true) { siteoutput = new SiteOutput(site); estoutput = new EstablishmentOutput(site); } this.site = site; foreach (ISpecies spc in PlugIn.modelCore.Species) { deadcohortages[spc] = new List <int>(); } uint key = ComputeKey(initialCommunity.MapCode, PlugIn.ModelCore.Ecoregion[site].MapCode); SiteConditions s = GetFromKey(key); if (s != null) { return; } // If we don't have a sorted list of age cohorts for the initial // community, make the list List <Landis.Library.AgeOnlyCohorts.ICohort> sortedAgeCohorts; if (!sortedCohorts.TryGetValue(initialCommunity.MapCode, out sortedAgeCohorts)) { sortedAgeCohorts = PlugIn.RankCohortAgesOldToYoung(initialCommunity.Cohorts); sortedCohorts[initialCommunity.MapCode] = sortedAgeCohorts; } hydrology = new Hydrology(PlugIn.modelCore.Ecoregion[site]); forestfloor = new ForestFloor(); cohorts = new SiteCohorts(); establishment = new EstablishmentProbability(site); if (sortedAgeCohorts.Count == 0) { return; } //PlugIn.ModelCore.UI.WriteLine("Making Biomass Cohorts "+ site); BiomassSpinUp(sortedAgeCohorts, site); initialSites[key] = this; return; }
public void SetCanopyLayers(SiteCohorts Cohorts, int MaxAge, int MaxBiom) { int NewNrOfLayersMax = Canopy.GetNumberOfLayers(MaxAge); canopy = new List <CohortBiomass> [NewNrOfLayersMax + 1]; for (int canopylayer = 0; canopylayer < NewNrOfLayersMax + 1; canopylayer++) { canopy[canopylayer] = new List <CohortBiomass>(); } if (Cohorts == null) { return; } foreach (ISpeciesCohorts spc in Cohorts) { foreach (Cohort cohort in spc) { // For initialization (all cohorts end up in one layer the first call regardless of biomass). // This is not pretty but saves computation time. if (MaxBiom < cohort.Biomass) { MaxBiom = cohort.Biomass; } // The max is not to allow a lower canopy layer than previously. float ratio = (float)(cohort.Biomass) / MaxBiom; int actuallayer = (int)(ratio * NewNrOfLayersMax) - 1; if (MaxBiom > 0) { // only reset CanopyLayer if NumberOfLayersMax changed if (NewNrOfLayersMax != NumberOfLayersMax) { cohort.CanopyLayer = Math.Min(NewNrOfLayersMax, Math.Max(cohort.CanopyLayer, actuallayer)); } } if (cohort.CanopyLayer > canopy.Length) { throw new System.Exception("cannot implement canopylayer = " + cohort.CanopyLayer + " number of canopy layers is " + canopy.Length + " MaxAge = " + MaxAge); } canopy[cohort.CanopyLayer].Add(new CohortBiomass(cohort)); } } NumberOfLayersMax = NewNrOfLayersMax; }
public SiteConditions(ActiveSite site, ICommunity initialCommunity) { cohorts = new SiteCohorts(); canopy = new Canopy(); if (PlugIn.HasSiteOutput[site] == true) { siteoutput = new SiteOutput(site); estoutput = new EstablishmentOutput(site); } this.site = site; foreach (ISpecies spc in PlugIn.modelCore.Species) { deadcohortages[spc] = new List<int>(); } uint key = ComputeKey(initialCommunity.MapCode, PlugIn.ModelCore.Ecoregion[site].MapCode); SiteConditions s = GetFromKey(key); if (s != null) return; // If we don't have a sorted list of age cohorts for the initial // community, make the list List<Landis.Library.AgeOnlyCohorts.ICohort> sortedAgeCohorts; if (!sortedCohorts.TryGetValue(initialCommunity.MapCode, out sortedAgeCohorts)) { sortedAgeCohorts = PlugIn.RankCohortAgesOldToYoung(initialCommunity.Cohorts); sortedCohorts[initialCommunity.MapCode] = sortedAgeCohorts; } hydrology = new Hydrology(PlugIn.modelCore.Ecoregion[site]); forestfloor = new ForestFloor(); cohorts = new SiteCohorts(); establishment = new EstablishmentProbability(site); if (sortedAgeCohorts.Count == 0) return; //PlugIn.ModelCore.UI.WriteLine("Making Biomass Cohorts "+ site); BiomassSpinUp(sortedAgeCohorts, site); initialSites[key] = this; return; }