private void CalculateModel(SiriusQualityWheatLAI.WheatLAIState wheatlaistate, List <LeafLayer> All)
        {
            //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 < All.Count; i++)
            {
                //if a new leaf has appeared
                if (i >= wheatlaistate.WaterLimitedPotDeltaAIList.Count)
                {
                    wheatlaistate.WaterLimitedPotDeltaAIList.Add(0);
                    wheatlaistate.leafStateList.Add(All[i].State);    //State==growing
                    wheatlaistate.isPrematurelyDying.Add(0);
                    wheatlaistate.TTgroSheathList.Add(All[i].TTgroLamina * wheatlaistate.MaximumPotentialSheathAI[i] / wheatlaistate.MaximumPotentialLaminaeAI[i]);
                    wheatlaistate.TT.Add(wheatlaistate.cumulTTShoot - wheatlaistate.deltaTTShoot);       // pm 29 May 2013, replaced air temperature by canopy temperature
                }
            }

            CalculateNewStates(wheatlaistate, All);

            // calculate potential delta area
            CalculatePotIncDeltaAI(wheatlaistate, All);


            //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(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);
            }
        }
示例#3
0
        private void CalculateModel(SiriusQualityWheatLAI.WheatLAIState wheatlaistate, SiriusQualityWheatLAI.WheatLeafState wheatleafstate, SiriusQualityWheatLAI.WheatLeafState wheatleafstate1, 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
            //update the size of the lists
            for (int i = 0; i < wheatleafstate.GAI.Count; i++)
            {
                //if a new leaf has appeared
                if (i >= wheatlaistate.WaterLimitedPotDeltaAIList.Count)
                {
                    wheatlaistate.WaterLimitedPotDeltaAIList.Add(0);
                    wheatlaistate.TTgroSheathList.Add(wheatleafstate.TTGroLamina[i] * wheatlaistate.MaximumPotentialSheathAI[i] / wheatlaistate.MaximumPotentialLaminaeAI[i]);
                    wheatlaistate.TT.Add(wheatlaistate.cumulTTShoot - wheatlaistate.deltaTTShoot);
                }
            }

            CalculateNewStates(wheatlaistate, wheatleafstate, wheatleafstate1);

            // calculate potential delta area
            CalculatePotIncDeltaAI(wheatlaistate, wheatleafstate, wheatleafstate1);


            //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
        }
示例#4
0
        public WheatLAIState(WheatLAIState toCopy)
        {
            _dayLength              = toCopy._dayLength;
            _avHourVPDDay           = toCopy._avHourVPDDay;
            _newLeafHasAppeared     = toCopy.newLeafHasAppeared;
            _leafNumber             = toCopy.leafNumber;
            _finalLeafNumber        = toCopy.finalLeafNumber;
            _roundedFinalLeafNumber = toCopy.roundedFinalLeafNumber;
            _phytonum              = toCopy.phytonum;
            _index                 = toCopy.index;
            _FPAW                  = toCopy.FPAW;
            _isPotentialLAI        = toCopy.isPotentialLAI;
            _VPDairCanopy          = toCopy.VPDairCanopy;
            _DSF                   = toCopy.DSF;
            _DEF                   = toCopy.DEF;
            _cumulTTShoot          = toCopy.cumulTTShoot;
            _deltaTTShoot          = toCopy.deltaTTShoot;
            _deltaTTSenescence     = toCopy.deltaTTSenescence;
            _incDeltaAreaLimitSF   = toCopy.incDeltaAreaLimitSF;
            _potentialIncDeltaArea = toCopy.potentialIncDeltaArea;
            _incDeltaArea          = toCopy._incDeltaArea;
            _availableN            = toCopy._availableN;

            System.Collections.Generic.List <double> _tilleringProfile = new List <double>();
            for (int i = 0; i < toCopy._tilleringProfile.Count; i++)
            {
                _tilleringProfile.Add(toCopy._tilleringProfile[i]);
            }
            System.Collections.Generic.List <double> _leafTillerNumberArray = new List <double>();
            for (int i = 0; i < toCopy._leafTillerNumberArray.Count; i++)
            {
                _leafTillerNumberArray.Add(toCopy._leafTillerNumberArray[i]);
            }
            System.Collections.Generic.List <double> _MaximumPotentialLaminaeAI = new List <double>();
            for (int i = 0; i < toCopy._MaximumPotentialLaminaeAI.Count; i++)
            {
                _MaximumPotentialLaminaeAI.Add(toCopy._MaximumPotentialLaminaeAI[i]);
            }
            System.Collections.Generic.List <double> _MaximumPotentialSheathAI = new List <double>();
            for (int i = 0; i < toCopy._MaximumPotentialSheathAI.Count; i++)
            {
                _MaximumPotentialSheathAI.Add(toCopy._MaximumPotentialSheathAI[i]);
            }
            System.Collections.Generic.List <double> _WaterLimitedPotDeltaAIList = new List <double>();
            for (int i = 0; i < toCopy._WaterLimitedPotDeltaAIList.Count; i++)
            {
                _WaterLimitedPotDeltaAIList.Add(toCopy._WaterLimitedPotDeltaAIList[i]);
            }
            _previousIndex = toCopy._previousIndex;
            System.Collections.Generic.List <double> _TTgroSheathList = new List <double>();
            for (int i = 0; i < toCopy._TTgroSheathList.Count; i++)
            {
                _TTgroSheathList.Add(toCopy._TTgroSheathList[i]);
            }
            System.Collections.Generic.List <double> _TT = new List <double>();
            for (int i = 0; i < toCopy._TT.Count; i++)
            {
                _TTgroSheathList.Add(toCopy._TT[i]);
            }
        }
