Exemple #1
0
 public PhenologyAuxiliary(PhenologyAuxiliary toCopy, bool copyAll) // copy constructor
 {
     if (copyAll)
     {
         _currentdate      = toCopy._currentdate;
         _cumulTT          = toCopy._cumulTT;
         _dayLength        = toCopy._dayLength;
         _deltaTT          = toCopy._deltaTT;
         _gAI              = toCopy._gAI;
         _pAR              = toCopy._pAR;
         _grainCumulTT     = toCopy._grainCumulTT;
         _fixPhyll         = toCopy._fixPhyll;
         _cumulTTFromZC_39 = toCopy._cumulTTFromZC_39;
         _cumulTTFromZC_91 = toCopy._cumulTTFromZC_91;
         _cumulTTFromZC_65 = toCopy._cumulTTFromZC_65;
     }
 }
Exemple #2
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.gAI.CurrentValue     = a.gAI;
         SiriusQualityPhenology.DomainClass.PhenologyAuxiliaryVarInfo.deltaTT.CurrentValue = a.deltaTT;
         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  r1  = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyAuxiliaryVarInfo.gAI);
         if (r1.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyAuxiliaryVarInfo.gAI.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.PhenologyStateVarInfo.pastMaxAI);
         if (r3.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.pastMaxAI.ValueType))
         {
             prc.AddCondition(r3);
         }
         RangeBasedCondition r4 = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.listTTShootWindowForPTQ1);
         if (r4.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.listTTShootWindowForPTQ1.ValueType))
         {
             prc.AddCondition(r4);
         }
         RangeBasedCondition r5 = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.listGAITTWindowForPTQ);
         if (r5.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.listGAITTWindowForPTQ.ValueType))
         {
             prc.AddCondition(r5);
         }
         prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("tTWindowForPTQ")));
         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)
        {
            List <string> calendarMoments_t1 = s1.calendarMoments;
            int           isMomentRegistredZC_39;

            isMomentRegistredZC_39   = calendarMoments_t1.Contains("FlagLeafLiguleJustVisible") ? 1 : 0;
            s.isMomentRegistredZC_39 = isMomentRegistredZC_39;
        }
Exemple #4
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);
     }
 }
 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.calendarMoments.CurrentValue = s.calendarMoments;
         ConditionsCollection prc = new ConditionsCollection();
         Preconditions        pre = new Preconditions();
         RangeBasedCondition  r1  = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.calendarMoments);
         if (r1.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.calendarMoments.ValueType))
         {
             prc.AddCondition(r1);
         }
         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);
     }
 }
Exemple #7
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.cumulTT.CurrentValue          = a.cumulTT;
         SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.phase.CurrentValue                = s.phase;
         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.cumulTTFromZC_65.CurrentValue = a.cumulTTFromZC_65;
         SiriusQualityPhenology.DomainClass.PhenologyAuxiliaryVarInfo.currentdate.CurrentValue      = a.currentdate;
         SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.finalLeafNumber.CurrentValue      = s.finalLeafNumber;
         SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.currentZadokStage.CurrentValue    = s.currentZadokStage;
         SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.hasZadokStageChanged.CurrentValue = s.hasZadokStageChanged;
         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.phase);
         if (r2.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.phase.ValueType))
         {
             prc.AddCondition(r2);
         }
         RangeBasedCondition r3 = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.leafNumber);
         if (r3.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.leafNumber.ValueType))
         {
             prc.AddCondition(r3);
         }
         RangeBasedCondition r4 = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.calendarMoments);
         if (r4.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.calendarMoments.ValueType))
         {
             prc.AddCondition(r4);
         }
         RangeBasedCondition r5 = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.calendarDates);
         if (r5.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.calendarDates.ValueType))
         {
             prc.AddCondition(r5);
         }
         RangeBasedCondition r6 = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.calendarCumuls);
         if (r6.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.calendarCumuls.ValueType))
         {
             prc.AddCondition(r6);
         }
         RangeBasedCondition r7 = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyAuxiliaryVarInfo.cumulTTFromZC_65);
         if (r7.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyAuxiliaryVarInfo.cumulTTFromZC_65.ValueType))
         {
             prc.AddCondition(r7);
         }
         RangeBasedCondition r8 = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyAuxiliaryVarInfo.currentdate);
         if (r8.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyAuxiliaryVarInfo.currentdate.ValueType))
         {
             prc.AddCondition(r8);
         }
         RangeBasedCondition r9 = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.finalLeafNumber);
         if (r9.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.finalLeafNumber.ValueType))
         {
             prc.AddCondition(r9);
         }
         RangeBasedCondition r10 = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.currentZadokStage);
         if (r10.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.currentZadokStage.ValueType))
         {
             prc.AddCondition(r10);
         }
         RangeBasedCondition r11 = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.hasZadokStageChanged);
         if (r11.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.hasZadokStageChanged.ValueType))
         {
             prc.AddCondition(r11);
         }
         prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("der")));
         prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("slopeTSFLN")));
         prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("intTSFLN")));
         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);
     }
 }
