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);
     }
 }
コード例 #2
0
        /// <summary>
        /// Test to verify the preconditions
        /// </summary>
        public string TestPreConditions(SiriusQualityWheatLAI.WheatLAIState wheatlaistate, SiriusQualityWheatLAI.WheatLeafState wheatleafstate, SiriusQualityWheatLAI.WheatLeafState wheatleafstate1, string callID)
        {
            try
            {
                //Set current values of the inputs to the static VarInfo representing the input properties of the domain classes

                SiriusQualityWheatLAI.WheatLAIStateVarInfo.roundedFinalLeafNumber.CurrentValue = wheatlaistate.roundedFinalLeafNumber;
                SiriusQualityWheatLAI.WheatLAIStateVarInfo.finalLeafNumber.CurrentValue        = wheatlaistate.finalLeafNumber;
                SiriusQualityWheatLAI.WheatLAIStateVarInfo.index.CurrentValue = wheatlaistate.index;

                //Create the collection of the conditions to test
                ConditionsCollection prc = new ConditionsCollection();
                Preconditions        pre = new Preconditions();


                RangeBasedCondition r1 = new RangeBasedCondition(SiriusQualityWheatLAI.WheatLAIStateVarInfo.roundedFinalLeafNumber);
                if (r1.ApplicableVarInfoValueTypes.Contains(SiriusQualityWheatLAI.WheatLAIStateVarInfo.roundedFinalLeafNumber.ValueType))
                {
                    prc.AddCondition(r1);
                }
                RangeBasedCondition r2 = new RangeBasedCondition(SiriusQualityWheatLAI.WheatLAIStateVarInfo.finalLeafNumber);
                if (r2.ApplicableVarInfoValueTypes.Contains(SiriusQualityWheatLAI.WheatLAIStateVarInfo.finalLeafNumber.ValueType))
                {
                    prc.AddCondition(r2);
                }
                RangeBasedCondition r3 = new RangeBasedCondition(SiriusQualityWheatLAI.WheatLAIStateVarInfo.index);
                if (r3.ApplicableVarInfoValueTypes.Contains(SiriusQualityWheatLAI.WheatLAIStateVarInfo.index.ValueType))
                {
                    prc.AddCondition(r3);
                }
                prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("NLL")));



                //GENERATED CODE END - PLACE YOUR CUSTOM CODE BELOW - Section3
                //Code written below will not be overwritten by a future code generation



                //End of custom code. Do not place your custom code below. It will be overwritten by a future code generation.
                //PLACE YOUR CUSTOM CODE ABOVE - GENERATED CODE START - Section3

                //Get the evaluation of preconditions;
                string preConditionsResult = pre.VerifyPreconditions(prc, callID);
                //if we have errors, send it to the configured output
                if (!string.IsNullOrEmpty(preConditionsResult))
                {
                    pre.TestsOut(preConditionsResult, true, "PreConditions errors in component SiriusQualityWheatLAI.Strategies, strategy " + this.GetType().Name);
                }
                return(preConditionsResult);
            }
            catch (Exception exception)
            {
                //Uncomment the next line to use the trace
                //	TraceStrategies.TraceEvent(System.Diagnostics.TraceEventType.Error, 1002,"Strategy: " + this.GetType().Name + " - Unhandled exception running pre-conditions");

                string msg = "Component SiriusQualityWheatLAI.Strategies, " + this.GetType().Name + ": Unhandled exception running pre-condition test. ";
                throw new Exception(msg, exception);
            }
        }
コード例 #3
0
 public string TestPostConditions(Phenology.DomainClass.PhenologyState s, Phenology.DomainClass.PhenologyState s1, Phenology.DomainClass.PhenologyRate r, Phenology.DomainClass.PhenologyAuxiliary a, Phenology.DomainClass.PhenologyExogenous ex, string callID)
 {
     try
     {
         //Set current values of the outputs to the static VarInfo representing the output properties of the domain classes
         Phenology.DomainClass.PhenologyStateVarInfo.phyllochron.CurrentValue = s.phyllochron;
         ConditionsCollection prc = new ConditionsCollection();
         Preconditions        pre = new Preconditions();
         RangeBasedCondition  r20 = new RangeBasedCondition(Phenology.DomainClass.PhenologyStateVarInfo.phyllochron);
         if (r20.ApplicableVarInfoValueTypes.Contains(Phenology.DomainClass.PhenologyStateVarInfo.phyllochron.ValueType))
         {
             prc.AddCondition(r20);
         }
         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 = ".Phenology, " + this.GetType().Name + ": Unhandled exception running post-condition test. ";
         throw new Exception(msg, exception);
     }
 }
コード例 #4
0
 public string TestPostConditions(SiriusQualityEnergybalance.DomainClass.EnergybalanceState s, SiriusQualityEnergybalance.DomainClass.EnergybalanceState s1, SiriusQualityEnergybalance.DomainClass.EnergybalanceRate r, SiriusQualityEnergybalance.DomainClass.EnergybalanceAuxiliary a, SiriusQualityEnergybalance.DomainClass.EnergybalanceExogenous ex, string callID)
 {
     try
     {
         //Set current values of the outputs to the static VarInfo representing the output properties of the domain classes
         SiriusQualityEnergybalance.DomainClass.EnergybalanceAuxiliaryVarInfo.netRadiation.CurrentValue = a.netRadiation;
         SiriusQualityEnergybalance.DomainClass.EnergybalanceAuxiliaryVarInfo.netOutGoingLongWaveRadiation.CurrentValue = a.netOutGoingLongWaveRadiation;
         ConditionsCollection prc = new ConditionsCollection();
         Preconditions        pre = new Preconditions();
         RangeBasedCondition  r9  = new RangeBasedCondition(SiriusQualityEnergybalance.DomainClass.EnergybalanceStateVarInfo.netRadiation);
         if (r9.ApplicableVarInfoValueTypes.Contains(SiriusQualityEnergybalance.DomainClass.EnergybalanceAuxiliaryVarInfo.netRadiation.ValueType))
         {
             prc.AddCondition(r9);
         }
         RangeBasedCondition r10 = new RangeBasedCondition(SiriusQualityEnergybalance.DomainClass.EnergybalanceStateVarInfo.netOutGoingLongWaveRadiation);
         if (r10.ApplicableVarInfoValueTypes.Contains(SiriusQualityEnergybalance.DomainClass.EnergybalanceAuxiliaryVarInfo.netOutGoingLongWaveRadiation.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.Energybalance, " + this.GetType().Name + ": Unhandled exception running post-condition test. ";
         throw new Exception(msg, exception);
     }
 }
コード例 #5
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.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);
     }
 }
コード例 #6
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.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);
     }
 }
コード例 #7
0
 public string TestPreConditions(SiriusQualityEnergyBalance.DomainClass.EnergyBalanceState s, SiriusQualityEnergyBalance.DomainClass.EnergyBalanceState s1, SiriusQualityEnergyBalance.DomainClass.EnergyBalanceRate r, SiriusQualityEnergyBalance.DomainClass.EnergyBalanceAuxiliary a, SiriusQualityEnergyBalance.DomainClass.EnergyBalanceExogenous ex, string callID)
 {
     try
     {
         //Set current values of the inputs to the static VarInfo representing the inputs properties of the domain classes
         SiriusQualityEnergyBalance.DomainClass.EnergyBalanceStateVarInfo.netRadiationEquivalentEvaporation.CurrentValue = s.netRadiationEquivalentEvaporation;
         SiriusQualityEnergyBalance.DomainClass.EnergyBalanceAuxiliaryVarInfo.hslope.CurrentValue = a.hslope;
         ConditionsCollection prc = new ConditionsCollection();
         Preconditions        pre = new Preconditions();
         RangeBasedCondition  r1  = new RangeBasedCondition(SiriusQualityEnergyBalance.DomainClass.EnergyBalanceStateVarInfo.netRadiationEquivalentEvaporation);
         if (r1.ApplicableVarInfoValueTypes.Contains(SiriusQualityEnergyBalance.DomainClass.EnergyBalanceStateVarInfo.netRadiationEquivalentEvaporation.ValueType))
         {
             prc.AddCondition(r1);
         }
         RangeBasedCondition r2 = new RangeBasedCondition(SiriusQualityEnergyBalance.DomainClass.EnergyBalanceAuxiliaryVarInfo.hslope);
         if (r2.ApplicableVarInfoValueTypes.Contains(SiriusQualityEnergyBalance.DomainClass.EnergyBalanceAuxiliaryVarInfo.hslope.ValueType))
         {
             prc.AddCondition(r2);
         }
         prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("psychrometricConstant")));
         prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("Alpha")));
         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.EnergyBalance, " + this.GetType().Name + ": Unhandled exception running pre-condition test. ";
         throw new Exception(msg, exception);
     }
 }
