Ejemplo n.º 1
0
        /// <summary>Crits the n factor.</summary>
        /// <param name="Leaf">The leaf.</param>
        /// <param name="Stem">The stem.</param>
        /// <param name="multiplier">The multiplier.</param>
        /// <returns></returns>
        private static double critNFactor(Leaf1 Leaf, Stem1 Stem, double multiplier)
        //=======================================================================================
        //   Calculate Nitrogen stress factor from a bunch of parts

        /*  Purpose
         *   The concentration of Nitrogen in plant parts is used to derive a Nitrogen stress index
         *   for many processes. This stress index is calculated from today's relative nutitional
         *   status between a critical and minimum Nitrogen concentration.
         */
        {
            double dm = Leaf.Live.Wt;
            double N  = Leaf.Live.N;

            if (Stem != null)
            {
                dm += Stem.Live.Wt;
                N  += Stem.Live.N;
            }

            if (dm > 0.0)
            {
                double N_conc = N / dm;

                // calculate critical and minimum N concentrations
                double N_crit = Leaf.NCrit;
                double N_min  = Leaf.NMin;
                if (Stem != null)
                {
                    N_crit += Stem.NCrit;
                    N_min  += Stem.NMin;
                }

                double N_conc_crit = N_crit / dm;
                double N_conc_min  = N_min / dm;

                //calculate shortfall in N concentrations
                double dividend = N_conc - N_conc_min;
                double divisor  = N_conc_crit - N_conc_min;
                if (divisor != 0)
                {
                    double result = multiplier * dividend / divisor;
                    return(MathUtilities.Bound(result, 0.0, 1.0));
                }
            }
            return(1.0);
        }
Ejemplo n.º 2
0
        //=======================================================================================
        //   Calculate Nitrogen stress factor from a bunch of parts
        /*  Purpose
        *   The concentration of Nitrogen in plant parts is used to derive a Nitrogen stress index
        *   for many processes. This stress index is calculated from today's relative nutitional
        *   status between a critical and minimum Nitrogen concentration.
        */
        /// <summary>Crits the n factor.</summary>
        /// <param name="Leaf">The leaf.</param>
        /// <param name="Stem">The stem.</param>
        /// <param name="multiplier">The multiplier.</param>
        /// <returns></returns>
        private static double critNFactor(Leaf1 Leaf, Stem1 Stem, double multiplier)
        {
            double dm = Leaf.Live.Wt;
            double N = Leaf.Live.N;
            if (Stem != null)
            {
                dm += Stem.Live.Wt;
                N += Stem.Live.N;
            }

            if (dm > 0.0)
            {
                double N_conc = N / dm;

                // calculate critical and minimum N concentrations
                double N_crit = Leaf.NCrit;
                double N_min = Leaf.NMin;
                if (Stem != null)
                {
                    N_crit += Stem.NCrit;
                    N_min += Stem.NMin;
                }

                double N_conc_crit = N_crit / dm;
                double N_conc_min = N_min / dm;

                //calculate shortfall in N concentrations
                double dividend = N_conc - N_conc_min;
                double divisor = N_conc_crit - N_conc_min;
                if (divisor != 0)
                {
                    double result = multiplier * dividend / divisor;
                    return MathUtilities.Bound(result, 0.0, 1.0);
                }
            }
            return (1.0);
        }