Example #1
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;

            // Retranslocation
            if (MathUtilities.IsGreaterThan(nitrogen.Retranslocation, startLive.StorageN + startLive.MetabolicN - NSupply.Retranslocation))
            {
                throw new Exception("N retranslocation exceeds storage + metabolic nitrogen in organ: " + Name);
            }
            double StorageNRetranslocation = Math.Min(nitrogen.Retranslocation, startLive.StorageN * (1 - senescenceRate.Value()) * nRetranslocationFactor.Value());

            Live.StorageN      -= StorageNRetranslocation;
            Live.MetabolicN    -= (nitrogen.Retranslocation - StorageNRetranslocation);
            Allocated.StorageN -= nitrogen.Retranslocation;

            // Reallocation
            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 * senescenceRate.Value() * nReallocationFactor.Value());

            Live.StorageN      -= StorageNReallocation;
            Live.MetabolicN    -= (nitrogen.Reallocation - StorageNReallocation);
            Allocated.StorageN -= nitrogen.Reallocation;
        }
Example #2
0
        /// <summary>Sets the dry matter allocation.</summary>
        public void SetDryMatterAllocation(BiomassAllocationType dryMatter)
        {
            double TotalRAw = 0;

            foreach (ZoneState Z in Zones)
            {
                TotalRAw += MathUtilities.Sum(Z.CalculateRootActivityValues());
            }

            Allocated.StructuralWt = dryMatter.Structural * dmConversionEfficiency.Value();
            Allocated.StorageWt    = dryMatter.Storage * dmConversionEfficiency.Value();
            Allocated.MetabolicWt  = dryMatter.Metabolic * dmConversionEfficiency.Value();
            // GrowthRespiration with unit CO2
            // GrowthRespiration is calculated as
            // Allocated CH2O from photosynthesis "1 / DMConversionEfficiency.Value()", converted
            // into carbon through (12 / 30), then minus the carbon in the biomass, finally converted into
            // CO2 (44/12).
            double growthRespFactor = ((1.0 / dmConversionEfficiency.Value()) * (12.0 / 30.0) - 1.0 * carbonConcentration.Value()) * 44.0 / 12.0;

            GrowthRespiration = (Allocated.StructuralWt + Allocated.StorageWt + Allocated.MetabolicWt) * growthRespFactor;
            if (TotalRAw == 0 && Allocated.Wt > 0)
            {
                throw new Exception("Error trying to partition root biomass");
            }

            foreach (ZoneState Z in Zones)
            {
                Z.PartitionRootMass(TotalRAw, Allocated.Wt);
            }
            needToRecalculateLiveDead = true;
        }
Example #3
0
        /// <summary>Sets the dry matter allocation.</summary>
        public void SetDryMatterAllocation(BiomassAllocationType dryMatter)
        {
            // GrowthRespiration with unit CO2
            // GrowthRespiration is calculated as
            // Allocated CH2O from photosynthesis "1 / DMConversionEfficiency.Value()", converted
            // into carbon through (12 / 30), then minus the carbon in the biomass, finally converted into
            // CO2 (44/12).
            double growthRespFactor = ((1 / DMConversionEfficiency.Value()) * (12.0 / 30.0) - 1.0 * CarbonConcentration.Value()) * 44.0 / 12.0;

            GrowthRespiration = (dryMatter.Structural + dryMatter.Storage) * growthRespFactor;

            AddNewLeafMaterial(StructuralWt: Math.Min(dryMatter.Structural * DMConversionEfficiency.Value(), DMDemand.Structural),
                               StorageWt: dryMatter.Storage * DMConversionEfficiency.Value(),
                               StructuralN: 0,
                               StorageN: 0,
                               SLA: SpecificLeafAreaFunction.Value());

            double Removal = dryMatter.Retranslocation;

            foreach (PerrenialLeafCohort L in Leaves)
            {
                double Delta = Math.Min(L.Live.StorageWt, Removal);
                L.Live.StorageWt -= Delta;
                Removal          -= Delta;
            }
            if (MathUtilities.IsGreaterThan(Removal, 0))
            {
                throw new Exception("Insufficient Storage DM to account for Retranslocation and Reallocation in Perrenial Leaf");
            }
        }
