public string TestPostConditions(SiriusQualityPhenology.DomainClass.PhenologyState s, SiriusQualityPhenology.DomainClass.PhenologyState s1, SiriusQualityPhenology.DomainClass.PhenologyRate r, SiriusQualityPhenology.DomainClass.PhenologyAuxiliary a, SiriusQualityPhenology.DomainClass.PhenologyExogenous ex, string callID)
 {
     try
     {
         //Set current values of the outputs to the static VarInfo representing the output properties of the domain classes
         SiriusQualityPhenology.DomainClass.PhenologyAuxiliaryVarInfo.fixPhyll.CurrentValue = a.fixPhyll;
         ConditionsCollection prc = new ConditionsCollection();
         Preconditions        pre = new Preconditions();
         RangeBasedCondition  r8  = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyAuxiliaryVarInfo.fixPhyll);
         if (r8.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyAuxiliaryVarInfo.fixPhyll.ValueType))
         {
             prc.AddCondition(r8);
         }
         string postConditionsResult = pre.VerifyPostconditions(prc, callID); if (!string.IsNullOrEmpty(postConditionsResult))
         {
             pre.TestsOut(postConditionsResult, true, "PostConditions errors in strategy " + this.GetType().Name);
         }
         return(postConditionsResult);
     }
     catch (Exception exception)
     {
         string msg = "SiriusQuality.Phenology, " + this.GetType().Name + ": Unhandled exception running post-condition test. ";
         throw new Exception(msg, exception);
     }
 }
 public string TestPreConditions(SiriusQualityPhenology.DomainClass.PhenologyState s, SiriusQualityPhenology.DomainClass.PhenologyState s1, SiriusQualityPhenology.DomainClass.PhenologyRate r, SiriusQualityPhenology.DomainClass.PhenologyAuxiliary a, SiriusQualityPhenology.DomainClass.PhenologyExogenous ex, string callID)
 {
     try
     {
         //Set current values of the inputs to the static VarInfo representing the inputs properties of the domain classes
         ConditionsCollection prc = new ConditionsCollection();
         Preconditions        pre = new Preconditions();
         prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("sowingDay")));
         prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("latitude")));
         prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("sDsa_sh")));
         prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("rp")));
         prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("sDws")));
         prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("sDsa_nh")));
         prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("p")));
         string preConditionsResult = pre.VerifyPreconditions(prc, callID); if (!string.IsNullOrEmpty(preConditionsResult))
         {
             pre.TestsOut(preConditionsResult, true, "PreConditions errors in strategy " + this.GetType().Name);
         }
         return(preConditionsResult);
     }
     catch (Exception exception)
     {
         string msg = "SiriusQuality.Phenology, " + this.GetType().Name + ": Unhandled exception running pre-condition test. ";
         throw new Exception(msg, exception);
     }
 }
        private void CalculateModel(SiriusQualityPhenology.DomainClass.PhenologyState s, SiriusQualityPhenology.DomainClass.PhenologyState s1, SiriusQualityPhenology.DomainClass.PhenologyRate r, SiriusQualityPhenology.DomainClass.PhenologyAuxiliary a, SiriusQualityPhenology.DomainClass.PhenologyExogenous ex)
        {
            double        canopyShootNumber_t1     = s1.canopyShootNumber;
            double        leafNumber               = s.leafNumber;
            List <double> tilleringProfile_t1      = s1.tilleringProfile;
            List <int>    leafTillerNumberArray_t1 = s1.leafTillerNumberArray;
            int           numberTillerCohort_t1    = s1.numberTillerCohort;
            double        averageShootNumberPerPlant;
            double        canopyShootNumber;
            List <int>    leafTillerNumberArray = new List <int>();
            List <double> tilleringProfile      = new List <double>();
            int           numberTillerCohort;
            int           emergedLeaves;
            int           shoots;
            int           i;
            List <int>    lNumberArray_rate = new List <int>();

            emergedLeaves              = Math.Max(1, (int)Math.Ceiling(leafNumber - 1.0d));
            shoots                     = fibonacci(emergedLeaves);
            canopyShootNumber          = Math.Min(shoots * sowingDensity, targetFertileShoot);
            averageShootNumberPerPlant = canopyShootNumber / sowingDensity;
            tilleringProfile           = new List <double>(tilleringProfile_t1);
            if (canopyShootNumber != canopyShootNumber_t1)
            {
                tilleringProfile.Add(canopyShootNumber - canopyShootNumber_t1);
            }
            numberTillerCohort = tilleringProfile.Count;
            for (i = leafTillerNumberArray_t1.Count; i < (int)Math.Ceiling(leafNumber); i += 1)
            {
                lNumberArray_rate.Add(numberTillerCohort);
            }
            leafTillerNumberArray = new List <int>(leafTillerNumberArray_t1);
            leafTillerNumberArray.AddRange(lNumberArray_rate);
            s.averageShootNumberPerPlant = averageShootNumberPerPlant;
            s.canopyShootNumber          = canopyShootNumber;
            s.leafTillerNumberArray      = leafTillerNumberArray;
            s.tilleringProfile           = tilleringProfile;
            s.numberTillerCohort         = numberTillerCohort;
        }
        private void CalculateModel(SiriusQualityPhenology.DomainClass.PhenologyState s, SiriusQualityPhenology.DomainClass.PhenologyState s1, SiriusQualityPhenology.DomainClass.PhenologyRate r, SiriusQualityPhenology.DomainClass.PhenologyAuxiliary a, SiriusQualityPhenology.DomainClass.PhenologyExogenous ex)
        {
            List <string> calendarMoments_t1 = s1.calendarMoments;
            int           isMomentRegistredZC_39;

            isMomentRegistredZC_39   = calendarMoments_t1.Contains("FlagLeafLiguleJustVisible") ? 1 : 0;
            s.isMomentRegistredZC_39 = isMomentRegistredZC_39;
        }
        private void CalculateModel(SiriusQualityPhenology.DomainClass.PhenologyState s, SiriusQualityPhenology.DomainClass.PhenologyState s1, SiriusQualityPhenology.DomainClass.PhenologyRate r, SiriusQualityPhenology.DomainClass.PhenologyAuxiliary a, SiriusQualityPhenology.DomainClass.PhenologyExogenous ex)
        {
            double          cumulTT         = a.cumulTT;
            double          leafNumber      = s.leafNumber;
            List <string>   calendarMoments = s.calendarMoments;
            List <DateTime> calendarDates   = s.calendarDates;
            List <double>   calendarCumuls  = s.calendarCumuls;
            DateTime        currentdate     = a.currentdate;
            double          finalLeafNumber = s.finalLeafNumber;
            int             hasFlagLeafLiguleAppeared_t1 = s1.hasFlagLeafLiguleAppeared;
            double          phase = s.phase;
            int             hasFlagLeafLiguleAppeared;

            hasFlagLeafLiguleAppeared = hasFlagLeafLiguleAppeared_t1;
            if (phase >= 1.0d && phase < 4.0d)
            {
                if (leafNumber > 0.0d)
                {
                    if (hasFlagLeafLiguleAppeared_t1 == 0 && (finalLeafNumber > 0.0d && leafNumber >= finalLeafNumber))
                    {
                        hasFlagLeafLiguleAppeared = 1;
                        if (!calendarMoments.Contains("FlagLeafLiguleJustVisible"))
                        {
                            calendarMoments.Add("FlagLeafLiguleJustVisible");
                            calendarCumuls.Add(cumulTT);
                            calendarDates.Add(currentdate);
                        }
                    }
                }
                else
                {
                    hasFlagLeafLiguleAppeared = 0;
                }
            }
            s.calendarMoments           = calendarMoments;
            s.calendarDates             = calendarDates;
            s.calendarCumuls            = calendarCumuls;
            s.hasFlagLeafLiguleAppeared = hasFlagLeafLiguleAppeared;
        }
 public string TestPreConditions(SiriusQualityPhenology.DomainClass.PhenologyState s, SiriusQualityPhenology.DomainClass.PhenologyState s1, SiriusQualityPhenology.DomainClass.PhenologyRate r, SiriusQualityPhenology.DomainClass.PhenologyAuxiliary a, SiriusQualityPhenology.DomainClass.PhenologyExogenous ex, string callID)
 {
     try
     {
         //Set current values of the inputs to the static VarInfo representing the inputs properties of the domain classes
         SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.canopyShootNumber.CurrentValue     = s.canopyShootNumber;
         SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.leafNumber.CurrentValue            = s.leafNumber;
         SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.tilleringProfile.CurrentValue      = s.tilleringProfile;
         SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.leafTillerNumberArray.CurrentValue = s.leafTillerNumberArray;
         SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.numberTillerCohort.CurrentValue    = s.numberTillerCohort;
         ConditionsCollection prc = new ConditionsCollection();
         Preconditions        pre = new Preconditions();
         RangeBasedCondition  r1  = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.canopyShootNumber);
         if (r1.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.canopyShootNumber.ValueType))
         {
             prc.AddCondition(r1);
         }
         RangeBasedCondition r2 = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.leafNumber);
         if (r2.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.leafNumber.ValueType))
         {
             prc.AddCondition(r2);
         }
         RangeBasedCondition r3 = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.tilleringProfile);
         if (r3.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.tilleringProfile.ValueType))
         {
             prc.AddCondition(r3);
         }
         RangeBasedCondition r4 = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.leafTillerNumberArray);
         if (r4.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.leafTillerNumberArray.ValueType))
         {
             prc.AddCondition(r4);
         }
         RangeBasedCondition r5 = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.numberTillerCohort);
         if (r5.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.numberTillerCohort.ValueType))
         {
             prc.AddCondition(r5);
         }
         prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("sowingDensity")));
         prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("targetFertileShoot")));
         string preConditionsResult = pre.VerifyPreconditions(prc, callID); if (!string.IsNullOrEmpty(preConditionsResult))
         {
             pre.TestsOut(preConditionsResult, true, "PreConditions errors in strategy " + this.GetType().Name);
         }
         return(preConditionsResult);
     }
     catch (Exception exception)
     {
         string msg = "SiriusQuality.Phenology, " + this.GetType().Name + ": Unhandled exception running pre-condition test. ";
         throw new Exception(msg, exception);
     }
 }
 public string TestPreConditions(SiriusQualityPhenology.DomainClass.PhenologyState s, SiriusQualityPhenology.DomainClass.PhenologyState s1, SiriusQualityPhenology.DomainClass.PhenologyRate r, SiriusQualityPhenology.DomainClass.PhenologyAuxiliary a, SiriusQualityPhenology.DomainClass.PhenologyExogenous ex, string callID)
 {
     try
     {
         //Set current values of the inputs to the static VarInfo representing the inputs properties of the domain classes
         SiriusQualityPhenology.DomainClass.PhenologyAuxiliaryVarInfo.dayLength.CurrentValue   = a.dayLength;
         SiriusQualityPhenology.DomainClass.PhenologyAuxiliaryVarInfo.deltaTT.CurrentValue     = a.deltaTT;
         SiriusQualityPhenology.DomainClass.PhenologyAuxiliaryVarInfo.cumulTT.CurrentValue     = a.cumulTT;
         SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.leafNumber.CurrentValue      = s.leafNumber;
         SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.calendarMoments.CurrentValue = s.calendarMoments;
         SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.calendarDates.CurrentValue   = s.calendarDates;
         SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.calendarCumuls.CurrentValue  = s.calendarCumuls;
         SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.vernaprog.CurrentValue       = s.vernaprog;
         SiriusQualityPhenology.DomainClass.PhenologyAuxiliaryVarInfo.currentdate.CurrentValue = a.currentdate;
         SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.minFinalNumber.CurrentValue  = s.minFinalNumber;
         ConditionsCollection prc = new ConditionsCollection();
         Preconditions        pre = new Preconditions();
         RangeBasedCondition  r1  = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyAuxiliaryVarInfo.dayLength);
         if (r1.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyAuxiliaryVarInfo.dayLength.ValueType))
         {
             prc.AddCondition(r1);
         }
         RangeBasedCondition r2 = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyAuxiliaryVarInfo.deltaTT);
         if (r2.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyAuxiliaryVarInfo.deltaTT.ValueType))
         {
             prc.AddCondition(r2);
         }
         RangeBasedCondition r3 = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyAuxiliaryVarInfo.cumulTT);
         if (r3.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyAuxiliaryVarInfo.cumulTT.ValueType))
         {
             prc.AddCondition(r3);
         }
         RangeBasedCondition r4 = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.leafNumber);
         if (r4.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.leafNumber.ValueType))
         {
             prc.AddCondition(r4);
         }
         RangeBasedCondition r5 = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.calendarMoments);
         if (r5.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.calendarMoments.ValueType))
         {
             prc.AddCondition(r5);
         }
         RangeBasedCondition r6 = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.calendarDates);
         if (r6.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.calendarDates.ValueType))
         {
             prc.AddCondition(r6);
         }
         RangeBasedCondition r7 = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.calendarCumuls);
         if (r7.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.calendarCumuls.ValueType))
         {
             prc.AddCondition(r7);
         }
         RangeBasedCondition r8 = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.vernaprog);
         if (r8.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.vernaprog.ValueType))
         {
             prc.AddCondition(r8);
         }
         RangeBasedCondition r9 = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyAuxiliaryVarInfo.currentdate);
         if (r9.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyAuxiliaryVarInfo.currentdate.ValueType))
         {
             prc.AddCondition(r9);
         }
         RangeBasedCondition r10 = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.minFinalNumber);
         if (r10.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.minFinalNumber.ValueType))
         {
             prc.AddCondition(r10);
         }
         prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("minTvern")));
         prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("intTvern")));
         prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("vAI")));
         prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("vBEE")));
         prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("minDL")));
         prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("maxDL")));
         prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("maxTvern")));
         prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("pNini")));
         prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("aMXLFNO")));
         prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("isVernalizable")));
         string preConditionsResult = pre.VerifyPreconditions(prc, callID); if (!string.IsNullOrEmpty(preConditionsResult))
         {
             pre.TestsOut(preConditionsResult, true, "PreConditions errors in strategy " + this.GetType().Name);
         }
         return(preConditionsResult);
     }
     catch (Exception exception)
     {
         string msg = "SiriusQuality.Phenology, " + this.GetType().Name + ": Unhandled exception running pre-condition test. ";
         throw new Exception(msg, exception);
     }
 }
 public string TestPostConditions(SiriusQualityPhenology.DomainClass.PhenologyState s, SiriusQualityPhenology.DomainClass.PhenologyState s1, SiriusQualityPhenology.DomainClass.PhenologyRate r, SiriusQualityPhenology.DomainClass.PhenologyAuxiliary a, SiriusQualityPhenology.DomainClass.PhenologyExogenous ex, string callID)
 {
     try
     {
         //Set current values of the outputs to the static VarInfo representing the output properties of the domain classes
         SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.hasFlagLeafLiguleAppeared.CurrentValue = s.hasFlagLeafLiguleAppeared;
         SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.calendarMoments.CurrentValue           = s.calendarMoments;
         SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.calendarDates.CurrentValue             = s.calendarDates;
         SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.calendarCumuls.CurrentValue            = s.calendarCumuls;
         ConditionsCollection prc = new ConditionsCollection();
         Preconditions        pre = new Preconditions();
         RangeBasedCondition  r10 = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.hasFlagLeafLiguleAppeared);
         if (r10.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.hasFlagLeafLiguleAppeared.ValueType))
         {
             prc.AddCondition(r10);
         }
         RangeBasedCondition r11 = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.calendarMoments);
         if (r11.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.calendarMoments.ValueType))
         {
             prc.AddCondition(r11);
         }
         RangeBasedCondition r12 = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.calendarDates);
         if (r12.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.calendarDates.ValueType))
         {
             prc.AddCondition(r12);
         }
         RangeBasedCondition r13 = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.calendarCumuls);
         if (r13.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.calendarCumuls.ValueType))
         {
             prc.AddCondition(r13);
         }
         string postConditionsResult = pre.VerifyPostconditions(prc, callID); if (!string.IsNullOrEmpty(postConditionsResult))
         {
             pre.TestsOut(postConditionsResult, true, "PostConditions errors in strategy " + this.GetType().Name);
         }
         return(postConditionsResult);
     }
     catch (Exception exception)
     {
         string msg = "SiriusQuality.Phenology, " + this.GetType().Name + ": Unhandled exception running post-condition test. ";
         throw new Exception(msg, exception);
     }
 }
