//Call of the associated strategies private void EstimateOfAssociatedClasses(SiriusQualityMaizeLAI.MaizeLAIState maizelaistate, List <LeafLayer> AllLeaves) { _calcler.Estimate(maizelaistate); _leafexpansiondroughtfactor.Estimate(maizelaistate); _maximumpotentialfinallai.Estimate(maizelaistate); _deltalaimaize.Estimate(maizelaistate, AllLeaves); }
private void CalculateModel(SiriusQualityMaizeLAI.MaizeLAIState maizelaistate, SiriusQualityMaizeLAI.MaizeLeafState maizeleafstate, SiriusQualityMaizeLAI.MaizeLeafState maizeleafstate1, CRA.AgroManagement.ActEvents actevents) { //GENERATED CODE END - PLACE YOUR CUSTOM CODE BELOW - Section1 //Code written below will not be overwritten by a future code generation if (maizelaistate.newLeafHasAppeared == 1) { var newNbLayer = (int)Math.Ceiling(maizelaistate.leafNumber); var curNbLayer = (int)Math.Ceiling(maizelaistate.previousLeafNumber); for (var index = curNbLayer; index < newNbLayer; ++index) { int leafnum = index + 1; double lag = Lagmax * leafnum; if (leafnum <= Nfinal - Nlast + 1) { maizeleafstate.fullyExpTT[index] = Math.Max(0, maizeleafstate.liguleTT[index] - lag); } else { maizeleafstate.fullyExpTT[index] = maizeleafstate.fullyExpTT[index - 1]; } } } //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 - Section1 }
private void CalculateModel(SiriusQualityMaizeLAI.MaizeLAIState maizelaistate, List <LeafLayer> AllLeaves) { //GENERATED CODE END - PLACE YOUR CUSTOM CODE BELOW - Section1 //Code written below will not be overwritten by a future code generation //update the size of the lists for (int i = 0; i < AllLeaves.Count; i++) { //if a new leaf has appeared, increase the size of the arrays if (i >= maizelaistate.WaterLimitedPotDeltaAIList.Count) { maizelaistate.WaterLimitedPotDeltaAIList.Add(0); maizelaistate.WaterLimitedPotExposedDeltaAIList.Add(0); maizelaistate.leafStateList.Add(AllLeaves[i].State); //State==growing maizelaistate.isPrematurelyDying.Add(0); } } CalculateNewLeafLayerStates(maizelaistate.cumulTTPHenoMaize, AllLeaves, maizelaistate); maizelaistate.potentialIncDeltaArea = calculateDeltaLAIpot(maizelaistate.cumulTTPHenoMaize, maizelaistate.deltaTTPhenoMaize, maizelaistate.LER, AllLeaves, maizelaistate); maizelaistate.incDeltaAreaLimitSF = maizelaistate.potentialIncDeltaArea * maizelaistate.DEF; //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 - Section1 }
private void CalculateModel(SiriusQualityMaizeLAI.MaizeLAIState maizelaistate, SiriusQualityMaizeLAI.MaizeLeafState maizeleafstate, SiriusQualityMaizeLAI.MaizeLeafState maizeleafstate1, CRA.AgroManagement.ActEvents actevents) { //GENERATED CODE END - PLACE YOUR CUSTOM CODE BELOW - Section1 //Code written below will not be overwritten by a future code generation if (maizelaistate.newLeafHasAppeared == 1) { var newNbLayer = (int)Math.Ceiling(maizelaistate.leafNumber); var curNbLayer = (int)Math.Ceiling(maizelaistate.previousLeafNumber); for (var index = curNbLayer; index < newNbLayer; ++index) { if (index < Math.Floor(maizelaistate.finalLeafNumber)) { maizeleafstate.fracPopn[index] = 1.0; } else { maizeleafstate.fracPopn[index] = maizelaistate.finalLeafNumber - Math.Floor(maizelaistate.finalLeafNumber); } } } //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 - Section1 }
private void CalculateModel(SiriusQualityMaizeLAI.MaizeLAIState maizelaistate, SiriusQualityMaizeLAI.MaizeLeafState maizeleafstate, SiriusQualityMaizeLAI.MaizeLeafState maizeleafstate1, CRA.AgroManagement.ActEvents actevents) { //GENERATED CODE END - PLACE YOUR CUSTOM CODE BELOW - Section1 //Code written below will not be overwritten by a future code generation // For leaf tips appearance : // -------------------------- if (maizelaistate.newLeafHasAppeared == 1) { var newNbLayer = (int)Math.Ceiling(maizelaistate.leafNumber); var curNbLayer = (int)Math.Ceiling(maizelaistate.previousLeafNumber); double cumulTT = maizelaistate.cumulTTPHenoMaize - maizelaistate.deltaTTPhenoMaize; for (var index = curNbLayer; index < newNbLayer; ++index) { double leafnum = index + 1; if (cumulTT <= btip) { maizeleafstate.tipTT[index] = Dse; } else { maizeleafstate.tipTT[index] = leafnum * atip + btip + Dse; } } } //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 - Section1 }
public MaizeLAIState(MaizeLAIState toCopy) { _LER = toCopy.LER; _newLeafHasAppeared = toCopy.newLeafHasAppeared; _leafNumber = toCopy.leafNumber; _finalLeafNumber = toCopy.finalLeafNumber; _IncDeltaArea = toCopy._IncDeltaArea; _availableN = toCopy._availableN; _FPAW = toCopy.FPAW; _VPDairCanopy = toCopy.VPDairCanopy; _potentialIncDeltaArea = toCopy.potentialIncDeltaArea; _TCanopyHourly = new double[24]; _VPDeq = new double[24]; _hLER = new double[24]; for (int i = 0; i < 24; i++) { _TCanopyHourly[i] = toCopy._TCanopyHourly[i]; _VPDeq[i] = toCopy._VPDeq[i]; _hLER[i] = toCopy.hLER[i]; } _cumulTTPHenoMaize = toCopy.cumulTTPHenoMaize; _deltaTTPhenoMaize = toCopy.deltaTTPhenoMaize; _radIntercepted = toCopy._radIntercepted; System.Collections.Generic.List <double> _WaterLimitedPotDeltaAIList = new List <double>(toCopy._WaterLimitedPotDeltaAIList); }
//GENERATED CODE END - PLACE YOUR CUSTOM CODE BELOW - Section2 //Code written below will not be overwritten by a future code generation //------------------------------------------------------------------------------------------------ //----------- calculate Hourly Leaf Extension Rate //------------------------------------------------------------------------------------------------ private void CalcHLER(SiriusQualityMaizeLAI.MaizeLAIState maizelaistate) { //VPDairLeaf is in kPa for (int i = 0; i < 24; i++) { maizelaistate.hLER[i] = (Math.Max(0.0, maizetempResponse(maizelaistate.TCanopyHourly[i]) * (LERa + LERb * maizelaistate.VPDeq[i] + LERc * CalcPsi(maizelaistate.FPAW)))); } }
double SLNcri = 1.0; //g(N)/m²(leaf) #endregion #region Constructor public MaizeLAIWrapper() { maizeLAI_ = new SiriusQualityMaizeLAI.Strategies.MaizeLAI(); maizeLaiState_ = new SiriusQualityMaizeLAI.MaizeLAIState(); maizeLeafState_ = new SiriusQualityMaizeLAI.MaizeLeafState(); maizeLeafState1_ = new SiriusQualityMaizeLAI.MaizeLeafState(); loadParametersMaize(); }
/// <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); } }
private void CalculateModel(SiriusQualityMaizeLAI.MaizeLAIState maizelaistate, SiriusQualityMaizeLAI.MaizeLeafState maizeleafstate, SiriusQualityMaizeLAI.MaizeLeafState maizeleafstate1, CRA.AgroManagement.ActEvents actevents) { EstimateOfAssociatedClasses(maizelaistate, maizeleafstate, maizeleafstate1, actevents); //GENERATED CODE END - PLACE YOUR CUSTOM CODE BELOW - Section1 //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 - Section1 }
//Parameters static VarInfo list of the composite class #endregion #region pre/post conditions management /// <summary> /// Test to verify the postconditions /// </summary> public string TestPostConditions(SiriusQualityMaizeLAI.MaizeLAIState maizelaistate, string callID) { try { //Set current values of the outputs to the static VarInfo representing the output properties of the domain classes SiriusQualityMaizeLAI.MaizeLAIStateVarInfo.MaximumPotentialSheathAI.CurrentValue = maizelaistate.MaximumPotentialSheathAI; SiriusQualityMaizeLAI.MaizeLAIStateVarInfo.MaximumPotentialLaminaeAI.CurrentValue = maizelaistate.MaximumPotentialLaminaeAI; //Create the collection of the conditions to test ConditionsCollection prc = new ConditionsCollection(); Preconditions pre = new Preconditions(); RangeBasedCondition r10 = new RangeBasedCondition(SiriusQualityMaizeLAI.MaizeLAIStateVarInfo.MaximumPotentialSheathAI); if (r10.ApplicableVarInfoValueTypes.Contains(SiriusQualityMaizeLAI.MaizeLAIStateVarInfo.MaximumPotentialSheathAI.ValueType)) { prc.AddCondition(r10); } RangeBasedCondition r11 = new RangeBasedCondition(SiriusQualityMaizeLAI.MaizeLAIStateVarInfo.MaximumPotentialLaminaeAI); if (r11.ApplicableVarInfoValueTypes.Contains(SiriusQualityMaizeLAI.MaizeLAIStateVarInfo.MaximumPotentialLaminaeAI.ValueType)) { prc.AddCondition(r11); } //GENERATED CODE END - PLACE YOUR CUSTOM CODE BELOW - Section4 //Code written below will not be overwritten by a future code generation //End of custom code. Do not place your custom code below. It will be overwritten by a future code generation. //PLACE YOUR CUSTOM CODE ABOVE - GENERATED CODE START - Section4 //Get the evaluation of postconditions string postConditionsResult = pre.VerifyPostconditions(prc, callID); //if we have errors, send it to the configured output if (!string.IsNullOrEmpty(postConditionsResult)) { pre.TestsOut(postConditionsResult, true, "PostConditions errors in component SiriusQualityMaizeLAI.Strategies, strategy " + this.GetType().Name); } return(postConditionsResult); } catch (Exception exception) { //Uncomment the next line to use the trace //TraceStrategies.TraceEvent(System.Diagnostics.TraceEventType.Error, 1001, "Strategy: " + this.GetType().Name + " - Unhandled exception running post-conditions"); string msg = "Component SiriusQualityMaizeLAI.Strategies, " + this.GetType().Name + ": Unhandled exception running post-condition test. "; throw new Exception(msg, exception); } }
private void CalculateModel(SiriusQualityMaizeLAI.MaizeLAIState maizelaistate, List <LeafLayer> AllLeaves) { EstimateOfAssociatedClasses(maizelaistate, AllLeaves); //GENERATED CODE END - PLACE YOUR CUSTOM CODE BELOW - Section1 //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 - Section1 }
private void CalculateModel(SiriusQualityMaizeLAI.MaizeLAIState maizelaistate) { //GENERATED CODE END - PLACE YOUR CUSTOM CODE BELOW - Section1 //Code written below will not be overwritten by a future code generation if (maizelaistate.newLeafHasAppeared == 1) { maizelaistate.MaximumPotentialLaminaeAI.Add(PotentialLaminaAreaIndex(maizelaistate.roundedFinalLeafNumber, maizelaistate.finalLeafNumber, maizelaistate.leafNumber, maizelaistate.isSmallPhytomer == 1, maizelaistate.phytonum, maizelaistate.index, maizelaistate.tilleringProfile, maizelaistate.leafTillerNumberArray)); maizelaistate.MaximumPotentialSheathAI.Add(PotentialSheathAreaIndex(maizelaistate.roundedFinalLeafNumber, maizelaistate.isSmallPhytomer == 1, maizelaistate.phytonum, maizelaistate.index, maizelaistate.tilleringProfile, maizelaistate.leafTillerNumberArray)); } //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 - Section1 }
/// <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); } }
/// <summary> /// Calculate method for the component with test of preconditions /// </summary> /// <param name=m>MaizeLAIState Domain class contains the accessors to values</param> /// <param name="saveLog">Save log via a writer or show on screen</param> /// <param name="callID">Context description for violations</param> public void Estimate (IStrategySiriusQualityMaizeLAI st, MaizeLAIState m, bool saveLog, string callID) { _resultPreConditions = String.Empty; _resultPostConditions = String.Empty; _resultPreConditions = st.TestPreConditions(m, callID); st.Estimate (m); _resultPostConditions = st.TestPostConditions(m, callID); if (_resultPreConditions != String.Empty || _resultPostConditions != String.Empty) { p.TestsOut(_resultPreConditions + _resultPostConditions, saveLog, callID); } }
//Call of the associated strategies private void EstimateOfAssociatedClasses(SiriusQualityMaizeLAI.MaizeLAIState maizelaistate, SiriusQualityMaizeLAI.MaizeLeafState maizeleafstate, SiriusQualityMaizeLAI.MaizeLeafState maizeleafstate1, CRA.AgroManagement.ActEvents actevents) { _calcfracpopn.Estimate(maizelaistate, maizeleafstate, maizeleafstate1, actevents); _calcler.Estimate(maizelaistate, maizeleafstate, maizeleafstate1, actevents); _calclercoeff.Estimate(maizelaistate, maizeleafstate, maizeleafstate1, actevents); _calcinittt.Estimate(maizelaistate, maizeleafstate, maizeleafstate1, actevents); _calctiptt.Estimate(maizelaistate, maizeleafstate, maizeleafstate1, actevents); _calcligulett.Estimate(maizelaistate, maizeleafstate, maizeleafstate1, actevents); _calcstartexptt.Estimate(maizelaistate, maizeleafstate, maizeleafstate1, actevents); _calcfullyexptt.Estimate(maizelaistate, maizeleafstate, maizeleafstate1, actevents); _calcbasewidth.Estimate(maizelaistate, maizeleafstate, maizeleafstate1, actevents); _calcstartenlargett.Estimate(maizelaistate, maizeleafstate, maizeleafstate1, actevents); _calcstopenlargett.Estimate(maizelaistate, maizeleafstate, maizeleafstate1, actevents); _deltalaimaize.Estimate(maizelaistate, maizeleafstate, maizeleafstate1, actevents); resetDeltaAI(maizeleafstate); }
private void CalculateModel(SiriusQualityMaizeLAI.MaizeLAIState maizelaistate, SiriusQualityMaizeLAI.MaizeLeafState maizeleafstate, SiriusQualityMaizeLAI.MaizeLeafState maizeleafstate1, CRA.AgroManagement.ActEvents actevents) { //GENERATED CODE END - PLACE YOUR CUSTOM CODE BELOW - Section1 //Code written below will not be overwritten by a future code generation if (maizelaistate.potentialIncDeltaArea > 0.0) { if (maizelaistate.potentialIncDeltaArea <= 0.0) { maizelaistate.IncDeltaArea = 0; } else { maizelaistate.IncDeltaArea = maizelaistate.potentialIncDeltaArea * Math.Min(1.0, maizelaistate.availableN / (maizelaistate.potentialIncDeltaArea * SLNcri)); IsNumber(maizelaistate.IncDeltaArea); } double stressGrowth = maizelaistate.IncDeltaArea / maizelaistate.potentialIncDeltaArea; for (int ilayer = 0; ilayer < maizeleafstate.GAI.Count; ilayer++) { if (maizelaistate.WaterLimitedPotDeltaAIList[ilayer] > 0.0) // leaf layer is growing { IsNumber(stressGrowth); maizeleafstate.deltaAI[ilayer] = maizelaistate.WaterLimitedPotDeltaAIList[ilayer] * stressGrowth; maizeleafstate1.LaminaAI[ilayer] = maizeleafstate1.LaminaAI[ilayer] + maizeleafstate.deltaAI[ilayer]; maizeleafstate.LaminaAI[ilayer] = maizeleafstate1.LaminaAI[ilayer]; maizeleafstate.GAI[ilayer] = maizeleafstate.LaminaAI[ilayer]; maizeleafstate1.MaxAI[ilayer] = Math.Max(maizeleafstate.MaxAI[ilayer], maizeleafstate.GAI[ilayer]); maizeleafstate.MaxAI[ilayer] = maizeleafstate1.MaxAI[ilayer]; } } } else { maizelaistate.IncDeltaArea = 0; } //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 - Section1 }
/// <summary> /// Run the strategy to calculate the outputs. In case of error during the execution, the preconditions tests are executed. /// </summary> public void Estimate(SiriusQualityMaizeLAI.MaizeLAIState maizelaistate, List <LeafLayer> AllLeaves) { try { CalculateModel(maizelaistate, AllLeaves); //Uncomment the next line to use the trace //TraceStrategies.TraceEvent(System.Diagnostics.TraceEventType.Verbose, 1005,"Strategy: " + this.GetType().Name + " - Model executed"); } catch (Exception exception) { //Uncomment the next line to use the trace //TraceStrategies.TraceEvent(System.Diagnostics.TraceEventType.Error, 1003, "Strategy: " + this.GetType().Name + " - Unhandled exception running model"); string msg = "Error in component SiriusQualityMaizeLAI.Strategies, strategy: " + this.GetType().Name + ": Unhandled exception running model. " + exception.GetType().FullName + " - " + exception.Message; throw new Exception(msg, exception); } }
private void CalculateModel(SiriusQualityMaizeLAI.MaizeLAIState maizelaistate, SiriusQualityMaizeLAI.MaizeLeafState maizeleafstate, SiriusQualityMaizeLAI.MaizeLeafState maizeleafstate1, CRA.AgroManagement.ActEvents actevents) { //GENERATED CODE END - PLACE YOUR CUSTOM CODE BELOW - Section1 //Code written below will not be overwritten by a future code generation if (maizelaistate.newLeafHasAppeared == 1) { var newNbLayer = (int)Math.Ceiling(maizelaistate.leafNumber); var curNbLayer = (int)Math.Ceiling(maizelaistate.previousLeafNumber); for (var index = curNbLayer; index < newNbLayer; ++index) { maizeleafstate.stopEnlargeTT[index] = Math.Max(0.0, maizeleafstate.fullyExpTT[index] - lagStopWidthExpand); } } //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 - Section1 }
private void CalculateModel(SiriusQualityMaizeLAI.MaizeLAIState maizelaistate, SiriusQualityMaizeLAI.MaizeLeafState maizeleafstate, SiriusQualityMaizeLAI.MaizeLeafState maizeleafstate1, CRA.AgroManagement.ActEvents actevents) { //GENERATED CODE END - PLACE YOUR CUSTOM CODE BELOW - Section1 //Code written below will not be overwritten by a future code generation // calculate hLER CalcHLER(maizelaistate); double dailyLER = 0; for (int i = 0; i < 24; i++) { dailyLER += maizelaistate.hLER[i]; } maizelaistate.LER = dailyLER / 24.0; //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 - Section1 }
private void CalculateModel(SiriusQualityMaizeLAI.MaizeLAIState maizelaistate, SiriusQualityMaizeLAI.MaizeLeafState maizeleafstate, SiriusQualityMaizeLAI.MaizeLeafState maizeleafstate1, CRA.AgroManagement.ActEvents actevents) { //GENERATED CODE END - PLACE YOUR CUSTOM CODE BELOW - Section1 //Code written below will not be overwritten by a future code generation if (maizelaistate.newLeafHasAppeared == 1) { var newNbLayer = (int)Math.Ceiling(maizelaistate.leafNumber); var curNbLayer = (int)Math.Ceiling(maizelaistate.previousLeafNumber); for (var index = curNbLayer; index < newNbLayer; ++index) { double BW = betaW * Nfinal; double GW = sigmaW * Nfinal; maizeleafstate.baseWidth[index] = width6 * Math.Exp(-Math.Pow((index + 1) - BW, 2) / (2 * Math.Pow(GW, 2))); } } //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 - Section1 }
private void CalculateModel(SiriusQualityMaizeLAI.MaizeLAIState maizelaistate) { //GENERATED CODE END - PLACE YOUR CUSTOM CODE BELOW - Section1 //Code written below will not be overwritten by a future code generation if (maizelaistate.isPotentialLAI == 1) { maizelaistate.DEF = 1; maizelaistate.DSF = 1; } else { /// Behnam (2016.03.18): Adding TranspSF to the calculations of Drought Factors. // pm 12 April 2016: Test of VPD effect on leaf expansion //DEF = CalculateDF(LowerFPAWexp, UpperFPAWexp, 0, 1, FPAW, TranspSF); maizelaistate.DEF = CalculateDF(LowerFPAWexp, UpperFPAWexp, 0, 1, maizelaistate.FPAW, maizelaistate.VPDairCanopy); // DSF = CalculateDF(LowerFPAWsen, UpperFPAWsen, MaxDSF, 1, FPAW, TranspSF); maizelaistate.DSF = CalculateDF(LowerFPAWsen, UpperFPAWsen, MaxDSF, 1, maizelaistate.FPAW, maizelaistate.VPDairCanopy); } //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 - Section1 }
private void CalculateModel(SiriusQualityMaizeLAI.MaizeLAIState maizelaistate, SiriusQualityMaizeLAI.MaizeLeafState maizeleafstate, SiriusQualityMaizeLAI.MaizeLeafState maizeleafstate1, CRA.AgroManagement.ActEvents actevents) { //GENERATED CODE END - PLACE YOUR CUSTOM CODE BELOW - Section1 //Code written below will not be overwritten by a future code generation if (maizelaistate.newLeafHasAppeared == 1) { var newNbLayer = (int)Math.Ceiling(maizelaistate.leafNumber); var curNbLayer = (int)Math.Ceiling(maizelaistate.previousLeafNumber); for (var index = curNbLayer; index < newNbLayer; ++index) { // For ligulation : // ---------------- double N_limll = alpha_tr * Nfinal; double b_ll2 = a_ll1 * N_limll * (1 - k_ll) + b_ll1; double a_ll2 = k_ll * a_ll1; double leafnum = index + 1; if (leafnum <= N_limll) { // Add tt_to_emerg (TTem): maizeleafstate.liguleTT[index] = a_ll1 * leafnum + b_ll1 + Dse; } else { // Add tt_to_emerg (TTem): maizeleafstate.liguleTT[index] = a_ll2 * leafnum + b_ll2 + Dse; } } } //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 - Section1 }
private void CalculateModel(SiriusQualityMaizeLAI.MaizeLAIState maizelaistate, SiriusQualityMaizeLAI.MaizeLeafState maizeleafstate, SiriusQualityMaizeLAI.MaizeLeafState maizeleafstate1, CRA.AgroManagement.ActEvents actevents) { //GENERATED CODE END - PLACE YOUR CUSTOM CODE BELOW - Section1 //Code written below will not be overwritten by a future code generation if (maizelaistate.newLeafHasAppeared == 1) { var newNbLayer = (int)Math.Ceiling(maizelaistate.leafNumber); var curNbLayer = (int)Math.Ceiling(maizelaistate.previousLeafNumber); for (var index = curNbLayer; index < newNbLayer; ++index) { double SIGMA = Sigma * Nfinal; double BETA = Beta * Nfinal; double DOWN = (2 * Math.Pow(SIGMA, 2)); double A6 = 1 / Math.Exp((-Math.Pow(6 - BETA, 2)) / DOWN); double UP = (-Math.Pow((index + 1) - BETA, 2)); maizeleafstate.coefLER[index] = A6 * Math.Exp(UP / DOWN); } } //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 - Section1 }
private void CalculateModel(SiriusQualityMaizeLAI.MaizeLAIState maizelaistate, SiriusQualityMaizeLAI.MaizeLeafState maizeleafstate, SiriusQualityMaizeLAI.MaizeLeafState maizeleafstate1, CRA.AgroManagement.ActEvents actevents) { //GENERATED CODE END - PLACE YOUR CUSTOM CODE BELOW - Section1 //Code written below will not be overwritten by a future code generation if (maizelaistate.newLeafHasAppeared == 1) { var newNbLayer = (int)Math.Ceiling(maizelaistate.leafNumber); var curNbLayer = (int)Math.Ceiling(maizelaistate.previousLeafNumber); for (var index = curNbLayer; index < newNbLayer; ++index) { // For beginning of linear elongation : // ------------------------------------ double leafnum = index + 1; double abl = k_bl * atip; double bbl = atip * Nlim * (1 - k_bl) + btip; if (leafnum <= Nlim) { maizeleafstate.startExpTT[index] = maizeleafstate.tipTT[index]; } else { maizeleafstate.startExpTT[index] = abl * leafnum + bbl + Dse; } } } //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 - Section1 }
//GENERATED CODE END - PLACE YOUR CUSTOM CODE BELOW - Section2 //Code written below will not be overwritten by a future code generation /// <summary> /// copy constructor. We only need to copy the parameters (the strategies being stateless) /// </summary> public void UpdateLeafArea(SiriusQualityMaizeLAI.MaizeLAIState maizelaistate, SiriusQualityMaizeLAI.MaizeLeafState maizeleafstate, SiriusQualityMaizeLAI.MaizeLeafState maizeleafstate1, CRA.AgroManagement.ActEvents actevents) { _updateleafarea.Estimate(maizelaistate, maizeleafstate, maizeleafstate1, actevents); }
public MaizeLAIState(MaizeLAIState toCopy, bool copyAll) { _LER = toCopy.LER; if (copyAll) { _newLeafHasAppeared = toCopy.newLeafHasAppeared; _leafNumber = toCopy.leafNumber; _finalLeafNumber = toCopy.finalLeafNumber; _roundedFinalLeafNumber = toCopy.roundedFinalLeafNumber; _isSmallPhytomer = toCopy.isSmallPhytomer; _phytonum = toCopy.phytonum; _index = toCopy.index; _FPAW = toCopy.FPAW; _isPotentialLAI = toCopy.isPotentialLAI; _VPDairCanopy = toCopy.VPDairCanopy; _DSF = toCopy.DSF; _DEF = toCopy.DEF; _incDeltaAreaLimitSF = toCopy.incDeltaAreaLimitSF; _potentialIncDeltaArea = toCopy.potentialIncDeltaArea; _deltaTTCanopyHourly = new double[24]; _VPDeq = new double[24]; _hLER = new double[24]; for (int i = 0; i < 24; i++) { _deltaTTCanopyHourly[i] = toCopy._deltaTTCanopyHourly[i]; _VPDeq[i] = toCopy._VPDeq[i]; _hLER[i] = toCopy.hLER[i]; } _cumulTTPHenoMaize = toCopy.cumulTTPHenoMaize; _deltaTTPhenoMaize = toCopy.deltaTTPhenoMaize; System.Collections.Generic.List <double> _WaterLimitedPotExposedDeltaAIList = new List <double>(toCopy.WaterLimitedPotExposedDeltaAIList); System.Collections.Generic.List <LeafState> _leafStateList = new List <LeafState>(toCopy._leafStateList); System.Collections.Generic.List <int> _isPrematurelyDying = new List <int>(toCopy._isPrematurelyDying); System.Collections.Generic.List <double> _tilleringProfile = new List <double>(toCopy._tilleringProfile); System.Collections.Generic.List <double> _leafTillerNumberArray = new List <double>(toCopy._leafTillerNumberArray); System.Collections.Generic.List <double> _MaximumPotentialLaminaeAI = new List <double>(toCopy._MaximumPotentialLaminaeAI); System.Collections.Generic.List <double> _MaximumPotentialSheathAI = new List <double>(toCopy._MaximumPotentialSheathAI); System.Collections.Generic.List <double> _WaterLimitedPotDeltaAIList = new List <double>(toCopy._WaterLimitedPotDeltaAIList); } }
public void Estimate(SiriusQualityMaizeLAI.MaizeLAIState maizelaistate) { }
/// <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 SiriusQualityMaizeLAI.MaizeLAIStateVarInfo.finalLeafNumber.CurrentValue = maizelaistate.finalLeafNumber; SiriusQualityMaizeLAI.MaizeLAIStateVarInfo.leafNumber.CurrentValue = maizelaistate.leafNumber; SiriusQualityMaizeLAI.MaizeLAIStateVarInfo.previousLeafNumber.CurrentValue = maizelaistate.previousLeafNumber; SiriusQualityMaizeLAI.MaizeLAIStateVarInfo.newLeafHasAppeared.CurrentValue = maizelaistate.newLeafHasAppeared; //Create the collection of the conditions to test ConditionsCollection prc = new ConditionsCollection(); Preconditions pre = new Preconditions(); RangeBasedCondition r1 = new RangeBasedCondition(SiriusQualityMaizeLAI.MaizeLAIStateVarInfo.finalLeafNumber); if (r1.ApplicableVarInfoValueTypes.Contains(SiriusQualityMaizeLAI.MaizeLAIStateVarInfo.finalLeafNumber.ValueType)) { prc.AddCondition(r1); } RangeBasedCondition r2 = new RangeBasedCondition(SiriusQualityMaizeLAI.MaizeLAIStateVarInfo.leafNumber); if (r2.ApplicableVarInfoValueTypes.Contains(SiriusQualityMaizeLAI.MaizeLAIStateVarInfo.leafNumber.ValueType)) { prc.AddCondition(r2); } RangeBasedCondition r3 = new RangeBasedCondition(SiriusQualityMaizeLAI.MaizeLAIStateVarInfo.previousLeafNumber); if (r3.ApplicableVarInfoValueTypes.Contains(SiriusQualityMaizeLAI.MaizeLAIStateVarInfo.previousLeafNumber.ValueType)) { prc.AddCondition(r3); } RangeBasedCondition r4 = new RangeBasedCondition(SiriusQualityMaizeLAI.MaizeLAIStateVarInfo.newLeafHasAppeared); if (r4.ApplicableVarInfoValueTypes.Contains(SiriusQualityMaizeLAI.MaizeLAIStateVarInfo.newLeafHasAppeared.ValueType)) { prc.AddCondition(r4); } prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("Nfinal"))); prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("width6"))); prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("betaW"))); prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("sigmaW"))); //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> /// Calculate method for the component /// </summary> /// <param name=m>MaizeLAIState Domain class contains the accessors to values</param> public void Estimate (IStrategySiriusQualityMaizeLAI st, MaizeLAIState m) { st.Estimate (m); }