Example #4
0
        /// <summary>Sets the dry matter allocation.</summary>
        /// <param name="dryMatter">The actual amount of drymatter allocation</param>
        public virtual void SetDryMatterAllocation(BiomassAllocationType dryMatter)
        {
            // get DM lost by respiration (growth respiration)
            // GrowthRespiration with unit CO2
            // GrowthRespiration is calculated as
            // Allocated CH2O from photosynthesis "1 / DMConversionEfficiency.Value()", converted
            // into carbon through (12 / 30), then minus the carbon in the biomass, finally converted into
            // CO2 (44/12).
            double dMCE             = DMConversionEfficiency.Value();
            double growthRespFactor = ((1.0 / dMCE) * (12.0 / 30.0) - 1.0 * CarbonConcentration.Value()) * 44.0 / 12.0;

            RetranslocationWt = dryMatter.Retranslocation;

            GrowthRespiration = 0.0;
            // allocate structural DM
            Allocated.StructuralWt = Math.Min(dryMatter.Structural * dMCE, DMDemand.Structural);
            Live.StructuralWt     += Allocated.StructuralWt;
            GrowthRespiration     += Allocated.StructuralWt * growthRespFactor;


            // allocate non structural DM
            if ((dryMatter.Storage * dMCE - DMDemand.Storage) > BiomassToleranceValue)
            {
                throw new Exception("Non structural DM allocation to " + Name + " is in excess of its capacity");
            }
            // Allocated.StorageWt = dryMatter.Storage * dmConversionEfficiency.Value();

            RetranslocateNitrogen.AllocateBiomass(this, dryMatter);
        }
Example #5
0
        /// <summary>Allocate the retranslocated material</summary>
        /// <param name="organ"></param>
        /// <param name="nitrogen"></param>
        public void Allocate(IOrgan organ, BiomassAllocationType nitrogen)
        {
            var genOrgan = organ as GenericOrgan;

            // Retranslocation
            if (MathUtilities.IsGreaterThan(nitrogen.Retranslocation, genOrgan.Live.StructuralN + genOrgan.Live.StorageN + genOrgan.Live.MetabolicN - genOrgan.NSupply.Retranslocation))
            {
                throw new Exception("N retranslocation exceeds storage + metabolic nitrogen in organ: " + Name);
            }

            var    remainingN             = nitrogen.Retranslocation;
            double storageRetranslocation = Math.Min(genOrgan.Live.StorageN, remainingN);

            genOrgan.Live.StorageN      -= storageRetranslocation;
            genOrgan.Allocated.StorageN -= storageRetranslocation;
            remainingN -= storageRetranslocation;

            double metabolicRetranslocation = Math.Min(genOrgan.Live.MetabolicN, remainingN);

            genOrgan.Live.MetabolicN      -= metabolicRetranslocation;
            genOrgan.Allocated.MetabolicN -= metabolicRetranslocation;
            remainingN -= metabolicRetranslocation;

            double structuralRetranslocation = Math.Min(genOrgan.Live.StructuralN, remainingN);

            genOrgan.Live.StructuralN      -= structuralRetranslocation;
            genOrgan.Allocated.StructuralN -= structuralRetranslocation;
            remainingN -= structuralRetranslocation;
        }
Example #6
0
        /// <summary>Allocate the retranslocated material</summary>
        /// <param name="organ"></param>
        /// <param name="biomass"></param>
        public void AllocateBiomass(IOrgan organ, BiomassAllocationType biomass)
        {
            //doing all non-structural allocation here for sorghum, as well as retranslocation
            //TODO JB refactor metabolic and storage allocation
            var genOrgan = organ as GenericOrgan;

            genOrgan.Live.StorageWt   += biomass.Storage;
            genOrgan.Live.MetabolicWt += biomass.Metabolic;

            genOrgan.Allocated.StorageWt   += biomass.Storage;
            genOrgan.Allocated.MetabolicWt += biomass.Metabolic;

            var    remainingBiomass       = biomass.Retranslocation;
            double storageRetranslocation = Math.Min(genOrgan.Live.StorageWt, remainingBiomass);

            genOrgan.Live.StorageWt      -= storageRetranslocation;
            genOrgan.Allocated.StorageWt -= storageRetranslocation;
            remainingBiomass             -= storageRetranslocation;

            double metabolicRetranslocation = Math.Min(genOrgan.Live.MetabolicWt, remainingBiomass);

            genOrgan.Live.MetabolicWt      -= metabolicRetranslocation;
            genOrgan.Allocated.MetabolicWt -= metabolicRetranslocation;
            remainingBiomass -= metabolicRetranslocation;

            double structuralRetranslocation = Math.Min(genOrgan.Live.StructuralWt, remainingBiomass);

            genOrgan.Live.StructuralWt      -= structuralRetranslocation;
            genOrgan.Allocated.StructuralWt -= structuralRetranslocation;
            remainingBiomass -= structuralRetranslocation;
        }