Beispiel #9
0
        private void CalculateModel(SiriusQualityPhenology.DomainClass.PhenologyState s, SiriusQualityPhenology.DomainClass.PhenologyState s1, SiriusQualityPhenology.DomainClass.PhenologyRate r, SiriusQualityPhenology.DomainClass.PhenologyAuxiliary a, SiriusQualityPhenology.DomainClass.PhenologyExogenous ex)
        {
            double deltaTT                   = a.deltaTT;
            double phyllochron_t1            = s1.phyllochron;
            int    hasFlagLeafLiguleAppeared = s.hasFlagLeafLiguleAppeared;
            double leafNumber_t1             = s1.leafNumber;
            double phase = s.phase;
            double leafNumber;

            leafNumber = leafNumber_t1;
            double phyllochron_;

            if (phase >= 1.0d && phase < 4.0d)
            {
                if (hasFlagLeafLiguleAppeared == 0)
                {
                    if (phyllochron_t1 == 0.0d)
                    {
                        phyllochron_ = 0.0000001d;
                    }
                    else
                    {
                        phyllochron_ = phyllochron_t1;
                    }
                    leafNumber = leafNumber_t1 + Math.Min(deltaTT / phyllochron_, 0.999d);
                }
            }
            s.leafNumber = leafNumber;
        }
        private void CalculateModel(SiriusQualityPhenology.DomainClass.PhenologyState s, SiriusQualityPhenology.DomainClass.PhenologyState s1, SiriusQualityPhenology.DomainClass.PhenologyRate r, SiriusQualityPhenology.DomainClass.PhenologyAuxiliary a, SiriusQualityPhenology.DomainClass.PhenologyExogenous ex)
        {
            double          cumulTT                 = a.cumulTT;
            double          phase                   = s.phase;
            double          leafNumber              = s.leafNumber;
            List <string>   calendarMoments         = s.calendarMoments;
            List <DateTime> calendarDates           = s.calendarDates;
            List <double>   calendarCumuls          = s.calendarCumuls;
            double          cumulTTFromZC_65        = a.cumulTTFromZC_65;
            DateTime        currentdate             = a.currentdate;
            double          finalLeafNumber         = s.finalLeafNumber;
            string          currentZadokStage       = s.currentZadokStage;
            int             hasZadokStageChanged_t1 = s1.hasZadokStageChanged;
            int             hasZadokStageChanged;
            int             roundedFinalLeafNumber;

            roundedFinalLeafNumber = (int)(finalLeafNumber + 0.5d);
            if (leafNumber >= 4.0d && !calendarMoments.Contains("MainShootPlus1Tiller"))
            {
                calendarMoments.Add("MainShootPlus1Tiller");
                calendarCumuls.Add(cumulTT);
                calendarDates.Add(currentdate);
                hasZadokStageChanged = 1;
                currentZadokStage    = "MainShootPlus1Tiller";
            }
            else if (leafNumber >= 5.0d && !calendarMoments.Contains("MainShootPlus2Tiller"))
            {
                calendarMoments.Add("MainShootPlus2Tiller");
                calendarCumuls.Add(cumulTT);
                calendarDates.Add(currentdate);
                hasZadokStageChanged = 1;
                currentZadokStage    = "MainShootPlus2Tiller";
            }
            else if (leafNumber >= 6.0d && !calendarMoments.Contains("MainShootPlus3Tiller"))
            {
                calendarMoments.Add("MainShootPlus3Tiller");
                calendarCumuls.Add(cumulTT);
                calendarDates.Add(currentdate);
                hasZadokStageChanged = 1;
                currentZadokStage    = "MainShootPlus3Tiller";
            }
            else if (finalLeafNumber > 0.0d && (leafNumber >= slopeTSFLN * finalLeafNumber - intTSFLN && !calendarMoments.Contains("TerminalSpikelet")))
            {
                calendarMoments.Add("TerminalSpikelet");
                calendarCumuls.Add(cumulTT);
                calendarDates.Add(currentdate);
                hasZadokStageChanged = 1;
                currentZadokStage    = "TerminalSpikelet";
            }
            else if (leafNumber >= roundedFinalLeafNumber - 4.0d && roundedFinalLeafNumber - 4 > 0 && !calendarMoments.Contains("PseudoStemErection"))
            {
                calendarMoments.Add("PseudoStemErection");
                calendarCumuls.Add(cumulTT);
                calendarDates.Add(currentdate);
                hasZadokStageChanged = 1;
                currentZadokStage    = "PseudoStemErection";
            }
            else if (leafNumber >= roundedFinalLeafNumber - 3.0d && roundedFinalLeafNumber - 3 > 0 && !calendarMoments.Contains("1stNodeDetectable"))
            {
                calendarMoments.Add("1stNodeDetectable");
                calendarCumuls.Add(cumulTT);
                calendarDates.Add(currentdate);
                hasZadokStageChanged = 1;
                currentZadokStage    = "1stNodeDetectable";
            }
            else if (leafNumber >= roundedFinalLeafNumber - 2.0d && roundedFinalLeafNumber - 2 > 0 && !calendarMoments.Contains("2ndNodeDetectable"))
            {
                calendarMoments.Add("2ndNodeDetectable");
                calendarCumuls.Add(cumulTT);
                calendarDates.Add(currentdate);
                hasZadokStageChanged = 1;
                currentZadokStage    = "2ndNodeDetectable";
            }
            else if (leafNumber >= roundedFinalLeafNumber - 1.0d && roundedFinalLeafNumber - 1 > 0 && !calendarMoments.Contains("FlagLeafJustVisible"))
            {
                calendarMoments.Add("FlagLeafJustVisible");
                calendarCumuls.Add(cumulTT);
                calendarDates.Add(currentdate);
                hasZadokStageChanged = 1;
                currentZadokStage    = "FlagLeafJustVisible";
            }
            else if (!calendarMoments.Contains("MidGrainFilling") && (phase == 4.5d && cumulTTFromZC_65 >= der))
            {
                calendarMoments.Add("MidGrainFilling");
                calendarCumuls.Add(cumulTT);
                calendarDates.Add(currentdate);
                hasZadokStageChanged = 1;
                currentZadokStage    = "MidGrainFilling";
            }
            else
            {
                hasZadokStageChanged = 0;
            }
            s.calendarMoments      = calendarMoments;
            s.calendarDates        = calendarDates;
            s.calendarCumuls       = calendarCumuls;
            s.currentZadokStage    = currentZadokStage;
            s.hasZadokStageChanged = hasZadokStageChanged;
        }
 public PhenologyRate(PhenologyRate toCopy, bool copyAll) // copy constructor 
 {
     if (copyAll)
     {
     }
 }