コード例 #8
0
 public string TestPreConditions(SiriusQualityEnergyBalance.DomainClass.EnergyBalanceState s, SiriusQualityEnergyBalance.DomainClass.EnergyBalanceState s1, SiriusQualityEnergyBalance.DomainClass.EnergyBalanceRate r, SiriusQualityEnergyBalance.DomainClass.EnergyBalanceAuxiliary a, SiriusQualityEnergyBalance.DomainClass.EnergyBalanceExogenous ex, string callID)
 {
     try
     {
         //Set current values of the inputs to the static VarInfo representing the inputs properties of the domain classes
         SiriusQualityEnergyBalance.DomainClass.EnergyBalanceStateVarInfo.diffusionLimitedEvaporation.CurrentValue = s.diffusionLimitedEvaporation;
         SiriusQualityEnergyBalance.DomainClass.EnergyBalanceStateVarInfo.energyLimitedEvaporation.CurrentValue    = s.energyLimitedEvaporation;
         ConditionsCollection prc = new ConditionsCollection();
         Preconditions        pre = new Preconditions();
         RangeBasedCondition  r1  = new RangeBasedCondition(SiriusQualityEnergyBalance.DomainClass.EnergyBalanceStateVarInfo.diffusionLimitedEvaporation);
         if (r1.ApplicableVarInfoValueTypes.Contains(SiriusQualityEnergyBalance.DomainClass.EnergyBalanceStateVarInfo.diffusionLimitedEvaporation.ValueType))
         {
             prc.AddCondition(r1);
         }
         RangeBasedCondition r2 = new RangeBasedCondition(SiriusQualityEnergyBalance.DomainClass.EnergyBalanceStateVarInfo.energyLimitedEvaporation);
         if (r2.ApplicableVarInfoValueTypes.Contains(SiriusQualityEnergyBalance.DomainClass.EnergyBalanceStateVarInfo.energyLimitedEvaporation.ValueType))
         {
             prc.AddCondition(r2);
         }
         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.EnergyBalance, " + this.GetType().Name + ": Unhandled exception running pre-condition test. ";
         throw new Exception(msg, exception);
     }
 }
コード例 #9
0
 public string TestPostConditions(SiriusQualitySnow.DomainClass.SnowState s, SiriusQualitySnow.DomainClass.SnowState s1, SiriusQualitySnow.DomainClass.SnowRate r, SiriusQualitySnow.DomainClass.SnowAuxiliary a, SiriusQualitySnow.DomainClass.SnowExogenous ex, string callID)
 {
     try
     {
         //Set current values of the outputs to the static VarInfo representing the output properties of the domain classes
         SiriusQualitySnow.DomainClass.SnowStateVarInfo.Sdepth_cm.CurrentValue = s.Sdepth_cm;
         ConditionsCollection prc = new ConditionsCollection();
         Preconditions        pre = new Preconditions();
         RangeBasedCondition  r3  = new RangeBasedCondition(SiriusQualitySnow.DomainClass.SnowStateVarInfo.Sdepth_cm);
         if (r3.ApplicableVarInfoValueTypes.Contains(SiriusQualitySnow.DomainClass.SnowStateVarInfo.Sdepth_cm.ValueType))
         {
             prc.AddCondition(r3);
         }
         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.Snow, " + this.GetType().Name + ": Unhandled exception running post-condition test. ";
         throw new Exception(msg, exception);
     }
 }
        /// <summary>
        /// Test to verify the preconditions
        /// </summary>
        public string TestPreConditions(SiriusQualityWheatLAI.WheatLAIState wheatlaistate, SiriusQualityWheatLAI.WheatLeafState wheatleafstate, SiriusQualityWheatLAI.WheatLeafState wheatleafstate1, string callID)
        {
            try
            {
                //Set current values of the inputs to the static VarInfo representing the input properties of the domain classes

                SiriusQualityWheatLAI.WheatLAIStateVarInfo.previousIndex.CurrentValue = wheatlaistate.previousIndex;

                //Create the collection of the conditions to test
                ConditionsCollection prc = new ConditionsCollection();
                Preconditions        pre = new Preconditions();


                RangeBasedCondition r1 = new RangeBasedCondition(SiriusQualityWheatLAI.WheatLAIStateVarInfo.previousIndex);
                if (r1.ApplicableVarInfoValueTypes.Contains(SiriusQualityWheatLAI.WheatLAIStateVarInfo.previousIndex.ValueType))
                {
                    prc.AddCondition(r1);
                }


                string ret = "";
                ret += _issmallphytomer.TestPreConditions(wheatlaistate, wheatleafstate, wheatleafstate1, "strategy SiriusQualityWheatLAI.Strategies.IsSmallPhytomer");
                ret += _laminaexpansionthermaltime.TestPreConditions(wheatlaistate, wheatleafstate, wheatleafstate1, "strategy SiriusQualityWheatLAI.Strategies.LaminaExpansionThermalTime");
                ret += _leafexpansiondroughtfactor.TestPreConditions(wheatlaistate, wheatleafstate, wheatleafstate1, "strategy SiriusQualityWheatLAI.Strategies.LeafExpansionDroughtFactor");
                ret += _maturitythermaltime.TestPreConditions(wheatlaistate, wheatleafstate, wheatleafstate1, "strategy SiriusQualityWheatLAI.Strategies.MaturityThermalTime");
                ret += _maximumpotentialfinallai.TestPreConditions(wheatlaistate, wheatleafstate, wheatleafstate1, "strategy SiriusQualityWheatLAI.Strategies.MaximumPotentialFinalLAI");
                ret += _senescencethermaltime.TestPreConditions(wheatlaistate, wheatleafstate, wheatleafstate1, "strategy SiriusQualityWheatLAI.Strategies.SenescenceThermalTime");
                ret += _updateleafarea.TestPreConditions(wheatlaistate, wheatleafstate, wheatleafstate1, "strategy SiriusQualityWheatLAI.Strategies.UpdateLeafArea");
                ret += _waterlimitedleafexpansion.TestPreConditions(wheatlaistate, wheatleafstate, wheatleafstate1, "strategy SiriusQualityWheatLAI.Strategies.WaterLimitedLeafExpansion");
                if (ret != "")
                {
                    pre.TestsOut(ret, true, "   preconditions tests of associated classes");
                }

                //GENERATED CODE END - PLACE YOUR CUSTOM CODE BELOW - Section3
                //Code written below will not be overwritten by a future code generation



                //End of custom code. Do not place your custom code below. It will be overwritten by a future code generation.
                //PLACE YOUR CUSTOM CODE ABOVE - GENERATED CODE START - Section3

                //Get the evaluation of preconditions;
                string preConditionsResult = pre.VerifyPreconditions(prc, callID);
                //if we have errors, send it to the configured output
                if (!string.IsNullOrEmpty(preConditionsResult))
                {
                    pre.TestsOut(preConditionsResult, true, "PreConditions errors in component SiriusQualityWheatLAI.Strategies, strategy " + this.GetType().Name);
                }
                return(preConditionsResult);
            }
            catch (Exception exception)
            {
                //Uncomment the next line to use the trace
                //	TraceStrategies.TraceEvent(System.Diagnostics.TraceEventType.Error, 1002,"Strategy: " + this.GetType().Name + " - Unhandled exception running pre-conditions");

                string msg = "Component SiriusQualityWheatLAI.Strategies, " + 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.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);
     }
 }
        /// <summary>
        /// Test to verify the preconditions
        /// </summary>
        public string TestPreConditions(INRA.SiriusQualityIrradiance.Interfaces.Rates rates, INRA.SiriusQualityIrradiance.Interfaces.Exogenous exogenous, INRA.SiriusQualityIrradiance.Interfaces.States states, string callID)
        {
            try
            {
                //Set current values of the inputs to the static VarInfo representing the input properties of the domain classes

                INRA.SiriusQualityIrradiance.Interfaces.StatesVarInfo.layersGAI.CurrentValue = states.layersGAI;
                INRA.SiriusQualityIrradiance.Interfaces.ExogenousVarInfo.incidentDiffuseIrradiance.CurrentValue = exogenous.incidentDiffuseIrradiance;
                INRA.SiriusQualityIrradiance.Interfaces.ExogenousVarInfo.incidentDirectIrradiance.CurrentValue  = exogenous.incidentDirectIrradiance;

                //Create the collection of the conditions to test
                ConditionsCollection prc = new ConditionsCollection();
                Preconditions        pre = new Preconditions();


                RangeBasedCondition r1 = new RangeBasedCondition(INRA.SiriusQualityIrradiance.Interfaces.StatesVarInfo.layersGAI);
                if (r1.ApplicableVarInfoValueTypes.Contains(INRA.SiriusQualityIrradiance.Interfaces.StatesVarInfo.layersGAI.ValueType))
                {
                    prc.AddCondition(r1);
                }
                RangeBasedCondition r2 = new RangeBasedCondition(INRA.SiriusQualityIrradiance.Interfaces.ExogenousVarInfo.incidentDiffuseIrradiance);
                if (r2.ApplicableVarInfoValueTypes.Contains(INRA.SiriusQualityIrradiance.Interfaces.ExogenousVarInfo.incidentDiffuseIrradiance.ValueType))
                {
                    prc.AddCondition(r2);
                }
                RangeBasedCondition r3 = new RangeBasedCondition(INRA.SiriusQualityIrradiance.Interfaces.ExogenousVarInfo.incidentDirectIrradiance);
                if (r3.ApplicableVarInfoValueTypes.Contains(INRA.SiriusQualityIrradiance.Interfaces.ExogenousVarInfo.incidentDirectIrradiance.ValueType))
                {
                    prc.AddCondition(r3);
                }
                prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("Kl")));



                //GENERATED CODE END - PLACE YOUR CUSTOM CODE BELOW - Section3
                //Code written below will not be overwritten by a future code generation



                //End of custom code. Do not place your custom code below. It will be overwritten by a future code generation.
                //PLACE YOUR CUSTOM CODE ABOVE - GENERATED CODE START - Section3

                //Get the evaluation of preconditions;
                string preConditionsResult = pre.VerifyPreconditions(prc, callID);
                //if we have errors, send it to the configured output
                if (!string.IsNullOrEmpty(preConditionsResult))
                {
                    pre.TestsOut(preConditionsResult, true, "PreConditions errors in component INRA.SiriusQualityIrradiance.Strategies, strategy " + this.GetType().Name);
                }
                return(preConditionsResult);
            }
            catch (Exception exception)
            {
                //Uncomment the next line to use the trace
                //	TraceStrategies.TraceEvent(System.Diagnostics.TraceEventType.Error, 1002,"Strategy: " + this.GetType().Name + " - Unhandled exception running pre-conditions");

                string msg = "Component INRA.SiriusQualityIrradiance.Strategies, " + this.GetType().Name + ": Unhandled exception running pre-condition test. ";
                throw new Exception(msg, exception);
            }
        }
