Esempio n. 1
0
        public static void Allocate(object sitecohorts, Cohort cohort, ExtensionType disturbanceType, double fraction)
        {
            if (sitecohorts == null)
            {
                throw new System.Exception("sitecohorts should not be null");
            }

            //ReduceDeadPools(sitecohorts, disturbanceType); // moved to RemoveCohort and ReduceBiomass to avoid multiple calls

            // 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"]);
                }
            }

            // Add new dead wood and litter
            float woodAdded = (float)((1 - pwoodlost) * cohort.Wood * fraction);
            float rootAdded = (float)((1 - prootlost) * cohort.Root * fraction);
            float folAdded  = (float)((1 - pfollost) * cohort.Fol * fraction);

            ((SiteCohorts)sitecohorts).AddWoodyDebris(woodAdded, cohort.SpeciesPNET.KWdLit);
            ((SiteCohorts)sitecohorts).AddWoodyDebris(rootAdded, cohort.SpeciesPNET.KWdLit);
            ((SiteCohorts)sitecohorts).AddLitter(folAdded, cohort.SpeciesPNET);

            cohort.AccumulateWoodySenescence((int)(woodAdded + rootAdded));
            cohort.AccumulateFoliageSenescence((int)(folAdded));
        }