Пример #1
0
        //---------------------------------------------------------------------

        public void CohortPartialMortality(object sender, Landis.Library.BiomassCohorts.PartialDeathEventArgs eventArgs)
        {
            ExtensionType disturbanceType = eventArgs.DisturbanceType;
            ActiveSite    site            = eventArgs.Site;

            Landis.Library.BiomassCohorts.ICohort cohort = eventArgs.Cohort;

            double fractionPartialMortality = (double)eventArgs.Reduction / (double)cohort.Biomass;
            //PlugIn.ModelCore.UI.WriteLine("   BIOMASS SUCCESSION PARTIAL MORTALITY START: species={0}, age={1}, biomass={2}, fraction_mortality={3:0.00}.", cohort.Species.Name, cohort.Age, cohort.Biomass, fractionPartialMortality);

            int nonWoody = cohort.ComputeNonWoodyBiomass(site);
            int woody    = (cohort.Biomass - nonWoody);

            float foliarInput = ((float)nonWoody * (float)fractionPartialMortality);
            float woodInput   = ((float)woody * (float)fractionPartialMortality);

            if (disturbanceType.IsMemberOf("disturbance:harvest"))
            {
                SiteVars.HarvestPrescriptionName = PlugIn.ModelCore.GetSiteVar <string>("Harvest.PrescriptionName");
                if (!Disturbed[site]) // this is the first cohort killed/damaged
                {
                    HarvestEffects.ReduceLayers(SiteVars.HarvestPrescriptionName[site], site);
                }
                woodInput   -= woodInput * (float)HarvestEffects.GetCohortWoodRemoval(site);
                foliarInput -= foliarInput * (float)HarvestEffects.GetCohortLeafRemoval(site);
            }
            if (disturbanceType.IsMemberOf("disturbance:fire"))
            {
                SiteVars.FireSeverity = PlugIn.ModelCore.GetSiteVar <byte>("Fire.Severity");

                if (!Disturbed[site]) // this is the first cohort killed/damaged
                {
                    if (SiteVars.FireSeverity != null && SiteVars.FireSeverity[site] > 0)
                    {
                        FireEffects.ReduceLayers(SiteVars.FireSeverity[site], site);
                    }
                }

                double woodFireConsumption   = woodInput * (float)FireEffects.ReductionsTable[(int)SiteVars.FireSeverity[site]].CoarseLitterReduction;
                double foliarFireConsumption = foliarInput * (float)FireEffects.ReductionsTable[(int)SiteVars.FireSeverity[site]].FineLitterReduction;

                woodInput   -= (float)woodFireConsumption;
                foliarInput -= (float)foliarFireConsumption;
            }

            ForestFloor.AddWoody(woodInput, cohort.Species, site);
            ForestFloor.AddLitter(foliarInput, cohort.Species, site);

            //PlugIn.ModelCore.UI.WriteLine("       BIOMASS SUCCESSION PARTIAL MORTALITY SUMMARY: Cohort Partial Mortality: species={0}, age={1}, disturbance={2}.", cohort.Species.Name, cohort.Age, disturbanceType);
            //PlugIn.ModelCore.UI.WriteLine("           InputB/TotalB:  Foliar={0:0.00}/{1:0.00}, Wood={2:0.0}/{3:0.0}.", foliarInput, nonWoody, woodInput, woody);

            return;
        }
        public void CohortTotalMortality(object sender, DeathEventArgs eventArgs)
        {
            ExtensionType disturbanceType = eventArgs.DisturbanceType;
            ActiveSite    site            = eventArgs.Site;

            ICohort cohort      = (Landis.Library.BiomassCohorts.ICohort)eventArgs.Cohort;
            int     foliarInput = cohort.ComputeNonWoodyBiomass(site);
            int     woodInput   = (cohort.Biomass - foliarInput);

            if (disturbanceType != null)
            {
                if (PlugIn.CalibrateMode && PlugIn.ModelCore.CurrentTime > 0)
                {
                    PlugIn.ModelCore.UI.WriteLine("   BIOMASS SUCCESSION TOTAL MORTALITY: species={0}, age={1}, woodInput={2}, foliarInputs={3}.", cohort.Species.Name, cohort.Age, woodInput, foliarInput);
                }

                if (disturbanceType.IsMemberOf("disturbance:fire"))
                {
                    SiteVars.FireSeverity = PlugIn.ModelCore.GetSiteVar <byte>("Fire.Severity");
                    Landis.Library.Succession.Reproduction.CheckForPostFireRegen(eventArgs.Cohort, site);

                    if (!Disturbed[site])  // the first cohort killed/damaged
                    {
                        if (SiteVars.FireSeverity != null && SiteVars.FireSeverity[site] > 0)
                        {
                            FireEffects.ReduceLayers(SiteVars.FireSeverity[site], site);
                        }
                    }

                    double woodFireConsumption   = woodInput * (float)FireEffects.ReductionsTable[(int)SiteVars.FireSeverity[site]].CoarseLitterReduction;
                    double foliarFireConsumption = foliarInput * (float)FireEffects.ReductionsTable[(int)SiteVars.FireSeverity[site]].FineLitterReduction;

                    woodInput   -= (int)woodFireConsumption;
                    foliarInput -= (int)foliarFireConsumption;
                }
                else
                {
                    if (disturbanceType.IsMemberOf("disturbance:harvest"))
                    {
                        SiteVars.HarvestPrescriptionName = PlugIn.ModelCore.GetSiteVar <string>("Harvest.PrescriptionName");
                        if (!Disturbed[site])  // the first cohort killed/damaged
                        {
                            HarvestEffects.ReduceLayers(SiteVars.HarvestPrescriptionName[site], site);
                        }
                        woodInput   -= (int)(woodInput * (float)HarvestEffects.GetCohortWoodRemoval(site));
                        foliarInput -= (int)(foliarInput * (float)HarvestEffects.GetCohortLeafRemoval(site));
                    }

                    // If not fire, check for resprouting:
                    Landis.Library.Succession.Reproduction.CheckForResprouting(eventArgs.Cohort, site);
                }
            }

            //PlugIn.ModelCore.UI.WriteLine("Cohort Died: species={0}, age={1}, wood={2:0.00}, foliage={3:0.00}.", cohort.Species.Name, cohort.Age, wood, foliar);
            ForestFloor.AddWoody(woodInput, cohort.Species, eventArgs.Site);
            ForestFloor.AddLitter(foliarInput, cohort.Species, eventArgs.Site);

            // Assume that ALL dead root biomass stays on site.
            //Roots.AddCoarseRootLitter(Roots.CalculateCoarseRoot(cohort, cohort.WoodBiomass), cohort, cohort.Species, eventArgs.Site);
            //Roots.AddFineRootLitter(Roots.CalculateFineRoot(cohort, cohort.LeafBiomass), cohort, cohort.Species, eventArgs.Site);

            if (disturbanceType != null)
            {
                Disturbed[site] = true;
            }

            return;

            //ExtensionType disturbanceType = eventArgs.DisturbanceType;
            //if (disturbanceType != null)
            //{
            //    ActiveSite site = eventArgs.Site;
            //    Disturbed[site] = true;
            //    if (disturbanceType.IsMemberOf("disturbance:fire"))
            //        Reproduction.CheckForPostFireRegen(eventArgs.Cohort, site);
            //    else
            //        Reproduction.CheckForResprouting(eventArgs.Cohort, site);
            //}
        }
        //---------------------------------------------------------------------

        public void CohortPartialMortality(object sender, Landis.Library.BiomassCohorts.PartialDeathEventArgs eventArgs)
        {
            ExtensionType disturbanceType = eventArgs.DisturbanceType;
            ActiveSite    site            = eventArgs.Site;

            Landis.Library.BiomassCohorts.ICohort cohort = eventArgs.Cohort;

            double partialMortality = (double)eventArgs.Reduction;

            if (PlugIn.CalibrateMode && PlugIn.ModelCore.CurrentTime > 0)
            {
                PlugIn.ModelCore.UI.WriteLine("   BIOMASS SUCCESSION PARTIAL MORTALITY I: species={0}, age={1}, disturbance={2}.", cohort.Species.Name, cohort.Age, disturbanceType);
                PlugIn.ModelCore.UI.WriteLine("   BIOMASS SUCCESSION PARTIAL MORTALITY I: eventReduction={0:0.0}, new_cohort_biomass={1}.", eventArgs.Reduction, cohort.Biomass);
            }
            double nonWoodyFraction = (double)cohort.ComputeNonWoodyBiomass(site) / (double)cohort.Biomass;
            double woodyFraction    = 1.0 - nonWoodyFraction;

            float foliarInput = (float)(partialMortality * nonWoodyFraction); // ((float) nonWoody * (float) fractionPartialMortality);
            float woodInput   = (float)(partialMortality * woodyFraction);    // ((float) woody * (float) fractionPartialMortality);

            if (PlugIn.CalibrateMode && PlugIn.ModelCore.CurrentTime > 0)
            {
                PlugIn.ModelCore.UI.WriteLine("   BIOMASS SUCCESSION PARTIAL MORTALITY II: species={0}, age={1}, woodInput={2}, foliarInputs={3}.", cohort.Species.Name, cohort.Age, woodInput, foliarInput);
            }


            if (disturbanceType.IsMemberOf("disturbance:harvest"))
            {
                SiteVars.HarvestPrescriptionName = PlugIn.ModelCore.GetSiteVar <string>("Harvest.PrescriptionName");
                if (!Disturbed[site]) // this is the first cohort killed/damaged
                {
                    HarvestEffects.ReduceLayers(SiteVars.HarvestPrescriptionName[site], site);
                }
                woodInput   -= woodInput * (float)HarvestEffects.GetCohortWoodRemoval(site);
                foliarInput -= foliarInput * (float)HarvestEffects.GetCohortLeafRemoval(site);
            }
            //PlugIn.ModelCore.UI.WriteLine("   BIOMASS SUCCESSION PARTIAL MORTALITY: species={0}, age={1}, woodInput={2}, foliarInputs={3}.", cohort.Species.Name, cohort.Age, woodInput, foliarInput);
            if (disturbanceType.IsMemberOf("disturbance:fire"))
            {
                SiteVars.FireSeverity = PlugIn.ModelCore.GetSiteVar <byte>("Fire.Severity");

                if (!Disturbed[site]) // this is the first cohort killed/damaged
                {
                    if (SiteVars.FireSeverity != null && SiteVars.FireSeverity[site] > 0)
                    {
                        FireEffects.ReduceLayers(SiteVars.FireSeverity[site], site);
                    }
                }

                double woodFireConsumption   = woodInput * (float)FireEffects.ReductionsTable[(int)SiteVars.FireSeverity[site]].CoarseLitterReduction;
                double foliarFireConsumption = foliarInput * (float)FireEffects.ReductionsTable[(int)SiteVars.FireSeverity[site]].FineLitterReduction;

                woodInput   -= (float)woodFireConsumption;
                foliarInput -= (float)foliarFireConsumption;
            }

            if (PlugIn.CalibrateMode && PlugIn.ModelCore.CurrentTime > 0)
            {
                PlugIn.ModelCore.UI.WriteLine("   BIOMASS SUCCESSION PARTIAL MORTALITY III: ForestFloorInputs: Foliar={0:0.00}, Wood={1:0.0}.", foliarInput, woodInput);
            }

            ForestFloor.AddWoody(woodInput, cohort.Species, site);
            ForestFloor.AddLitter(foliarInput, cohort.Species, site);

            if (disturbanceType != null)
            {
                Disturbed[site] = true;
            }


            return;
        }