Example #7
0
        /// <summary>Allocate the retranslocated material</summary>
        /// <param name="organ"></param>
        /// <param name="biomass"></param>
        public void AllocateBiomass(IOrgan organ, BiomassAllocationType biomass)
        {
            GenericOrgan genOrgan = organ as GenericOrgan;

            // get DM lost by respiration (growth respiration)
            // GrowthRespiration with unit CO2
            // GrowthRespiration is calculated as
            // Allocated CH2O from photosynthesis "1 / DMConversionEfficiency.Value()", converted
            // into carbon through (12 / 30), then minus the carbon in the biomass, finally converted into
            // CO2 (44/12).
            // FIXME - this is also calculated in GenericOrgan. Seems redundant to calculate this twice.
            double growthRespFactor = ((1.0 / genOrgan.DMConversionEfficiency.Value()) * (12.0 / 30.0) - 1.0 * genOrgan.CarbonConcentration.Value()) * 44.0 / 12.0;

            // Check retranslocation
            if (MathUtilities.IsGreaterThan(biomass.Retranslocation, genOrgan.StartLive.StorageWt))
            {
                throw new Exception("Retranslocation exceeds non structural biomass in organ: " + Name);
            }

            double diffWt = biomass.Storage - biomass.Retranslocation;

            if (diffWt > 0)
            {
                diffWt *= genOrgan.DMConversionEfficiency.Value();
                genOrgan.GrowthRespiration += diffWt * growthRespFactor;
            }
            genOrgan.Allocated.StorageWt = diffWt;
            genOrgan.Live.StorageWt     += diffWt;
            // allocate metabolic DM
            genOrgan.Allocated.MetabolicWt = biomass.Metabolic * genOrgan.DMConversionEfficiency.Value();
            genOrgan.GrowthRespiration    += genOrgan.Allocated.MetabolicWt * growthRespFactor;
            genOrgan.Live.MetabolicWt     += genOrgan.Allocated.MetabolicWt;
        }
Example #8
0
        /// <summary>Sets the n allocation.</summary>
        public void SetNitrogenAllocation(BiomassAllocationType nitrogen)
        {
            cohort.AddNewLeafMaterial(structuralMass: 0,
                                      storageMass: 0,
                                      structuralN: nitrogen.Structural,
                                      storageN: nitrogen.Storage,
                                      sla: SpecificLeafAreaFunction.Value());

            cohort.DoNitrogenRetranslocation(nitrogen.Retranslocation + nitrogen.Reallocation);
        }
Example #9
0
        /// <summary>Sets the dry matter allocation.</summary>
        public void SetDryMatterAllocation(BiomassAllocationType value)
        {
            // GrowthRespiration with unit CO2
            // GrowthRespiration is calculated as
            // Allocated CH2O from photosynthesis "1 / DMConversionEfficiency.Value()", converted
            // into carbon through (12 / 30), then minus the carbon in the biomass, finally converted into
            // CO2 (44/12).
            double growthRespFactor = ((1.0 / DMConversionEfficiency.Value()) * (12.0 / 30.0) - 1.0 * CarbonConcentration.Value()) * 44.0 / 12.0;

            GrowthRespiration = (value.Structural) * growthRespFactor;

            Live.StructuralWt     += value.Structural * DMConversionEfficiency.Value();
            Allocated.StructuralWt = value.Structural * DMConversionEfficiency.Value();
        }
