public static void Allocate(object sitecohorts, Cohort cohort, ExtensionType disturbanceType) { if (sitecohorts == null) return;// Deaths in spinup are not added yet float pwoodlost = 0; float prootlost = 0; float pfollost = 0; Parameter<string> p; if (disturbanceType != null && PlugIn.TryGetParameter(disturbanceType.Name, out p)) { if (p.ContainsKey(Reductions.WoodReduction)) { pwoodlost = float.Parse(p[Reductions.WoodReduction]); } if (p.ContainsKey(Reductions.RootReduction)) { prootlost = float.Parse(p[Reductions.RootReduction]); } if (p.ContainsKey(Reductions.FolReduction)) { pfollost = float.Parse(p[Reductions.FolReduction]); } } ((SiteCohorts)sitecohorts).AddWoodyDebris((float)((1 - pwoodlost) * cohort.Wood), cohort.species.KWdLit()); ((SiteCohorts)sitecohorts).AddWoodyDebris((float)((1 - prootlost) * cohort.Root), cohort.species.KWdLit()); ((SiteCohorts)sitecohorts).AddLitter((float)((1 - pfollost) * cohort.Fol), cohort.species); }
/// <summary> /// Passed anonymously to succession modules to compute defoliation /// In succession modules defoliation is computed per-cohort, hence cohortBiomass parameter /// </summary> /// <param name="active"></param> /// <param name="species"></param> /// <param name="cohortBiomass"></param> /// <param name="siteBiomass"></param> /// <returns></returns> //public static double InsectDefoliate(ActiveSite active, ISpecies species, int cohortBiomass, int siteBiomass) public static double InsectDefoliate(ICohort cohort, ActiveSite active, int siteBiomass) { double totalDefoliation = 0.0; InsectDefoliation id = null; foreach (IChange lcc in SiteVars.LandUse[active].LandCoverChanges) { if (lcc.GetType() == typeof(InsectDefoliation)) { id = (lcc as InsectDefoliation); if (id.repeat) { CohortDefoliation.Compute = InsectDefoliate; } else if (Model.Core.CurrentTime > id.harvestTime) { //Model.Core.UI.WriteLine("Disabling defoliation after harvest time: " + Model.Core.CurrentTime); CohortDefoliation.Compute = DontCompute; id = null; break; } break; } } if (id != null) { Landis.Extension.Succession.BiomassPnET.Cohort defolCohort = (cohort as Landis.Extension.Succession.BiomassPnET.Cohort); if (id.landCoverSelectors.ContainsKey(defolCohort.Species.Name)) { Percentage percentage = null; id.landCoverSelectors[defolCohort.Species.Name].Selects(defolCohort, out percentage); if (percentage == null) { Model.Core.UI.WriteLine("Null percent"); } else { totalDefoliation = percentage.Value; } if (totalDefoliation > 1.0) // Cannot exceed 100% defoliation { totalDefoliation = 1.0; } } } return(totalDefoliation); }
public Cohort(Cohort cohort, int IMAX) { SubCanopyLayers = new System.Collections.Generic.List<SubCanopyLayer>(); this.MaxBiomass = cohort.MaxBiomass; this.species = cohort.species; this.Age = cohort.Age; this.Wood = cohort.Wood; this.NSC = cohort.NSC; this.Root = cohort.Root; this.Fol = cohort.Fol; this.MaxBiomass = cohort.MaxBiomass; this.IsAlive = true; }
public static void Allocate(object sitecohorts, Cohort cohort, ExtensionType disturbanceType) { if (sitecohorts == null) { throw new System.Exception("sitecohorts should not be null"); } // By default, all material is allocated to the woody debris or the litter pool float pwoodlost = 0; float prootlost = 0; float pfollost = 0; Parameter<string> parameter; if (disturbanceType != null && PlugIn.TryGetParameter(disturbanceType.Name, out parameter)) { // If parameters are available, then set the loss fractions here. if (parameter.ContainsKey("WoodReduction")) { pwoodlost = float.Parse(parameter["WoodReduction"]); } if (parameter.ContainsKey("RootReduction")) { prootlost = float.Parse(parameter["RootReduction"]); } if (parameter.ContainsKey("FolReduction")) { pfollost = float.Parse(parameter["FolReduction"]); } } float woodLost = (float)((1 - pwoodlost) * cohort.Wood); float rootLost = (float)((1 - prootlost) * cohort.Root); float folLost = (float)((1 - pfollost) * cohort.Fol); ((SiteCohorts)sitecohorts).AddWoodyDebris(woodLost, cohort.SpeciesPNET.KWdLit); ((SiteCohorts)sitecohorts).AddWoodyDebris(rootLost, cohort.SpeciesPNET.KWdLit); ((SiteCohorts)sitecohorts).AddLitter(folLost, cohort.SpeciesPNET); cohort.AccumulateWoodySenescence((int)(woodLost + rootLost)); cohort.AccumulateFoliageSenescence((int)(folLost)); }
public Cohort(Cohort cohort) { this.species = cohort.species; this.age = cohort.age; this.nsc = cohort.nsc; this.biomass = cohort.biomass; biomassmax = cohort.biomassmax; this.fol = cohort.fol; }
// Get totals for the public void Accumulate(Cohort c) { biomass += c.biomass; biomassmax = Math.Max(biomassmax, biomass); fol += c.Fol; }
//--------------------------------------------------------------------- /// <summary> /// Raises a Cohort.AgeOnlyDeathEvent. /// </summary> public static void RaiseDeathEvent(object sender, Cohort cohort, ActiveSite site, ExtensionType disturbanceType) { //if (AgeOnlyDeathEvent != null) //{ // AgeOnlyDeathEvent(sender, new Landis.Library.BiomassCohorts.DeathEventArgs(cohort, site, disturbanceType)); //} if (DeathEvent != null) { DeathEvent(sender, new Landis.Library.BiomassCohorts.DeathEventArgs(cohort, site, disturbanceType)); } }
public static Percentage ComputeNonWoodyPercentage(Cohort cohort, ActiveSite site) { return new Percentage(cohort.fol / (cohort.Wood + cohort.Fol)); }
//--------------------------------------------------------------------- /// <summary> /// Raises a Cohort.AgeOnlyDeathEvent. /// </summary> public static void Died(object sender, Cohort cohort, ActiveSite site, ExtensionType disturbanceType) { if (AgeOnlyDeathEvent != null) { AgeOnlyDeathEvent(sender, new Landis.Library.BiomassCohorts.DeathEventArgs(cohort, site, disturbanceType)); } if (DeathEvent != null) { DeathEvent(sender, new Landis.Library.BiomassCohorts.DeathEventArgs(cohort, site, disturbanceType)); } Allocation.Allocate(sender, cohort, disturbanceType); }
public void AddNewCohort(ISpecies species, ActiveSite site) { Cohort cohort = new Cohort(species, (ushort)Date.Year, IMAX, species.InitialNSC(), species.DNSC()); if(SiteOutputNames.ContainsKey(site)) { cohort.InitializeOutput(SiteOutputNames[site], (ushort)Date.Year, PlugIn.ModelCore.UI.WriteLine); } sitecohorts[site].AddNewCohort(cohort, Timestep); }
public SubCanopyLayer(Cohort cohort, byte LayerIndex) { this.cohort = cohort; this.LayerIndex = LayerIndex; }