예제 #1
0
        protected void OnDoActualPlantGrowth(object sender, EventArgs e)
        {
            if (parentPlant.IsAlive)
            {
                // Do senescence
                double senescedFrac = senescenceRate.Value();
                if (Live.Wt * (1.0 - senescedFrac) < BiomassToleranceValue)
                {
                    senescedFrac = 1.0;  // remaining amount too small, senesce all
                }
                Biomass Loss = Live * senescedFrac;
                Live.Subtract(Loss);
                Dead.Add(Loss);
                Senesced.Add(Loss);

                // Do detachment
                double detachedFrac = detachmentRateFunction.Value();
                if (Dead.Wt * (1.0 - detachedFrac) < BiomassToleranceValue)
                {
                    detachedFrac = 1.0;  // remaining amount too small, detach all
                }
                Biomass detaching = Dead * detachedFrac;
                Dead.Multiply(1.0 - detachedFrac);
                if (detaching.Wt > 0.0)
                {
                    Detached.Add(detaching);
                    surfaceOrganicMatter.Add(detaching.Wt * 10, detaching.N * 10, 0, parentPlant.CropType, Name);
                }

                // Do maintenance respiration
                MaintenanceRespiration  = 0;
                MaintenanceRespiration += Live.MetabolicWt * maintenanceRespirationFunction.Value();
                MaintenanceRespiration += Live.StorageWt * maintenanceRespirationFunction.Value();
            }
        }
예제 #2
0
        /// <summary>Sets the n allocation.</summary>
        /// <param name="nitrogen">The nitrogen allocation</param>
        public virtual void SetNitrogenAllocation(BiomassAllocationType nitrogen)
        {
            Live.StructuralN += nitrogen.Structural;
            Live.StorageN    += nitrogen.Storage;
            Live.MetabolicN  += nitrogen.Metabolic;

            Allocated.StructuralN += nitrogen.Structural;
            Allocated.StorageN    += nitrogen.Storage;
            Allocated.MetabolicN  += nitrogen.Metabolic;

            RetranslocateNitrogen.Allocate(this, nitrogen);

            // Reallocation
            double senescedFrac = SenescenceRate.Value();

            if (StartLive.Wt * (1.0 - senescedFrac) < BiomassToleranceValue)
            {
                senescedFrac = 1.0;  // remaining amount too small, senesce all
            }
            if (senescedFrac > 0 && StartLive.Wt > 0 && Name == "Shell")
            {
            }

            if (MathUtilities.IsGreaterThan(nitrogen.Reallocation, StartLive.StorageN + StartLive.MetabolicN))
            {
                throw new Exception("N reallocation exceeds storage + metabolic nitrogen in organ: " + Name);
            }
            double StorageNReallocation = Math.Min(nitrogen.Reallocation, StartLive.StorageN * senescedFrac * nReallocationFactor.Value());

            Live.StorageN      -= StorageNReallocation;
            Live.MetabolicN    -= (nitrogen.Reallocation - StorageNReallocation);
            Allocated.StorageN -= nitrogen.Reallocation;

            // now move the remaining senescing material to the dead pool
            Biomass Loss = new Biomass();

            Loss.StructuralN  = StartLive.StructuralN * senescedFrac;
            Loss.StorageN     = StartLive.StorageN * senescedFrac - StorageNReallocation;
            Loss.MetabolicN   = StartLive.MetabolicN * senescedFrac - (nitrogen.Reallocation - StorageNReallocation);
            Loss.StructuralWt = StartLive.StructuralWt * senescedFrac;
            Loss.MetabolicWt  = StartLive.MetabolicWt * senescedFrac;
            Loss.StorageWt    = StartLive.StorageWt * senescedFrac;
            Live.Subtract(Loss);
            Dead.Add(Loss);
            Senesced.Add(Loss);
        }