Beispiel #12
0
        private void CalculateModel(SiriusQualityPhenology.DomainClass.PhenologyState s, SiriusQualityPhenology.DomainClass.PhenologyState s1, SiriusQualityPhenology.DomainClass.PhenologyRate r, SiriusQualityPhenology.DomainClass.PhenologyAuxiliary a, SiriusQualityPhenology.DomainClass.PhenologyExogenous ex)
        {
            double        gAI          = a.gAI;
            double        deltaTT      = a.deltaTT;
            double        pastMaxAI_t1 = s1.pastMaxAI;
            List <double> listTTShootWindowForPTQ1_t1 = s1.listTTShootWindowForPTQ1;
            List <double> listGAITTWindowForPTQ_t1    = s1.listGAITTWindowForPTQ;
            double        gAImean;
            double        pastMaxAI;
            List <double> listTTShootWindowForPTQ1 = new List <double>();
            List <double> listGAITTWindowForPTQ    = new List <double>();
            List <double> TTList  = new List <double>();
            List <double> GAIList = new List <double>();
            double        SumTT;
            int           count        = 0;
            double        gai_         = 0.0d;
            double        gaiMean_     = 0.0d;
            int           countGaiMean = 0;
            int           i;

            for (i = 0; i != listTTShootWindowForPTQ1_t1.Count; i += 1)
            {
                TTList.Add(listTTShootWindowForPTQ1_t1[i]);
                GAIList.Add(listGAITTWindowForPTQ_t1[i]);
            }
            TTList.Add(deltaTT);
            GAIList.Add(gAI);
            SumTT = TTList.Sum();
            while (SumTT > tTWindowForPTQ)
            {
                SumTT = SumTT - TTList[count];
                count = count + 1;
            }
            for (i = count; i != TTList.Count; i += 1)
            {
                listTTShootWindowForPTQ1.Add(TTList[i]);
                listGAITTWindowForPTQ.Add(GAIList[i]);
            }
            for (i = 0; i != listGAITTWindowForPTQ.Count; i += 1)
            {
                gaiMean_     = gaiMean_ + listGAITTWindowForPTQ[i];
                countGaiMean = countGaiMean + 1;
            }
            gaiMean_    = gaiMean_ / countGaiMean;
            gai_        = Math.Max(pastMaxAI_t1, gaiMean_);
            pastMaxAI   = gai_;
            gAImean     = gai_;
            s.gAImean   = gAImean;
            s.pastMaxAI = pastMaxAI;
            s.listTTShootWindowForPTQ1 = listTTShootWindowForPTQ1;
            s.listGAITTWindowForPTQ    = listGAITTWindowForPTQ;
        }