Example #10
0
        /// <summary>Sets the dry matter allocation.</summary>
        /// <param name="dryMatter">The actual amount of drymatter allocation</param>
        public virtual void SetDryMatterAllocation(BiomassAllocationType dryMatter)
        {
            // get DM lost by respiration (growth respiration)
            // GrowthRespiration with unit CO2
            // GrowthRespiration is calculated as
            // Allocated CH2O from photosynthesis "1 / DMConversionEfficiency.Value()", converted
            // into carbon through (12 / 30), then minus the carbon in the biomass, finally converted into
            // CO2 (44/12).
            double growthRespFactor = ((1.0 / dmConversionEfficiency.Value()) * (12.0 / 30.0) - 1.0 * CarbonConcentration.Value()) * 44.0 / 12.0;

            GrowthRespiration = 0.0;
            // allocate structural DM
            Allocated.StructuralWt = Math.Min(dryMatter.Structural * dmConversionEfficiency.Value(), DMDemand.Structural);
            Live.StructuralWt     += Allocated.StructuralWt;
            GrowthRespiration     += Allocated.StructuralWt * growthRespFactor;


            // allocate non structural DM
            if ((dryMatter.Storage * dmConversionEfficiency.Value() - DMDemand.Storage) > BiomassToleranceValue)
            {
                throw new Exception("Non structural DM allocation to " + Name + " is in excess of its capacity");
            }
            // Allocated.StorageWt = dryMatter.Storage * dmConversionEfficiency.Value();

            if (RetranslocateNitrogen != null)
            {
                RetranslocateNitrogen.AllocateBiomass(this, dryMatter);
            }
            else
            {
                // Check retranslocation
                if (dryMatter.Retranslocation - StartLive.StorageWt > BiomassToleranceValue)
                {
                    throw new Exception("Retranslocation exceeds non structural biomass in organ: " + Name);
                }

                double diffWt = dryMatter.Storage - dryMatter.Retranslocation;
                if (diffWt > 0)
                {
                    diffWt            *= dmConversionEfficiency.Value();
                    GrowthRespiration += diffWt * growthRespFactor;
                }
                Allocated.StorageWt = diffWt;
                Live.StorageWt     += diffWt;
                // allocate metabolic DM
                Allocated.MetabolicWt = dryMatter.Metabolic * dmConversionEfficiency.Value();
                GrowthRespiration    += Allocated.MetabolicWt * growthRespFactor;
                Live.MetabolicWt     += Allocated.MetabolicWt;
            }
        }
Example #11
0
        /// <summary>Sets the n allocation.</summary>
        public void SetNitrogenAllocation(BiomassAllocationType nitrogen)
        {
            double totalStructuralNDemand = 0;
            double totalNDemand           = 0;

            foreach (ZoneState Z in Zones)
            {
                totalStructuralNDemand += MathUtilities.Sum(Z.StructuralNDemand);
                totalNDemand           += MathUtilities.Sum(Z.StructuralNDemand) + MathUtilities.Sum(Z.StorageNDemand);
            }
            NTakenUp = nitrogen.Uptake;
            Allocated.StructuralN = nitrogen.Structural;
            Allocated.StorageN    = nitrogen.Storage;
            Allocated.MetabolicN  = nitrogen.Metabolic;

            double surplus = Allocated.N - totalNDemand;

            if (surplus > 0.000000001)
            {
                throw new Exception("N Allocation to roots exceeds Demand");
            }
            double NAllocated = 0;

            foreach (ZoneState Z in Zones)
            {
                for (int i = 0; i < Z.LayerLive.Length; i++)
                {
                    if (totalStructuralNDemand > 0)
                    {
                        double StructFrac = Z.StructuralNDemand[i] / totalStructuralNDemand;
                        Z.LayerLive[i].StructuralN += nitrogen.Structural * StructFrac;
                        NAllocated += nitrogen.Structural * StructFrac;
                    }
                    double totalStorageNDemand = MathUtilities.Sum(Z.StorageNDemand);
                    if (totalStorageNDemand > 0)
                    {
                        double NonStructFrac = Z.StorageNDemand[i] / totalStorageNDemand;
                        Z.LayerLive[i].StorageN += nitrogen.Storage * NonStructFrac;
                        NAllocated += nitrogen.Storage * NonStructFrac;
                    }
                }
            }
            needToRecalculateLiveDead = true;

            if (!MathUtilities.FloatsAreEqual(NAllocated - Allocated.N, 0.0))
            {
                throw new Exception("Error in N Allocation: " + Name);
            }
        }
