Example #1
0
 public void resetDeltaAI(SiriusQualityMaizeLAI.MaizeLeafState wheatleafstate)
 {
     for (int ilayer = 0; ilayer < wheatleafstate.deltaAI.Count; ilayer++)
     {
         wheatleafstate.deltaAI[ilayer] = 0;
     }
 }
        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();
        }
Example #3
0
        public MaizeLeafState(MaizeLeafState toCopy)
        {
            _State            = new List <int>();
            _liguleTT         = new List <double>();
            _fullyExpTT       = new List <double>();
            _GAI              = new List <double>();
            _length           = new List <double>();
            _width            = new List <double>();
            _fracPopn         = new List <double>();
            _startExpTT       = new List <double>();
            _baseWidth        = new List <double>();
            _area             = new List <double>();
            _coefLER          = new List <double>();
            _tipTT            = new List <double>();
            _exposedArea      = new List <double>();
            _PreviousState    = new List <int>();
            _startEnlargeTT   = new List <double>();
            _stopEnlargeTT    = new List <double>();
            _leafAge          = new List <double>();
            _cumIntRad        = new List <double>();
            _initialisationTT = new List <double>();
            _deltaAI          = new List <double>();
            _LaminaAI         = new List <double>();
            _MaxAI            = new List <double>();

            for (int ival = 0; ival < toCopy._LaminaAI.Count; ival++)
            {
                _State.Add(toCopy._State[ival]);
                _liguleTT.Add(toCopy._liguleTT[ival]);
                _fullyExpTT.Add(toCopy._fullyExpTT[ival]);
                _GAI.Add(toCopy._GAI[ival]);
                _length.Add(toCopy._length[ival]);
                _width.Add(toCopy._width[ival]);
                _fracPopn.Add(toCopy._fracPopn[ival]);
                _startExpTT.Add(toCopy._startExpTT[ival]);
                _baseWidth.Add(toCopy._baseWidth[ival]);
                _area.Add(toCopy._area[ival]);
                _coefLER.Add(toCopy._coefLER[ival]);
                _tipTT.Add(toCopy._tipTT[ival]);
                _exposedArea.Add(toCopy._exposedArea[ival]);
                _PreviousState.Add(toCopy._PreviousState[ival]);
                _startEnlargeTT.Add(toCopy._startEnlargeTT[ival]);
                _stopEnlargeTT.Add(toCopy._stopEnlargeTT[ival]);
                _leafAge.Add(toCopy._leafAge[ival]);
                _cumIntRad.Add(toCopy._cumIntRad[ival]);
                _initialisationTT.Add(toCopy._initialisationTT[ival]);
                _deltaAI.Add(toCopy._deltaAI[ival]);
                _LaminaAI.Add(toCopy._LaminaAI[ival]);
                _MaxAI.Add(toCopy._MaxAI[ival]);
            }
        }
        /// <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=m1>MaizeLeafState Domain class contains the accessors to values</param>
        /// <param name=m2>MaizeLeafState Domain class contains the accessors to values</param>
        /// <param name=ae>AgroManagement objects of impact parameters</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, MaizeLeafState m1, MaizeLeafState m2, ActEvents ae, bool saveLog, string callID)
        {
            _resultPreConditions  = String.Empty;
            _resultPostConditions = String.Empty;
            _resultPreConditions  = st.TestPreConditions(m, m1, m2, callID);
            st.Estimate
                (m, m1, m2, ae);
            _resultPostConditions = st.TestPostConditions(m, m1, m2, callID);

            if (_resultPreConditions != String.Empty || _resultPostConditions != String.Empty)
            {
                p.TestsOut(_resultPreConditions + _resultPostConditions, saveLog, callID);
            }
        }
        /// <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, SiriusQualityMaizeLAI.MaizeLeafState maizeleafstate, SiriusQualityMaizeLAI.MaizeLeafState maizeleafstate1, CRA.AgroManagement.ActEvents actevents)
        {
            try
            {
                CalculateModel(maizelaistate, maizeleafstate, maizeleafstate1, actevents);

                //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

            // 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
        }
        //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, SiriusQualityMaizeLAI.MaizeLeafState maizeleafstate, SiriusQualityMaizeLAI.MaizeLeafState maizeleafstate1, string callID)
        {
            try
            {
                //Set current values of the outputs to the static VarInfo representing the output properties of the domain classes

                SiriusQualityMaizeLAI.MaizeLeafStateVarInfo.baseWidth.CurrentValue = maizeleafstate.baseWidth;

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


                RangeBasedCondition r5 = new RangeBasedCondition(SiriusQualityMaizeLAI.MaizeLeafStateVarInfo.baseWidth);
                if (r5.ApplicableVarInfoValueTypes.Contains(SiriusQualityMaizeLAI.MaizeLeafStateVarInfo.baseWidth.ValueType))
                {
                    prc.AddCondition(r5);
                }



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



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

                //Get the evaluation of postconditions
                string postConditionsResult = pre.VerifyPostconditions(prc, callID);
                //if we have errors, send it to the configured output
                if (!string.IsNullOrEmpty(postConditionsResult))
                {
                    pre.TestsOut(postConditionsResult, true, "PostConditions errors in component 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);
            }
        }
        /// <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);
            }
        }
Example #9
0
        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
        }
Example #10
0
 //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
        }
Example #12
0
        /// <summary>
        /// Test to verify the preconditions
        /// </summary>
        public string TestPreConditions(SiriusQualityMaizeLAI.MaizeLAIState maizelaistate, SiriusQualityMaizeLAI.MaizeLeafState maizeleafstate, SiriusQualityMaizeLAI.MaizeLeafState maizeleafstate1, string callID)
        {
            try
            {
                //Set current values of the inputs to the static VarInfo representing the input properties of the domain classes


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



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

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



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

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

                string msg = "Component SiriusQualityMaizeLAI.Strategies, " + this.GetType().Name + ": Unhandled exception running pre-condition test. ";
                throw new Exception(msg, exception);
            }
        }
 /// <summary>
 /// Calculate method for the component
 /// </summary>
 /// <param name=m>MaizeLAIState Domain class contains the accessors to values</param>
 /// <param name=m1>MaizeLeafState Domain class contains the accessors to values</param>
 /// <param name=m2>MaizeLeafState Domain class contains the accessors to values</param>
 /// <param name=ae>AgroManagement objects of impact parameters</param>
 public void Estimate
     (IStrategySiriusQualityMaizeLAI st, MaizeLAIState m, MaizeLeafState m1, MaizeLeafState m2, ActEvents ae)
 {
     st.Estimate
         (m, m1, m2, ae);
 }
Example #14
0
        //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);
        }
        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
        }
Example #16
0
        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
        }
        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
        }
Example #18
0
        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
        }
Example #19
0
        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
        }
Example #20
0
        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.startEnlargeTT[index] = maizeleafstate.startExpTT[index];
                }
            }
            //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)
                {
                    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
        }