Beispiel #13
0
 public string TestPostConditions(SiriusQualityPhenology.DomainClass.PhenologyState s, SiriusQualityPhenology.DomainClass.PhenologyState s1, SiriusQualityPhenology.DomainClass.PhenologyRate r, SiriusQualityPhenology.DomainClass.PhenologyAuxiliary a, SiriusQualityPhenology.DomainClass.PhenologyExogenous ex, string callID)
 {
     try
     {
         //Set current values of the outputs to the static VarInfo representing the output properties of the domain classes
         SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.gAImean.CurrentValue   = s.gAImean;
         SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.pastMaxAI.CurrentValue = s.pastMaxAI;
         SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.listTTShootWindowForPTQ1.CurrentValue = s.listTTShootWindowForPTQ1;
         SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.listGAITTWindowForPTQ.CurrentValue    = s.listGAITTWindowForPTQ;
         ConditionsCollection prc = new ConditionsCollection();
         Preconditions        pre = new Preconditions();
         RangeBasedCondition  r7  = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.gAImean);
         if (r7.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.gAImean.ValueType))
         {
             prc.AddCondition(r7);
         }
         RangeBasedCondition r8 = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.pastMaxAI);
         if (r8.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.pastMaxAI.ValueType))
         {
             prc.AddCondition(r8);
         }
         RangeBasedCondition r9 = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.listTTShootWindowForPTQ1);
         if (r9.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.listTTShootWindowForPTQ1.ValueType))
         {
             prc.AddCondition(r9);
         }
         RangeBasedCondition r10 = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.listGAITTWindowForPTQ);
         if (r10.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.listGAITTWindowForPTQ.ValueType))
         {
             prc.AddCondition(r10);
         }
         string postConditionsResult = pre.VerifyPostconditions(prc, callID); if (!string.IsNullOrEmpty(postConditionsResult))
         {
             pre.TestsOut(postConditionsResult, true, "PostConditions errors in strategy " + this.GetType().Name);
         }
         return(postConditionsResult);
     }
     catch (Exception exception)
     {
         string msg = "SiriusQuality.Phenology, " + this.GetType().Name + ": Unhandled exception running post-condition test. ";
         throw new Exception(msg, exception);
     }
 }
        private void CalculateModel(SiriusQualityPhenology.DomainClass.PhenologyState s, SiriusQualityPhenology.DomainClass.PhenologyState s1, SiriusQualityPhenology.DomainClass.PhenologyRate r, SiriusQualityPhenology.DomainClass.PhenologyAuxiliary a, SiriusQualityPhenology.DomainClass.PhenologyExogenous ex)
        {
            double fixPhyll;

            if (latitude < 0.0d)
            {
                if (sowingDay > (int)(sDsa_sh))
                {
                    fixPhyll = p * (1 - (rp * Math.Min((sowingDay - sDsa_sh), sDws)));
                }
                else
                {
                    fixPhyll = p;
                }
            }
            else
            {
                if (sowingDay < (int)(sDsa_nh))
                {
                    fixPhyll = p * (1 - (rp * Math.Min(sowingDay, sDws)));
                }
                else
                {
                    fixPhyll = p;
                }
            }
            a.fixPhyll = fixPhyll;
        }
        private void CalculateModel(SiriusQualityPhenology.DomainClass.PhenologyState s, SiriusQualityPhenology.DomainClass.PhenologyState s1, SiriusQualityPhenology.DomainClass.PhenologyRate r, SiriusQualityPhenology.DomainClass.PhenologyAuxiliary a, SiriusQualityPhenology.DomainClass.PhenologyExogenous ex)
        {
            double          dayLength          = a.dayLength;
            double          deltaTT            = a.deltaTT;
            double          cumulTT            = a.cumulTT;
            double          leafNumber_t1      = s1.leafNumber;
            List <string>   calendarMoments_t1 = s1.calendarMoments;
            List <DateTime> calendarDates_t1   = s1.calendarDates;
            List <double>   calendarCumuls_t1  = s1.calendarCumuls;
            double          vernaprog_t1       = s1.vernaprog;
            DateTime        currentdate        = a.currentdate;
            double          minFinalNumber_t1  = s1.minFinalNumber;
            double          vernaprog;
            double          minFinalNumber;
            List <string>   calendarMoments = new List <string>();
            List <DateTime> calendarDates   = new List <DateTime>();
            List <double>   calendarCumuls  = new List <double>();
            double          maxVernaProg;
            double          dLverna;
            double          primordno;
            double          minLeafNumber;
            double          potlfno;
            double          tt;

            calendarMoments = new List <string>(calendarMoments_t1);
            calendarCumuls  = new List <double>(calendarCumuls_t1);
            calendarDates   = new List <DateTime>(calendarDates_t1);
            minFinalNumber  = minFinalNumber_t1;
            vernaprog       = vernaprog_t1;
            if (isVernalizable == 1 && vernaprog_t1 < 1.0d)
            {
                tt = deltaTT;
                if (tt >= minTvern && tt <= intTvern)
                {
                    vernaprog = vernaprog_t1 + (vAI * tt) + vBEE;
                }
                else
                {
                    vernaprog = vernaprog_t1;
                }
                if (tt > intTvern)
                {
                    maxVernaProg = vAI * intTvern + vBEE;
                    dLverna      = Math.Max(minDL, Math.Min(maxDL, dayLength));
                    vernaprog    = vernaprog + Math.Max(0.0d, maxVernaProg * (1.0d + ((intTvern - tt) / (maxTvern - intTvern) * ((dLverna - minDL) / (maxDL - minDL)))));
                }
                primordno     = 2.0d * leafNumber_t1 + pNini;
                minLeafNumber = minFinalNumber_t1;
                if (vernaprog >= 1.0d || primordno >= aMXLFNO)
                {
                    minFinalNumber = Math.Max(primordno, minFinalNumber_t1);
                    calendarMoments.Add("EndVernalisation");
                    calendarCumuls.Add(cumulTT);
                    calendarDates.Add(currentdate);
                    vernaprog = Math.Max(1.0d, vernaprog);
                }
                else
                {
                    potlfno = aMXLFNO - ((aMXLFNO - minLeafNumber) * vernaprog);
                    if (primordno >= potlfno)
                    {
                        minFinalNumber = Math.Max((potlfno + primordno) / 2.0d, minFinalNumber_t1);
                        vernaprog      = Math.Max(1.0d, vernaprog);
                        calendarMoments.Add("EndVernalisation");
                        calendarCumuls.Add(cumulTT);
                        calendarDates.Add(currentdate);
                    }
                }
            }
            s.vernaprog       = vernaprog;
            s.minFinalNumber  = minFinalNumber;
            s.calendarMoments = calendarMoments;
            s.calendarDates   = calendarDates;
            s.calendarCumuls  = calendarCumuls;
        }