示例#5
0
        /// <summary>
        /// Test to verify the preconditions
        /// </summary>
        public string TestPreConditions(SiriusQualityWheatLAI.WheatLAIState wheatlaistate, SiriusQualityWheatLAI.WheatLeafState wheatleafstate, SiriusQualityWheatLAI.WheatLeafState wheatleafstate1, string callID)
        {
            try
            {
                //Set current values of the inputs to the static VarInfo representing the input properties of the domain classes

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

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


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



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



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

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

                string msg = "Component SiriusQualityWheatLAI.Strategies, " + this.GetType().Name + ": Unhandled exception running pre-condition test. ";
                throw new Exception(msg, exception);
            }
        }
 // #Andrea 26/11/2015
 /// <summary>Update all leaf state </summary>
 private void CalculateNewStates(SiriusQualityWheatLAI.WheatLAIState wheatlaistate, List <LeafLayer> All)
 {
     for (int i = 0; i < All.Count; i++)
     {
         var    ll    = All[i];
         double TTgro = All[i].TTgroLamina + wheatlaistate.TTgroSheathList[i];
         CalculateNewLeafLayerState(wheatlaistate, i, ll.GAI, ll.TTem, TTgro, ll.TTmat, ll.TTsen, ll.GetLeafLamina().SpecificN);    //#Andrea 25/11/2015
     }
 }
        public WheatLAIWrapper()
        {
            wheatLAI_        = new SiriusQualityWheatLAI.Strategies.WheatLAI();
            wheatLaistate_   = new SiriusQualityWheatLAI.WheatLAIState();
            wheatLeafstate_  = new SiriusQualityWheatLAI.WheatLeafState();
            wheatLeafstate1_ = new SiriusQualityWheatLAI.WheatLeafState();

            loadParametersWheat();
        }
        private void CalculateModel(SiriusQualityWheatLAI.WheatLAIState wheatlaistate, SiriusQualityWheatLAI.WheatLeafState wheatleafstate, SiriusQualityWheatLAI.WheatLeafState wheatleafstate1, 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

            wheatleafstate.TTGroLamina[wheatlaistate.index] = wheatleafstate.Phyllochron[wheatlaistate.index] * PexpL;

            //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
        }
示例#9
0
        private void CalculateModel(SiriusQualityWheatLAI.WheatLAIState wheatlaistate, SiriusQualityWheatLAI.WheatLeafState wheatleafstate, SiriusQualityWheatLAI.WheatLeafState wheatleafstate1, 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

            wheatleafstate.isSmallPhytomer[wheatlaistate.index] = isSmallPhytomer(wheatlaistate.index, wheatlaistate.finalLeafNumber, wheatlaistate.roundedFinalLeafNumber);

            //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
        }
