/// <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;
        }
        /// <summary>Allocate the retranslocated material</summary>
        /// <param name="organ"></param>
        public double CalculateBiomass(IOrgan organ)
        {
            GenericOrgan genOrgan    = organ as GenericOrgan; // FIXME!
            double       availableDM = Math.Max(0.0, genOrgan.StartLive.StorageWt - genOrgan.DMSupply.Reallocation) * genOrgan.DMRetranslocationFactor.Value();

            if (MathUtilities.IsNegative(availableDM))
            {
                throw new Exception("Negative DM retranslocation value computed for " + Name);
            }

            return(availableDM);
        }
示例#3
0
        /// <summary>Relatives the allocation.</summary>
        /// <param name="iSupply">The organs.</param>
        /// <param name="iSink">The organs.</param>
        /// <param name="n">The organs.</param>
        /// <param name="dm">The dm BAT.</param>
        /// <param name="source">The organ which N will be taken from.</param>
        public double AllocateStructuralFromStem(int iSupply, int iSink, BiomassArbitrationType n, BiomassArbitrationType dm, GenericOrgan source)
        {
            double StructuralRequirement = Math.Max(0.0, n.StructuralDemand[iSink] - n.StructuralAllocation[iSink]);

            if (MathUtilities.IsPositive(StructuralRequirement))
            {
                //only allocate as much structural as demanded - cyclical process so allow for any amounts already allocated to Retranslocation
                double nAvailable = Math.Min(StructuralRequirement, n.RetranslocationSupply[iSupply] - n.Retranslocation[iSupply]);
                double nProvided  = 0;
                double dmGreen    = source.Live.Wt;
                double dltDmGreen = dm.StructuralAllocation[iSupply] + dm.MetabolicAllocation[iSupply];
                double dltNGreen  = n.StructuralAllocation[iSupply] + n.MetabolicAllocation[iSupply] + n.StorageAllocation[iSupply];

                if (dltNGreen > StructuralRequirement)
                {
                    n.StructuralAllocation[iSink] += StructuralRequirement;
                    n.Retranslocation[iSupply]    += StructuralRequirement;
                    return(StructuralRequirement);
                }
                else
                {
                    StructuralRequirement -= dltNGreen;
                    nProvided              = dltNGreen;
                }

                // dh - no point multiplying both numbers by 100 as we do in old apsim.
                double nConc = MathUtilities.Divide(source.Live.N, dmGreen + dltDmGreen, 0);
                if (nConc < source.CritNconc)
                {
                    return(0);
                }

                double availableN = n.RetranslocationSupply[iSupply] - n.Retranslocation[iSupply];

                // cannot take below structural N
                double structN = (dmGreen + dltDmGreen) * source.CritNconc;
                nAvailable = Math.Min(nAvailable, source.Live.N - structN);
                nAvailable = Math.Max(nAvailable, 0);
                nProvided += Math.Min(StructuralRequirement, nAvailable);

                n.StructuralAllocation[iSink] += nProvided;
                n.Retranslocation[iSupply]    += nProvided;
                return(nProvided);
            }
            return(0.0);
        }
示例#4
0
        /// <summary>Relatives the allocation.</summary>
        /// <param name="iSupply">The organs.</param>
        /// <param name="iSink">The organs.</param>
        /// <param name="n">The organs.</param>
        /// <param name="dm">The dm BAT.</param>
        /// <param name="source">The organ which N will be taken from.</param>
        public double AllocateStructuralFromRachis(int iSupply, int iSink, BiomassArbitrationType n, BiomassArbitrationType dm, GenericOrgan source)
        {
            double StructuralRequirement = Math.Max(0.0, n.StructuralDemand[iSink] - n.StructuralAllocation[iSink]);

            if (MathUtilities.IsPositive(StructuralRequirement))
            {
                //only allocate as much structural as demanded - cyclical process so allow for any amounts already allocated to Retranslocation
                double StructuralAllocation = Math.Min(StructuralRequirement, n.RetranslocationSupply[iSupply] - n.Retranslocation[iSupply]);

                double dmGreen    = source.Live.Wt;
                double dltDmGreen = dm.StructuralAllocation[iSupply] + dm.MetabolicAllocation[iSupply];
                double dltNGreen  = n.StructuralAllocation[iSupply] + n.MetabolicAllocation[iSupply];
                double nConc      = MathUtilities.Divide(source.Live.N, dmGreen + dltDmGreen, 0);
                // dh - no point multiplying both numbers by 100 as we do in old apsim.
                if (nConc < source.MinNconc)
                {
                    return(0);
                }

                n.StructuralAllocation[iSink] += StructuralAllocation;
                n.Retranslocation[iSupply]    += StructuralAllocation;
                return(StructuralAllocation);
            }
            return(0.0);
        }
        /// <summary>Allocate the retranslocated material</summary>
        /// <param name="organ"></param>
        public double Calculate(IOrgan organ)
        {
            GenericOrgan genOrgan = organ as GenericOrgan; // FIXME!

            return(Math.Max(0, (genOrgan.StartLive.StorageN + genOrgan.StartLive.MetabolicN) * (1 - genOrgan.SenescenceRate.Value()) * genOrgan.NRetranslocationFactor.Value()));
        }