コード例 #13
0
 public string TestPreConditions(SiriusQualitySnow.DomainClass.SnowState s, SiriusQualitySnow.DomainClass.SnowState s1, SiriusQualitySnow.DomainClass.SnowRate r, SiriusQualitySnow.DomainClass.SnowAuxiliary a, SiriusQualitySnow.DomainClass.SnowExogenous ex, string callID)
 {
     try
     {
         //Set current values of the inputs to the static VarInfo representing the inputs properties of the domain classes
         SiriusQualitySnow.DomainClass.SnowStateVarInfo.Sdepth.CurrentValue = s.Sdepth;
         ConditionsCollection prc = new ConditionsCollection();
         Preconditions        pre = new Preconditions();
         RangeBasedCondition  r1  = new RangeBasedCondition(SiriusQualitySnow.DomainClass.SnowStateVarInfo.Sdepth);
         if (r1.ApplicableVarInfoValueTypes.Contains(SiriusQualitySnow.DomainClass.SnowStateVarInfo.Sdepth.ValueType))
         {
             prc.AddCondition(r1);
         }
         prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("Pns")));
         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.Snow, " + this.GetType().Name + ": Unhandled exception running pre-condition test. ";
         throw new Exception(msg, exception);
     }
 }
コード例 #14
0
        //Parameters static VarInfo list of the composite class


        #endregion

        #region pre/post conditions management

        /// <summary>
        /// Test to verify the postconditions
        /// </summary>
        public string TestPostConditions(SiriusQualityPhenology.PhenologyState phenologystate, SiriusQualityPhenology.PhenologyState phenologystate1, string callID)
        {
            try
            {
                //Set current values of the outputs to the static VarInfo representing the output properties of the domain classes

                SiriusQualityPhenology.PhenologyStateVarInfo.hasZadokStageChanged.CurrentValue = phenologystate.hasZadokStageChanged;
                SiriusQualityPhenology.PhenologyStateVarInfo.currentZadokStage.CurrentValue    = phenologystate.currentZadokStage;
                SiriusQualityPhenology.PhenologyStateVarInfo.Calendar.CurrentValue             = phenologystate.Calendar;

                //Create the collection of the conditions to test
                ConditionsCollection prc = new ConditionsCollection();
                Preconditions        pre = new Preconditions();


                RangeBasedCondition r7 = new RangeBasedCondition(SiriusQualityPhenology.PhenologyStateVarInfo.hasZadokStageChanged);
                if (r7.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.PhenologyStateVarInfo.hasZadokStageChanged.ValueType))
                {
                    prc.AddCondition(r7);
                }
                RangeBasedCondition r8 = new RangeBasedCondition(SiriusQualityPhenology.PhenologyStateVarInfo.currentZadokStage);
                if (r8.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.PhenologyStateVarInfo.currentZadokStage.ValueType))
                {
                    prc.AddCondition(r8);
                }
                RangeBasedCondition r9 = new RangeBasedCondition(SiriusQualityPhenology.PhenologyStateVarInfo.Calendar);
                if (r9.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.PhenologyStateVarInfo.Calendar.ValueType))
                {
                    prc.AddCondition(r9);
                }



                //GENERATED CODE END - PLACE YOUR CUSTOM CODE BELOW - Section4
                //Code written below will not be overwritten by a future code generation



                //End of custom code. Do not place your custom code below. It will be overwritten by a future code generation.
                //PLACE YOUR CUSTOM CODE ABOVE - GENERATED CODE START - Section4

                //Get the evaluation of postconditions
                string postConditionsResult = pre.VerifyPostconditions(prc, callID);
                //if we have errors, send it to the configured output
                if (!string.IsNullOrEmpty(postConditionsResult))
                {
                    pre.TestsOut(postConditionsResult, true, "PostConditions errors in component SiriusQualityPhenology.Strategies, strategy " + this.GetType().Name);
                }
                return(postConditionsResult);
            }
            catch (Exception exception)
            {
                //Uncomment the next line to use the trace
                //TraceStrategies.TraceEvent(System.Diagnostics.TraceEventType.Error, 1001,	"Strategy: " + this.GetType().Name + " - Unhandled exception running post-conditions");

                string msg = "Component SiriusQualityPhenology.Strategies, " + this.GetType().Name + ": Unhandled exception running post-condition test. ";
                throw new Exception(msg, exception);
            }
        }
