Example #1
0
 /// <summary>Clears the transferring biomass amounts.</summary>
 private void ClearBiomassFlows()
 {
     Allocated.Clear();
     Senesced.Clear();
     Detached.Clear();
     Removed.Clear();
 }
Example #2
0
 /// <summary>Clears some variables.</summary>
 virtual protected void DoDailyCleanup()
 {
     Allocated.Clear();
     Senesced.Clear();
     Detached.Clear();
     Removed.Clear();
 }
Example #3
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();
            }
        }
Example #4
0
 protected void OnDoDailyInitialisation(object sender, EventArgs e)
 {
     if (Plant.IsAlive)
     {
         Allocated.Clear();
         Senesced.Clear();
         Detached.Clear();
         Removed.Clear();
     }
 }
Example #5
0
 /// <summary>Clears this instance.</summary>
 protected virtual void Clear()
 {
     Live = new Biomass();
     Dead = new Biomass();
     DMSupply.Clear();
     NSupply.Clear();
     DMDemand.Clear();
     NDemand.Clear();
     potentialDMAllocation.Clear();
     Allocated.Clear();
     Senesced.Clear();
     Detached.Clear();
     Removed.Clear();
 }
Example #6
0
 /// <summary>Clears this instance.</summary>
 private void Clear()
 {
     Live = new Biomass();
     Dead = new Biomass();
     DMSupply.Clear();
     NSupply.Clear();
     DMDemand.Clear();
     NDemand.Clear();
     potentialDMAllocation.Clear();
     Allocated.Clear();
     Senesced.Clear();
     Detached.Clear();
     Removed.Clear();
     Height          = 0;
     LAI             = 0;
     LeafInitialised = false;
 }
Example #7
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);
        }
Example #8
0
 /// <summary>Clears this instance.</summary>
 protected virtual void Clear()
 {
     Live = new Biomass();
     Dead = new Biomass();
     dryMatterSupply.Clear();
     nitrogenSupply.Clear();
     dryMatterDemand.Clear();
     nitrogenDemand.Clear();
     potentialDMAllocation.Clear();
     potentialDMAllocating           = 0.0;
     potentialStructuralDMAllocation = 0.0;
     potentialMetabolicDMAllocation  = 0.0;
     Allocated.Clear();
     Senesced.Clear();
     Detached.Clear();
     Removed.Clear();
 }
Example #9
0
 /// <summary>Clears this instance.</summary>
 protected virtual void Clear()
 {
     Live.Clear();
     Dead.Clear();
     DMRetranslocationSupply         = 0.0;
     DMReallocationSupply            = 0.0;
     NRetranslocationSupply          = 0.0;
     NReallocationSupply             = 0.0;
     PotentialDMAllocation           = 0.0;
     PotentialStructuralDMAllocation = 0.0;
     PotentialMetabolicDMAllocation  = 0.0;
     StructuralDMDemand = 0.0;
     StorageDMDemand    = 0.0;
     Allocated.Clear();
     Senesced.Clear();
     Detached.Clear();
     Removed.Clear();
 }