Beispiel #16
0
        private void CalculateModel(SiriusQualityPhenology.DomainClass.PhenologyState s, SiriusQualityPhenology.DomainClass.PhenologyState s1, SiriusQualityPhenology.DomainClass.PhenologyRate r, SiriusQualityPhenology.DomainClass.PhenologyAuxiliary a, SiriusQualityPhenology.DomainClass.PhenologyExogenous ex)
        {
            double          cumulTT         = a.cumulTT;
            List <string>   calendarMoments = s.calendarMoments;
            List <DateTime> calendarDates   = s.calendarDates;
            List <double>   calendarCumuls  = s.calendarCumuls;
            DateTime        currentdate     = a.currentdate;
            double          phase           = s.phase;

            if (phase >= 1.0d && phase < 2.0d && !calendarMoments.Contains("Emergence"))
            {
                calendarMoments.Add("Emergence");
                calendarCumuls.Add(cumulTT);
                calendarDates.Add(currentdate);
            }
            else if (phase >= 2.0d && phase < 3.0d && !calendarMoments.Contains("FloralInitiation"))
            {
                calendarMoments.Add("FloralInitiation");
                calendarCumuls.Add(cumulTT);
                calendarDates.Add(currentdate);
            }
            else if (phase >= 3.0d && phase < 4.0d && !calendarMoments.Contains("Heading"))
            {
                calendarMoments.Add("Heading");
                calendarCumuls.Add(cumulTT);
                calendarDates.Add(currentdate);
            }
            else if (phase == 4.0d && !calendarMoments.Contains("Anthesis"))
            {
                calendarMoments.Add("Anthesis");
                calendarCumuls.Add(cumulTT);
                calendarDates.Add(currentdate);
            }
            else if (phase == 4.5d && !calendarMoments.Contains("EndCellDivision"))
            {
                calendarMoments.Add("EndCellDivision");
                calendarCumuls.Add(cumulTT);
                calendarDates.Add(currentdate);
            }
            else if (phase >= 5.0d && phase < 6.0d && !calendarMoments.Contains("EndGrainFilling"))
            {
                calendarMoments.Add("EndGrainFilling");
                calendarCumuls.Add(cumulTT);
                calendarDates.Add(currentdate);
            }
            else if (phase >= 6.0d && phase < 7.0d && !calendarMoments.Contains("Maturity"))
            {
                calendarMoments.Add("Maturity");
                calendarCumuls.Add(cumulTT);
                calendarDates.Add(currentdate);
            }
            s.calendarMoments = calendarMoments;
            s.calendarDates   = calendarDates;
            s.calendarCumuls  = calendarCumuls;
        }