コード例 #15
0
        /// <summary>
        /// Test to verify the preconditions
        /// </summary>
        public string TestPreConditions(SiriusQualityEnergyBalance.EnergyBalanceState energybalancestate, string callID)
        {
            try
            {
                //Set current values of the inputs to the static VarInfo representing the input properties of the domain classes

                SiriusQualityEnergyBalance.EnergyBalanceStateVarInfo.netRadiationEquivalentEvaporation.CurrentValue = energybalancestate.netRadiationEquivalentEvaporation;
                SiriusQualityEnergyBalance.EnergyBalanceStateVarInfo.soilHeatFlux.CurrentValue           = energybalancestate.soilHeatFlux;
                SiriusQualityEnergyBalance.EnergyBalanceStateVarInfo.potentialTranspiration.CurrentValue = energybalancestate.potentialTranspiration;

                //Create the collection of the conditions to test
                ConditionsCollection prc = new ConditionsCollection();
                Preconditions        pre = new Preconditions();


                RangeBasedCondition r1 = new RangeBasedCondition(SiriusQualityEnergyBalance.EnergyBalanceStateVarInfo.netRadiationEquivalentEvaporation);
                if (r1.ApplicableVarInfoValueTypes.Contains(SiriusQualityEnergyBalance.EnergyBalanceStateVarInfo.netRadiationEquivalentEvaporation.ValueType))
                {
                    prc.AddCondition(r1);
                }
                RangeBasedCondition r2 = new RangeBasedCondition(SiriusQualityEnergyBalance.EnergyBalanceStateVarInfo.soilHeatFlux);
                if (r2.ApplicableVarInfoValueTypes.Contains(SiriusQualityEnergyBalance.EnergyBalanceStateVarInfo.soilHeatFlux.ValueType))
                {
                    prc.AddCondition(r2);
                }
                RangeBasedCondition r3 = new RangeBasedCondition(SiriusQualityEnergyBalance.EnergyBalanceStateVarInfo.potentialTranspiration);
                if (r3.ApplicableVarInfoValueTypes.Contains(SiriusQualityEnergyBalance.EnergyBalanceStateVarInfo.potentialTranspiration.ValueType))
                {
                    prc.AddCondition(r3);
                }



                //GENERATED CODE END - PLACE YOUR CUSTOM CODE BELOW - Section3
                //Code written below will not be overwritten by a future code generation



                //End of custom code. Do not place your custom code below. It will be overwritten by a future code generation.
                //PLACE YOUR CUSTOM CODE ABOVE - GENERATED CODE START - Section3

                //Get the evaluation of preconditions;
                string preConditionsResult = pre.VerifyPreconditions(prc, callID);
                //if we have errors, send it to the configured output
                if (!string.IsNullOrEmpty(preConditionsResult))
                {
                    pre.TestsOut(preConditionsResult, true, "PreConditions errors in component SiriusQualityEnergyBalance, strategy " + this.GetType().Name);
                }
                return(preConditionsResult);
            }
            catch (Exception exception)
            {
                //Uncomment the next line to use the trace
                //	TraceStrategies.TraceEvent(System.Diagnostics.TraceEventType.Error, 1002,"Strategy: " + this.GetType().Name + " - Unhandled exception running pre-conditions");

                string msg = "Component SiriusQualityEnergyBalance, " + this.GetType().Name + ": Unhandled exception running pre-condition test. ";
                throw new Exception(msg, exception);
            }
        }
コード例 #16
0
        /// <summary>
        /// Test to verify the postconditions
        /// </summary>
        public string TestPostConditions(SiriusQualityEnergyBalance.EnergyBalanceState energybalancestate, string callID)
        {
            try
            {
                //Set current values of the outputs to the static VarInfo representing the output properties of the domain classes


                //Create the collection of the conditions to test
                ConditionsCollection prc = new ConditionsCollection();
                Preconditions        pre = new Preconditions();



                string ret = "";
                ret += _calculatenetradiation.TestPostConditions(energybalancestate, "strategy SiriusQualityEnergyBalance.CalculateNetRadiation");
                ret += _calculatediffusionlimitedevaporation.TestPostConditions(energybalancestate, "strategy SiriusQualityEnergyBalance.CalculateDiffusionLimitedEvaporation");
                ret += _calculatepriestlytaylor.TestPostConditions(energybalancestate, "strategy SiriusQualityEnergyBalance.CalculatePriestlyTaylor");
                ret += _calculateptsoil.TestPostConditions(energybalancestate, "strategy SiriusQualityEnergyBalance.CalculatePtSoil");
                ret += _calculateconductance.TestPostConditions(energybalancestate, "strategy SiriusQualityEnergyBalance.CalculateConductance");
                ret += _calculatepenman.TestPostConditions(energybalancestate, "strategy SiriusQualityEnergyBalance.CalculatePenman");
                ret += _calculatepottranspiration.TestPostConditions(energybalancestate, "strategy SiriusQualityEnergyBalance.CalculatePotTranspiration");
                ret += _calculatesoilevaporation.TestPostConditions(energybalancestate, "strategy SiriusQuailtyEnergyBalance.CalculateSoilEvaporation");
                ret += _calculatesoilheatflux.TestPostConditions(energybalancestate, "strategy SiriusQualityEnergyBalance.CalculateSoilHeatFlux");
                ret += _calculatecropheatflux.TestPostConditions(energybalancestate, "strategy SiriusQualityEnergyBalance.CalculateCropHeatFlux");
                ret += _calculatecanopytemperature.TestPostConditions(energybalancestate, "strategy SiriusQualityEnergyBalance.CalculateCanopyTemperature");
                ret += _calculatecanopytemperaturemaize.TestPostConditions(energybalancestate, "strategy SiriusQualityEnergyBalance.CalculateCanopyTemperatureMaize");
                ret += _calculatevpdairleaf.TestPostConditions(energybalancestate, "strategy SiriusQualityEnergyBalance.Calculatevpdairleaf");
                ret += _calculatevpdeq.TestPostConditions(energybalancestate, "strategy SiriusQualityEnergyBalance.calculateVPDeq");
                if (ret != "")
                {
                    pre.TestsOut(ret, true, "   postconditions tests of associated classes");
                }

                //GENERATED CODE END - PLACE YOUR CUSTOM CODE BELOW - Section4
                //Code written below will not be overwritten by a future code generation



                //End of custom code. Do not place your custom code below. It will be overwritten by a future code generation.
                //PLACE YOUR CUSTOM CODE ABOVE - GENERATED CODE START - Section4

                //Get the evaluation of postconditions
                string postConditionsResult = pre.VerifyPostconditions(prc, callID);
                //if we have errors, send it to the configured output
                if (!string.IsNullOrEmpty(postConditionsResult))
                {
                    pre.TestsOut(postConditionsResult, true, "PostConditions errors in component SiriusQualityEnergyBalance, strategy " + this.GetType().Name);
                }
                return(postConditionsResult);
            }
            catch (Exception exception)
            {
                //Uncomment the next line to use the trace
                //TraceStrategies.TraceEvent(System.Diagnostics.TraceEventType.Error, 1001,	"Strategy: " + this.GetType().Name + " - Unhandled exception running post-conditions");

                string msg = "Component SiriusQualityEnergyBalance, " + this.GetType().Name + ": Unhandled exception running post-condition test. ";
                throw new Exception(msg, exception);
            }
        }