Example #12
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 #13
0
        /// <summary>Sets the dry matter allocation.</summary>
        public void SetDryMatterAllocation(BiomassAllocationType dryMatter)
        {
            // GrowthRespiration with unit CO2
            // GrowthRespiration is calculated as
            // Allocated CH2O from photosynthesis "1 / DMConversionEfficiency.Value()", converted
            // into carbon through (12 / 30), then minus the carbon in the biomass, finally converted into
            // CO2 (44/12).
            double growthRespFactor = ((1 / DMConversionEfficiency.Value()) * (12.0 / 30.0) - 1.0 * CarbonConcentration.Value()) * 44.0 / 12.0;

            GrowthRespiration = (dryMatter.Structural + dryMatter.Storage) * growthRespFactor;

            cohort.AddNewLeafMaterial(structuralMass: Math.Min(dryMatter.Structural * DMConversionEfficiency.Value(), DMDemand.Structural),
                                      storageMass: dryMatter.Storage * DMConversionEfficiency.Value(),
                                      structuralN: 0,
                                      storageN: 0,
                                      sla: SpecificLeafAreaFunction.Value());

            cohort.DoBiomassRetranslocation(dryMatter.Retranslocation);
        }
Example #14
0
        /// <summary>Sets the dry matter allocation.</summary>
        public void SetDryMatterAllocation(BiomassAllocationType dryMatter)
        {
            // Check retranslocation
            if (dryMatter.Retranslocation - startLive.StorageWt > BiomassToleranceValue)
            {
                throw new Exception("Retranslocation exceeds non structural biomass in organ: " + Name);
            }

            // get DM lost by respiration (growth respiration)
            // GrowthRespiration with unit CO2
            // GrowthRespiration is calculated as
            // Allocated CH2O from photosynthesis "1 / DMConversionEfficiency.Value()", converted
            // into carbon through (12 / 30), then minus the carbon in the biomass, finally converted into
            // CO2 (44/12).
            double growthRespFactor = ((1.0 / dmConversionEfficiency.Value()) * (12.0 / 30.0) - 1.0 * CarbonConcentration.Value()) * 44.0 / 12.0;

            GrowthRespiration = 0.0;
            // allocate structural DM
            Allocated.StructuralWt = Math.Min(dryMatter.Structural * dmConversionEfficiency.Value(), DMDemand.Structural);
            Live.StructuralWt     += Allocated.StructuralWt;
            GrowthRespiration     += Allocated.StructuralWt * growthRespFactor;

            // allocate non structural DM
            if ((dryMatter.Storage * dmConversionEfficiency.Value() - DMDemand.Storage) > BiomassToleranceValue)
            {
                throw new Exception("Non structural DM allocation to " + Name + " is in excess of its capacity");
            }
            // Allocated.StorageWt = dryMatter.Storage * dmConversionEfficiency.Value();
            double diffWt = dryMatter.Storage - dryMatter.Retranslocation;

            if (diffWt > 0)
            {
                diffWt            *= dmConversionEfficiency.Value();
                GrowthRespiration += diffWt * growthRespFactor;
            }
            Allocated.StorageWt = diffWt;
            Live.StorageWt     += diffWt;
            // allocate metabolic DM
            Allocated.MetabolicWt = dryMatter.Metabolic * dmConversionEfficiency.Value();
            GrowthRespiration    += Allocated.MetabolicWt * growthRespFactor;
            //This is the DM that is consumed to fix N.  this is calculated by the arbitrator and passed to the nodule to report
            RespiredWt = dryMatter.Respired;    // Now get the respired value for ourselves.
        }
Example #15
0
        /// <summary>Sets the n allocation.</summary>
        public void SetNitrogenAllocation(BiomassAllocationType nitrogen)
        {
            AddNewLeafMaterial(StructuralWt: 0,
                               StorageWt: 0,
                               StructuralN: nitrogen.Structural,
                               StorageN: nitrogen.Storage,
                               SLA: SpecificLeafAreaFunction.Value());

            double Removal = nitrogen.Retranslocation + nitrogen.Reallocation;

            foreach (PerrenialLeafCohort L in Leaves)
            {
                double Delta = Math.Min(L.Live.StorageN, Removal);
                L.Live.StorageN -= Delta;
                Removal         -= Delta;
            }
            if (MathUtilities.IsGreaterThan(Removal, 0))
            {
                throw new Exception("Insufficient Storage N to account for Retranslocation and Reallocation in Perrenial Leaf");
            }
        }