Exemple #8
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;
            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_t1    = s1.currentZadokStage;
            int             hasZadokStageChanged_t1 = s1.hasZadokStageChanged;
            int             hasZadokStageChanged;
            string          currentZadokStage;
            int             roundedFinalLeafNumber;

            currentZadokStage      = currentZadokStage_t1;
            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.hasZadokStageChanged = hasZadokStageChanged;
            s.currentZadokStage    = currentZadokStage;
        }
Exemple #9
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.hasZadokStageChanged.CurrentValue = s.hasZadokStageChanged;
         SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.currentZadokStage.CurrentValue    = s.currentZadokStage;
         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  r15 = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.hasZadokStageChanged);
         if (r15.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.hasZadokStageChanged.ValueType))
         {
             prc.AddCondition(r15);
         }
         RangeBasedCondition r16 = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.currentZadokStage);
         if (r16.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.currentZadokStage.ValueType))
         {
             prc.AddCondition(r16);
         }
         RangeBasedCondition r17 = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.calendarMoments);
         if (r17.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.calendarMoments.ValueType))
         {
             prc.AddCondition(r17);
         }
         RangeBasedCondition r18 = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.calendarDates);
         if (r18.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.calendarDates.ValueType))
         {
             prc.AddCondition(r18);
         }
         RangeBasedCondition r19 = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.calendarCumuls);
         if (r19.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.calendarCumuls.ValueType))
         {
             prc.AddCondition(r19);
         }
         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);
     }
 }
Exemple #10
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;
        }
Exemple #11
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.PhenologyAuxiliaryVarInfo.cumulTTFromZC_65.CurrentValue = a.cumulTTFromZC_65;
         SiriusQualityPhenology.DomainClass.PhenologyAuxiliaryVarInfo.cumulTTFromZC_39.CurrentValue = a.cumulTTFromZC_39;
         SiriusQualityPhenology.DomainClass.PhenologyAuxiliaryVarInfo.cumulTTFromZC_91.CurrentValue = a.cumulTTFromZC_91;
         ConditionsCollection prc = new ConditionsCollection();
         Preconditions        pre = new Preconditions();
         RangeBasedCondition  r4  = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyAuxiliaryVarInfo.cumulTTFromZC_65);
         if (r4.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyAuxiliaryVarInfo.cumulTTFromZC_65.ValueType))
         {
             prc.AddCondition(r4);
         }
         RangeBasedCondition r5 = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyAuxiliaryVarInfo.cumulTTFromZC_39);
         if (r5.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyAuxiliaryVarInfo.cumulTTFromZC_39.ValueType))
         {
             prc.AddCondition(r5);
         }
         RangeBasedCondition r6 = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyAuxiliaryVarInfo.cumulTTFromZC_91);
         if (r6.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyAuxiliaryVarInfo.cumulTTFromZC_91.ValueType))
         {
             prc.AddCondition(r6);
         }
         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);
     }
 }
Exemple #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;
        }
Exemple #13
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;
        }