Exemple #1
0
        public static TLeaf Create <TLeaf>() where TLeaf : Leaf, INotSetupable, new()
        {
            Profiler.BeginSample("Leaf.Create");
            Profiler.BeginSample(typeof(TLeaf).FullName);

            var leaf = new TLeaf();

            Profiler.EndSample();
            Profiler.EndSample();

            return(leaf);
        }
        public double calcLER(double[] hourlyTemperature, double[] deltaTTCanopyHourly, double Tmax, double Tmin, double radN, double sumTTFromSowing, double profileSwAvailRatio, double calc3cmWC)
        {
            //clear LER variables
            hRadn.Clear();
            SVP.Clear();
            RH.Clear();
            VPDair.Clear();
            TLeaf.Clear();
            VPDairLeaf.Clear();
            VPDeq.Clear();
            hLER.Clear();

            // daily calculation of elongation rate given environment and genetic factors
            // LER = (Tleaf - T0)(A + b * VPDair-leaf -c * T)
            // need hourly values

            calcHourlyWeatherVars(Latitude, base.CurrentDate.DayOfYear, radN, Tmax, Tmin, hourlyTemperature);

            // double psi;
            double psi = CalcPsi(profileSwAvailRatio);

            // -------------------------------------------------------
            // [Seb L.] :

            // calculate TLeaf + SEB L. ==> Tapex != Tair !!!
            // The same CalcTLeaf is used to get the impact of SWC in the first layer !

            // With this we define the number of leaves (tip) of today :
            double Ntip = atip * sumTTFromSowing + Leaf_tip_emerg; /////////////// /////////////////////LEAFNUMBER

            // We calculate with a function based also on the number of leaves :
            CalcTApex(hourlyTemperature, calc3cmWC, Ntip);

            // calculate VPDair-leaf with final TLeaf corrected :
            CalcVPDairLeaf(hourlyTemperature);

            // calculate VPDeq
            CalcVPDeq();

            // calculate hLER
            CalcHLER(deltaTTCanopyHourly, LERa, LERb, LERc, psi);

            double dailyLER = 0;

            for (int i = 0; i < 24; i++)
            {
                dailyLER += hLER[i];
            }

            return(dailyLER / 24.0);
        }
        // New function to Calculate Tapex for leaf before applying stress (S/D ratio effect on Tleaf) :
        private void CalcTApex(double[] hourlyTemperature, double Wc_3cm, double Ntip)
        {
            // declare new parameters:
            double a, b, c, d, e;

            // Set the parameters value depending on the stage of the crop (up till leaf 8):
            if (Ntip >= 8)
            {
                a = 6.49; b = 0.77; c = 0.01; d = -0.48; e = -0.22;
            }
            else
            {
                a = 1.18; b = 1; c = 0.01; d = -1.65; e = 0;
            }
            // Now loop over the hours to define Tapex !
            for (int i = 0; i < 24; i++)
            {
                double Tcalc = a + b * hourlyTemperature[i] + c * VPDair[i] + d * hRadn[i] + e * Wc_3cm;
                TLeaf.Add(Tcalc);
            }
        }