Example #1
0
 /// <summary>Adds a given amount of detached root material (DM and N) to the surface organic matter pool.</summary>
 /// <param name="amountDM">The DM amount to send (kg/ha)</param>
 /// <param name="amountN">The N amount to send (kg/ha)</param>
 public virtual void DetachBiomass(double amountDM, double amountN)
 {
     if (amountDM > 0.0)
     {
         surfaceOrganicMatter.Add(amountDM, amountN, 0.0, species.Name, species.Name);
     }
 }
Example #2
0
 private void OnPlantEnding(object sender, EventArgs e)
 {
     if (Wt > 0.0)
     {
         Detached.Add(Live);
         Detached.Add(Dead);
         SurfaceOrganicMatter.Add(Wt * 10, N * 10, 0, Plant.CropType, Name);
     }
     Clear();
 }
Example #3
0
        private void OnPlantEnding(object sender, EventArgs e)
        {
            Biomass total = Live + Dead;

            if (total.Wt > 0.0)
            {
                Detached.Add(Live);
                Detached.Add(Dead);
                SurfaceOrganicMatter.Add(total.Wt * 10, total.N * 10, 0, Plant.CropType, Name);
            }
            Clear();
        }
Example #4
0
        protected void OnDoActualPlantGrowth(object sender, EventArgs e)
        {
            if (Plant.IsAlive)
            {
                Biomass Loss = new Biomass();
                Loss.StructuralWt    = Live.StructuralWt * SenescenceRate;
                Loss.NonStructuralWt = Live.NonStructuralWt * SenescenceRate;
                Loss.StructuralN     = Live.StructuralN * SenescenceRate;
                Loss.NonStructuralN  = Live.NonStructuralN * SenescenceRate;

                Live.StructuralWt    -= Loss.StructuralWt;
                Live.NonStructuralWt -= Loss.NonStructuralWt;
                Live.StructuralN     -= Loss.StructuralN;
                Live.NonStructuralN  -= Loss.NonStructuralN;

                Dead.StructuralWt    += Loss.StructuralWt;
                Dead.NonStructuralWt += Loss.NonStructuralWt;
                Dead.StructuralN     += Loss.StructuralN;
                Dead.NonStructuralN  += Loss.NonStructuralN;

                double DetachedFrac = 0;
                if (DetachmentRateFunction != null)
                {
                    DetachedFrac = DetachmentRateFunction.Value;
                }
                if (DetachedFrac > 0.0)
                {
                    double DetachedWt = Dead.Wt * DetachedFrac;
                    double DetachedN  = Dead.N * DetachedFrac;

                    Dead.StructuralWt    *= (1 - DetachedFrac);
                    Dead.StructuralN     *= (1 - DetachedFrac);
                    Dead.NonStructuralWt *= (1 - DetachedFrac);
                    Dead.NonStructuralN  *= (1 - DetachedFrac);
                    Dead.MetabolicWt     *= (1 - DetachedFrac);
                    Dead.MetabolicN      *= (1 - DetachedFrac);

                    if (DetachedWt > 0)
                    {
                        SurfaceOrganicMatter.Add(DetachedWt * 10, DetachedN * 10, 0, Plant.CropType, Name);
                    }
                }

                if (DryMatterContent != null)
                {
                    LiveFWt = Live.Wt / DryMatterContent.Value;
                }
            }
        }
Example #5
0
        /// <summary>
        /// Remove a fraction of the biomass.
        /// </summary>
        /// <param name="fractionToRemove">The fraction from each layer to remove.</param>
        /// <param name="sendToSurfaceOrganicMatter">Send to surface organic matter?</param>
        /// <returns></returns>
        public BiomassAndNLayered RemoveBiomass(double fractionToRemove, bool sendToSurfaceOrganicMatter)
        {
            var removed = new BiomassAndNLayered();

            removed.Wt = MathUtilities.Multiply_Value(dmLayer, fractionToRemove);
            removed.N  = MathUtilities.Multiply_Value(nLayer, fractionToRemove);
            for (int layer = 0; layer < dmLayer.Length; layer++)
            {
                dmLayer[layer] -= removed.Wt[layer];
                nLayer[layer]  -= removed.N[layer];
            }
            UpdateDM();

            if (sendToSurfaceOrganicMatter)
            {
                surfaceOrganicMatter.Add(removed.Wt.Sum(), removed.N.Sum(), 0.0, species.Name, species.Name);
            }

            return(removed);
        }
Example #6
0
        /// <summary>Removes a fraction of the biomass from this tissue.</summary>
        /// <param name="fractionToRemove">The fraction of biomass to remove.</param>
        /// <param name="fractionToSoil">The fraction of removed biomass to send to soil.</param>
        public void RemoveBiomass(double fractionToRemove, double fractionToSoil)
        {
            var dmToSoil      = fractionToSoil * dryMatter.Wt;
            var nToSoil       = fractionToSoil * dryMatter.N;
            var totalFraction = fractionToRemove + fractionToSoil;

            DMRemoved = totalFraction * dryMatter.Wt;
            NRemoved  = totalFraction * dryMatter.N;

            if (totalFraction > 0.0)
            {
                dryMatter.Wt   *= (1.0 - totalFraction);
                dryMatter.N    *= (1.0 - totalFraction);
                NRemobilisable *= (1.0 - totalFraction);
            }

            if (dmToSoil > 0.0)
            {
                surfaceOrganicMatter.Add(dmToSoil, nToSoil, 0.0, species.Name, species.Name);
            }

            CalculateDigestibility();
        }