示例#10
0
        public WheatLAIState(WheatLAIState toCopy, bool copyAll)
        {
            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;

                _cumulTTShoot = toCopy.cumulTTShoot;

                _deltaTTShoot = toCopy.deltaTTShoot;

                _deltaTTSenescence = toCopy.deltaTTSenescence;

                _incDeltaAreaLimitSF = toCopy.incDeltaAreaLimitSF;

                _potentialIncDeltaArea = toCopy.potentialIncDeltaArea;

                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);

                System.Collections.Generic.List <double> _TTgroSheathList = new List <double>(toCopy._TTgroSheathList);

                System.Collections.Generic.List <double> _TT = new List <double>(toCopy._TT);
            }
        }
示例#11
0
        /// <summary>Update all leaf state </summary>
        private void CalculateNewStates(SiriusQualityWheatLAI.WheatLAIState wheatlaistate, SiriusQualityWheatLAI.WheatLeafState wheatleafstate, SiriusQualityWheatLAI.WheatLeafState wheatleafstate1)
        {
            wheatleafstate1.State        = new List <int>();
            wheatleafstate.PreviousState = new List <int>();

            for (int i = 0; i < wheatleafstate.GAI.Count; i++)
            {
                double TTgro = wheatleafstate.TTGroLamina[i] + wheatlaistate.TTgroSheathList[i];
                CalculateNewLeafLayerState(wheatlaistate, wheatleafstate, wheatleafstate1, i, wheatleafstate.GAI[i], wheatleafstate.TTem[i], TTgro, wheatleafstate.TTmat[i], wheatleafstate.TTsen[i], wheatleafstate.laminaSpecificN[i]);
            }
        }
示例#12
0
        private void CalculateModel(SiriusQualityWheatLAI.WheatLAIState wheatlaistate, List <LeafLayer> All)
        {
            EstimateOfAssociatedClasses(wheatlaistate, All);

            //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(SiriusQualityWheatLAI.WheatLAIState wheatlaistate, SiriusQualityWheatLAI.WheatLeafState wheatleafstate, SiriusQualityWheatLAI.WheatLeafState wheatleafstate1, CRA.AgroManagement.ActEvents actevents)
        {
            EstimateOfAssociatedClasses(wheatlaistate, wheatleafstate, wheatleafstate1, 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
        }
示例#14
0
        //Parameters static VarInfo list of the composite class


        #endregion

        #region pre/post conditions management

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

                SiriusQualityWheatLAI.WheatLAIStateVarInfo.DSF.CurrentValue = wheatlaistate.DSF;
                SiriusQualityWheatLAI.WheatLAIStateVarInfo.DEF.CurrentValue = wheatlaistate.DEF;

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


                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);
                }



                //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 SiriusQualityWheatLAI.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 SiriusQualityWheatLAI.Strategies, " + this.GetType().Name + ": Unhandled exception running post-condition test. ";
                throw new Exception(msg, exception);
            }
        }
示例#15
0
        private void CalculateNewLeafLayerState(SiriusQualityWheatLAI.WheatLAIState wheatlaistate, SiriusQualityWheatLAI.WheatLeafState wheatleafstate, SiriusQualityWheatLAI.WheatLeafState wheatleafstate1, int leafIndex, double GAI, double TTem, double TTgro, double TTmat, double TTsen, double leafLaminaSpecificN)
        {
            wheatleafstate1.State.Add(wheatleafstate.State[leafIndex]);
            wheatleafstate.PreviousState.Add(wheatleafstate1.State[leafIndex]);

            switch (wheatleafstate.State[leafIndex])
            {
            case 1:
            case 2:  wheatlaistate.TT[leafIndex] += wheatlaistate.deltaTTSenescence * wheatlaistate.DSF; break;

            default: wheatlaistate.TT[leafIndex] += wheatlaistate.deltaTTShoot; break;
            }
            if (GAI <= 0 && wheatleafstate.State[leafIndex] >= 1 && wheatleafstate.State[leafIndex] != 3)
            {
                wheatleafstate1.State[leafIndex] = 3;
            }
            else if (GAI > 0)
            {
                if (wheatleafstate.isPrematurelyDying[leafIndex] == 0)
                {
                    if (wheatlaistate.TT[leafIndex] <= TTem + TTgro)
                    {
                        wheatleafstate1.State[leafIndex] = 0;
                    }
                    else if (wheatlaistate.TT[leafIndex] < TTem + TTgro + TTmat)
                    {
                        wheatleafstate1.State[leafIndex] = 1;
                    }
                    else if (wheatlaistate.TT[leafIndex] < TTem + TTgro + TTmat + TTsen || GAI > 0)
                    {
                        wheatleafstate1.State[leafIndex] = 2;
                    }
                    else
                    {
                        wheatleafstate1.State[leafIndex] = 3;
                    }
                    if (leafLaminaSpecificN <= SLNmin)
                    {
                        wheatleafstate1.isPrematurelyDying[leafIndex] = 1;
                        wheatleafstate1.State[leafIndex] = 2;
                    }
                }
                else
                {
                    wheatleafstate1.State[leafIndex] = 2;
                }
            }

            wheatleafstate.State[leafIndex] = wheatleafstate1.State[leafIndex];
            wheatleafstate.isPrematurelyDying[leafIndex] = wheatleafstate1.isPrematurelyDying[leafIndex];
        }