コード例 #17
0
 public string TestPreConditions(Phenology.DomainClass.PhenologyState s, Phenology.DomainClass.PhenologyState s1, Phenology.DomainClass.PhenologyRate r, Phenology.DomainClass.PhenologyAuxiliary a, Phenology.DomainClass.PhenologyExogenous ex, string callID)
 {
     try
     {
         //Set current values of the inputs to the static VarInfo representing the inputs properties of the domain classes
         Phenology.DomainClass.PhenologyAuxiliaryVarInfo.fixPhyll.CurrentValue = a.fixPhyll;
         Phenology.DomainClass.PhenologyStateVarInfo.leafNumber.CurrentValue   = s.leafNumber;
         Phenology.DomainClass.PhenologyStateVarInfo.ptq.CurrentValue          = s.ptq;
         Phenology.DomainClass.PhenologyStateVarInfo.gAImean.CurrentValue      = s.gAImean;
         ConditionsCollection prc = new ConditionsCollection();
         Preconditions        pre = new Preconditions();
         RangeBasedCondition  r1  = new RangeBasedCondition(Phenology.DomainClass.PhenologyAuxiliaryVarInfo.fixPhyll);
         if (r1.ApplicableVarInfoValueTypes.Contains(Phenology.DomainClass.PhenologyAuxiliaryVarInfo.fixPhyll.ValueType))
         {
             prc.AddCondition(r1);
         }
         RangeBasedCondition r2 = new RangeBasedCondition(Phenology.DomainClass.PhenologyStateVarInfo.leafNumber);
         if (r2.ApplicableVarInfoValueTypes.Contains(Phenology.DomainClass.PhenologyStateVarInfo.leafNumber.ValueType))
         {
             prc.AddCondition(r2);
         }
         RangeBasedCondition r3 = new RangeBasedCondition(Phenology.DomainClass.PhenologyStateVarInfo.ptq);
         if (r3.ApplicableVarInfoValueTypes.Contains(Phenology.DomainClass.PhenologyStateVarInfo.ptq.ValueType))
         {
             prc.AddCondition(r3);
         }
         RangeBasedCondition r4 = new RangeBasedCondition(Phenology.DomainClass.PhenologyStateVarInfo.gAImean);
         if (r4.ApplicableVarInfoValueTypes.Contains(Phenology.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 = ".Phenology, " + this.GetType().Name + ": Unhandled exception running pre-condition test. ";
         throw new Exception(msg, exception);
     }
 }
コード例 #18
0
        /// <summary>
        /// Test to verify the preconditions
        /// </summary>
        public string TestPreConditions(SiriusQualityMaizeLAI.MaizeLAIState maizelaistate, SiriusQualityMaizeLAI.MaizeLeafState maizeleafstate, SiriusQualityMaizeLAI.MaizeLeafState maizeleafstate1, string callID)
        {
            try
            {
                //Set current values of the inputs to the static VarInfo representing the input properties of the domain classes


                //Create the collection of the conditions to test
                ConditionsCollection prc = new ConditionsCollection();
                Preconditions        pre = new Preconditions();



                string ret = "";
                ret += _calcbasewidth.TestPreConditions(maizelaistate, maizeleafstate, maizeleafstate1, "strategy SiriusQualityMaizeLAI.Strategies.calcBaseWidth");
                ret += _calcfracpopn.TestPreConditions(maizelaistate, maizeleafstate, maizeleafstate1, "strategy SiriusQualityMaizeLAI.Strategies.calcFracPopn");
                ret += _calcfullyexptt.TestPreConditions(maizelaistate, maizeleafstate, maizeleafstate1, "strategy SiriusQualityMaizeLAI.Strategies.calcFullyExpTT");
                ret += _calcinittt.TestPreConditions(maizelaistate, maizeleafstate, maizeleafstate1, "strategy SiriusQualityMaizeLAI.Strategies.calcInitTT");
                ret += _calcler.TestPreConditions(maizelaistate, maizeleafstate, maizeleafstate1, "strategy SiriusQualityMaizeLAI.Strategies.calcLER");
                ret += _calclercoeff.TestPreConditions(maizelaistate, maizeleafstate, maizeleafstate1, "strategy SiriusQualityMaizeLAI.Strategies.calcLERCoeff");
                ret += _calcligulett.TestPreConditions(maizelaistate, maizeleafstate, maizeleafstate1, "strategy SiriusQualityMaizeLAI.Strategies.calcLiguleTT");
                ret += _calcstartenlargett.TestPreConditions(maizelaistate, maizeleafstate, maizeleafstate1, "strategy SiriusQualityMaizeLAI.Strategies.calcStartEnlargeTT");
                ret += _calcstartexptt.TestPreConditions(maizelaistate, maizeleafstate, maizeleafstate1, "strategy SiriusQualityMaizeLAI.Strategies.calcStartExpTT");
                ret += _calcstopenlargett.TestPreConditions(maizelaistate, maizeleafstate, maizeleafstate1, "strategy SiriusQualityMaizeLAI.Strategies.calcStopEnlargeTT");
                ret += _calctiptt.TestPreConditions(maizelaistate, maizeleafstate, maizeleafstate1, "strategy SiriusQualityMaizeLAI.Strategies.calcTipTT");
                ret += _deltalaimaize.TestPreConditions(maizelaistate, maizeleafstate, maizeleafstate1, "strategy SiriusQualityMaizeLAI.Strategies.DeltaLAIMaize");
                ret += _updateleafarea.TestPreConditions(maizelaistate, maizeleafstate, maizeleafstate1, "strategy SiriusQualityMaizeLAI.Strategies.UpdateLeafArea");
                if (ret != "")
                {
                    pre.TestsOut(ret, true, "   preconditions tests of associated classes");
                }

                //GENERATED CODE END - PLACE YOUR CUSTOM CODE BELOW - Section3
                //Code written below will not be overwritten by a future code generation



                //End of custom code. Do not place your custom code below. It will be overwritten by a future code generation.
                //PLACE YOUR CUSTOM CODE ABOVE - GENERATED CODE START - Section3

                //Get the evaluation of preconditions;
                string preConditionsResult = pre.VerifyPreconditions(prc, callID);
                //if we have errors, send it to the configured output
                if (!string.IsNullOrEmpty(preConditionsResult))
                {
                    pre.TestsOut(preConditionsResult, true, "PreConditions errors in component SiriusQualityMaizeLAI.Strategies, strategy " + this.GetType().Name);
                }
                return(preConditionsResult);
            }
            catch (Exception exception)
            {
                //Uncomment the next line to use the trace
                //	TraceStrategies.TraceEvent(System.Diagnostics.TraceEventType.Error, 1002,"Strategy: " + this.GetType().Name + " - Unhandled exception running pre-conditions");

                string msg = "Component SiriusQualityMaizeLAI.Strategies, " + this.GetType().Name + ": Unhandled exception running pre-condition test. ";
                throw new Exception(msg, exception);
            }
        }
コード例 #19
0
        /// <summary>
        /// Test to verify the preconditions
        /// </summary>
        public string TestPreConditions(SiriusQualityMeteo.MeteoState meteostate, string callID)
        {
            try
            {
                //Set current values of the inputs to the static VarInfo representing the input properties of the domain classes

                SiriusQualityMeteo.MeteoStateVarInfo.dailyMeanWindSpeed.CurrentValue   = meteostate.dailyMeanWindSpeed;
                SiriusQualityMeteo.MeteoStateVarInfo.hourlySolarElevation.CurrentValue = meteostate.hourlySolarElevation;

                //Create the collection of the conditions to test
                ConditionsCollection prc = new ConditionsCollection();
                Preconditions        pre = new Preconditions();


                RangeBasedCondition r1 = new RangeBasedCondition(SiriusQualityMeteo.MeteoStateVarInfo.dailyMeanWindSpeed);
                if (r1.ApplicableVarInfoValueTypes.Contains(SiriusQualityMeteo.MeteoStateVarInfo.dailyMeanWindSpeed.ValueType))
                {
                    prc.AddCondition(r1);
                }
                RangeBasedCondition r2 = new RangeBasedCondition(SiriusQualityMeteo.MeteoStateVarInfo.hourlySolarElevation);
                if (r2.ApplicableVarInfoValueTypes.Contains(SiriusQualityMeteo.MeteoStateVarInfo.hourlySolarElevation.ValueType))
                {
                    prc.AddCondition(r2);
                }
                prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("hourOfBlowingBeginingT1")));
                prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("hourOfBlowingStopT3")));
                prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("nightTimeWindFactor")));



                //GENERATED CODE END - PLACE YOUR CUSTOM CODE BELOW - Section3
                //Code written below will not be overwritten by a future code generation



                //End of custom code. Do not place your custom code below. It will be overwritten by a future code generation.
                //PLACE YOUR CUSTOM CODE ABOVE - GENERATED CODE START - Section3

                //Get the evaluation of preconditions;
                string preConditionsResult = pre.VerifyPreconditions(prc, callID);
                //if we have errors, send it to the configured output
                if (!string.IsNullOrEmpty(preConditionsResult))
                {
                    pre.TestsOut(preConditionsResult, true, "PreConditions errors in component SiriusQualityMeteo.Strategies, strategy " + this.GetType().Name);
                }
                return(preConditionsResult);
            }
            catch (Exception exception)
            {
                //Uncomment the next line to use the trace
                //	TraceStrategies.TraceEvent(System.Diagnostics.TraceEventType.Error, 1002,"Strategy: " + this.GetType().Name + " - Unhandled exception running pre-conditions");

                string msg = "Component SiriusQualityMeteo.Strategies, " + this.GetType().Name + ": Unhandled exception running pre-condition test. ";
                throw new Exception(msg, exception);
            }
        }
