コード例 #1
0
        /// <summary>Relatives the allocation.</summary>
        /// <param name="leaf">The organs.</param>
        /// <param name="iSupply">The organs.</param>
        /// <param name="iSink">The organs.</param>
        /// <param name="BAT">The organs.</param>
        public double AllocateStructuralFromLeaf(SorghumLeaf leaf, int iSupply, int iSink, BiomassArbitrationType BAT)
        {
            double StructuralRequirement = Math.Max(0.0, BAT.StructuralDemand[iSink] - BAT.StructuralAllocation[iSink]);

            if (MathUtilities.IsPositive(StructuralRequirement))
            {
                bool   forLeaf   = iSupply == iSink;
                double providedN = leaf.provideNRetranslocation(BAT, StructuralRequirement, forLeaf);
                BAT.StructuralAllocation[iSink] += providedN;

                // Leaf's dltRetranslocatedN is negative (as in old apsim).
                BAT.Retranslocation[iSupply] = Math.Abs(leaf.DltRetranslocatedN);

                return(providedN);
            }
            return(0.0);
        }
コード例 #2
0
        /// <summary>Relatives the allocation.</summary>
        /// <param name="leaf">The organs.</param>
        /// <param name="iSupply">The organs.</param>
        /// <param name="iSink">The organs.</param>
        /// <param name="BAT">The organs.</param>
        public double AllocateStructuralFromLeaf(SorghumLeaf leaf, int iSupply, int iSink, BiomassArbitrationType BAT)
        {
            //leaf called
            double StructuralRequirement = Math.Max(0.0, BAT.StructuralDemand[iSink] - BAT.StructuralAllocation[iSink]);

            if ((StructuralRequirement) > 0.0)
            {
                double currentRetranslocatedN = leaf.DltRetranslocatedN; //-ve number

                double providedN = leaf.provideNRetranslocation(BAT, StructuralRequirement);
                BAT.StructuralAllocation[iSink] += providedN;

                double afterRetranslocatedN = leaf.DltRetranslocatedN;
                //Leaf keeps track of retranslocation - the return value can include DltLAI which is not techncally retraslocated
                //Let leaf handle the updating

                BAT.Retranslocation[iSupply] += Math.Abs(afterRetranslocatedN - currentRetranslocatedN);
                return(providedN);
            }
            return(0.0);
        }