示例#16
0
        private void CalculateModel(SiriusQualityWheatLAI.WheatLAIState wheatlaistate)
        {
            //GENERATED CODE END - PLACE YOUR CUSTOM CODE BELOW - Section1
            //Code written below will not be overwritten by a future code generation
            if (wheatlaistate.newLeafHasAppeared == 1)
            {
                wheatlaistate.MaximumPotentialLaminaeAI.Add(PotentialLaminaAreaIndex(wheatlaistate.roundedFinalLeafNumber, wheatlaistate.finalLeafNumber, wheatlaistate.leafNumber, wheatlaistate.isSmallPhytomer == 1, wheatlaistate.phytonum, wheatlaistate.index, wheatlaistate.tilleringProfile, wheatlaistate.leafTillerNumberArray));
                wheatlaistate.MaximumPotentialSheathAI.Add(PotentialSheathAreaIndex(wheatlaistate.roundedFinalLeafNumber, wheatlaistate.isSmallPhytomer == 1, wheatlaistate.phytonum, wheatlaistate.index, wheatlaistate.tilleringProfile, wheatlaistate.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>
        /// Calculate method for the component with test of preconditions
        /// </summary>
        /// <param name=w>WheatLAIState 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
            (IStrategySiriusQualityWheatLAI st, WheatLAIState w, bool saveLog, string callID)
        {
            _resultPreConditions  = String.Empty;
            _resultPostConditions = String.Empty;
            _resultPreConditions  = st.TestPreConditions(w, callID);
            st.Estimate
                (w);
            _resultPostConditions = st.TestPostConditions(w, callID);

            if (_resultPreConditions != String.Empty || _resultPostConditions != String.Empty)
            {
                p.TestsOut(_resultPreConditions + _resultPostConditions, saveLog, callID);
            }
        }
示例#18
0
        //GENERATED CODE END - PLACE YOUR CUSTOM CODE BELOW - Section2
        //Code written below will not be overwritten by a future code generation

        /// <summary>Calculate potential delta area index of the day (either growth or senescence)</summary>
        /// <param name="potentialIncDeltaArea">Potential delta area index increment of the day</param>
        private void CalculatePotIncDeltaAI(SiriusQualityWheatLAI.WheatLAIState wheatlaistate, SiriusQualityWheatLAI.WheatLeafState wheatleafstate, SiriusQualityWheatLAI.WheatLeafState wheatleafstate1)
        {
            wheatlaistate.potentialIncDeltaArea = 0;
            for (int i = 0; i < wheatleafstate.GAI.Count; i++)
            {
                CalculateWaterLimitedPotentialDeltaArea(wheatlaistate, wheatleafstate, wheatleafstate1, i);
                var potDelta = wheatlaistate.WaterLimitedPotDeltaAIList[i];
                if (potDelta > 0)
                {
                    wheatlaistate.potentialIncDeltaArea += potDelta;
                }
            }

            wheatlaistate.incDeltaAreaLimitSF = wheatlaistate.potentialIncDeltaArea * wheatlaistate.DEF;
        }
        //Call of the associated strategies
        private void EstimateOfAssociatedClasses(SiriusQualityWheatLAI.WheatLAIState wheatlaistate, SiriusQualityWheatLAI.WheatLeafState wheatleafstate, SiriusQualityWheatLAI.WheatLeafState wheatleafstate1, CRA.AgroManagement.ActEvents actevents)
        {
            if (wheatlaistate.previousIndex != wheatlaistate.index)
            {
                _issmallphytomer.Estimate(wheatlaistate, wheatleafstate, wheatleafstate1, actevents);
                _laminaexpansionthermaltime.Estimate(wheatlaistate, wheatleafstate, wheatleafstate1, actevents);
                _maturitythermaltime.Estimate(wheatlaistate, wheatleafstate, wheatleafstate1, actevents);
                _senescencethermaltime.Estimate(wheatlaistate, wheatleafstate, wheatleafstate1, actevents);
            }
            _leafexpansiondroughtfactor.Estimate(wheatlaistate, wheatleafstate, wheatleafstate1, actevents);
            _maximumpotentialfinallai.Estimate(wheatlaistate, wheatleafstate, wheatleafstate1, actevents);
            _waterlimitedleafexpansion.Estimate(wheatlaistate, wheatleafstate, wheatleafstate1, actevents);

            resetDeltaAI(wheatleafstate);
        }
示例#20
0
        /// <summary>
        /// Test to verify the postconditions
        /// </summary>
        public string TestPostConditions(SiriusQualityWheatLAI.WheatLAIState wheatlaistate, string callID)
        {
            try
            {
                //Set current values of the outputs to the static VarInfo representing the output properties of the domain classes


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



                string ret = "";
                ret += _leafexpansiondroughtfactor.TestPostConditions(wheatlaistate, "strategy SiriusQualityWheatLAI.Strategies.LeafExpansionDroughtFactor");
                ret += _maximumpotentialfinallai.TestPostConditions(wheatlaistate, "strategy SiriusQualityWheatLAI.Strategies.MaximumPotentialFinalLAI");
                ret += _waterlimitedleafexpansion.TestPostConditions(wheatlaistate, "strategy SiriusQualityWheatLAI.Strategies.WaterLimitedLeafExpansion");
                if (ret != "")
                {
                    pre.TestsOut(ret, true, "   postconditions tests of associated classes");
                }

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



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

                //Get the evaluation of postconditions
                string postConditionsResult = pre.VerifyPostconditions(prc, callID);
                //if we have errors, send it to the configured output
                if (!string.IsNullOrEmpty(postConditionsResult))
                {
                    pre.TestsOut(postConditionsResult, true, "PostConditions errors in component SiriusQualityWheatLAI.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 SiriusQualityWheatLAI.Strategies, " + this.GetType().Name + ": Unhandled exception running post-condition test. ";
                throw new Exception(msg, exception);
            }
        }
        // #Andrea 26/11/2015
        private void CalculateNewLeafLayerState(SiriusQualityWheatLAI.WheatLAIState wheatlaistate, int leafIndex, double GAI, double TTem, double TTgro, double TTmat, double TTsen, double leafLaminaSpecificN)
        {
            switch (wheatlaistate.leafStateList[leafIndex])
            {
            case LeafState.Mature:
            case LeafState.Senescing:

                //TT[leafIndex] += deltaTTShoot * DSF; break; //#Andrea 26/11/2015
                wheatlaistate.TT[leafIndex] += wheatlaistate.deltaTTSenescence * wheatlaistate.DSF; break;         // #Andrea 26/11/2015

            default: wheatlaistate.TT[leafIndex] += wheatlaistate.deltaTTShoot; break;
            }
            if (GAI <= 0 && wheatlaistate.leafStateList[leafIndex] >= LeafState.Mature && wheatlaistate.leafStateList[leafIndex] != LeafState.Dead)
            {
                wheatlaistate.leafStateList[leafIndex] = LeafState.Dead;
            }
            else if (GAI > 0)
            {
                if (wheatlaistate.isPrematurelyDying[leafIndex] == 0)
                {
                    if (wheatlaistate.TT[leafIndex] <= TTem + TTgro)
                    {
                        wheatlaistate.leafStateList[leafIndex] = LeafState.Growing;
                    }
                    else if (wheatlaistate.TT[leafIndex] < TTem + TTgro + TTmat)
                    {
                        wheatlaistate.leafStateList[leafIndex] = LeafState.Mature;
                    }
                    else if (wheatlaistate.TT[leafIndex] < TTem + TTgro + TTmat + TTsen || GAI > 0)
                    {
                        wheatlaistate.leafStateList[leafIndex] = LeafState.Senescing;
                    }
                    else
                    {
                        wheatlaistate.leafStateList[leafIndex] = LeafState.Dead;
                    }
                    if (leafLaminaSpecificN <= SLNmin)
                    {
                        wheatlaistate.isPrematurelyDying[leafIndex] = 1;
                        wheatlaistate.leafStateList[leafIndex]      = LeafState.Senescing;
                    }
                }
                else
                {
                    wheatlaistate.leafStateList[leafIndex] = LeafState.Senescing;
                }
            }
        }
        //GENERATED CODE END - PLACE YOUR CUSTOM CODE BELOW - Section2
        //Code written below will not be overwritten by a future code generation
        // #Andrea 26/11/2015 - included double deltaTTSenescence
        /// <summary>Calculate potential delta area index of the day (either growth or senescence)</summary>
        /// <param name="potentialIncDeltaArea">Potential delta area index increment of the day</param>
        private void CalculatePotIncDeltaAI(SiriusQualityWheatLAI.WheatLAIState wheatlaistate,
                                            List <LeafLayer> All)
        {
            wheatlaistate.potentialIncDeltaArea = 0;
            for (int i = 0; i < All.Count; i++)
            {
                CalculateWaterLimitedPotentialDeltaArea(wheatlaistate, i, All);
                var potDelta = wheatlaistate.WaterLimitedPotDeltaAIList[i];
                if (potDelta > 0)
                {
                    wheatlaistate.potentialIncDeltaArea += potDelta;
                }
            }

            wheatlaistate.incDeltaAreaLimitSF = wheatlaistate.potentialIncDeltaArea * wheatlaistate.DEF;
        }
        private void CalculateModel(SiriusQualityWheatLAI.WheatLAIState wheatlaistate, SiriusQualityWheatLAI.WheatLeafState wheatleafstate, SiriusQualityWheatLAI.WheatLeafState wheatleafstate1, 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 (wheatleafstate.isSmallPhytomer[wheatlaistate.index] == 0)
            {
                wheatleafstate.TTsen[wheatlaistate.index] = PsenLL * wheatleafstate.Phyllochron[wheatlaistate.index];
            }
            else
            {
                wheatleafstate.TTsen[wheatlaistate.index] = PsenSL * wheatleafstate.Phyllochron[wheatlaistate.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
        }
示例#24
0
        /// <summary>
        /// Run the strategy to calculate the outputs. In case of error during the execution, the preconditions tests are executed.
        /// </summary>
        public void Estimate(SiriusQualityWheatLAI.WheatLAIState wheatlaistate)
        {
            try
            {
                CalculateModel(wheatlaistate);

                //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 SiriusQualityWheatLAI.Strategies, strategy: " + this.GetType().Name + ": Unhandled exception running model. " + exception.GetType().FullName + " - " + exception.Message;
                throw new Exception(msg, exception);
            }
        }
示例#25
0
        private void CalculateModel(SiriusQualityWheatLAI.WheatLAIState wheatlaistate, SiriusQualityWheatLAI.WheatLeafState wheatleafstate, SiriusQualityWheatLAI.WheatLeafState wheatleafstate1, 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 (wheatlaistate.isPotentialLAI == 1)
            {
                wheatlaistate.DEF = 1;
                wheatlaistate.DSF = 1;
            }
            else
            {
                wheatlaistate.DEF = CalculateDF(LowerFPAWexp, UpperFPAWexp, 0, 1, wheatlaistate.FPAW, wheatlaistate.VPDairCanopy);
                wheatlaistate.DSF = CalculateDF(LowerFPAWsen, UpperFPAWsen, MaxDSF, 1, wheatlaistate.FPAW, wheatlaistate.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
        }
示例#26
0
        private void CalculateWaterLimitedPotentialDeltaArea(SiriusQualityWheatLAI.WheatLAIState wheatlaistate, SiriusQualityWheatLAI.WheatLeafState wheatleafstate, SiriusQualityWheatLAI.WheatLeafState wheatleafstate1, int i)
        {
            wheatlaistate.WaterLimitedPotDeltaAIList[i] = 0;

            if (wheatleafstate.State[i] >= 2)
            {
                wheatlaistate.WaterLimitedPotDeltaAIList[i] = Math.Max(-wheatleafstate.MaxAI[i] * (wheatlaistate.deltaTTSenescence * wheatlaistate.DSF) / wheatleafstate.TTsen[i], -(wheatleafstate.LaminaAI[i] + wheatleafstate.SheathAI[i]));
            }
            else if (wheatleafstate.State[i] == 0 && wheatleafstate.isPrematurelyDying[i] == 0)
            {
                if ((wheatlaistate.cumulTTShoot - wheatleafstate.TTem[i]) < wheatleafstate.TTGroLamina[i])     //IsLeafLaminaeGrowing
                {
                    wheatlaistate.WaterLimitedPotDeltaAIList[i] = Math.Min(wheatlaistate.MaximumPotentialLaminaeAI[i] * wheatlaistate.deltaTTShoot / wheatleafstate.TTGroLamina[i], Math.Max(0, wheatlaistate.MaximumPotentialLaminaeAI[i] - wheatleafstate.LaminaAI[i]));
                }
                else if (wheatlaistate.TTgroSheathList[i] > 0)
                {
                    wheatlaistate.WaterLimitedPotDeltaAIList[i] = Math.Min(wheatlaistate.MaximumPotentialSheathAI[i] * wheatlaistate.deltaTTShoot / wheatlaistate.TTgroSheathList[i], Math.Max(0, wheatlaistate.MaximumPotentialSheathAI[i] - wheatleafstate.SheathAI[i]));
                }
            }
        }
        // #Andrea 26/11/2015 - Added deltaTTSenescence
        private void CalculateWaterLimitedPotentialDeltaArea(SiriusQualityWheatLAI.WheatLAIState wheatlaistate, int i,
                                                             List <LeafLayer> All)
        {
            wheatlaistate.WaterLimitedPotDeltaAIList[i] = 0;

            if (wheatlaistate.leafStateList[i] >= LeafState.Senescing)
            //if ((IsPrematurelyDying && ! IsDeadBeforeEnd) || State >= LeafState.Senescing)
            {
                wheatlaistate.WaterLimitedPotDeltaAIList[i] = Math.Max(-All[i].MaxAI * (wheatlaistate.deltaTTSenescence * wheatlaistate.DSF) / All[i].TTsen, -(All[i].getLaminaAreaIndex() + All[i].getSheathAreaIndex()));
            }
            else if (wheatlaistate.leafStateList[i] == LeafState.Growing && wheatlaistate.isPrematurelyDying[i] == 0)
            {
                if ((wheatlaistate.cumulTTShoot - All[i].TTem) < All[i].LayerPhyllochron * PexpL)     //IsLeafLaminaeGrowing
                {
                    wheatlaistate.WaterLimitedPotDeltaAIList[i] = Math.Min(wheatlaistate.MaximumPotentialLaminaeAI[i] * wheatlaistate.deltaTTShoot / All[i].TTgroLamina, Math.Max(0, wheatlaistate.MaximumPotentialLaminaeAI[i] - All[i].getLaminaAreaIndex()));
                }
                else if (wheatlaistate.TTgroSheathList[i] > 0)
                {
                    wheatlaistate.WaterLimitedPotDeltaAIList[i] = Math.Min(wheatlaistate.MaximumPotentialSheathAI[i] * wheatlaistate.deltaTTShoot / wheatlaistate.TTgroSheathList[i], Math.Max(0, wheatlaistate.MaximumPotentialSheathAI[i] - All[i].getSheathAreaIndex()));
                }
            }
        }
示例#28
0
        private void CalculateModel(SiriusQualityWheatLAI.WheatLAIState wheatlaistate)
        {
            //GENERATED CODE END - PLACE YOUR CUSTOM CODE BELOW - Section1
            //Code written below will not be overwritten by a future code generation
            if (wheatlaistate.isPotentialLAI == 1)
            {
                wheatlaistate.DEF = 1;
                wheatlaistate.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);
                wheatlaistate.DEF = CalculateDF(LowerFPAWexp, UpperFPAWexp, 0, 1, wheatlaistate.FPAW, wheatlaistate.VPDairCanopy);
                // DSF = CalculateDF(LowerFPAWsen, UpperFPAWsen, MaxDSF, 1, FPAW, TranspSF);
                wheatlaistate.DSF = CalculateDF(LowerFPAWsen, UpperFPAWsen, MaxDSF, 1, wheatlaistate.FPAW, wheatlaistate.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
        }
 /// <summary>
 /// Calculate method for the component
 /// </summary>
 /// <param name=w>WheatLAIState Domain class contains the accessors to values</param>
 public void Estimate
     (IStrategySiriusQualityWheatLAI st, WheatLAIState w)
 {
     st.Estimate
         (w);
 }
 public void Estimate(SiriusQualityWheatLAI.WheatLAIState wheatlaistate)
 {
 }