Beispiel #1
0
        // 3. Public methods
        //-----------------------------------------------------------------------------------------------------------------

        /// <summary>Computes the phenological development during one time-step.</summary>
        /// <remarks>Returns true when target is met.</remarks>
        public bool DoTimeStep(ref double propOfDayToUse)
        {
            bool proceedToNextPhase = false;

            TTForTimeStep = phenology.thermalTime.Value() * propOfDayToUse;
            if (EmergenceDate != null)
            {
                Target = (DateUtilities.GetDate(EmergenceDate, clock.Today) - plant.SowingDate).TotalDays;
                ProgressThroughPhase += 1;
                if (DateUtilities.DatesEqual(EmergenceDate, clock.Today))
                {
                    proceedToNextPhase = true;
                }
            }
            else
            {
                ProgressThroughPhase += TTForTimeStep;
                if (ProgressThroughPhase > Target)
                {
                    if (TTForTimeStep > 0.0)
                    {
                        proceedToNextPhase = true;
                        propOfDayToUse     = (ProgressThroughPhase - Target) / TTForTimeStep;
                        TTForTimeStep     *= (1 - propOfDayToUse);
                    }
                    ProgressThroughPhase = Target;
                }
            }
            return(proceedToNextPhase);
        }
Beispiel #2
0
 private void OnStartOfDay(object sender, EventArgs e)
 {
     if ((Start) && (TypeOfInfestation == InfestationType.OnStart))
     {
         Infest();
         Start = false;
         return;
     }
     else if (TypeOfInfestation == InfestationType.OnDate)
     {
         if (DateUtilities.DatesEqual(InfestationDate, Clock.Today))
         {
             Infest();
         }
         return;
     }
     else if (TypeOfInfestation == InfestationType.BetweenDates)
     {
         if (DateUtilities.WithinDates(InfestationDate, Clock.Today, InfestationEndDate))
         {
             Infest();
         }
         return;
     }
     else if (TypeOfInfestation == InfestationType.Continious)
     {
         Infest();
         return;
     }
 }
Beispiel #3
0
        // 4. Public method
        //-----------------------------------------------------------------------------------------------------------------

        /// <summary>Compute the phenological development during one time-step.</summary>
        /// <remarks>Returns true when target is met.</remarks>
        public bool DoTimeStep(ref double propOfDayToUse)
        {
            bool proceedToNextPhase = false;

            if (GerminationDate != null)
            {
                if (DateUtilities.DatesEqual(GerminationDate, clock.Today))
                {
                    proceedToNextPhase = true;
                    propOfDayToUse     = 1;
                }
            }

            else if (!phenology.OnStartDayOf("Sowing") && soil.Water[SowLayer] > soil.LL15mm[SowLayer])
            {
                // Invoke an AboutToSow event.
                if (SeedImbibed != null)
                {
                    SeedImbibed.Invoke(this, new EventArgs());
                }
                proceedToNextPhase = true;
                propOfDayToUse     = 1;
            }

            return(proceedToNextPhase);
        }
Beispiel #4
0
        // 4. Public method
        //-----------------------------------------------------------------------------------------------------------------

        /// <summary>Compute the phenological development during one time-step.</summary>
        /// <remarks>Returns true when target is met.</remarks>
        public bool DoTimeStep(ref double propOfDayToUse)
        {
            bool proceedToNextPhase = false;

            if (GerminationDate != null)
            {
                if (DateUtilities.DatesEqual(GerminationDate, clock.Today))
                {
                    doGermination(ref proceedToNextPhase, ref propOfDayToUse);
                }
            }

            else if (!phenology.OnStartDayOf("Sowing") && waterBalance.SWmm[SowLayer] > soilPhysical.LL15mm[SowLayer])
            {
                doGermination(ref proceedToNextPhase, ref propOfDayToUse);
            }

            return(proceedToNextPhase);
        }
Beispiel #5
0
        private void OnEndOfDay(object sender, EventArgs e)
        {
            if (EndOfSummer != null && DateUtilities.DatesEqual(FirstDateOfAutumn, clock.Today.AddDays(1)))
            {
                EndOfSummer.Invoke(this, e);
            }

            if (EndOfAutumn != null && DateUtilities.DatesEqual(FirstDateOfWinter, clock.Today.AddDays(1)))
            {
                EndOfAutumn.Invoke(this, e);
            }

            if (EndOfWinter != null && DateUtilities.DatesEqual(FirstDateOfSpring, clock.Today.AddDays(1)))
            {
                EndOfWinter.Invoke(this, e);
            }

            if (EndOfSpring != null && DateUtilities.DatesEqual(FirstDateOfSummer, clock.Today.AddDays(1)))
            {
                EndOfSpring.Invoke(this, e);
            }
        }