コード例 #20
0
 public string TestPreConditions(SiriusQualitySnow.DomainClass.SnowState s, SiriusQualitySnow.DomainClass.SnowState s1, SiriusQualitySnow.DomainClass.SnowRate r, SiriusQualitySnow.DomainClass.SnowAuxiliary a, SiriusQualitySnow.DomainClass.SnowExogenous ex, string callID)
 {
     try
     {
         //Set current values of the inputs to the static VarInfo representing the inputs properties of the domain classes
         SiriusQualitySnow.DomainClass.SnowStateVarInfo.Swet.CurrentValue       = s.Swet;
         SiriusQualitySnow.DomainClass.SnowAuxiliaryVarInfo.precip.CurrentValue = a.precip;
         SiriusQualitySnow.DomainClass.SnowRateVarInfo.Snowaccu.CurrentValue    = r.Snowaccu;
         SiriusQualitySnow.DomainClass.SnowRateVarInfo.Mrf.CurrentValue         = r.Mrf;
         SiriusQualitySnow.DomainClass.SnowRateVarInfo.M.CurrentValue           = r.M;
         SiriusQualitySnow.DomainClass.SnowStateVarInfo.Sdry.CurrentValue       = s.Sdry;
         ConditionsCollection prc = new ConditionsCollection();
         Preconditions        pre = new Preconditions();
         RangeBasedCondition  r1  = new RangeBasedCondition(SiriusQualitySnow.DomainClass.SnowStateVarInfo.Swet);
         if (r1.ApplicableVarInfoValueTypes.Contains(SiriusQualitySnow.DomainClass.SnowStateVarInfo.Swet.ValueType))
         {
             prc.AddCondition(r1);
         }
         RangeBasedCondition r2 = new RangeBasedCondition(SiriusQualitySnow.DomainClass.SnowAuxiliaryVarInfo.precip);
         if (r2.ApplicableVarInfoValueTypes.Contains(SiriusQualitySnow.DomainClass.SnowAuxiliaryVarInfo.precip.ValueType))
         {
             prc.AddCondition(r2);
         }
         RangeBasedCondition r3 = new RangeBasedCondition(SiriusQualitySnow.DomainClass.SnowRateVarInfo.Snowaccu);
         if (r3.ApplicableVarInfoValueTypes.Contains(SiriusQualitySnow.DomainClass.SnowRateVarInfo.Snowaccu.ValueType))
         {
             prc.AddCondition(r3);
         }
         RangeBasedCondition r4 = new RangeBasedCondition(SiriusQualitySnow.DomainClass.SnowRateVarInfo.Mrf);
         if (r4.ApplicableVarInfoValueTypes.Contains(SiriusQualitySnow.DomainClass.SnowRateVarInfo.Mrf.ValueType))
         {
             prc.AddCondition(r4);
         }
         RangeBasedCondition r5 = new RangeBasedCondition(SiriusQualitySnow.DomainClass.SnowRateVarInfo.M);
         if (r5.ApplicableVarInfoValueTypes.Contains(SiriusQualitySnow.DomainClass.SnowRateVarInfo.M.ValueType))
         {
             prc.AddCondition(r5);
         }
         RangeBasedCondition r6 = new RangeBasedCondition(SiriusQualitySnow.DomainClass.SnowStateVarInfo.Sdry);
         if (r6.ApplicableVarInfoValueTypes.Contains(SiriusQualitySnow.DomainClass.SnowStateVarInfo.Sdry.ValueType))
         {
             prc.AddCondition(r6);
         }
         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.Snow, " + this.GetType().Name + ": Unhandled exception running pre-condition test. ";
         throw new Exception(msg, exception);
     }
 }
コード例 #21
0
 public string TestPreConditions(Phenology.DomainClass.PhenologyState s, Phenology.DomainClass.PhenologyState s1, Phenology.DomainClass.PhenologyRate r, Phenology.DomainClass.PhenologyAuxiliary a, Phenology.DomainClass.PhenologyExogenous ex, string callID)
 {
     try
     {
         //Set current values of the inputs to the static VarInfo representing the inputs properties of the domain classes
         Phenology.DomainClass.PhenologyAuxiliaryVarInfo.cumulTT.CurrentValue     = a.cumulTT;
         Phenology.DomainClass.PhenologyStateVarInfo.calendarMoments.CurrentValue = s.calendarMoments;
         Phenology.DomainClass.PhenologyStateVarInfo.calendarDates.CurrentValue   = s.calendarDates;
         Phenology.DomainClass.PhenologyStateVarInfo.calendarCumuls.CurrentValue  = s.calendarCumuls;
         Phenology.DomainClass.PhenologyAuxiliaryVarInfo.currentdate.CurrentValue = a.currentdate;
         Phenology.DomainClass.PhenologyStateVarInfo.phase.CurrentValue           = s.phase;
         ConditionsCollection prc = new ConditionsCollection();
         Preconditions        pre = new Preconditions();
         RangeBasedCondition  r1  = new RangeBasedCondition(Phenology.DomainClass.PhenologyAuxiliaryVarInfo.cumulTT);
         if (r1.ApplicableVarInfoValueTypes.Contains(Phenology.DomainClass.PhenologyAuxiliaryVarInfo.cumulTT.ValueType))
         {
             prc.AddCondition(r1);
         }
         RangeBasedCondition r2 = new RangeBasedCondition(Phenology.DomainClass.PhenologyStateVarInfo.calendarMoments);
         if (r2.ApplicableVarInfoValueTypes.Contains(Phenology.DomainClass.PhenologyStateVarInfo.calendarMoments.ValueType))
         {
             prc.AddCondition(r2);
         }
         RangeBasedCondition r3 = new RangeBasedCondition(Phenology.DomainClass.PhenologyStateVarInfo.calendarDates);
         if (r3.ApplicableVarInfoValueTypes.Contains(Phenology.DomainClass.PhenologyStateVarInfo.calendarDates.ValueType))
         {
             prc.AddCondition(r3);
         }
         RangeBasedCondition r4 = new RangeBasedCondition(Phenology.DomainClass.PhenologyStateVarInfo.calendarCumuls);
         if (r4.ApplicableVarInfoValueTypes.Contains(Phenology.DomainClass.PhenologyStateVarInfo.calendarCumuls.ValueType))
         {
             prc.AddCondition(r4);
         }
         RangeBasedCondition r5 = new RangeBasedCondition(Phenology.DomainClass.PhenologyAuxiliaryVarInfo.currentdate);
         if (r5.ApplicableVarInfoValueTypes.Contains(Phenology.DomainClass.PhenologyAuxiliaryVarInfo.currentdate.ValueType))
         {
             prc.AddCondition(r5);
         }
         RangeBasedCondition r6 = new RangeBasedCondition(Phenology.DomainClass.PhenologyStateVarInfo.phase);
         if (r6.ApplicableVarInfoValueTypes.Contains(Phenology.DomainClass.PhenologyStateVarInfo.phase.ValueType))
         {
             prc.AddCondition(r6);
         }
         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 = ".Phenology, " + this.GetType().Name + ": Unhandled exception running pre-condition test. ";
         throw new Exception(msg, exception);
     }
 }