Beispiel #17
0
        private void CalculateModel(SiriusQualityPhenology.DomainClass.PhenologyState s, SiriusQualityPhenology.DomainClass.PhenologyState s1, SiriusQualityPhenology.DomainClass.PhenologyRate r, SiriusQualityPhenology.DomainClass.PhenologyAuxiliary a, SiriusQualityPhenology.DomainClass.PhenologyExogenous ex)
        {
            double fixPhyll   = a.fixPhyll;
            double leafNumber = s.leafNumber;
            double ptq        = s.ptq;
            double gAImean    = s.gAImean;
            double phyllochron;
            double gaiLim;
            double LAR;

            phyllochron = 0.0d;
            LAR         = 0.0d;
            gaiLim      = lNeff * ((areaSL + areaSS) / 10000.0d) * sowingDensity;
            if (choosePhyllUse == "Default")
            {
                if (leafNumber < ldecr)
                {
                    phyllochron = fixPhyll * pdecr;
                }
                else if (leafNumber >= ldecr && leafNumber < lincr)
                {
                    phyllochron = fixPhyll;
                }
                else
                {
                    phyllochron = fixPhyll * pincr;
                }
            }
            if (choosePhyllUse == "PTQ")
            {
                if (gAImean > gaiLim)
                {
                    LAR = (lARmin + ((lARmax - lARmin) * ptq / (pTQhf + ptq))) / (B * gAImean);
                }
                else
                {
                    LAR = (lARmin + ((lARmax - lARmin) * ptq / (pTQhf + ptq))) / (B * gaiLim);
                }
                phyllochron = 1.0d / LAR;
            }
            if (choosePhyllUse == "Test")
            {
                if (leafNumber < ldecr)
                {
                    phyllochron = p * pdecr;
                }
                else if (leafNumber >= ldecr && leafNumber < lincr)
                {
                    phyllochron = p;
                }
                else
                {
                    phyllochron = p * pincr;
                }
            }
            s.phyllochron = phyllochron;
        }
 public string TestPreConditions(SiriusQualityPhenology.DomainClass.PhenologyState s, SiriusQualityPhenology.DomainClass.PhenologyState s1, SiriusQualityPhenology.DomainClass.PhenologyRate r, SiriusQualityPhenology.DomainClass.PhenologyAuxiliary a, SiriusQualityPhenology.DomainClass.PhenologyExogenous ex, string callID)
 {
     try
     {
         //Set current values of the inputs to the static VarInfo representing the inputs properties of the domain classes
         SiriusQualityPhenology.DomainClass.PhenologyAuxiliaryVarInfo.cumulTT.CurrentValue               = a.cumulTT;
         SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.leafNumber.CurrentValue                = s.leafNumber;
         SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.calendarMoments.CurrentValue           = s.calendarMoments;
         SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.calendarDates.CurrentValue             = s.calendarDates;
         SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.calendarCumuls.CurrentValue            = s.calendarCumuls;
         SiriusQualityPhenology.DomainClass.PhenologyAuxiliaryVarInfo.currentdate.CurrentValue           = a.currentdate;
         SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.finalLeafNumber.CurrentValue           = s.finalLeafNumber;
         SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.hasFlagLeafLiguleAppeared.CurrentValue = s.hasFlagLeafLiguleAppeared;
         SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.phase.CurrentValue = s.phase;
         ConditionsCollection prc = new ConditionsCollection();
         Preconditions        pre = new Preconditions();
         RangeBasedCondition  r1  = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyAuxiliaryVarInfo.cumulTT);
         if (r1.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyAuxiliaryVarInfo.cumulTT.ValueType))
         {
             prc.AddCondition(r1);
         }
         RangeBasedCondition r2 = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.leafNumber);
         if (r2.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.leafNumber.ValueType))
         {
             prc.AddCondition(r2);
         }
         RangeBasedCondition r3 = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.calendarMoments);
         if (r3.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.calendarMoments.ValueType))
         {
             prc.AddCondition(r3);
         }
         RangeBasedCondition r4 = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.calendarDates);
         if (r4.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.calendarDates.ValueType))
         {
             prc.AddCondition(r4);
         }
         RangeBasedCondition r5 = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.calendarCumuls);
         if (r5.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.calendarCumuls.ValueType))
         {
             prc.AddCondition(r5);
         }
         RangeBasedCondition r6 = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyAuxiliaryVarInfo.currentdate);
         if (r6.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyAuxiliaryVarInfo.currentdate.ValueType))
         {
             prc.AddCondition(r6);
         }
         RangeBasedCondition r7 = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.finalLeafNumber);
         if (r7.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.finalLeafNumber.ValueType))
         {
             prc.AddCondition(r7);
         }
         RangeBasedCondition r8 = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.hasFlagLeafLiguleAppeared);
         if (r8.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.hasFlagLeafLiguleAppeared.ValueType))
         {
             prc.AddCondition(r8);
         }
         RangeBasedCondition r9 = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.phase);
         if (r9.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.phase.ValueType))
         {
             prc.AddCondition(r9);
         }
         string preConditionsResult = pre.VerifyPreconditions(prc, callID); if (!string.IsNullOrEmpty(preConditionsResult))
         {
             pre.TestsOut(preConditionsResult, true, "PreConditions errors in strategy " + this.GetType().Name);
         }
         return(preConditionsResult);
     }
     catch (Exception exception)
     {
         string msg = "SiriusQuality.Phenology, " + this.GetType().Name + ": Unhandled exception running pre-condition test. ";
         throw new Exception(msg, exception);
     }
 }