Example #16
0
        /// <summary>Sets the dry matter allocation.</summary>
        public override void SetDryMatterAllocation(BiomassAllocationType dryMatter)
        {
            double TotalRAw = 0;

            foreach (ZoneState Z in Zones)
            {
                TotalRAw += MathUtilities.Sum(Z.CalculateRootActivityValues());
            }

            Allocated.StructuralWt = dryMatter.Structural * DMConversionEfficiency.Value();
            Allocated.StorageWt    = dryMatter.Storage * DMConversionEfficiency.Value();
            Allocated.MetabolicWt  = dryMatter.Metabolic * DMConversionEfficiency.Value();
            GrowthRespiration      = (dryMatter.Structural + dryMatter.Storage + dryMatter.Metabolic) * (1 - DMConversionEfficiency.Value());
            if (TotalRAw == 0 && Allocated.Wt > 0)
            {
                throw new Exception("Error trying to partition root biomass");
            }

            foreach (ZoneState Z in Zones)
            {
                Z.PartitionRootMass(TotalRAw, Allocated.Wt);
            }
            needToRecalculateLiveDead = true;
        }
Example #17
0
        /// <summary>Sets the dry matter allocation.</summary>
        public void SetDryMatterAllocation(BiomassAllocationType dryMatter)
        {
            GrowthRespiration = dryMatter.Structural * (1 - DMConversionEfficiency.Value())
                                + dryMatter.Storage * (1 - DMConversionEfficiency.Value());

            AddNewLeafMaterial(StructuralWt: Math.Min(dryMatter.Structural * DMConversionEfficiency.Value(), StructuralDMDemand),
                               StorageWt: dryMatter.Storage * DMConversionEfficiency.Value(),
                               StructuralN: 0,
                               StorageN: 0,
                               SLA: SpecificLeafAreaFunction.Value());

            double Removal = dryMatter.Retranslocation;

            foreach (PerrenialLeafCohort L in Leaves)
            {
                double Delta = Math.Min(L.Live.StorageWt, Removal);
                L.Live.StorageWt -= Delta;
                Removal          -= Delta;
            }
            if (MathUtilities.IsGreaterThan(Removal, 0))
            {
                throw new Exception("Insufficient Storage DM to account for Retranslocation and Reallocation in Perrenial Leaf");
            }
        }
Example #18
0
 /// <summary>Sets the n allocation.</summary>
 public void SetNitrogenAllocation(BiomassAllocationType nitrogen)
 {
     Live.StructuralN     += nitrogen.Structural;
     Allocated.StructuralN = nitrogen.Structural;
 }
 /// <summary>Allocate the retranslocated material</summary>
 /// <param name="organ"></param>
 /// <param name="biomass"></param>
 public void AllocateBiomass(IOrgan organ, BiomassAllocationType biomass)
 {
 }
Example #20
0
 /// <summary>Sets the dry matter allocation.</summary>
 public void SetDryMatterAllocation(BiomassAllocationType dryMatter)
 {
     Live.StructuralWt += dryMatter.Structural; DailyGrowth = dryMatter.Structural;
 }
Example #21
0
 /// <summary>Sets the dry matter allocation.</summary>
 public virtual void SetDryMatterAllocation(BiomassAllocationType value)
 {
 }
Example #22
0
 /// <summary>Sets the n allocation.</summary>
 public virtual void SetNitrogenAllocation(BiomassAllocationType nitrogen)
 {
 }
Example #23
0
 /// <summary>Sets the n allocation.</summary>
 public override void SetNitrogenAllocation(BiomassAllocationType nitrogen)
 {
     Live.StructuralN += nitrogen.Structural;
 }
Example #24
0
 /// <summary>Sets the dry matter allocation.</summary>
 public override void SetDryMatterAllocation(BiomassAllocationType value)
 {
     GrowthRespiration      = value.Structural * (1 - DMConversionEfficiency.Value());
     Live.StructuralWt     += value.Structural * DMConversionEfficiency.Value();
     Allocated.StructuralWt = value.Structural * DMConversionEfficiency.Value();
 }
Example #25
0
 /// <summary>Sets the n allocation.</summary>
 public override void SetNitrogenAllocation(BiomassAllocationType nitrogen)
 {
     base.SetNitrogenAllocation(nitrogen); // give N allocation to base first.
     NFixed = nitrogen.Fixation;           // now get our fixation value.
 }
Example #26
0
 /// <summary>Sets the dry matter allocation.</summary>
 public override void SetDryMatterAllocation(BiomassAllocationType value)
 {
     //This is the DM that is consumed to fix N.  this is calculated by the arbitrator and passed to the nodule to report
     base.SetDryMatterAllocation(value); // Give the allocation to our base GenericOrgan first
     RespiredWt = value.Respired;        // Now get the respired value for ourselves.
 }