コード例 #22
0
ファイル: Meteorology.cs プロジェクト: SiriusQuality/Release
        /// <summary>
        /// Test to verify the preconditions
        /// </summary>
        public string TestPreConditions(SiriusQualityMeteo.MeteoState meteostate, string callID)
        {
            try
            {
                //Set current values of the inputs to the static VarInfo representing the input properties of the domain classes


                //Create the collection of the conditions to test
                ConditionsCollection prc = new ConditionsCollection();
                Preconditions        pre = new Preconditions();



                string ret = "";
                ret += _calculatedailyvpd.TestPreConditions(meteostate, "strategy SiriusQualityMeteo.Strategies.CalculateDailyVPD");
                ret += _calculatehourlyairtemperature.TestPreConditions(meteostate, "strategy SiriusQualityMeteo.Strategies.CalculateHourlyAirTemperature");
                ret += _calculatehourlydirdifradiations.TestPreConditions(meteostate, "strategy SiriusQualityMeteo.Strategies.CalculateHourlyDirDifRadiations");
                ret += _calculatehourlyradiation.TestPreConditions(meteostate, "strategy SiriusQualityMeteo.Strategies.CalculateHourlyRadiation");
                ret += _calculatehourlyvpdair.TestPreConditions(meteostate, "strategy SiriusQualityMeteo.Strategies.calculateHourlyVPDAir");
                ret += _calculatehourlywindspeed.TestPreConditions(meteostate, "strategy SiriusQualityMeteo.Strategies.CalculateHourlyWindSpeed");
                ret += _calculateminmaxdailywindspeed.TestPreConditions(meteostate, "strategy SiriusQualityMeteo.Strategies.CalculateMinMaxDailyWindSpeed");
                ret += _calculatephotoperiod.TestPreConditions(meteostate, "strategy SiriusQualityMeteo.Strategies.CalculatePhotoperiod");
                if (ret != "")
                {
                    pre.TestsOut(ret, true, "   preconditions tests of associated classes");
                }

                //GENERATED CODE END - PLACE YOUR CUSTOM CODE BELOW - Section3
                //Code written below will not be overwritten by a future code generation



                //End of custom code. Do not place your custom code below. It will be overwritten by a future code generation.
                //PLACE YOUR CUSTOM CODE ABOVE - GENERATED CODE START - Section3

                //Get the evaluation of preconditions;
                string preConditionsResult = pre.VerifyPreconditions(prc, callID);
                //if we have errors, send it to the configured output
                if (!string.IsNullOrEmpty(preConditionsResult))
                {
                    pre.TestsOut(preConditionsResult, true, "PreConditions errors in component SiriusQualityMeteo.Strategies, strategy " + this.GetType().Name);
                }
                return(preConditionsResult);
            }
            catch (Exception exception)
            {
                //Uncomment the next line to use the trace
                //	TraceStrategies.TraceEvent(System.Diagnostics.TraceEventType.Error, 1002,"Strategy: " + this.GetType().Name + " - Unhandled exception running pre-conditions");

                string msg = "Component SiriusQualityMeteo.Strategies, " + this.GetType().Name + ": Unhandled exception running pre-condition test. ";
                throw new Exception(msg, exception);
            }
        }
        //Parameters static VarInfo list of the composite class


        #endregion

        #region pre/post conditions management

        /// <summary>
        /// Test to verify the postconditions
        /// </summary>
        public string TestPostConditions(INRA.SiriusQualityIrradiance.Interfaces.Rates rates, INRA.SiriusQualityIrradiance.Interfaces.Exogenous exogenous, INRA.SiriusQualityIrradiance.Interfaces.States states, string callID)
        {
            try
            {
                //Set current values of the outputs to the static VarInfo representing the output properties of the domain classes

                INRA.SiriusQualityIrradiance.Interfaces.RatesVarInfo.absorbedGlobalIrradiance.CurrentValue = rates.absorbedGlobalIrradiance;
                INRA.SiriusQualityIrradiance.Interfaces.RatesVarInfo.absorbedGlobalIrradianceLayeredHourly.CurrentValue = rates.absorbedGlobalIrradianceLayeredHourly;

                //Create the collection of the conditions to test
                ConditionsCollection prc = new ConditionsCollection();
                Preconditions        pre = new Preconditions();


                RangeBasedCondition r4 = new RangeBasedCondition(INRA.SiriusQualityIrradiance.Interfaces.RatesVarInfo.absorbedGlobalIrradiance);
                if (r4.ApplicableVarInfoValueTypes.Contains(INRA.SiriusQualityIrradiance.Interfaces.RatesVarInfo.absorbedGlobalIrradiance.ValueType))
                {
                    prc.AddCondition(r4);
                }
                RangeBasedCondition r5 = new RangeBasedCondition(INRA.SiriusQualityIrradiance.Interfaces.RatesVarInfo.absorbedGlobalIrradianceLayeredHourly);
                if (r5.ApplicableVarInfoValueTypes.Contains(INRA.SiriusQualityIrradiance.Interfaces.RatesVarInfo.absorbedGlobalIrradianceLayeredHourly.ValueType))
                {
                    prc.AddCondition(r5);
                }



                //GENERATED CODE END - PLACE YOUR CUSTOM CODE BELOW - Section4
                //Code written below will not be overwritten by a future code generation



                //End of custom code. Do not place your custom code below. It will be overwritten by a future code generation.
                //PLACE YOUR CUSTOM CODE ABOVE - GENERATED CODE START - Section4

                //Get the evaluation of postconditions
                string postConditionsResult = pre.VerifyPostconditions(prc, callID);
                //if we have errors, send it to the configured output
                if (!string.IsNullOrEmpty(postConditionsResult))
                {
                    pre.TestsOut(postConditionsResult, true, "PostConditions errors in component INRA.SiriusQualityIrradiance.Strategies, strategy " + this.GetType().Name);
                }
                return(postConditionsResult);
            }
            catch (Exception exception)
            {
                //Uncomment the next line to use the trace
                //TraceStrategies.TraceEvent(System.Diagnostics.TraceEventType.Error, 1001,	"Strategy: " + this.GetType().Name + " - Unhandled exception running post-conditions");

                string msg = "Component INRA.SiriusQualityIrradiance.Strategies, " + this.GetType().Name + ": Unhandled exception running post-condition test. ";
                throw new Exception(msg, exception);
            }
        }
コード例 #24
0
 public string TestPreConditions(SiriusQualityEnergybalance.DomainClass.EnergybalanceState s, SiriusQualityEnergybalance.DomainClass.EnergybalanceState s1, SiriusQualityEnergybalance.DomainClass.EnergybalanceRate r, SiriusQualityEnergybalance.DomainClass.EnergybalanceAuxiliary a, SiriusQualityEnergybalance.DomainClass.EnergybalanceExogenous ex, string callID)
 {
     try
     {
         //Set current values of the inputs to the static VarInfo representing the inputs properties of the domain classes
         SiriusQualityEnergybalance.DomainClass.EnergybalanceAuxiliaryVarInfo.minTair.CurrentValue             = a.minTair;
         SiriusQualityEnergybalance.DomainClass.EnergybalanceAuxiliaryVarInfo.maxTair.CurrentValue             = a.maxTair;
         SiriusQualityEnergybalance.DomainClass.EnergybalanceAuxiliaryVarInfo.solarRadiation.CurrentValue      = a.solarRadiation;
         SiriusQualityEnergybalance.DomainClass.EnergybalanceAuxiliaryVarInfo.vaporPressure.CurrentValue       = a.vaporPressure;
         SiriusQualityEnergybalance.DomainClass.EnergybalanceAuxiliaryVarInfo.extraSolarRadiation.CurrentValue = a.extraSolarRadiation;
         ConditionsCollection prc = new ConditionsCollection();
         Preconditions        pre = new Preconditions();
         RangeBasedCondition  r1  = new RangeBasedCondition(SiriusQualityEnergybalance.DomainClass.EnergybalanceStateVarInfo.minTair);
         if (r1.ApplicableVarInfoValueTypes.Contains(SiriusQualityEnergybalance.DomainClass.EnergybalanceAuxiliaryVarInfo.minTair.ValueType))
         {
             prc.AddCondition(r1);
         }
         RangeBasedCondition r2 = new RangeBasedCondition(SiriusQualityEnergybalance.DomainClass.EnergybalanceStateVarInfo.maxTair);
         if (r2.ApplicableVarInfoValueTypes.Contains(SiriusQualityEnergybalance.DomainClass.EnergybalanceAuxiliaryVarInfo.maxTair.ValueType))
         {
             prc.AddCondition(r2);
         }
         RangeBasedCondition r3 = new RangeBasedCondition(SiriusQualityEnergybalance.DomainClass.EnergybalanceStateVarInfo.solarRadiation);
         if (r3.ApplicableVarInfoValueTypes.Contains(SiriusQualityEnergybalance.DomainClass.EnergybalanceAuxiliaryVarInfo.solarRadiation.ValueType))
         {
             prc.AddCondition(r3);
         }
         RangeBasedCondition r4 = new RangeBasedCondition(SiriusQualityEnergybalance.DomainClass.EnergybalanceStateVarInfo.vaporPressure);
         if (r4.ApplicableVarInfoValueTypes.Contains(SiriusQualityEnergybalance.DomainClass.EnergybalanceAuxiliaryVarInfo.vaporPressure.ValueType))
         {
             prc.AddCondition(r4);
         }
         RangeBasedCondition r5 = new RangeBasedCondition(SiriusQualityEnergybalance.DomainClass.EnergybalanceStateVarInfo.extraSolarRadiation);
         if (r5.ApplicableVarInfoValueTypes.Contains(SiriusQualityEnergybalance.DomainClass.EnergybalanceAuxiliaryVarInfo.extraSolarRadiation.ValueType))
         {
             prc.AddCondition(r5);
         }
         prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("albedoCoefficient")));
         prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("stefanBoltzman")));
         prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("elevation")));
         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.Energybalance, " + this.GetType().Name + ": Unhandled exception running pre-condition test. ";
         throw new Exception(msg, exception);
     }
 }