Beispiel #19
0
 public string TestPreConditions(SiriusQualityPhenology.DomainClass.PhenologyState s, SiriusQualityPhenology.DomainClass.PhenologyState s1, SiriusQualityPhenology.DomainClass.PhenologyRate r, SiriusQualityPhenology.DomainClass.PhenologyAuxiliary a, SiriusQualityPhenology.DomainClass.PhenologyExogenous ex, string callID)
 {
     try
     {
         //Set current values of the inputs to the static VarInfo representing the inputs properties of the domain classes
         SiriusQualityPhenology.DomainClass.PhenologyAuxiliaryVarInfo.fixPhyll.CurrentValue = a.fixPhyll;
         SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.leafNumber.CurrentValue   = s.leafNumber;
         SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.ptq.CurrentValue          = s.ptq;
         SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.gAImean.CurrentValue      = s.gAImean;
         ConditionsCollection prc = new ConditionsCollection();
         Preconditions        pre = new Preconditions();
         RangeBasedCondition  r1  = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyAuxiliaryVarInfo.fixPhyll);
         if (r1.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyAuxiliaryVarInfo.fixPhyll.ValueType))
         {
             prc.AddCondition(r1);
         }
         RangeBasedCondition r2 = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.leafNumber);
         if (r2.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.leafNumber.ValueType))
         {
             prc.AddCondition(r2);
         }
         RangeBasedCondition r3 = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.ptq);
         if (r3.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.ptq.ValueType))
         {
             prc.AddCondition(r3);
         }
         RangeBasedCondition r4 = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.gAImean);
         if (r4.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.gAImean.ValueType))
         {
             prc.AddCondition(r4);
         }
         prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("lincr")));
         prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("ldecr")));
         prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("pdecr")));
         prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("pincr")));
         prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("kl")));
         prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("pTQhf")));
         prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("B")));
         prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("p")));
         prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("choosePhyllUse")));
         prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("areaSL")));
         prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("areaSS")));
         prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("lARmin")));
         prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("lARmax")));
         prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("sowingDensity")));
         prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("lNeff")));
         string preConditionsResult = pre.VerifyPreconditions(prc, callID); if (!string.IsNullOrEmpty(preConditionsResult))
         {
             pre.TestsOut(preConditionsResult, true, "PreConditions errors in strategy " + this.GetType().Name);
         }
         return(preConditionsResult);
     }
     catch (Exception exception)
     {
         string msg = "SiriusQuality.Phenology, " + this.GetType().Name + ": Unhandled exception running pre-condition test. ";
         throw new Exception(msg, exception);
     }
 }
 public string TestPostConditions(SiriusQualityPhenology.DomainClass.PhenologyState s, SiriusQualityPhenology.DomainClass.PhenologyState s1, SiriusQualityPhenology.DomainClass.PhenologyRate r, SiriusQualityPhenology.DomainClass.PhenologyAuxiliary a, SiriusQualityPhenology.DomainClass.PhenologyExogenous ex, string callID)
 {
     try
     {
         //Set current values of the outputs to the static VarInfo representing the output properties of the domain classes
         SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.averageShootNumberPerPlant.CurrentValue = s.averageShootNumberPerPlant;
         SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.canopyShootNumber.CurrentValue          = s.canopyShootNumber;
         SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.leafTillerNumberArray.CurrentValue      = s.leafTillerNumberArray;
         SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.tilleringProfile.CurrentValue           = s.tilleringProfile;
         SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.numberTillerCohort.CurrentValue         = s.numberTillerCohort;
         ConditionsCollection prc = new ConditionsCollection();
         Preconditions        pre = new Preconditions();
         RangeBasedCondition  r8  = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.averageShootNumberPerPlant);
         if (r8.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.averageShootNumberPerPlant.ValueType))
         {
             prc.AddCondition(r8);
         }
         RangeBasedCondition r9 = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.canopyShootNumber);
         if (r9.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.canopyShootNumber.ValueType))
         {
             prc.AddCondition(r9);
         }
         RangeBasedCondition r10 = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.leafTillerNumberArray);
         if (r10.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.leafTillerNumberArray.ValueType))
         {
             prc.AddCondition(r10);
         }
         RangeBasedCondition r11 = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.tilleringProfile);
         if (r11.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.tilleringProfile.ValueType))
         {
             prc.AddCondition(r11);
         }
         RangeBasedCondition r12 = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.numberTillerCohort);
         if (r12.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.numberTillerCohort.ValueType))
         {
             prc.AddCondition(r12);
         }
         string postConditionsResult = pre.VerifyPostconditions(prc, callID); if (!string.IsNullOrEmpty(postConditionsResult))
         {
             pre.TestsOut(postConditionsResult, true, "PostConditions errors in strategy " + this.GetType().Name);
         }
         return(postConditionsResult);
     }
     catch (Exception exception)
     {
         string msg = "SiriusQuality.Phenology, " + this.GetType().Name + ": Unhandled exception running post-condition test. ";
         throw new Exception(msg, exception);
     }
 }
Beispiel #21
0
 public string TestPreConditions(SiriusQualityPhenology.DomainClass.PhenologyState s, SiriusQualityPhenology.DomainClass.PhenologyState s1, SiriusQualityPhenology.DomainClass.PhenologyRate r, SiriusQualityPhenology.DomainClass.PhenologyAuxiliary a, SiriusQualityPhenology.DomainClass.PhenologyExogenous ex, string callID)
 {
     try
     {
         //Set current values of the inputs to the static VarInfo representing the inputs properties of the domain classes
         SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.listTTShootWindowForPTQ.CurrentValue = s.listTTShootWindowForPTQ;
         SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.listPARTTWindowForPTQ.CurrentValue   = s.listPARTTWindowForPTQ;
         SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.listGAITTWindowForPTQ.CurrentValue   = s.listGAITTWindowForPTQ;
         SiriusQualityPhenology.DomainClass.PhenologyAuxiliaryVarInfo.pAR.CurrentValue     = a.pAR;
         SiriusQualityPhenology.DomainClass.PhenologyAuxiliaryVarInfo.deltaTT.CurrentValue = a.deltaTT;
         ConditionsCollection prc = new ConditionsCollection();
         Preconditions        pre = new Preconditions();
         RangeBasedCondition  r1  = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.listTTShootWindowForPTQ);
         if (r1.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.listTTShootWindowForPTQ.ValueType))
         {
             prc.AddCondition(r1);
         }
         RangeBasedCondition r2 = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.listPARTTWindowForPTQ);
         if (r2.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.listPARTTWindowForPTQ.ValueType))
         {
             prc.AddCondition(r2);
         }
         RangeBasedCondition r3 = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.listGAITTWindowForPTQ);
         if (r3.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.listGAITTWindowForPTQ.ValueType))
         {
             prc.AddCondition(r3);
         }
         RangeBasedCondition r4 = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyAuxiliaryVarInfo.pAR);
         if (r4.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyAuxiliaryVarInfo.pAR.ValueType))
         {
             prc.AddCondition(r4);
         }
         RangeBasedCondition r5 = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyAuxiliaryVarInfo.deltaTT);
         if (r5.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyAuxiliaryVarInfo.deltaTT.ValueType))
         {
             prc.AddCondition(r5);
         }
         prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("tTWindowForPTQ")));
         prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("kl")));
         string preConditionsResult = pre.VerifyPreconditions(prc, callID); if (!string.IsNullOrEmpty(preConditionsResult))
         {
             pre.TestsOut(preConditionsResult, true, "PreConditions errors in strategy " + this.GetType().Name);
         }
         return(preConditionsResult);
     }
     catch (Exception exception)
     {
         string msg = "SiriusQuality.Phenology, " + this.GetType().Name + ": Unhandled exception running pre-condition test. ";
         throw new Exception(msg, exception);
     }
 }
 public void Estimate(SiriusQualityPhenology.DomainClass.PhenologyState s, SiriusQualityPhenology.DomainClass.PhenologyState s1, SiriusQualityPhenology.DomainClass.PhenologyRate r, SiriusQualityPhenology.DomainClass.PhenologyAuxiliary a, SiriusQualityPhenology.DomainClass.PhenologyExogenous ex)
 {
     try
     {
         CalculateModel(s, s1, r, a, ex);
     }
     catch (Exception exception)
     {
         string msg = "Error in component SiriusQualityPhenology, strategy: " + this.GetType().Name + ": Unhandled exception running model. " + exception.GetType().FullName + " - " + exception.Message;
         throw new Exception(msg, exception);
     }
 }
