/// <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(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); } }
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.PhenologyStateVarInfo.calendarMoments.CurrentValue = s.calendarMoments; ConditionsCollection prc = new ConditionsCollection(); Preconditions pre = new Preconditions(); RangeBasedCondition r1 = new RangeBasedCondition(Phenology.DomainClass.PhenologyStateVarInfo.calendarMoments); if (r1.ApplicableVarInfoValueTypes.Contains(Phenology.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 = ".Phenology, " + this.GetType().Name + ": Unhandled exception running pre-condition test. "; throw new Exception(msg, exception); } }
public string TestPreConditions(SiriusQualityPhenology.DomainClass.PhenologyState s,SiriusQualityPhenology.DomainClass.PhenologyState s1,SiriusQualityPhenology.DomainClass.PhenologyRate r,SiriusQualityPhenology.DomainClass.PhenologyAuxiliary a,SiriusQualityPhenology.DomainClass.PhenologyExogenous ex,string callID) { try { //Set current values of the inputs to the static VarInfo representing the inputs properties of the domain classes SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.canopyShootNumber.CurrentValue=s.canopyShootNumber; SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.leafNumber.CurrentValue=s.leafNumber; SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.tilleringProfile.CurrentValue=s.tilleringProfile; SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.leafTillerNumberArray.CurrentValue=s.leafTillerNumberArray; SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.numberTillerCohort.CurrentValue=s.numberTillerCohort; ConditionsCollection prc = new ConditionsCollection(); Preconditions pre = new Preconditions(); RangeBasedCondition r1 = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.canopyShootNumber); if(r1.ApplicableVarInfoValueTypes.Contains( SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.canopyShootNumber.ValueType)){prc.AddCondition(r1);} RangeBasedCondition r2 = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.leafNumber); if(r2.ApplicableVarInfoValueTypes.Contains( SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.leafNumber.ValueType)){prc.AddCondition(r2);} RangeBasedCondition r3 = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.tilleringProfile); if(r3.ApplicableVarInfoValueTypes.Contains( SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.tilleringProfile.ValueType)){prc.AddCondition(r3);} RangeBasedCondition r4 = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.leafTillerNumberArray); if(r4.ApplicableVarInfoValueTypes.Contains( SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.leafTillerNumberArray.ValueType)){prc.AddCondition(r4);} RangeBasedCondition r5 = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.numberTillerCohort); if(r5.ApplicableVarInfoValueTypes.Contains( SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.numberTillerCohort.ValueType)){prc.AddCondition(r5);} prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("sowingDensity"))); prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("targetFertileShoot"))); string preConditionsResult = pre.VerifyPreconditions(prc, callID); if (!string.IsNullOrEmpty(preConditionsResult)) { pre.TestsOut(preConditionsResult, true, "PreConditions errors in strategy " + this.GetType().Name); } return preConditionsResult; } catch (Exception exception) { string msg = "SiriusQuality.Phenology, " + this.GetType().Name + ": Unhandled exception running pre-condition test. "; throw new Exception(msg, exception); } }
public string TestPreConditions(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); } }
/// <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); } }
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); } }
/// <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); } }
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); } }
/// <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); } }
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); } }
/// <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); } }
/// <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); } }
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); } }
public string TestPreConditions(SiriusQualityPhenology.DomainClass.PhenologyState s, SiriusQualityPhenology.DomainClass.PhenologyState s1, SiriusQualityPhenology.DomainClass.PhenologyRate r, SiriusQualityPhenology.DomainClass.PhenologyAuxiliary a, SiriusQualityPhenology.DomainClass.PhenologyExogenous ex, string callID) { try { //Set current values of the inputs to the static VarInfo representing the inputs properties of the domain classes SiriusQualityPhenology.DomainClass.PhenologyAuxiliaryVarInfo.cumulTT.CurrentValue = a.cumulTT; SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.calendarMoments.CurrentValue = s.calendarMoments; SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.calendarDates.CurrentValue = s.calendarDates; SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.calendarCumuls.CurrentValue = s.calendarCumuls; SiriusQualityPhenology.DomainClass.PhenologyAuxiliaryVarInfo.currentdate.CurrentValue = a.currentdate; SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.phase.CurrentValue = s.phase; ConditionsCollection prc = new ConditionsCollection(); Preconditions pre = new Preconditions(); RangeBasedCondition r1 = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyAuxiliaryVarInfo.cumulTT); if (r1.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyAuxiliaryVarInfo.cumulTT.ValueType)) { prc.AddCondition(r1); } RangeBasedCondition r2 = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.calendarMoments); if (r2.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.calendarMoments.ValueType)) { prc.AddCondition(r2); } RangeBasedCondition r3 = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.calendarDates); if (r3.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.calendarDates.ValueType)) { prc.AddCondition(r3); } RangeBasedCondition r4 = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.calendarCumuls); if (r4.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.calendarCumuls.ValueType)) { prc.AddCondition(r4); } RangeBasedCondition r5 = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyAuxiliaryVarInfo.currentdate); if (r5.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.DomainClass.PhenologyAuxiliaryVarInfo.currentdate.ValueType)) { prc.AddCondition(r5); } RangeBasedCondition r6 = new RangeBasedCondition(SiriusQualityPhenology.DomainClass.PhenologyStateVarInfo.phase); if (r6.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.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 = "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(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); } }
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); } }
/// <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); } }
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); } }
/// <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); } }
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.deltaTT.CurrentValue = a.deltaTT; Phenology.DomainClass.PhenologyStateVarInfo.phyllochron.CurrentValue = s.phyllochron; Phenology.DomainClass.PhenologyStateVarInfo.hasFlagLeafLiguleAppeared.CurrentValue = s.hasFlagLeafLiguleAppeared; Phenology.DomainClass.PhenologyStateVarInfo.leafNumber.CurrentValue = s.leafNumber; Phenology.DomainClass.PhenologyStateVarInfo.phase.CurrentValue = s.phase; ConditionsCollection prc = new ConditionsCollection(); Preconditions pre = new Preconditions(); RangeBasedCondition r1 = new RangeBasedCondition(Phenology.DomainClass.PhenologyAuxiliaryVarInfo.deltaTT); if (r1.ApplicableVarInfoValueTypes.Contains(Phenology.DomainClass.PhenologyAuxiliaryVarInfo.deltaTT.ValueType)) { prc.AddCondition(r1); } RangeBasedCondition r2 = new RangeBasedCondition(Phenology.DomainClass.PhenologyStateVarInfo.phyllochron); if (r2.ApplicableVarInfoValueTypes.Contains(Phenology.DomainClass.PhenologyStateVarInfo.phyllochron.ValueType)) { prc.AddCondition(r2); } RangeBasedCondition r3 = new RangeBasedCondition(Phenology.DomainClass.PhenologyStateVarInfo.hasFlagLeafLiguleAppeared); if (r3.ApplicableVarInfoValueTypes.Contains(Phenology.DomainClass.PhenologyStateVarInfo.hasFlagLeafLiguleAppeared.ValueType)) { prc.AddCondition(r3); } RangeBasedCondition r4 = new RangeBasedCondition(Phenology.DomainClass.PhenologyStateVarInfo.leafNumber); if (r4.ApplicableVarInfoValueTypes.Contains(Phenology.DomainClass.PhenologyStateVarInfo.leafNumber.ValueType)) { prc.AddCondition(r4); } RangeBasedCondition r5 = new RangeBasedCondition(Phenology.DomainClass.PhenologyStateVarInfo.phase); if (r5.ApplicableVarInfoValueTypes.Contains(Phenology.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 = ".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(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(); 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("P"))); prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("SDws"))); prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("SDsa_nh"))); prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("Rp"))); //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); } }
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.EnergyBalanceRateVarInfo.cropHeatFlux.CurrentValue = r.cropHeatFlux; SiriusQualityEnergyBalance.DomainClass.EnergyBalanceStateVarInfo.conductance.CurrentValue = s.conductance; ConditionsCollection prc = new ConditionsCollection(); Preconditions pre = new Preconditions(); RangeBasedCondition r1 = new RangeBasedCondition(SiriusQualityEnergyBalance.DomainClass.EnergyBalanceAuxiliaryVarInfo.minTair); if (r1.ApplicableVarInfoValueTypes.Contains(SiriusQualityEnergyBalance.DomainClass.EnergyBalanceAuxiliaryVarInfo.minTair.ValueType)) { prc.AddCondition(r1); } RangeBasedCondition r2 = new RangeBasedCondition(SiriusQualityEnergyBalance.DomainClass.EnergyBalanceAuxiliaryVarInfo.maxTair); if (r2.ApplicableVarInfoValueTypes.Contains(SiriusQualityEnergyBalance.DomainClass.EnergyBalanceAuxiliaryVarInfo.maxTair.ValueType)) { prc.AddCondition(r2); } RangeBasedCondition r3 = new RangeBasedCondition(SiriusQualityEnergyBalance.DomainClass.EnergyBalanceRateVarInfo.cropHeatFlux); if (r3.ApplicableVarInfoValueTypes.Contains(SiriusQualityEnergyBalance.DomainClass.EnergyBalanceRateVarInfo.cropHeatFlux.ValueType)) { prc.AddCondition(r3); } RangeBasedCondition r4 = new RangeBasedCondition(SiriusQualityEnergyBalance.DomainClass.EnergyBalanceStateVarInfo.conductance); if (r4.ApplicableVarInfoValueTypes.Contains(SiriusQualityEnergyBalance.DomainClass.EnergyBalanceStateVarInfo.conductance.ValueType)) { prc.AddCondition(r4); } prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("lambdaV"))); prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("rhoDensityAir"))); prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("specificHeatCapacityAir"))); 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); } }
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.plantHeight.CurrentValue = a.plantHeight; SiriusQualityEnergybalance.DomainClass.EnergybalanceAuxiliaryVarInfo.wind.CurrentValue = a.wind; ConditionsCollection prc = new ConditionsCollection(); Preconditions pre = new Preconditions(); RangeBasedCondition r1 = new RangeBasedCondition(SiriusQualityEnergybalance.DomainClass.EnergybalanceStateVarInfo.plantHeight); if (r1.ApplicableVarInfoValueTypes.Contains(SiriusQualityEnergybalance.DomainClass.EnergybalanceAuxiliaryVarInfo.plantHeight.ValueType)) { prc.AddCondition(r1); } RangeBasedCondition r2 = new RangeBasedCondition(SiriusQualityEnergybalance.DomainClass.EnergybalanceStateVarInfo.wind); if (r2.ApplicableVarInfoValueTypes.Contains(SiriusQualityEnergybalance.DomainClass.EnergybalanceAuxiliaryVarInfo.wind.ValueType)) { prc.AddCondition(r2); } prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("vonKarman"))); prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("heightWeatherMeasurements"))); prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("zm"))); prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("zh"))); prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("d"))); 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); } }
/// <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 SiriusQualityPhenology.PhenologyStateVarInfo.DeltaTT.CurrentValue = phenologystate.DeltaTT; SiriusQualityPhenology.PhenologyStateVarInfo.Phyllochron.CurrentValue = phenologystate.Phyllochron; SiriusQualityPhenology.PhenologyStateVarInfo.HasFlagLeafLiguleAppeared.CurrentValue = phenologystate.HasFlagLeafLiguleAppeared; SiriusQualityPhenology.PhenologyStateVarInfo.LeafNumber.CurrentValue = phenologystate.LeafNumber; //Create the collection of the conditions to test ConditionsCollection prc = new ConditionsCollection(); Preconditions pre = new Preconditions(); RangeBasedCondition r1 = new RangeBasedCondition(SiriusQualityPhenology.PhenologyStateVarInfo.DeltaTT); if (r1.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.PhenologyStateVarInfo.DeltaTT.ValueType)) { prc.AddCondition(r1); } RangeBasedCondition r2 = new RangeBasedCondition(SiriusQualityPhenology.PhenologyStateVarInfo.Phyllochron); if (r2.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.PhenologyStateVarInfo.Phyllochron.ValueType)) { prc.AddCondition(r2); } RangeBasedCondition r3 = new RangeBasedCondition(SiriusQualityPhenology.PhenologyStateVarInfo.HasFlagLeafLiguleAppeared); if (r3.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.PhenologyStateVarInfo.HasFlagLeafLiguleAppeared.ValueType)) { prc.AddCondition(r3); } RangeBasedCondition r4 = new RangeBasedCondition(SiriusQualityPhenology.PhenologyStateVarInfo.LeafNumber); if (r4.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.PhenologyStateVarInfo.LeafNumber.ValueType)) { prc.AddCondition(r4); } //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); } }
/// <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 SiriusQualityPhenology.PhenologyStateVarInfo.DayLength.CurrentValue = phenologystate.DayLength; SiriusQualityPhenology.PhenologyStateVarInfo.DeltaTT.CurrentValue = phenologystate.DeltaTT; SiriusQualityPhenology.PhenologyStateVarInfo.cumulTT.CurrentValue = phenologystate.cumulTT; SiriusQualityPhenology.PhenologyStateVarInfo.LeafNumber.CurrentValue = phenologystate.LeafNumber; SiriusQualityPhenology.PhenologyStateVarInfo.Calendar.CurrentValue = phenologystate.Calendar; SiriusQualityPhenology.PhenologyStateVarInfo.Vernaprog.CurrentValue = phenologystate.Vernaprog; SiriusQualityPhenology.PhenologyStateVarInfo.MinFinalNumber.CurrentValue = phenologystate.MinFinalNumber; //Create the collection of the conditions to test ConditionsCollection prc = new ConditionsCollection(); Preconditions pre = new Preconditions(); RangeBasedCondition r1 = new RangeBasedCondition(SiriusQualityPhenology.PhenologyStateVarInfo.DayLength); if (r1.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.PhenologyStateVarInfo.DayLength.ValueType)) { prc.AddCondition(r1); } RangeBasedCondition r2 = new RangeBasedCondition(SiriusQualityPhenology.PhenologyStateVarInfo.DeltaTT); if (r2.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.PhenologyStateVarInfo.DeltaTT.ValueType)) { prc.AddCondition(r2); } RangeBasedCondition r3 = new RangeBasedCondition(SiriusQualityPhenology.PhenologyStateVarInfo.cumulTT); if (r3.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.PhenologyStateVarInfo.cumulTT.ValueType)) { prc.AddCondition(r3); } RangeBasedCondition r4 = new RangeBasedCondition(SiriusQualityPhenology.PhenologyStateVarInfo.LeafNumber); if (r4.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.PhenologyStateVarInfo.LeafNumber.ValueType)) { prc.AddCondition(r4); } RangeBasedCondition r5 = new RangeBasedCondition(SiriusQualityPhenology.PhenologyStateVarInfo.Calendar); if (r5.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.PhenologyStateVarInfo.Calendar.ValueType)) { prc.AddCondition(r5); } RangeBasedCondition r6 = new RangeBasedCondition(SiriusQualityPhenology.PhenologyStateVarInfo.Vernaprog); if (r6.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.PhenologyStateVarInfo.Vernaprog.ValueType)) { prc.AddCondition(r6); } RangeBasedCondition r7 = new RangeBasedCondition(SiriusQualityPhenology.PhenologyStateVarInfo.MinFinalNumber); if (r7.ApplicableVarInfoValueTypes.Contains(SiriusQualityPhenology.PhenologyStateVarInfo.MinFinalNumber.ValueType)) { prc.AddCondition(r7); } prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("AMNFLNO"))); prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("IsVernalizable"))); prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("MinTvern"))); prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("IntTvern"))); prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("VAI"))); prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("VBEE"))); prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("MinDL"))); prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("MaxDL"))); prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("MaxTvern"))); prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("PNini"))); prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("AMXLFNO"))); //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); } }
/// <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.isWindVpDefined.CurrentValue = energybalancestate.isWindVpDefined; //Create the collection of the conditions to test ConditionsCollection prc = new ConditionsCollection(); Preconditions pre = new Preconditions(); RangeBasedCondition r1 = new RangeBasedCondition(SiriusQualityEnergyBalance.EnergyBalanceStateVarInfo.isWindVpDefined); if (r1.ApplicableVarInfoValueTypes.Contains(SiriusQualityEnergyBalance.EnergyBalanceStateVarInfo.isWindVpDefined.ValueType)) { prc.AddCondition(r1); } prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("SwitchMaize"))); string ret = ""; ret += _calculatenetradiation.TestPreConditions(energybalancestate, "strategy SiriusQualityEnergyBalance.CalculateNetRadiation"); ret += _calculatediffusionlimitedevaporation.TestPreConditions(energybalancestate, "strategy SiriusQualityEnergyBalance.CalculateDiffusionLimitedEvaporation"); ret += _calculatepriestlytaylor.TestPreConditions(energybalancestate, "strategy SiriusQualityEnergyBalance.CalculatePriestlyTaylor"); ret += _calculateptsoil.TestPreConditions(energybalancestate, "strategy SiriusQualityEnergyBalance.CalculatePtSoil"); ret += _calculateconductance.TestPreConditions(energybalancestate, "strategy SiriusQualityEnergyBalance.CalculateConductance"); ret += _calculatepenman.TestPreConditions(energybalancestate, "strategy SiriusQualityEnergyBalance.CalculatePenman"); ret += _calculatepottranspiration.TestPreConditions(energybalancestate, "strategy SiriusQualityEnergyBalance.CalculatePotTranspiration"); ret += _calculatesoilevaporation.TestPreConditions(energybalancestate, "strategy SiriusQuailtyEnergyBalance.CalculateSoilEvaporation"); ret += _calculatesoilheatflux.TestPreConditions(energybalancestate, "strategy SiriusQualityEnergyBalance.CalculateSoilHeatFlux"); ret += _calculatecropheatflux.TestPreConditions(energybalancestate, "strategy SiriusQualityEnergyBalance.CalculateCropHeatFlux"); ret += _calculatecanopytemperature.TestPreConditions(energybalancestate, "strategy SiriusQualityEnergyBalance.CalculateCanopyTemperature"); ret += _calculatecanopytemperaturemaize.TestPreConditions(energybalancestate, "strategy SiriusQualityEnergyBalance.CalculateCanopyTemperatureMaize"); ret += _calculatevpdairleaf.TestPreConditions(energybalancestate, "strategy SiriusQualityEnergyBalance.Calculatevpdairleaf"); ret += _calculatevpdeq.TestPreConditions(energybalancestate, "strategy SiriusQualityEnergyBalance.calculateVPDeq"); 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 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); } }
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.SnowAuxiliaryVarInfo.jul.CurrentValue = a.jul; SiriusQualitySnow.DomainClass.SnowAuxiliaryVarInfo.tmin.CurrentValue = a.tmin; SiriusQualitySnow.DomainClass.SnowAuxiliaryVarInfo.tmax.CurrentValue = a.tmax; SiriusQualitySnow.DomainClass.SnowAuxiliaryVarInfo.precip.CurrentValue = a.precip; SiriusQualitySnow.DomainClass.SnowStateVarInfo.Sdry.CurrentValue = s.Sdry; SiriusQualitySnow.DomainClass.SnowStateVarInfo.Sdepth.CurrentValue = s.Sdepth; SiriusQualitySnow.DomainClass.SnowStateVarInfo.Swet.CurrentValue = s.Swet; SiriusQualitySnow.DomainClass.SnowStateVarInfo.ps.CurrentValue = s.ps; ConditionsCollection prc = new ConditionsCollection(); Preconditions pre = new Preconditions(); RangeBasedCondition r1 = new RangeBasedCondition(SiriusQualitySnow.DomainClass.SnowAuxiliaryVarInfo.jul); if (r1.ApplicableVarInfoValueTypes.Contains(SiriusQualitySnow.DomainClass.SnowAuxiliaryVarInfo.jul.ValueType)) { prc.AddCondition(r1); } RangeBasedCondition r2 = new RangeBasedCondition(SiriusQualitySnow.DomainClass.SnowAuxiliaryVarInfo.tmin); if (r2.ApplicableVarInfoValueTypes.Contains(SiriusQualitySnow.DomainClass.SnowAuxiliaryVarInfo.tmin.ValueType)) { prc.AddCondition(r2); } RangeBasedCondition r3 = new RangeBasedCondition(SiriusQualitySnow.DomainClass.SnowAuxiliaryVarInfo.tmax); if (r3.ApplicableVarInfoValueTypes.Contains(SiriusQualitySnow.DomainClass.SnowAuxiliaryVarInfo.tmax.ValueType)) { prc.AddCondition(r3); } RangeBasedCondition r4 = new RangeBasedCondition(SiriusQualitySnow.DomainClass.SnowAuxiliaryVarInfo.precip); if (r4.ApplicableVarInfoValueTypes.Contains(SiriusQualitySnow.DomainClass.SnowAuxiliaryVarInfo.precip.ValueType)) { prc.AddCondition(r4); } RangeBasedCondition r5 = new RangeBasedCondition(SiriusQualitySnow.DomainClass.SnowStateVarInfo.Sdry); if (r5.ApplicableVarInfoValueTypes.Contains(SiriusQualitySnow.DomainClass.SnowStateVarInfo.Sdry.ValueType)) { prc.AddCondition(r5); } RangeBasedCondition r6 = new RangeBasedCondition(SiriusQualitySnow.DomainClass.SnowStateVarInfo.Sdepth); if (r6.ApplicableVarInfoValueTypes.Contains(SiriusQualitySnow.DomainClass.SnowStateVarInfo.Sdepth.ValueType)) { prc.AddCondition(r6); } RangeBasedCondition r7 = new RangeBasedCondition(SiriusQualitySnow.DomainClass.SnowStateVarInfo.Swet); if (r7.ApplicableVarInfoValueTypes.Contains(SiriusQualitySnow.DomainClass.SnowStateVarInfo.Swet.ValueType)) { prc.AddCondition(r7); } RangeBasedCondition r8 = new RangeBasedCondition(SiriusQualitySnow.DomainClass.SnowStateVarInfo.ps); if (r8.ApplicableVarInfoValueTypes.Contains(SiriusQualitySnow.DomainClass.SnowStateVarInfo.ps.ValueType)) { prc.AddCondition(r8); } prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("tmaxseuil"))); prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("tminseuil"))); prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("prof"))); prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("E"))); prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("rho"))); prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("Pns"))); prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("Kmin"))); prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("Tmf"))); prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("SWrf"))); prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("tsmax"))); prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("DKmax"))); prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("trmax"))); string ret = ""; ret += _Melting.TestPreConditions(s, s1, r, a, ex, " strategy SiriusQualitySnow.Strategies.Snow"); ret += _Refreezing.TestPreConditions(s, s1, r, a, ex, " strategy SiriusQualitySnow.Strategies.Snow"); ret += _SnowAccumulation.TestPreConditions(s, s1, r, a, ex, " strategy SiriusQualitySnow.Strategies.Snow"); ret += _SnowDensity.TestPreConditions(s, s1, r, a, ex, " strategy SiriusQualitySnow.Strategies.Snow"); ret += _SnowDepth.TestPreConditions(s, s1, r, a, ex, " strategy SiriusQualitySnow.Strategies.Snow"); ret += _SnowDepthTrans.TestPreConditions(s, s1, r, a, ex, " strategy SiriusQualitySnow.Strategies.Snow"); ret += _SnowDry.TestPreConditions(s, s1, r, a, ex, " strategy SiriusQualitySnow.Strategies.Snow"); ret += _SnowMelt.TestPreConditions(s, s1, r, a, ex, " strategy SiriusQualitySnow.Strategies.Snow"); ret += _SnowWet.TestPreConditions(s, s1, r, a, ex, " strategy SiriusQualitySnow.Strategies.Snow"); ret += _Tavg.TestPreConditions(s, s1, r, a, ex, " strategy SiriusQualitySnow.Strategies.Snow"); ret += _TempMax.TestPreConditions(s, s1, r, a, ex, " strategy SiriusQualitySnow.Strategies.Snow"); ret += _TempMin.TestPreConditions(s, s1, r, a, ex, " strategy SiriusQualitySnow.Strategies.Snow"); ret += _Preciprec.TestPreConditions(s, s1, r, a, ex, " strategy SiriusQualitySnow.Strategies.Snow"); if (ret != "") { pre.TestsOut(ret, true, " preconditions tests of associated classes"); } string preConditionsResult = pre.VerifyPreconditions(prc, callID); if (!string.IsNullOrEmpty(preConditionsResult)) { pre.TestsOut(preConditionsResult, true, "PreConditions errors in component " + this.GetType().Name); } return(preConditionsResult); } catch (Exception exception) { string msg = "Component SiriusQuality.Snow, " + this.GetType().Name + ": Unhandled exception running pre-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.cumulTTShoot.CurrentValue = wheatlaistate.cumulTTShoot; SiriusQualityWheatLAI.WheatLAIStateVarInfo.deltaTTShoot.CurrentValue = wheatlaistate.deltaTTShoot; SiriusQualityWheatLAI.WheatLAIStateVarInfo.deltaTTSenescence.CurrentValue = wheatlaistate.deltaTTSenescence; SiriusQualityWheatLAI.WheatLAIStateVarInfo.DSF.CurrentValue = wheatlaistate.DSF; SiriusQualityWheatLAI.WheatLAIStateVarInfo.DEF.CurrentValue = wheatlaistate.DEF; SiriusQualityWheatLAI.WheatLeafStateVarInfo.GAI.CurrentValue = wheatleafstate.GAI; SiriusQualityWheatLAI.WheatLeafStateVarInfo.TTGroLamina.CurrentValue = wheatleafstate.TTGroLamina; SiriusQualityWheatLAI.WheatLeafStateVarInfo.State.CurrentValue = wheatleafstate.State; SiriusQualityWheatLAI.WheatLeafStateVarInfo.PreviousState.CurrentValue = wheatleafstate.PreviousState; SiriusQualityWheatLAI.WheatLeafStateVarInfo.TTsen.CurrentValue = wheatleafstate.TTsen; SiriusQualityWheatLAI.WheatLeafStateVarInfo.TTem.CurrentValue = wheatleafstate.TTem; SiriusQualityWheatLAI.WheatLeafStateVarInfo.TTmat.CurrentValue = wheatleafstate.TTmat; SiriusQualityWheatLAI.WheatLeafStateVarInfo.laminaSpecificN.CurrentValue = wheatleafstate.laminaSpecificN; SiriusQualityWheatLAI.WheatLeafStateVarInfo.LaminaAI.CurrentValue = wheatleafstate.LaminaAI; SiriusQualityWheatLAI.WheatLeafStateVarInfo.SheathAI.CurrentValue = wheatleafstate.SheathAI; SiriusQualityWheatLAI.WheatLeafStateVarInfo.MaxAI.CurrentValue = wheatleafstate.MaxAI; SiriusQualityWheatLAI.WheatLeafStateVarInfo.isPrematurelyDying.CurrentValue = wheatleafstate.isPrematurelyDying; SiriusQualityWheatLAI.WheatLAIStateVarInfo.MaximumPotentialLaminaeAI.CurrentValue = wheatlaistate.MaximumPotentialLaminaeAI; SiriusQualityWheatLAI.WheatLAIStateVarInfo.MaximumPotentialSheathAI.CurrentValue = wheatlaistate.MaximumPotentialSheathAI; //Create the collection of the conditions to test ConditionsCollection prc = new ConditionsCollection(); Preconditions pre = new Preconditions(); RangeBasedCondition r1 = new RangeBasedCondition(SiriusQualityWheatLAI.WheatLAIStateVarInfo.cumulTTShoot); if (r1.ApplicableVarInfoValueTypes.Contains(SiriusQualityWheatLAI.WheatLAIStateVarInfo.cumulTTShoot.ValueType)) { prc.AddCondition(r1); } RangeBasedCondition r2 = new RangeBasedCondition(SiriusQualityWheatLAI.WheatLAIStateVarInfo.deltaTTShoot); if (r2.ApplicableVarInfoValueTypes.Contains(SiriusQualityWheatLAI.WheatLAIStateVarInfo.deltaTTShoot.ValueType)) { prc.AddCondition(r2); } RangeBasedCondition r3 = new RangeBasedCondition(SiriusQualityWheatLAI.WheatLAIStateVarInfo.deltaTTSenescence); if (r3.ApplicableVarInfoValueTypes.Contains(SiriusQualityWheatLAI.WheatLAIStateVarInfo.deltaTTSenescence.ValueType)) { prc.AddCondition(r3); } RangeBasedCondition r4 = new RangeBasedCondition(SiriusQualityWheatLAI.WheatLAIStateVarInfo.DSF); if (r4.ApplicableVarInfoValueTypes.Contains(SiriusQualityWheatLAI.WheatLAIStateVarInfo.DSF.ValueType)) { prc.AddCondition(r4); } RangeBasedCondition r5 = new RangeBasedCondition(SiriusQualityWheatLAI.WheatLAIStateVarInfo.DEF); if (r5.ApplicableVarInfoValueTypes.Contains(SiriusQualityWheatLAI.WheatLAIStateVarInfo.DEF.ValueType)) { prc.AddCondition(r5); } RangeBasedCondition r6 = new RangeBasedCondition(SiriusQualityWheatLAI.WheatLeafStateVarInfo.GAI); if (r6.ApplicableVarInfoValueTypes.Contains(SiriusQualityWheatLAI.WheatLeafStateVarInfo.GAI.ValueType)) { prc.AddCondition(r6); } RangeBasedCondition r7 = new RangeBasedCondition(SiriusQualityWheatLAI.WheatLeafStateVarInfo.TTGroLamina); if (r7.ApplicableVarInfoValueTypes.Contains(SiriusQualityWheatLAI.WheatLeafStateVarInfo.TTGroLamina.ValueType)) { prc.AddCondition(r7); } RangeBasedCondition r8 = new RangeBasedCondition(SiriusQualityWheatLAI.WheatLeafStateVarInfo.State); if (r8.ApplicableVarInfoValueTypes.Contains(SiriusQualityWheatLAI.WheatLeafStateVarInfo.State.ValueType)) { prc.AddCondition(r8); } RangeBasedCondition r9 = new RangeBasedCondition(SiriusQualityWheatLAI.WheatLeafStateVarInfo.PreviousState); if (r9.ApplicableVarInfoValueTypes.Contains(SiriusQualityWheatLAI.WheatLeafStateVarInfo.PreviousState.ValueType)) { prc.AddCondition(r9); } RangeBasedCondition r10 = new RangeBasedCondition(SiriusQualityWheatLAI.WheatLeafStateVarInfo.TTsen); if (r10.ApplicableVarInfoValueTypes.Contains(SiriusQualityWheatLAI.WheatLeafStateVarInfo.TTsen.ValueType)) { prc.AddCondition(r10); } RangeBasedCondition r11 = new RangeBasedCondition(SiriusQualityWheatLAI.WheatLeafStateVarInfo.TTem); if (r11.ApplicableVarInfoValueTypes.Contains(SiriusQualityWheatLAI.WheatLeafStateVarInfo.TTem.ValueType)) { prc.AddCondition(r11); } RangeBasedCondition r12 = new RangeBasedCondition(SiriusQualityWheatLAI.WheatLeafStateVarInfo.TTmat); if (r12.ApplicableVarInfoValueTypes.Contains(SiriusQualityWheatLAI.WheatLeafStateVarInfo.TTmat.ValueType)) { prc.AddCondition(r12); } RangeBasedCondition r13 = new RangeBasedCondition(SiriusQualityWheatLAI.WheatLeafStateVarInfo.laminaSpecificN); if (r13.ApplicableVarInfoValueTypes.Contains(SiriusQualityWheatLAI.WheatLeafStateVarInfo.laminaSpecificN.ValueType)) { prc.AddCondition(r13); } RangeBasedCondition r14 = new RangeBasedCondition(SiriusQualityWheatLAI.WheatLeafStateVarInfo.LaminaAI); if (r14.ApplicableVarInfoValueTypes.Contains(SiriusQualityWheatLAI.WheatLeafStateVarInfo.LaminaAI.ValueType)) { prc.AddCondition(r14); } RangeBasedCondition r15 = new RangeBasedCondition(SiriusQualityWheatLAI.WheatLeafStateVarInfo.SheathAI); if (r15.ApplicableVarInfoValueTypes.Contains(SiriusQualityWheatLAI.WheatLeafStateVarInfo.SheathAI.ValueType)) { prc.AddCondition(r15); } RangeBasedCondition r16 = new RangeBasedCondition(SiriusQualityWheatLAI.WheatLeafStateVarInfo.MaxAI); if (r16.ApplicableVarInfoValueTypes.Contains(SiriusQualityWheatLAI.WheatLeafStateVarInfo.MaxAI.ValueType)) { prc.AddCondition(r16); } RangeBasedCondition r17 = new RangeBasedCondition(SiriusQualityWheatLAI.WheatLeafStateVarInfo.isPrematurelyDying); if (r17.ApplicableVarInfoValueTypes.Contains(SiriusQualityWheatLAI.WheatLeafStateVarInfo.isPrematurelyDying.ValueType)) { prc.AddCondition(r17); } RangeBasedCondition r18 = new RangeBasedCondition(SiriusQualityWheatLAI.WheatLAIStateVarInfo.MaximumPotentialLaminaeAI); if (r18.ApplicableVarInfoValueTypes.Contains(SiriusQualityWheatLAI.WheatLAIStateVarInfo.MaximumPotentialLaminaeAI.ValueType)) { prc.AddCondition(r18); } RangeBasedCondition r19 = new RangeBasedCondition(SiriusQualityWheatLAI.WheatLAIStateVarInfo.MaximumPotentialSheathAI); if (r19.ApplicableVarInfoValueTypes.Contains(SiriusQualityWheatLAI.WheatLAIStateVarInfo.MaximumPotentialSheathAI.ValueType)) { prc.AddCondition(r19); } prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("SLNmin"))); //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); } }
/// <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.evapoTranspirationPriestlyTaylor.CurrentValue = energybalancestate.evapoTranspirationPriestlyTaylor; SiriusQualityEnergyBalance.EnergyBalanceStateVarInfo.hslope.CurrentValue = energybalancestate.hslope; SiriusQualityEnergyBalance.EnergyBalanceStateVarInfo.VPDair.CurrentValue = energybalancestate.VPDair; SiriusQualityEnergyBalance.EnergyBalanceStateVarInfo.conductance.CurrentValue = energybalancestate.conductance; //Create the collection of the conditions to test ConditionsCollection prc = new ConditionsCollection(); Preconditions pre = new Preconditions(); RangeBasedCondition r1 = new RangeBasedCondition(SiriusQualityEnergyBalance.EnergyBalanceStateVarInfo.evapoTranspirationPriestlyTaylor); if (r1.ApplicableVarInfoValueTypes.Contains(SiriusQualityEnergyBalance.EnergyBalanceStateVarInfo.evapoTranspirationPriestlyTaylor.ValueType)) { prc.AddCondition(r1); } RangeBasedCondition r2 = new RangeBasedCondition(SiriusQualityEnergyBalance.EnergyBalanceStateVarInfo.hslope); if (r2.ApplicableVarInfoValueTypes.Contains(SiriusQualityEnergyBalance.EnergyBalanceStateVarInfo.hslope.ValueType)) { prc.AddCondition(r2); } RangeBasedCondition r3 = new RangeBasedCondition(SiriusQualityEnergyBalance.EnergyBalanceStateVarInfo.VPDair); if (r3.ApplicableVarInfoValueTypes.Contains(SiriusQualityEnergyBalance.EnergyBalanceStateVarInfo.VPDair.ValueType)) { prc.AddCondition(r3); } RangeBasedCondition r4 = new RangeBasedCondition(SiriusQualityEnergyBalance.EnergyBalanceStateVarInfo.conductance); if (r4.ApplicableVarInfoValueTypes.Contains(SiriusQualityEnergyBalance.EnergyBalanceStateVarInfo.conductance.ValueType)) { prc.AddCondition(r4); } prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("psychrometricConstant"))); prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("rhoDensityAir"))); prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("specificHeatCapacityAir"))); prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("lambda"))); prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("Alpha"))); //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); } }