コード例 #25
0
        /// <summary>
        /// Test to verify the preconditions
        /// </summary>
        public string TestPreConditions(SiriusQualityPhenology.PhenologyState phenologystate, SiriusQualityPhenology.PhenologyState phenologystate1, string callID)
        {
            try
            {
                //Set current values of the inputs to the static VarInfo representing the input properties of the domain classes


                //Create the collection of the conditions to test
                ConditionsCollection prc = new ConditionsCollection();
                Preconditions        pre = new Preconditions();



                string ret = "";
                ret += _calculateleafnumber.TestPreConditions(phenologystate, phenologystate1, "strategy SiriusQualityPhenology.Strategies.CalculateLeafNumber");
                ret += _calculatephyllochron.TestPreConditions(phenologystate, phenologystate1, "strategy SiriusQualityPhenology.Strategies.CalculatePhyllochron");
                ret += _calculateshootnumber.TestPreConditions(phenologystate, phenologystate1, "strategy SiriusQualityPhenology.Strategies.CalculateShootNumber");
                ret += _calculatevernalizationprogress.TestPreConditions(phenologystate, phenologystate1, "strategy SiriusQualityPhenology.Strategies.CalculateVernalizationProgress");
                ret += _registerzadok.TestPreConditions(phenologystate, phenologystate1, "strategy SiriusQualityPhenology.Strategies.RegisterZadok");
                ret += _updateleafflag.TestPreConditions(phenologystate, phenologystate1, "strategy SiriusQualityPhenology.Strategies.UpdateLeafFlag");
                ret += _updatephase.TestPreConditions(phenologystate, phenologystate1, "strategy SiriusQualityPhenology.Strategies.UpdatePhase");
                if (ret != "")
                {
                    pre.TestsOut(ret, true, "   preconditions tests of associated classes");
                }

                //GENERATED CODE END - PLACE YOUR CUSTOM CODE BELOW - Section3
                //Code written below will not be overwritten by a future code generation



                //End of custom code. Do not place your custom code below. It will be overwritten by a future code generation.
                //PLACE YOUR CUSTOM CODE ABOVE - GENERATED CODE START - Section3

                //Get the evaluation of preconditions;
                string preConditionsResult = pre.VerifyPreconditions(prc, callID);
                //if we have errors, send it to the configured output
                if (!string.IsNullOrEmpty(preConditionsResult))
                {
                    pre.TestsOut(preConditionsResult, true, "PreConditions errors in component SiriusQualityPhenology.Strategies, strategy " + this.GetType().Name);
                }
                return(preConditionsResult);
            }
            catch (Exception exception)
            {
                //Uncomment the next line to use the trace
                //	TraceStrategies.TraceEvent(System.Diagnostics.TraceEventType.Error, 1002,"Strategy: " + this.GetType().Name + " - Unhandled exception running pre-conditions");

                string msg = "Component SiriusQualityPhenology.Strategies, " + this.GetType().Name + ": Unhandled exception running pre-condition test. ";
                throw new Exception(msg, exception);
            }
        }
コード例 #26
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);
     }
 }
コード例 #27
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.deltaTT.CurrentValue = a.deltaTT;
         SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.phyllochron.CurrentValue = s.phyllochron;
         SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.hasFlagLeafLiguleAppeared.CurrentValue = s.hasFlagLeafLiguleAppeared;
         SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.leafNumber.CurrentValue = s.leafNumber;
         SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.phase.CurrentValue      = s.phase;
         ConditionsCollection prc = new ConditionsCollection();
         Preconditions        pre = new Preconditions();
         RangeBasedCondition  r1  = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyAuxiliaryVarInfo.deltaTT);
         if (r1.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyAuxiliaryVarInfo.deltaTT.ValueType))
         {
             prc.AddCondition(r1);
         }
         RangeBasedCondition r2 = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.phyllochron);
         if (r2.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.phyllochron.ValueType))
         {
             prc.AddCondition(r2);
         }
         RangeBasedCondition r3 = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.hasFlagLeafLiguleAppeared);
         if (r3.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.hasFlagLeafLiguleAppeared.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.phase);
         if (r5.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.phase.ValueType))
         {
             prc.AddCondition(r5);
         }
         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);
     }
 }
コード例 #28
0
ファイル: MaizeLAI.cs プロジェクト: SiriusQuality/Release
        /// <summary>
        /// Test to verify the preconditions
        /// </summary>
        public string TestPreConditions(SiriusQualityMaizeLAI.MaizeLAIState maizelaistate, string callID)
        {
            try
            {
                //Set current values of the inputs to the static VarInfo representing the input properties of the domain classes


                //Create the collection of the conditions to test
                ConditionsCollection prc = new ConditionsCollection();
                Preconditions        pre = new Preconditions();



                string ret = "";
                ret += _maximumpotentialfinallai.TestPreConditions(maizelaistate, "strategy SiriusQualityMaizeLAI.Strategies.MaximumPotentialFinalLAI");
                ret += _leafexpansiondroughtfactor.TestPreConditions(maizelaistate, "strategy SiriusQualityMaizeLAI.Strategies.LeafExpansionDroughtFactor");
                ret += _deltalaimaize.TestPreConditions(maizelaistate, "strategy SiriusQualityMaizeLAI.Strategies.DeltaLAIMaize");
                ret += _calcler.TestPreConditions(maizelaistate, "strategy SiriusQualityMaizeLAI.Strategies.calcLER");
                if (ret != "")
                {
                    pre.TestsOut(ret, true, "   preconditions tests of associated classes");
                }

                //GENERATED CODE END - PLACE YOUR CUSTOM CODE BELOW - Section3
                //Code written below will not be overwritten by a future code generation



                //End of custom code. Do not place your custom code below. It will be overwritten by a future code generation.
                //PLACE YOUR CUSTOM CODE ABOVE - GENERATED CODE START - Section3

                //Get the evaluation of preconditions;
                string preConditionsResult = pre.VerifyPreconditions(prc, callID);
                //if we have errors, send it to the configured output
                if (!string.IsNullOrEmpty(preConditionsResult))
                {
                    pre.TestsOut(preConditionsResult, true, "PreConditions errors in component SiriusQualityMaizeLAI.Strategies, strategy " + this.GetType().Name);
                }
                return(preConditionsResult);
            }
            catch (Exception exception)
            {
                //Uncomment the next line to use the trace
                //	TraceStrategies.TraceEvent(System.Diagnostics.TraceEventType.Error, 1002,"Strategy: " + this.GetType().Name + " - Unhandled exception running pre-conditions");

                string msg = "Component SiriusQualityMaizeLAI.Strategies, " + this.GetType().Name + ": Unhandled exception running pre-condition test. ";
                throw new Exception(msg, exception);
            }
        }
コード例 #29
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  r16 = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.hasZadokStageChanged);
         if (r16.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.hasZadokStageChanged.ValueType))
         {
             prc.AddCondition(r16);
         }
         RangeBasedCondition r17 = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.currentZadokStage);
         if (r17.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.currentZadokStage.ValueType))
         {
             prc.AddCondition(r17);
         }
         RangeBasedCondition r18 = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.calendarMoments);
         if (r18.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.calendarMoments.ValueType))
         {
             prc.AddCondition(r18);
         }
         RangeBasedCondition r19 = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.calendarDates);
         if (r19.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.calendarDates.ValueType))
         {
             prc.AddCondition(r19);
         }
         RangeBasedCondition r20 = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.calendarCumuls);
         if (r20.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.calendarCumuls.ValueType))
         {
             prc.AddCondition(r20);
         }
         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 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.vernaprog.CurrentValue       = s.vernaprog;
         SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.minFinalNumber.CurrentValue  = s.minFinalNumber;
         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  r21 = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.vernaprog);
         if (r21.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.vernaprog.ValueType))
         {
             prc.AddCondition(r21);
         }
         RangeBasedCondition r22 = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.minFinalNumber);
         if (r22.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.minFinalNumber.ValueType))
         {
             prc.AddCondition(r22);
         }
         RangeBasedCondition r23 = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.calendarMoments);
         if (r23.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.calendarMoments.ValueType))
         {
             prc.AddCondition(r23);
         }
         RangeBasedCondition r24 = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.calendarDates);
         if (r24.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.calendarDates.ValueType))
         {
             prc.AddCondition(r24);
         }
         RangeBasedCondition r25 = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.calendarCumuls);
         if (r25.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.calendarCumuls.ValueType))
         {
             prc.AddCondition(r25);
         }
         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);
     }
 }