Beispiel #23
0
        private void CalculateModel(SiriusQualityPhenology.DomainClass.PhenologyState s, SiriusQualityPhenology.DomainClass.PhenologyState s1, SiriusQualityPhenology.DomainClass.PhenologyRate r, SiriusQualityPhenology.DomainClass.PhenologyAuxiliary a, SiriusQualityPhenology.DomainClass.PhenologyExogenous ex)
        {
            List <double> listTTShootWindowForPTQ_t1 = s1.listTTShootWindowForPTQ;
            List <double> listPARTTWindowForPTQ_t1   = s1.listPARTTWindowForPTQ;
            List <double> listGAITTWindowForPTQ      = s.listGAITTWindowForPTQ;
            double        pAR     = a.pAR;
            double        deltaTT = a.deltaTT;
            List <double> listPARTTWindowForPTQ   = new List <double>();
            List <double> listTTShootWindowForPTQ = new List <double>();
            double        ptq;
            List <double> TTList  = new List <double>();
            List <double> PARList = new List <double>();
            int           i;
            int           count;
            double        SumTT;
            double        parInt = 0.0d;
            double        TTShoot;

            for (i = 0; i != listTTShootWindowForPTQ_t1.Count; i += 1)
            {
                TTList.Add(listTTShootWindowForPTQ_t1[i]);
                PARList.Add(listPARTTWindowForPTQ_t1[i]);
            }
            TTList.Add(deltaTT);
            PARList.Add(pAR);
            SumTT = TTList.Sum();
            count = 0;
            while (SumTT > tTWindowForPTQ)
            {
                SumTT = SumTT - TTList[count];
                count = count + 1;
            }
            for (i = count; i != TTList.Count; i += 1)
            {
                listTTShootWindowForPTQ.Add(TTList[i]);
                listPARTTWindowForPTQ.Add(PARList[i]);
            }
            for (i = 0; i != listTTShootWindowForPTQ.Count; i += 1)
            {
                parInt = parInt + (listPARTTWindowForPTQ[i] * (1 - Math.Exp(-kl * listGAITTWindowForPTQ[i])));
            }
            TTShoot = listTTShootWindowForPTQ.Sum();
            ptq     = parInt / TTShoot;
            s.listPARTTWindowForPTQ   = listPARTTWindowForPTQ;
            s.listTTShootWindowForPTQ = listTTShootWindowForPTQ;
            s.ptq = ptq;
        }
        public void Init(SiriusQualityPhenology.DomainClass.PhenologyState s, SiriusQualityPhenology.DomainClass.PhenologyState s1, SiriusQualityPhenology.DomainClass.PhenologyRate r, SiriusQualityPhenology.DomainClass.PhenologyAuxiliary a, SiriusQualityPhenology.DomainClass.PhenologyExogenous ex)
        {
            double        canopyShootNumber_t1;
            double        leafNumber;
            List <double> tilleringProfile_t1      = new List <double>();
            List <int>    leafTillerNumberArray_t1 = new List <int>();
            int           numberTillerCohort_t1;
            double        averageShootNumberPerPlant;
            double        canopyShootNumber;
            List <int>    leafTillerNumberArray = new List <int>();
            List <double> tilleringProfile      = new List <double>();
            int           numberTillerCohort;

            canopyShootNumber          = sowingDensity;
            averageShootNumberPerPlant = 1.0d;
            tilleringProfile.Add(sowingDensity);
            numberTillerCohort           = 1;
            s.averageShootNumberPerPlant = averageShootNumberPerPlant;
            s.canopyShootNumber          = canopyShootNumber;
            s.leafTillerNumberArray      = leafTillerNumberArray;
            s.tilleringProfile           = tilleringProfile;
            s.numberTillerCohort         = numberTillerCohort;
        }
Beispiel #25
0
        private void CalculateModel(SiriusQualityPhenology.DomainClass.PhenologyState s, SiriusQualityPhenology.DomainClass.PhenologyState s1, SiriusQualityPhenology.DomainClass.PhenologyRate r, SiriusQualityPhenology.DomainClass.PhenologyAuxiliary a, SiriusQualityPhenology.DomainClass.PhenologyExogenous ex)
        {
            List <string> calendarMoments_t1 = s1.calendarMoments;
            List <double> calendarCumuls_t1  = s1.calendarCumuls;
            double        cumulTT            = a.cumulTT;
            double        cumulTTFromZC_65;
            double        cumulTTFromZC_39;
            double        cumulTTFromZC_91;

            cumulTTFromZC_65 = 0.0d;
            cumulTTFromZC_39 = 0.0d;
            cumulTTFromZC_91 = 0.0d;
            if (calendarMoments_t1.Contains("Anthesis"))
            {
                cumulTTFromZC_65 = cumulTT - calendarCumuls_t1[calendarMoments_t1.IndexOf("Anthesis")];
            }
            if (calendarMoments_t1.Contains("FlagLeafLiguleJustVisible"))
            {
                cumulTTFromZC_39 = cumulTT - calendarCumuls_t1[calendarMoments_t1.IndexOf("FlagLeafLiguleJustVisible")];
            }
            if (calendarMoments_t1.Contains("EndGrainFilling"))
            {
                cumulTTFromZC_91 = cumulTT - calendarCumuls_t1[calendarMoments_t1.IndexOf("EndGrainFilling")];
            }
            a.cumulTTFromZC_65 = cumulTTFromZC_65;
            a.cumulTTFromZC_39 = cumulTTFromZC_39;
            a.cumulTTFromZC_91 = cumulTTFromZC_91;
        }