public PhenologyWrapper()
 {
     s  = new PhenologyState();
     r  = new PhenologyRate();
     a  = new PhenologyAuxiliary();
     ex = new PhenologyExogenous();
     phenologyComponent = new PhenologyComponent();
     loadParameters();
 }
 public PhenologyWrapper(PhenologyWrapper toCopy, bool copyAll) : this()
 {
     s  = (toCopy.s != null) ? new PhenologyState(toCopy.s, copyAll) : null;
     r  = (toCopy.r != null) ? new PhenologyRate(toCopy.r, copyAll) : null;
     a  = (toCopy.a != null) ? new PhenologyAuxiliary(toCopy.a, copyAll) : null;
     ex = (toCopy.ex != null) ? new PhenologyExogenous(toCopy.ex, copyAll) : null;
     if (copyAll)
     {
         phenologyComponent = (toCopy.phenologyComponent != null) ? new PhenologyComponent(toCopy.phenologyComponent) : null;
     }
 }
Exemple #3
0
 public void Init(PhenologyState s, PhenologyState s1, PhenologyRate r, PhenologyAuxiliary a, PhenologyExogenous ex)
 {
     s.calendarMoments.Add("Sowing");
     s.calendarCumuls.Add(0.0d);
     s.calendarDates.Add(sowingDate);
     s.minFinalNumber = 5.5d;
 }
Exemple #4
0
 public void  CalculateModel(PhenologyState s, PhenologyState s1, PhenologyRate r, PhenologyAuxiliary a, PhenologyExogenous ex)
 {
     _phylsowingdatecorrection.CalculateModel(s, s1, r, a, ex);
     _vernalizationprogress.CalculateModel(s, s1, r, a, ex);
     _ismomentregistredzc_39.CalculateModel(s, s1, r, a, ex);
     _cumulttfrom.CalculateModel(s, s1, r, a, ex);
     _gaimean.CalculateModel(s, s1, r, a, ex);
     _updatephase.CalculateModel(s, s1, r, a, ex);
     _ptq.CalculateModel(s, s1, r, a, ex);
     _leafnumber.CalculateModel(s, s1, r, a, ex);
     _phyllochron.CalculateModel(s, s1, r, a, ex);
     _updateleafflag.CalculateModel(s, s1, r, a, ex);
     _shootnumber.CalculateModel(s, s1, r, a, ex);
     _registerzadok.CalculateModel(s, s1, r, a, ex);
     _updatecalendar.CalculateModel(s, s1, r, a, ex);
 }
    public void  CalculateModel(PhenologyState s, PhenologyState s1, PhenologyRate r, PhenologyAuxiliary a, PhenologyExogenous ex)
    {
        //- Name: UpdateLeafFlag -Version: 1.0, -Time step: 1
        //- Description:
        //            * Title: UpdateLeafFlag Model
        //            * Author: Pierre MARTRE
        //            * Reference: Modeling development phase in the
        //                Wheat Simulation Model SiriusQuality.
        //                See documentation at http://www1.clermont.inra.fr/siriusquality/?page_id=427
        //            * Institution: INRA Montpellier
        //            * Abstract: tells if flag leaf has appeared and update the calendar if so
        //
        //- inputs:
        //            * name: cumulTT
        //                          ** description : cumul thermal times at current date
        //                          ** variablecategory : auxiliary
        //                          ** datatype : DOUBLE
        //                          ** min : -200
        //                          ** max : 10000
        //                          ** default : 741.510096671757
        //                          ** unit : °C d
        //                          ** uri : some url
        //                          ** inputtype : variable
        //            * name: leafNumber
        //                          ** description : Actual number of phytomers
        //                          ** variablecategory : state
        //                          ** datatype : DOUBLE
        //                          ** min : 0
        //                          ** max : 25
        //                          ** default : 8.919453833361189
        //                          ** unit : leaf
        //                          ** uri : some url
        //                          ** inputtype : variable
        //            * name: calendarMoments
        //                          ** description : List containing apparition of each stage
        //                          ** variablecategory : state
        //                          ** datatype : STRINGLIST
        //                          ** default : ['Sowing']
        //                          ** unit :
        //                          ** inputtype : variable
        //            * name: calendarDates
        //                          ** description : List containing  the dates of the wheat developmental phases
        //                          ** variablecategory : state
        //                          ** datatype : DATELIST
        //                          ** default : ['2007/3/21']
        //                          ** unit :
        //                          ** inputtype : variable
        //            * name: calendarCumuls
        //                          ** description : list containing for each stage occured its cumulated thermal times
        //                          ** variablecategory : state
        //                          ** datatype : DOUBLELIST
        //                          ** default : [0.0]
        //                          ** unit : °C d
        //                          ** inputtype : variable
        //            * name: currentdate
        //                          ** description :  current date
        //                          ** variablecategory : auxiliary
        //                          ** datatype : DATE
        //                          ** default : 2007/4/29
        //                          ** unit :
        //                          ** uri : some url
        //                          ** inputtype : variable
        //            * name: finalLeafNumber
        //                          ** description : final leaf number
        //                          ** variablecategory : state
        //                          ** datatype : DOUBLE
        //                          ** min : 0
        //                          ** max : 10000
        //                          ** default : 8.797582013199484
        //                          ** unit : leaf
        //                          ** uri : some url
        //                          ** inputtype : variable
        //            * name: hasFlagLeafLiguleAppeared_t1
        //                          ** description : true if flag leaf has appeared (leafnumber reached finalLeafNumber)
        //                          ** variablecategory : state
        //                          ** datatype : INT
        //                          ** min : 0
        //                          ** max : 1
        //                          ** default : 1
        //                          ** unit :
        //                          ** uri : some url
        //                          ** inputtype : variable
        //            * name: phase
        //                          ** description :  the name of the phase
        //                          ** variablecategory : state
        //                          ** datatype : DOUBLE
        //                          ** min : 0
        //                          ** max : 7
        //                          ** default : 1
        //                          ** unit :
        //                          ** uri : some url
        //                          ** inputtype : variable
        //- outputs:
        //            * name: hasFlagLeafLiguleAppeared
        //                          ** description : true if flag leaf has appeared (leafnumber reached finalLeafNumber)
        //                          ** variablecategory : state
        //                          ** datatype : INT
        //                          ** min : 0
        //                          ** max : 1
        //                          ** unit :
        //                          ** uri : some url
        //            * name: calendarMoments
        //                          ** description :  List containing apparition of each stage
        //                          ** variablecategory : state
        //                          ** datatype : STRINGLIST
        //                          ** unit :
        //            * name: calendarDates
        //                          ** description :  List containing  the dates of the wheat developmental phases
        //                          ** variablecategory : state
        //                          ** datatype : DATELIST
        //                          ** unit :
        //            * name: calendarCumuls
        //                          ** description :  list containing for each stage occured its cumulated thermal times
        //                          ** variablecategory : state
        //                          ** datatype : DOUBLELIST
        //                          ** unit : °C d
        double          cumulTT         = a.cumulTT;
        double          leafNumber      = s.leafNumber;
        List <string>   calendarMoments = s.calendarMoments;
        List <DateTime> calendarDates   = s.calendarDates;
        List <double>   calendarCumuls  = s.calendarCumuls;
        DateTime        currentdate     = a.currentdate;
        double          finalLeafNumber = s.finalLeafNumber;
        int             hasFlagLeafLiguleAppeared_t1 = s1.hasFlagLeafLiguleAppeared;
        double          phase = s.phase;
        int             hasFlagLeafLiguleAppeared;

        hasFlagLeafLiguleAppeared = 0;
        if (phase >= 1.0d && phase < 4.0d)
        {
            if (leafNumber > 0.0d)
            {
                if (hasFlagLeafLiguleAppeared == 0 && (finalLeafNumber > 0.0d && leafNumber >= finalLeafNumber))
                {
                    hasFlagLeafLiguleAppeared = 1;
                    if (!calendarMoments.Contains("FlagLeafLiguleJustVisible"))
                    {
                        calendarMoments.Add("FlagLeafLiguleJustVisible");
                        calendarCumuls.Add(cumulTT);
                        calendarDates.Add(currentdate);
                    }
                }
            }
        }
        s.calendarMoments           = calendarMoments;
        s.calendarDates             = calendarDates;
        s.calendarCumuls            = calendarCumuls;
        s.hasFlagLeafLiguleAppeared = hasFlagLeafLiguleAppeared;
    }
Exemple #6
0
    public void  CalculateModel(PhenologyState s, PhenologyState s1, PhenologyRate r, PhenologyAuxiliary a, PhenologyExogenous ex)
    {
        //- Name: LeafNumber -Version: 1.0, -Time step: 1
        //- Description:
        //            * Title: CalculateLeafNumber Model
        //            * Author: Pierre MARTRE
        //            * Reference: Modeling development phase in the
        //                Wheat Simulation Model SiriusQuality.
        //                See documentation at http://www1.clermont.inra.fr/siriusquality/?page_id=427
        //            * Institution: INRA Montpellier
        //            * Abstract: calculate leaf number. LeafNumber increase is caped at one more leaf per day
        //- inputs:
        //            * name: deltaTT
        //                          ** description : daily delta TT
        //                          ** variablecategory : auxiliary
        //                          ** datatype : DOUBLE
        //                          ** min : -20
        //                          ** max : 100
        //                          ** default : 23.5895677277199
        //                          ** unit : °C d
        //                          ** inputtype : variable
        //            * name: phyllochron_t1
        //                          ** description : phyllochron
        //                          ** variablecategory : state
        //                          ** inputtype : variable
        //                          ** datatype : DOUBLE
        //                          ** min : 0
        //                          ** max : 1000
        //                          ** default : 0
        //                          ** unit : °C d leaf-1
        //            * name: hasFlagLeafLiguleAppeared
        //                          ** description : true if flag leaf has appeared (leafnumber reached finalLeafNumber)
        //                          ** variablecategory : state
        //                          ** datatype : INT
        //                          ** min : 0
        //                          ** max : 1
        //                          ** default : 0
        //                          ** unit :
        //                          ** inputtype : variable
        //            * name: leafNumber_t1
        //                          ** description :  Actual number of phytomers
        //                          ** variablecategory : state
        //                          ** datatype : DOUBLE
        //                          ** min : 0
        //                          ** max : 25
        //                          ** default : 0
        //                          ** unit : leaf
        //                          ** inputtype : variable
        //            * name: phase
        //                          ** description :  the name of the phase
        //                          ** variablecategory : state
        //                          ** datatype : DOUBLE
        //                          ** min : 0
        //                          ** max : 7
        //                          ** default : 1
        //                          ** unit :
        //                          ** uri : some url
        //                          ** inputtype : variable
        //- outputs:
        //            * name: leafNumber
        //                          ** description : Actual number of phytomers
        //                          ** variablecategory : state
        //                          ** datatype : DOUBLE
        //                          ** min : 0
        //                          ** max : 10000
        //                          ** unit : leaf
        //                          ** uri : some url
        double deltaTT                   = a.deltaTT;
        double phyllochron_t1            = s1.phyllochron;
        int    hasFlagLeafLiguleAppeared = s.hasFlagLeafLiguleAppeared;
        double leafNumber_t1             = s1.leafNumber;
        double phase = s.phase;
        double leafNumber;

        leafNumber = leafNumber_t1;
        double phyllochron_;

        if (phase >= 1.0d && phase < 4.0d)
        {
            if (hasFlagLeafLiguleAppeared == 0)
            {
                if (phyllochron_t1 == 0.0d)
                {
                    phyllochron_ = 0.0000001d;
                }
                else
                {
                    phyllochron_ = phyllochron_t1;
                }
                leafNumber = leafNumber_t1 + Math.Min(deltaTT / phyllochron_, 0.999d);
            }
        }
        s.leafNumber = leafNumber;
    }
Exemple #7
0
    public void  CalculateModel(PhenologyState s, PhenologyState s1, PhenologyRate r, PhenologyAuxiliary a, PhenologyExogenous ex)
    {
        //- Name: IsMomentRegistredZC_39 -Version: 1.0, -Time step: 1
        //- Description:
        //            * Title: Is FlagLeafLiguleJustVisible Model
        //            * Author: Pierre Martre
        //            * Reference: Modeling development phase in the
        //                Wheat Simulation Model SiriusQuality.
        //                See documentation at http://www1.clermont.inra.fr/siriusquality/?page_id=427
        //            * Institution: INRA Montpellier
        //            * Abstract: if FlagLeafLiguleJustVisible is already Registred
        //- inputs:
        //            * name: calendarMoments_t1
        //                          ** description : List containing appearance of each stage at previous time
        //                          ** variablecategory : state
        //                          ** datatype : STRINGLIST
        //                          ** default : ['Sowing']
        //                          ** unit :
        //                          ** inputtype : variable
        //- outputs:
        //            * name: isMomentRegistredZC_39
        //                          ** description :  if Flag leaf ligule has already appeared
        //                          ** variablecategory : state
        //                          ** datatype : INT
        //                          ** min : 0
        //                          ** max : 1
        //                          ** unit :
        List <string> calendarMoments_t1 = s1.calendarMoments;
        int           isMomentRegistredZC_39;

        isMomentRegistredZC_39   = calendarMoments_t1.Contains("FlagLeafLiguleJustVisible") ? 1 : 0;
        s.isMomentRegistredZC_39 = isMomentRegistredZC_39;
    }
    public void  CalculateModel(PhenologyState s, PhenologyState s1, PhenologyRate r, PhenologyAuxiliary a, PhenologyExogenous ex)
    {
        //- Name: ShootNumber -Version: 1.0, -Time step: 1
        //- Description:
        //            * Title: CalculateShootNumber Model
        //            * Author: Pierre MARTRE
        //            * Reference: Modeling development phase in the
        //                Wheat Simulation Model SiriusQuality.
        //                See documentation at http://www1.clermont.inra.fr/siriusquality/?page_id=427
        //            * Institution: INRA/LEPSE Montpellier
        //            * Abstract: calculate the shoot number and update the related variables if needed
        //- inputs:
        //            * name: canopyShootNumber_t1
        //                          ** description : shoot number for the whole canopy
        //                          ** variablecategory : state
        //                          ** datatype : DOUBLE
        //                          ** min : 0
        //                          ** max : 10000
        //                          ** default : 288.0
        //                          ** unit : shoot m-2
        //                          ** inputtype : variable
        //            * name: leafNumber
        //                          ** description : Leaf number
        //                          ** variablecategory : state
        //                          ** inputtype : variable
        //                          ** datatype : DOUBLE
        //                          ** min : 0
        //                          ** max : 10000
        //                          ** default : 3.34
        //                          ** unit : leaf
        //            * name: sowingDensity
        //                          ** description : number of plant /m²
        //                          ** parametercategory : species
        //                          ** datatype : DOUBLE
        //                          ** min : 0
        //                          ** max : 500
        //                          ** default : 288.0
        //                          ** unit : plant m-2
        //                          ** inputtype : parameter
        //            * name: targetFertileShoot
        //                          ** description : max value of shoot number for the canopy
        //                          ** parametercategory : species
        //                          ** datatype : DOUBLE
        //                          ** min : 280
        //                          ** max : 1000
        //                          ** default : 600.0
        //                          ** unit : shoot
        //                          ** inputtype : variable
        //            * name: tilleringProfile_t1
        //                          ** description :  store the amount of new tiller created at each time a new tiller appears
        //                          ** variablecategory : state
        //                          ** datatype : DOUBLELIST
        //                          ** default : [288.0]
        //                          ** unit :
        //                          ** inputtype : variable
        //            * name: leafTillerNumberArray_t1
        //                          ** description : store the number of tiller for each leaf layer
        //                          ** variablecategory : state
        //                          ** datatype : INTLIST
        //                          ** unit : leaf
        //                          ** default : [1, 1, 1]
        //                          ** inputtype : variable
        //            * name: numberTillerCohort_t1
        //                          ** description :  Number of tiller which appears
        //                          ** variablecategory : state
        //                          ** datatype : INT
        //                          ** min : 0
        //                          ** max : 10000
        //                          ** default : 1
        //                          ** unit :
        //                          ** inputtype : variable
        //- outputs:
        //            * name: averageShootNumberPerPlant
        //                          ** description : average shoot number per plant in the canopy
        //                          ** variablecategory : state
        //                          ** datatype : DOUBLE
        //                          ** min : 0
        //                          ** max : 10000
        //                          ** unit : shoot m-2
        //            * name: canopyShootNumber
        //                          ** description : shoot number for the whole canopy
        //                          ** variablecategory : state
        //                          ** datatype : DOUBLE
        //                          ** min : 0
        //                          ** max : 10000
        //                          ** unit : shoot m-2
        //            * name: leafTillerNumberArray
        //                          ** description : store the number of tiller for each leaf layer
        //                          ** variablecategory : state
        //                          ** datatype : INTLIST
        //                          ** unit : leaf
        //            * name: tilleringProfile
        //                          ** description :  store the amount of new tiller created at each time a new tiller appears
        //                          ** variablecategory : state
        //                          ** datatype : DOUBLELIST
        //                          ** unit : dimensionless
        //            * name: numberTillerCohort
        //                          ** description : Number of tiller which appears
        //                          ** variablecategory : state
        //                          ** datatype : INT
        //                          ** min : 0
        //                          ** max : 10000
        //                          ** unit : dimensionless
        double        canopyShootNumber_t1     = s1.canopyShootNumber;
        double        leafNumber               = s.leafNumber;
        List <double> tilleringProfile_t1      = s1.tilleringProfile;
        List <int>    leafTillerNumberArray_t1 = s1.leafTillerNumberArray;
        int           numberTillerCohort_t1    = s1.numberTillerCohort;
        double        averageShootNumberPerPlant;
        double        canopyShootNumber;
        List <int>    leafTillerNumberArray = new List <int>();
        List <double> tilleringProfile      = new List <double>();
        int           numberTillerCohort;
        int           emergedLeaves;
        int           shoots;
        int           i;
        List <int>    lNumberArray_rate = new List <int>();

        emergedLeaves              = Math.Max(1, (int)Math.Ceiling(leafNumber - 1.0d));
        shoots                     = fibonacci(emergedLeaves);
        canopyShootNumber          = Math.Min(shoots * sowingDensity, targetFertileShoot);
        averageShootNumberPerPlant = canopyShootNumber / sowingDensity;
        if (canopyShootNumber != canopyShootNumber_t1)
        {
            tilleringProfile = new List <double>(tilleringProfile_t1);
            tilleringProfile.Add(canopyShootNumber - canopyShootNumber_t1);
        }
        numberTillerCohort = tilleringProfile.Count;
        for (i = leafTillerNumberArray_t1.Count; i != (int)Math.Ceiling(leafNumber); i += 1)
        {
            lNumberArray_rate.Add(numberTillerCohort);
        }
        leafTillerNumberArray = new List <int>(leafTillerNumberArray_t1);
        leafTillerNumberArray.AddRange(lNumberArray_rate);
        s.averageShootNumberPerPlant = averageShootNumberPerPlant;
        s.canopyShootNumber          = canopyShootNumber;
        s.leafTillerNumberArray      = leafTillerNumberArray;
        s.tilleringProfile           = tilleringProfile;
        s.numberTillerCohort         = numberTillerCohort;
    }
Exemple #9
0
    public void  CalculateModel(PhenologyState s, PhenologyState s1, PhenologyRate r, PhenologyAuxiliary a, PhenologyExogenous ex)
    {
        //- Name: Phyllochron -Version: 1.0, -Time step: 1
        //- Description:
        //            * Title: Phyllochron Model
        //            * Author: Pierre Martre
        //            * Reference: Modeling development phase in the
        //                Wheat Simulation Model SiriusQuality.
        //                See documentation at http://www1.clermont.inra.fr/siriusquality/?page_id=427
        //            * Institution: INRA Montpellier
        //            * Abstract: Calculate different types of phyllochron
        //- inputs:
        //            * name: fixPhyll
        //                          ** description : Sowing date corrected Phyllochron
        //                          ** inputtype : variable
        //                          ** variablecategory : auxiliary
        //                          ** datatype : DOUBLE
        //                          ** default : 5.0
        //                          ** min : 0.0
        //                          ** max : 10000.0
        //                          ** unit : °C d leaf-1
        //                          ** uri : some url
        //            * name: leafNumber
        //                          ** description : Actual number of phytomers
        //                          ** inputtype : variable
        //                          ** variablecategory : state
        //                          ** datatype : DOUBLE
        //                          ** default : 0.0
        //                          ** min : 0.0
        //                          ** max : 25.0
        //                          ** unit : leaf
        //                          ** uri : some url
        //            * name: lincr
        //                          ** description : Leaf number above which the phyllochron is increased by Pincr
        //                          ** inputtype : parameter
        //                          ** parametercategory : species
        //                          ** datatype : DOUBLE
        //                          ** default : 8.0
        //                          ** min : 0.0
        //                          ** max : 30.0
        //                          ** unit : leaf
        //                          ** uri : some url
        //            * name: ldecr
        //                          ** description : Leaf number up to which the phyllochron is decreased by Pdecr
        //                          ** inputtype : parameter
        //                          ** parametercategory : species
        //                          ** datatype : DOUBLE
        //                          ** default : 0.0
        //                          ** min : 0.0
        //                          ** max : 100.0
        //                          ** unit : leaf
        //                          ** uri : some url
        //            * name: pdecr
        //                          ** description : Factor decreasing the phyllochron for leaf number less than Ldecr
        //                          ** inputtype : parameter
        //                          ** parametercategory : species
        //                          ** datatype : DOUBLE
        //                          ** default : 0.4
        //                          ** min : 0.0
        //                          ** max : 10.0
        //                          ** unit : -
        //                          ** uri : some url
        //            * name: pincr
        //                          ** description : Factor increasing the phyllochron for leaf number higher than Lincr
        //                          ** inputtype : parameter
        //                          ** parametercategory : species
        //                          ** datatype : DOUBLE
        //                          ** default : 1.5
        //                          ** min : 0.0
        //                          ** max : 10.0
        //                          ** unit : -
        //                          ** uri : some url
        //            * name: ptq
        //                          ** description : Photothermal quotient
        //                          ** inputtype : variable
        //                          ** variablecategory : state
        //                          ** datatype : DOUBLE
        //                          ** default : 0.0
        //                          ** min : 0.0
        //                          ** max : 10000.0
        //                          ** unit : MJ °C-1 d-1 m-2)
        //                          ** uri : some url
        //            * name: gAImean
        //                          ** description : Green Area Index
        //                          ** inputtype : variable
        //                          ** variablecategory : state
        //                          ** datatype : DOUBLE
        //                          ** default : 0.0
        //                          ** min : 0.0
        //                          ** max : 10000.0
        //                          ** unit : m2 m-2
        //                          ** uri : some url
        //            * name: kl
        //                          ** description : Exctinction Coefficient
        //                          ** inputtype : parameter
        //                          ** parametercategory : species
        //                          ** datatype : DOUBLE
        //                          ** default : 0.45
        //                          ** min : 0.0
        //                          ** max : 50.0
        //                          ** unit : -
        //                          ** uri : some url
        //            * name: pTQhf
        //                          ** description : Slope to intercept ratio for Phyllochron  parametrization with PhotoThermal Quotient
        //                          ** inputtype : parameter
        //                          ** parametercategory : genotypic
        //                          ** datatype : DOUBLE
        //                          ** default : 0.0
        //                          ** min : 0.0
        //                          ** max : 1000.0
        //                          ** unit : °C d leaf-1
        //                          ** uri : some url
        //            * name: B
        //                          ** description : Phyllochron at PTQ equal 1
        //                          ** inputtype : parameter
        //                          ** parametercategory : species
        //                          ** datatype : DOUBLE
        //                          ** default : 20.0
        //                          ** min : 0.0
        //                          ** max : 1000.0
        //                          ** unit : °C d leaf-1
        //                          ** uri : some url
        //            * name: p
        //                          ** description : Phyllochron (Varietal parameter)
        //                          ** inputtype : parameter
        //                          ** parametercategory : species
        //                          ** datatype : DOUBLE
        //                          ** default : 120.0
        //                          ** min : 0.0
        //                          ** max : 1000.0
        //                          ** unit : °C d leaf-1
        //                          ** uri : some url
        //            * name: choosePhyllUse
        //                          ** description : Switch to choose the type of phyllochron calculation to be used
        //                          ** inputtype : parameter
        //                          ** parametercategory : species
        //                          ** datatype : STRING
        //                          ** default : Default
        //                          ** min :
        //                          ** max :
        //                          ** unit : -
        //                          ** uri : some url
        //            * name: areaSL
        //                          ** description :  Area Leaf
        //                          ** inputtype : parameter
        //                          ** parametercategory : genotypic
        //                          ** datatype : DOUBLE
        //                          ** default : 0.0
        //                          ** min : 0.0
        //                          ** max : 1000.0
        //                          ** unit : cm2
        //                          ** uri : some url
        //            * name: areaSS
        //                          ** description : Area Sheath
        //                          ** inputtype : parameter
        //                          ** parametercategory : genotypic
        //                          ** datatype : DOUBLE
        //                          ** default : 0.0
        //                          ** min : 0.0
        //                          ** max : 1000.0
        //                          ** unit : cm2
        //                          ** uri : some url
        //            * name: lARmin
        //                          ** description : LAR minimum
        //                          ** inputtype : parameter
        //                          ** parametercategory : genotypic
        //                          ** datatype : DOUBLE
        //                          ** default : 0.0
        //                          ** min : 0.0
        //                          ** max : 1000.0
        //                          ** unit : leaf-1 °C
        //                          ** uri : some url
        //            * name: lARmax
        //                          ** description : LAR maximum
        //                          ** inputtype : parameter
        //                          ** parametercategory : genotypic
        //                          ** datatype : DOUBLE
        //                          ** default : 0.0
        //                          ** min : 0.0
        //                          ** max : 1000.0
        //                          ** unit : leaf-1 °C
        //                          ** uri : some url
        //            * name: sowingDensity
        //                          ** description : Sowing Density
        //                          ** inputtype : parameter
        //                          ** parametercategory : genotypic
        //                          ** datatype : DOUBLE
        //                          ** default : 0.0
        //                          ** min : 0.0
        //                          ** max : 1000.0
        //                          ** unit : plant m-2
        //                          ** uri : some url
        //            * name: lNeff
        //                          ** description : Leaf Number efficace
        //                          ** inputtype : parameter
        //                          ** parametercategory : genotypic
        //                          ** datatype : DOUBLE
        //                          ** default : 0.0
        //                          ** min : 0.0
        //                          ** max : 1000.0
        //                          ** unit : leaf
        //                          ** uri : some url
        //- outputs:
        //            * name: phyllochron
        //                          ** description :  the rate of leaf appearance
        //                          ** variablecategory : state
        //                          ** datatype : DOUBLE
        //                          ** min : 0
        //                          ** max : 1000
        //                          ** unit :  °C d leaf-1
        //                          ** uri : some url
        double fixPhyll   = a.fixPhyll;
        double leafNumber = s.leafNumber;
        double ptq        = s.ptq;
        double gAImean    = s.gAImean;
        double phyllochron;
        double gaiLim;
        double LAR;

        phyllochron = 0.0d;
        LAR         = 0.0d;
        gaiLim      = lNeff * ((areaSL + areaSS) / 10000.0d) * sowingDensity;
        if (choosePhyllUse == "Default")
        {
            if (leafNumber < ldecr)
            {
                phyllochron = fixPhyll * pdecr;
            }
            else if (leafNumber >= ldecr && leafNumber < lincr)
            {
                phyllochron = fixPhyll;
            }
            else
            {
                phyllochron = fixPhyll * pincr;
            }
        }
        if (choosePhyllUse == "PTQ")
        {
            if (gAImean > gaiLim)
            {
                LAR = (lARmin + ((lARmax - lARmin) * ptq / (pTQhf + ptq))) / (B * gAImean);
            }
            else
            {
                LAR = (lARmin + ((lARmax - lARmin) * ptq / (pTQhf + ptq))) / (B * gaiLim);
            }
            phyllochron = 1.0d / LAR;
        }
        if (choosePhyllUse == "Test")
        {
            if (leafNumber < ldecr)
            {
                phyllochron = p * pdecr;
            }
            else if (leafNumber >= ldecr && leafNumber < lincr)
            {
                phyllochron = p;
            }
            else
            {
                phyllochron = p * pincr;
            }
        }
        s.phyllochron = phyllochron;
    }
    public void  CalculateModel(PhenologyState s, PhenologyState s1, PhenologyRate r, PhenologyAuxiliary a, PhenologyExogenous ex)
    {
        //- Name: UpdatePhase -Version: 1.0, -Time step: 1
        //- Description:
        //            * Title: UpdatePhase Model
        //            * Author: Pierre MARTRE
        //            * Reference: Modeling development phase in the
        //                Wheat Simulation Model SiriusQuality.
        //                See documentation at http://www1.clermont.inra.fr/siriusquality/?page_id=427
        //            * Institution: INRA Montpellier
        //            * Abstract: This strategy advances the phase and calculate the final leaf number
        //
        //- inputs:
        //            * name: cumulTT
        //                          ** description : cumul thermal times at current date
        //                          ** variablecategory : auxiliary
        //                          ** datatype : DOUBLE
        //                          ** min : -200
        //                          ** max : 10000
        //                          ** default : 354.582294511779
        //                          ** unit : °C d
        //                          ** inputtype : variable
        //            * name: leafNumber_t1
        //                          ** description : Actual number of phytomers
        //                          ** variablecategory : state
        //                          ** datatype : DOUBLE
        //                          ** min : 0
        //                          ** max : 25
        //                          ** default :  4.620511621863958
        //                          ** unit : leaf
        //                          ** inputtype : variable
        //            * name: cumulTTFromZC_39
        //                          ** description : cumul of the thermal time ( DeltaTT) since the moment ZC_39
        //                          ** variablecategory : auxiliary
        //                          ** datatype : DOUBLE
        //                          ** min : 0
        //                          ** max : 10000
        //                          ** default : 0
        //                          ** unit : °C d-1
        //                          ** inputtype : variable
        //            * name: isMomentRegistredZC_39
        //                          ** description : true if ZC_39 is registered in the calendar
        //                          ** variablecategory : state
        //                          ** datatype : INT
        //                          ** min : 0
        //                          ** max : 1
        //                          ** default : 0
        //                          ** unit :
        //                          ** inputtype : variable
        //            * name: gAI
        //                          ** description : used to calculate Terminal spikelet
        //                          ** variablecategory : auxiliary
        //                          ** datatype : DOUBLE
        //                          ** min : 0
        //                          ** max : 10000
        //                          ** default : 0.3255196285135
        //                          ** unit :
        //                          ** inputtype : variable
        //            * name: grainCumulTT
        //                          ** description : cumulTT used for the grain developpment
        //                          ** variablecategory : auxiliary
        //                          ** datatype : DOUBLE
        //                          ** min : 0
        //                          ** max : 10000
        //                          ** default : 0
        //                          ** unit : °C d
        //                          ** inputtype : variable
        //            * name: dayLength
        //                          ** description : length of the day
        //                          ** datatype : DOUBLE
        //                          ** variablecategory : auxiliary
        //                          ** min : 0
        //                          ** max : 24
        //                          ** unit : h
        //                          ** default : 12.7433275303389
        //                          ** inputtype : variable
        //            * name: vernaprog
        //                          ** description : progression on a 0  to 1 scale of the vernalization
        //                          ** variablecategory : state
        //                          ** datatype : DOUBLE
        //                          ** min : 0
        //                          ** max : 10
        //                          ** default :  1.0532526829571554
        //                          ** unit :
        //                          ** inputtype : variable
        //            * name: minFinalNumber
        //                          ** description : minimum final leaf number
        //                          ** variablecategory : state
        //                          ** datatype : DOUBLE
        //                          ** min : 0
        //                          ** max : 25
        //                          ** default : 6.879410413987549
        //                          ** unit : leaf
        //                          ** inputtype : variable
        //            * name: fixPhyll
        //                          ** description : Phyllochron with sowing date fix
        //                          ** variablecategory : auxiliary
        //                          ** datatype : DOUBLE
        //                          ** min : 0
        //                          ** max : 10000
        //                          ** default : 91.2
        //                          ** unit : °C d
        //                          ** inputtype : variable
        //            * name: isVernalizable
        //                          ** description : true if the plant is vernalizable
        //                          ** parametercategory : species
        //                          ** datatype : INT
        //                          ** min : 0
        //                          ** max : 1
        //                          ** unit :
        //                          ** default : 1
        //                          ** inputtype : parameter
        //            * name: dse
        //                          ** description : Thermal time from sowing to emergence
        //                          ** parametercategory : genotypic
        //                          ** datatype : DOUBLE
        //                          ** min : 0
        //                          ** max : 1000
        //                          ** default : 105
        //                          ** unit : °C d
        //                          ** inputtype : parameter
        //            * name: pFLLAnth
        //                          ** description : Phyllochronic duration of the period between flag leaf ligule appearance and anthesis
        //                          ** parametercategory : species
        //                          ** datatype : DOUBLE
        //                          ** min : 0
        //                          ** max : 1000
        //                          ** unit :
        //                          ** default : 2.22
        //                          ** inputtype : parameter
        //            * name: dcd
        //                          ** description : Duration of the endosperm cell division phase
        //                          ** parametercategory : species
        //                          ** datatype : DOUBLE
        //                          ** min : 0
        //                          ** max : 10000
        //                          ** default : 100
        //                          ** unit : °C d
        //                          ** inputtype : parameter
        //            * name: dgf
        //                          ** description : Grain filling duration (from anthesis to physiological maturity)
        //                          ** parametercategory : species
        //                          ** datatype : DOUBLE
        //                          ** min : 0
        //                          ** max : 10000
        //                          ** default : 450
        //                          ** unit : °C d
        //                          ** inputtype : parameter
        //            * name: degfm
        //                          ** description : Grain maturation duration (from physiological maturity to harvest ripeness)
        //                          ** parametercategory : species
        //                          ** datatype : DOUBLE
        //                          ** min : 0
        //                          ** max : 50
        //                          ** default : 0
        //                          ** unit : °C d
        //                          ** inputtype : parameter
        //            * name: maxDL
        //                          ** description : Saturating photoperiod above which final leaf number is not influenced by daylength
        //                          ** parametercategory : species
        //                          ** datatype : DOUBLE
        //                          ** min : 0
        //                          ** max : 24
        //                          ** default : 15
        //                          ** unit : h
        //                          ** inputtype : parameter
        //            * name: sLDL
        //                          ** description : Daylength response of leaf production
        //                          ** parametercategory : species
        //                          ** datatype : DOUBLE
        //                          ** min : 0
        //                          ** max : 1
        //                          ** default : 0.85
        //                          ** unit : leaf h-1
        //                          ** inputtype : parameter
        //            * name: ignoreGrainMaturation
        //                          ** description : true to ignore grain maturation
        //                          ** parametercategory : species
        //                          ** datatype : BOOLEAN
        //                          ** default : FALSE
        //                          ** unit :
        //                          ** inputtype : parameter
        //            * name: pHEADANTH
        //                          ** description : Number of phyllochron between heading and anthesiss
        //                          ** parametercategory : species
        //                          ** datatype : DOUBLE
        //                          ** min : 0
        //                          ** max : 1000
        //                          ** default : 1
        //                          ** unit :
        //                          ** inputtype : parameter
        //            * name: choosePhyllUse
        //                          ** description : Switch to choose the type of phyllochron calculation to be used
        //                          ** parametercategory : species
        //                          ** datatype : STRING
        //                          ** unit :
        //                          ** default : Default
        //                          ** inputtype : parameter
        //            * name: p
        //                          ** description : Phyllochron (Varietal parameter)
        //                          ** parametercategory : species
        //                          ** datatype : DOUBLE
        //                          ** min : 0
        //                          ** max : 1000
        //                          ** default : 120
        //                          ** unit : °C d leaf-1
        //                          ** inputtype : parameter
        //            * name: phase_t1
        //                          ** description :  the name of the phase
        //                          ** variablecategory : state
        //                          ** datatype : DOUBLE
        //                          ** min : 0
        //                          ** max : 7
        //                          ** default : 1
        //                          ** unit :
        //                          ** inputtype : variable
        //            * name: cumulTTFromZC_91
        //                          ** description : cumul of the thermal time (DeltaTT) since the moment ZC_91
        //                          ** variablecategory : auxiliary
        //                          ** datatype : DOUBLE
        //                          ** min : 0
        //                          ** max : 5000
        //                          ** default : 0
        //                          ** unit : °C d-1
        //                          ** inputtype : variable
        //            * name: phyllochron
        //                          ** description : Phyllochron
        //                          ** variablecategory : state
        //                          ** datatype : DOUBLE
        //                          ** min : 0
        //                          ** max : 1000
        //                          ** default : 91.2
        //                          ** unit : °C d leaf-1
        //                          ** inputtype : variable
        //            * name: hasLastPrimordiumAppeared_t1
        //                          ** description : if Last Primordium has Appeared
        //                          ** variablecategory : state
        //                          ** datatype : INT
        //                          ** min : 0
        //                          ** max : 1
        //                          ** default : 0
        //                          ** unit :
        //                          ** inputtype : variable
        //            * name: finalLeafNumber_t1
        //                          ** description : final leaf number
        //                          ** variablecategory : state
        //                          ** datatype : DOUBLE
        //                          ** min : 0
        //                          ** max : 25
        //                          ** default : 0
        //                          ** unit : leaf
        //                          ** inputtype : variable
        //- outputs:
        //            * name: finalLeafNumber
        //                          ** description : final leaf number
        //                          ** variablecategory : state
        //                          ** datatype : DOUBLE
        //                          ** min : 0
        //                          ** max : 25
        //                          ** unit : leaf
        //            * name: phase
        //                          ** description : the name of the phase
        //                          ** variablecategory : state
        //                          ** datatype : DOUBLE
        //                          ** min : 0
        //                          ** max : 7
        //                          ** unit :
        //            * name: hasLastPrimordiumAppeared
        //                          ** description : if Last Primordium has Appeared
        //                          ** variablecategory : state
        //                          ** datatype : INT
        //                          ** min : 0
        //                          ** max : 1
        //                          ** unit :
        double cumulTT                = a.cumulTT;
        double leafNumber_t1          = s1.leafNumber;
        double cumulTTFromZC_39       = a.cumulTTFromZC_39;
        int    isMomentRegistredZC_39 = s.isMomentRegistredZC_39;
        double gAI                          = a.gAI;
        double grainCumulTT                 = a.grainCumulTT;
        double dayLength                    = a.dayLength;
        double vernaprog                    = s.vernaprog;
        double minFinalNumber               = s.minFinalNumber;
        double fixPhyll                     = a.fixPhyll;
        double phase_t1                     = s1.phase;
        double cumulTTFromZC_91             = a.cumulTTFromZC_91;
        double phyllochron                  = s.phyllochron;
        int    hasLastPrimordiumAppeared_t1 = s1.hasLastPrimordiumAppeared;
        double finalLeafNumber_t1           = s1.finalLeafNumber;
        double finalLeafNumber;
        double phase;
        int    hasLastPrimordiumAppeared;
        double ttFromLastLeafToHeading;
        double appFLN;
        double localDegfm;
        double ttFromLastLeafToAnthesis;

        hasLastPrimordiumAppeared = hasLastPrimordiumAppeared_t1;
        finalLeafNumber           = finalLeafNumber_t1;
        phase = phase_t1;
        if (phase_t1 >= 0.0d && phase_t1 < 1.0d)
        {
            if (cumulTT >= dse)
            {
                phase = 1.0d;
            }
            else
            {
                phase = phase_t1;
            }
        }
        else if (phase_t1 >= 1.0d && phase_t1 < 2.0d)
        {
            if (isVernalizable == 1 && vernaprog >= 1.0d || isVernalizable == 0)
            {
                if (dayLength > maxDL)
                {
                    finalLeafNumber           = minFinalNumber;
                    hasLastPrimordiumAppeared = 1;
                }
                else
                {
                    appFLN = minFinalNumber + (sLDL * (maxDL - dayLength));
                    if (appFLN / 2.0d <= leafNumber_t1)
                    {
                        finalLeafNumber           = appFLN;
                        hasLastPrimordiumAppeared = 1;
                    }
                    else
                    {
                        phase = phase_t1;
                    }
                }
                if (hasLastPrimordiumAppeared == 1)
                {
                    phase = 2.0d;
                }
            }
            else
            {
                phase = phase_t1;
            }
        }
        else if (phase_t1 >= 2.0d && phase_t1 < 4.0d)
        {
            if (isMomentRegistredZC_39 == 1)
            {
                if (phase_t1 < 3.0d)
                {
                    ttFromLastLeafToHeading = 0.0d;
                    if (choosePhyllUse == "Default")
                    {
                        ttFromLastLeafToHeading = (pFLLAnth - pHEADANTH) * fixPhyll;
                    }
                    else if (choosePhyllUse == "PTQ")
                    {
                        ttFromLastLeafToHeading = (pFLLAnth - pHEADANTH) * phyllochron;
                    }
                    else if (choosePhyllUse == "Test")
                    {
                        ttFromLastLeafToHeading = (pFLLAnth - pHEADANTH) * p;
                    }
                    if (cumulTTFromZC_39 >= ttFromLastLeafToHeading)
                    {
                        phase = 3.0d;
                    }
                    else
                    {
                        phase = phase_t1;
                    }
                }
                else
                {
                    phase = phase_t1;
                }
                ttFromLastLeafToAnthesis = 0.0d;
                if (choosePhyllUse == "Default")
                {
                    ttFromLastLeafToAnthesis = pFLLAnth * fixPhyll;
                }
                else if (choosePhyllUse == "PTQ")
                {
                    ttFromLastLeafToAnthesis = pFLLAnth * phyllochron;
                }
                else if (choosePhyllUse == "Test")
                {
                    ttFromLastLeafToAnthesis = pFLLAnth * p;
                }
                if (cumulTTFromZC_39 >= ttFromLastLeafToAnthesis)
                {
                    phase = 4.0d;
                }
            }
            else
            {
                phase = phase_t1;
            }
        }
        else if (phase_t1 == 4.0d)
        {
            if (grainCumulTT >= dcd)
            {
                phase = 4.5d;
            }
            else
            {
                phase = phase_t1;
            }
        }
        else if (phase_t1 == 4.5d)
        {
            if (grainCumulTT >= dgf || gAI <= 0.0d)
            {
                phase = 5.0d;
            }
            else
            {
                phase = phase_t1;
            }
        }
        else if (phase_t1 >= 5.0d && phase_t1 < 6.0d)
        {
            localDegfm = degfm;
            if (ignoreGrainMaturation)
            {
                localDegfm = -1.0d;
            }
            if (cumulTTFromZC_91 >= localDegfm)
            {
                phase = 6.0d;
            }
            else
            {
                phase = phase_t1;
            }
        }
        else if (phase_t1 >= 6.0d && phase_t1 < 7.0d)
        {
            phase = phase_t1;
        }
        s.finalLeafNumber           = finalLeafNumber;
        s.phase                     = phase;
        s.hasLastPrimordiumAppeared = hasLastPrimordiumAppeared;
    }
    public void  CalculateModel(PhenologyState s, PhenologyState s1, PhenologyRate r, PhenologyAuxiliary a, PhenologyExogenous ex)
    {
        //- Name: RegisterZadok -Version: 1.0, -Time step: 1
        //- Description:
        //            * Title: RegisterZadok Model
        //            * Author: Pierre MARTRE
        //            * Reference: Modeling development phase in the
        //                Wheat Simulation Model SiriusQuality.
        //                See documentation at http://www1.clermont.inra.fr/siriusquality/?page_id=427
        //            * Institution: INRA/LEPSE Montpellier
        //            * Abstract: Record the zadok stage in the calendar
        //
        //- inputs:
        //            * name: cumulTT
        //                          ** description :
        //                          ** variablecategory : auxiliary
        //                          ** datatype : DOUBLE
        //                          ** min : -200
        //                          ** max : 10000
        //                          ** default : 354.582294511779
        //                          ** unit : °C d
        //                          ** uri : some url
        //                          ** inputtype : variable
        //            * name: phase
        //                          ** description : instance of the phase class . You can get the name of the phase using phase.getPhaseAsString(PhaseValue)
        //                          ** variablecategory : state
        //                          ** inputtype : variable
        //                          ** datatype : DOUBLE
        //                          ** min : 0
        //                          ** max : 7
        //                          ** default : 2
        //                          ** unit :
        //                          ** uri : some url
        //            * name: leafNumber
        //                          ** description : Actual number of phytomers
        //                          ** variablecategory : state
        //                          ** datatype : DOUBLE
        //                          ** min : 0
        //                          ** max : 25
        //                          ** default : 4.8854219661087575
        //                          ** unit : leaf
        //                          ** uri : some url
        //                          ** inputtype : variable
        //            * name: calendarMoments
        //                          ** description : List containing apparition of each stage
        //                          ** variablecategory : state
        //                          ** datatype : STRINGLIST
        //                          ** default : ['Sowing']
        //                          ** unit :
        //                          ** inputtype : variable
        //            * name: calendarDates
        //                          ** description : List containing  the dates of the wheat developmental phases
        //                          ** variablecategory : state
        //                          ** datatype : DATELIST
        //                          ** default : ['2007/3/21']
        //                          ** unit :
        //                          ** inputtype : variable
        //            * name: calendarCumuls
        //                          ** description : list containing for each stage occured its cumulated thermal times
        //                          ** variablecategory : state
        //                          ** datatype : DOUBLELIST
        //                          ** default : [0.0]
        //                          ** unit : °C d
        //                          ** inputtype : variable
        //            * name: cumulTTFromZC_65
        //                          ** description : cumul of the thermal time (DeltaTT) since the moment ZC_65
        //                          ** variablecategory : auxiliary
        //                          ** datatype : DOUBLE
        //                          ** min : -200
        //                          ** max : 10000
        //                          ** default : 0
        //                          ** unit : °C d
        //                          ** uri : some url
        //                          ** inputtype : variable
        //            * name: currentdate
        //                          ** description : current date
        //                          ** variablecategory : auxiliary
        //                          ** datatype : DATE
        //                          ** min :
        //                          ** max :
        //                          ** default : 2007/4/9
        //                          ** unit :
        //                          ** uri : some url
        //                          ** inputtype : variable
        //            * name: der
        //                          ** description : Duration of the endosperm endoreduplication phase
        //                          ** parametercategory : species
        //                          ** datatype : DOUBLE
        //                          ** min : 0
        //                          ** max : 10000
        //                          ** default : 300.0
        //                          ** unit : °C d
        //                          ** uri : some url
        //                          ** inputtype : parameter
        //            * name: slopeTSFLN
        //                          ** description : used to calculate Terminal spikelet
        //                          ** parametercategory : species
        //                          ** datatype : DOUBLE
        //                          ** min : 0
        //                          ** max : 10000
        //                          ** default : 0.9
        //                          ** unit :
        //                          ** uri : some url
        //                          ** inputtype : parameter
        //            * name: intTSFLN
        //                          ** description : used to calculate Terminal spikelet
        //                          ** parametercategory : species
        //                          ** datatype : DOUBLE
        //                          ** min : 0
        //                          ** max : 10000
        //                          ** default : 0.9
        //                          ** unit :
        //                          ** uri : some url
        //                          ** inputtype : parameter
        //            * name: finalLeafNumber
        //                          ** description : final leaf number
        //                          ** variablecategory : state
        //                          ** datatype : DOUBLE
        //                          ** min : 0
        //                          ** max : 10000
        //                          ** default : 8.797582013199484
        //                          ** unit : leaf
        //                          ** uri : some url
        //                          ** inputtype : variable
        //            * name: currentZadokStage
        //                          ** description : current zadok stage
        //                          ** variablecategory : state
        //                          ** datatype : STRING
        //                          ** min :
        //                          ** max :
        //                          ** default : MainShootPlus1Tiller
        //                          ** unit :
        //                          ** uri : some url
        //                          ** inputtype : variable
        //            * name: hasZadokStageChanged_t1
        //                          ** description : true if the zadok stage has changed this time step
        //                          ** variablecategory : state
        //                          ** datatype : INT
        //                          ** min : 0
        //                          ** max : 1
        //                          ** default : 0
        //                          ** unit :
        //                          ** uri : some url
        //                          ** inputtype : variable
        //            * name: sowingDate
        //                          ** description :  Date of Sowing
        //                          ** parametercategory : constant
        //                          ** datatype : DATE
        //                          ** min :
        //                          ** max :
        //                          ** default : 2007/3/21
        //                          ** unit :
        //                          ** inputtype : parameter
        //- outputs:
        //            * name: hasZadokStageChanged
        //                          ** description : true if the zadok stage has changed this time step
        //                          ** variablecategory : state
        //                          ** datatype : INT
        //                          ** min : 0
        //                          ** max : 1
        //                          ** unit :
        //                          ** uri : some url
        //            * name: currentZadokStage
        //                          ** description : current zadok stage
        //                          ** variablecategory : state
        //                          ** datatype : STRING
        //                          ** unit :
        //                          ** uri : some url
        //            * name: calendarMoments
        //                          ** description :  List containing apparition of each stage
        //                          ** variablecategory : state
        //                          ** datatype : STRINGLIST
        //                          ** unit :
        //            * name: calendarDates
        //                          ** description :  List containing  the dates of the wheat developmental phases
        //                          ** variablecategory : state
        //                          ** datatype : DATELIST
        //                          ** unit :
        //            * name: calendarCumuls
        //                          ** description :  list containing for each stage occured its cumulated thermal times
        //                          ** variablecategory : state
        //                          ** datatype : DOUBLELIST
        //                          ** unit : °C d
        double          cumulTT                 = a.cumulTT;
        double          phase                   = s.phase;
        double          leafNumber              = s.leafNumber;
        List <string>   calendarMoments         = s.calendarMoments;
        List <DateTime> calendarDates           = s.calendarDates;
        List <double>   calendarCumuls          = s.calendarCumuls;
        double          cumulTTFromZC_65        = a.cumulTTFromZC_65;
        DateTime        currentdate             = a.currentdate;
        double          finalLeafNumber         = s.finalLeafNumber;
        string          currentZadokStage       = s.currentZadokStage;
        int             hasZadokStageChanged_t1 = s1.hasZadokStageChanged;
        int             hasZadokStageChanged;
        int             roundedFinalLeafNumber;

        roundedFinalLeafNumber = (int)(finalLeafNumber + 0.5d);
        if (leafNumber >= 4.0d && !calendarMoments.Contains("MainShootPlus1Tiller"))
        {
            calendarMoments.Add("MainShootPlus1Tiller");
            calendarCumuls.Add(cumulTT);
            calendarDates.Add(currentdate);
            hasZadokStageChanged = 1;
            currentZadokStage    = "MainShootPlus1Tiller";
        }
        else if (leafNumber >= 5.0d && !calendarMoments.Contains("MainShootPlus2Tiller"))
        {
            calendarMoments.Add("MainShootPlus2Tiller");
            calendarCumuls.Add(cumulTT);
            calendarDates.Add(currentdate);
            hasZadokStageChanged = 1;
            currentZadokStage    = "MainShootPlus2Tiller";
        }
        else if (leafNumber >= 6.0d && !calendarMoments.Contains("MainShootPlus3Tiller"))
        {
            calendarMoments.Add("MainShootPlus3Tiller");
            calendarCumuls.Add(cumulTT);
            calendarDates.Add(currentdate);
            hasZadokStageChanged = 1;
            currentZadokStage    = "MainShootPlus3Tiller";
        }
        else if (finalLeafNumber > 0.0d && (leafNumber >= slopeTSFLN * finalLeafNumber - intTSFLN && !calendarMoments.Contains("TerminalSpikelet")))
        {
            calendarMoments.Add("TerminalSpikelet");
            calendarCumuls.Add(cumulTT);
            calendarDates.Add(currentdate);
            hasZadokStageChanged = 1;
            currentZadokStage    = "TerminalSpikelet";
        }
        else if (leafNumber >= roundedFinalLeafNumber - 4.0d && roundedFinalLeafNumber - 4 > 0 && !calendarMoments.Contains("PseudoStemErection"))
        {
            calendarMoments.Add("PseudoStemErection");
            calendarCumuls.Add(cumulTT);
            calendarDates.Add(currentdate);
            hasZadokStageChanged = 1;
            currentZadokStage    = "PseudoStemErection";
        }
        else if (leafNumber >= roundedFinalLeafNumber - 3.0d && roundedFinalLeafNumber - 3 > 0 && !calendarMoments.Contains("1stNodeDetectable"))
        {
            calendarMoments.Add("1stNodeDetectable");
            calendarCumuls.Add(cumulTT);
            calendarDates.Add(currentdate);
            hasZadokStageChanged = 1;
            currentZadokStage    = "1stNodeDetectable";
        }
        else if (leafNumber >= roundedFinalLeafNumber - 2.0d && roundedFinalLeafNumber - 2 > 0 && !calendarMoments.Contains("2ndNodeDetectable"))
        {
            calendarMoments.Add("2ndNodeDetectable");
            calendarCumuls.Add(cumulTT);
            calendarDates.Add(currentdate);
            hasZadokStageChanged = 1;
            currentZadokStage    = "2ndNodeDetectable";
        }
        else if (leafNumber >= roundedFinalLeafNumber - 1.0d && roundedFinalLeafNumber - 1 > 0 && !calendarMoments.Contains("FlagLeafJustVisible"))
        {
            calendarMoments.Add("FlagLeafJustVisible");
            calendarCumuls.Add(cumulTT);
            calendarDates.Add(currentdate);
            hasZadokStageChanged = 1;
            currentZadokStage    = "FlagLeafJustVisible";
        }
        else if (!calendarMoments.Contains("MidGrainFilling") && (phase == 4.5d && cumulTTFromZC_65 >= der))
        {
            calendarMoments.Add("MidGrainFilling");
            calendarCumuls.Add(cumulTT);
            calendarDates.Add(currentdate);
            hasZadokStageChanged = 1;
            currentZadokStage    = "MidGrainFilling";
        }
        else
        {
            hasZadokStageChanged = 0;
        }
        s.calendarMoments      = calendarMoments;
        s.calendarDates        = calendarDates;
        s.calendarCumuls       = calendarCumuls;
        s.currentZadokStage    = currentZadokStage;
        s.hasZadokStageChanged = hasZadokStageChanged;
    }
    public void  CalculateModel(PhenologyState s, PhenologyState s1, PhenologyRate r, PhenologyAuxiliary a, PhenologyExogenous ex)
    {
        //- Name: UpdateCalendar -Version: 1.0, -Time step: 1
        //- Description:
        //            * Title: Calendar Model
        //            * Author: Pierre Martre
        //            * Reference: Modeling development phase in the
        //                Wheat Simulation Model SiriusQuality.
        //                See documentation at http://www1.clermont.inra.fr/siriusquality/?page_id=427
        //            * Institution: INRA Montpellier
        //            * Abstract: Lists containing for each stage the date it occurs as well as a copy of all types of cumulated thermal times
        //- inputs:
        //            * name: cumulTT
        //                          ** description : cumul thermal times at current date
        //                          ** variablecategory : auxiliary
        //                          ** datatype : DOUBLE
        //                          ** min : -200
        //                          ** max : 10000
        //                          ** default : 741.510096671757
        //                          ** unit : °C d
        //                          ** inputtype : variable
        //            * name: calendarMoments
        //                          ** description : List containing apparition of each stage
        //                          ** variablecategory : state
        //                          ** datatype : STRINGLIST
        //                          ** default : ['Sowing']
        //                          ** unit :
        //                          ** inputtype : variable
        //            * name: calendarDates
        //                          ** description : List containing  the dates of the wheat developmental phases
        //                          ** variablecategory : state
        //                          ** datatype : DATELIST
        //                          ** default : ['2007/3/21']
        //                          ** unit :
        //                          ** inputtype : variable
        //            * name: calendarCumuls
        //                          ** description : list containing for each stage occured its cumulated thermal times
        //                          ** variablecategory : state
        //                          ** datatype : DOUBLELIST
        //                          ** default : [0.0]
        //                          ** unit : °C d
        //                          ** inputtype : variable
        //            * name: currentdate
        //                          ** description : current date
        //                          ** variablecategory : auxiliary
        //                          ** datatype : DATE
        //                          ** default : 2007/3/27
        //                          ** unit :
        //                          ** inputtype : variable
        //            * name: phase
        //                          ** description :  the name of the phase
        //                          ** variablecategory : state
        //                          ** datatype : DOUBLE
        //                          ** min : 0
        //                          ** max : 7
        //                          ** default : 1
        //                          ** unit :
        //                          ** inputtype : variable
        //- outputs:
        //            * name: calendarMoments
        //                          ** description :  List containing apparition of each stage
        //                          ** variablecategory : state
        //                          ** datatype : STRINGLIST
        //                          ** unit :
        //            * name: calendarDates
        //                          ** description :  List containing  the dates of the wheat developmental phases
        //                          ** variablecategory : state
        //                          ** datatype : DATELIST
        //                          ** unit :
        //            * name: calendarCumuls
        //                          ** description :  list containing for each stage occured its cumulated thermal times
        //                          ** variablecategory : state
        //                          ** datatype : DOUBLELIST
        //                          ** unit : °C d
        double          cumulTT         = a.cumulTT;
        List <string>   calendarMoments = s.calendarMoments;
        List <DateTime> calendarDates   = s.calendarDates;
        List <double>   calendarCumuls  = s.calendarCumuls;
        DateTime        currentdate     = a.currentdate;
        double          phase           = s.phase;

        if (phase >= 1.0d && phase < 2.0d && !calendarMoments.Contains("Emergence"))
        {
            calendarMoments.Add("Emergence");
            calendarCumuls.Add(cumulTT);
            calendarDates.Add(currentdate);
        }
        else if (phase >= 2.0d && phase < 3.0d && !calendarMoments.Contains("FloralInitiation"))
        {
            calendarMoments.Add("FloralInitiation");
            calendarCumuls.Add(cumulTT);
            calendarDates.Add(currentdate);
        }
        else if (phase >= 3.0d && phase < 4.0d && !calendarMoments.Contains("Heading"))
        {
            calendarMoments.Add("Heading");
            calendarCumuls.Add(cumulTT);
            calendarDates.Add(currentdate);
        }
        else if (phase == 4.0d && !calendarMoments.Contains("Anthesis"))
        {
            calendarMoments.Add("Anthesis");
            calendarCumuls.Add(cumulTT);
            calendarDates.Add(currentdate);
        }
        else if (phase == 4.5d && !calendarMoments.Contains("EndCellDivision"))
        {
            calendarMoments.Add("EndCellDivision");
            calendarCumuls.Add(cumulTT);
            calendarDates.Add(currentdate);
        }
        else if (phase >= 5.0d && phase < 6.0d && !calendarMoments.Contains("EndGrainFilling"))
        {
            calendarMoments.Add("EndGrainFilling");
            calendarCumuls.Add(cumulTT);
            calendarDates.Add(currentdate);
        }
        else if (phase >= 6.0d && phase < 7.0d && !calendarMoments.Contains("Maturity"))
        {
            calendarMoments.Add("Maturity");
            calendarCumuls.Add(cumulTT);
            calendarDates.Add(currentdate);
        }
        s.calendarMoments = calendarMoments;
        s.calendarDates   = calendarDates;
        s.calendarCumuls  = calendarCumuls;
    }
    public void  CalculateModel(PhenologyState s, PhenologyState s1, PhenologyRate r, PhenologyAuxiliary a, PhenologyExogenous ex)
    {
        //- Name: CumulTTFrom -Version: 1.0, -Time step: 1
        //- Description:
        //            * Title: CumulTTFrom Model
        //            * Author: Pierre Martre
        //            * Reference: Modeling development phase in the
        //                Wheat Simulation Model SiriusQuality.
        //                See documentation at http://www1.clermont.inra.fr/siriusquality/?page_id=427
        //            * Institution: INRA Montpellier
        //            * Abstract: Calculate CumulTT
        //- inputs:
        //            * name: calendarMoments_t1
        //                          ** description : List containing appearance of each stage at previous day
        //                          ** variablecategory : state
        //                          ** datatype : STRINGLIST
        //                          ** default : ['Sowing']
        //                          ** unit :
        //                          ** inputtype : variable
        //            * name: calendarCumuls_t1
        //                          ** description : list containing for each stage occured its cumulated thermal times at previous day
        //                          ** variablecategory : state
        //                          ** datatype : DOUBLELIST
        //                          ** default : [0.0]
        //                          ** unit : °C d
        //                          ** inputtype : variable
        //            * name: cumulTT
        //                          ** description : cumul TT at current date
        //                          ** datatype : DOUBLE
        //                          ** variablecategory : auxiliary
        //                          ** min : -200
        //                          ** max : 10000
        //                          ** default : 8.0
        //                          ** unit : °C d
        //                          ** inputtype : variable
        //- outputs:
        //            * name: cumulTTFromZC_65
        //                          ** description :  cumul TT from Anthesis to current date
        //                          ** variablecategory : auxiliary
        //                          ** datatype : DOUBLE
        //                          ** min : 0
        //                          ** max : 5000
        //                          ** unit : °C d
        //            * name: cumulTTFromZC_39
        //                          ** description :  cumul TT from FlagLeafLiguleJustVisible to current date
        //                          ** variablecategory : auxiliary
        //                          ** datatype : DOUBLE
        //                          ** min : 0
        //                          ** max : 5000
        //                          ** unit : °C d
        //            * name: cumulTTFromZC_91
        //                          ** description :  cumul TT from EndGrainFilling to current date
        //                          ** variablecategory : auxiliary
        //                          ** datatype : DOUBLE
        //                          ** min : 0
        //                          ** max : 5000
        //                          ** unit : °C d
        List <string> calendarMoments_t1 = s1.calendarMoments;
        List <double> calendarCumuls_t1  = s1.calendarCumuls;
        double        cumulTT            = a.cumulTT;
        double        cumulTTFromZC_65;
        double        cumulTTFromZC_39;
        double        cumulTTFromZC_91;

        cumulTTFromZC_65 = 0.0d;
        cumulTTFromZC_39 = 0.0d;
        cumulTTFromZC_91 = 0.0d;
        if (calendarMoments_t1.Contains("Anthesis"))
        {
            cumulTTFromZC_65 = cumulTT - calendarCumuls_t1[calendarMoments_t1.IndexOf("Anthesis")];
        }
        if (calendarMoments_t1.Contains("FlagLeafLiguleJustVisible"))
        {
            cumulTTFromZC_39 = cumulTT - calendarCumuls_t1[calendarMoments_t1.IndexOf("FlagLeafLiguleJustVisible")];
        }
        if (calendarMoments_t1.Contains("EndGrainFilling"))
        {
            cumulTTFromZC_91 = cumulTT - calendarCumuls_t1[calendarMoments_t1.IndexOf("EndGrainFilling")];
        }
        a.cumulTTFromZC_65 = cumulTTFromZC_65;
        a.cumulTTFromZC_39 = cumulTTFromZC_39;
        a.cumulTTFromZC_91 = cumulTTFromZC_91;
    }
Exemple #14
0
    public void  CalculateModel(PhenologyState s, PhenologyState s1, PhenologyRate r, PhenologyAuxiliary a, PhenologyExogenous ex)
    {
        //- Name: PTQ -Version: 1.0, -Time step: 1
        //- Description:
        //            * Title: Phyllochron Model
        //            * Author: Pierre Martre
        //            * Reference: Modeling development phase in the
        //                Wheat Simulation Model SiriusQuality.
        //                See documentation at http://www1.clermont.inra.fr/siriusquality/?page_id=427
        //            * Institution: INRA Montpellier
        //            * Abstract: Calculate Photothermal Quaotient
        //- inputs:
        //            * name: tTWindowForPTQ
        //                          ** description : Thermal time window in which averages are computed
        //                          ** parametercategory : species
        //                          ** datatype : DOUBLE
        //                          ** min : 0.0
        //                          ** max : 70000.0
        //                          ** default : 70.0
        //                          ** unit : °C d
        //                          ** uri : some url
        //                          ** inputtype : parameter
        //            * name: kl
        //                          ** description : Exctinction Coefficient
        //                          ** parametercategory : species
        //                          ** datatype : DOUBLE
        //                          ** min : 0.0
        //                          ** max : 50.0
        //                          ** default : 0.45
        //                          ** unit :
        //                          ** uri : some url
        //                          ** inputtype : parameter
        //            * name: listTTShootWindowForPTQ_t1
        //                          ** description : List of Daily Shoot thermal time during TTWindowForPTQ thermal time period
        //                          ** variablecategory : state
        //                          ** datatype : DOUBLELIST
        //                          ** min :
        //                          ** max :
        //                          ** default : [0.0]
        //                          ** unit : °C d
        //                          ** uri : some url
        //                          ** inputtype : variable
        //            * name: listPARTTWindowForPTQ_t1
        //                          ** description : List of Daily PAR during TTWindowForPTQ thermal time period
        //                          ** variablecategory : state
        //                          ** inputtype : variable
        //                          ** datatype : DOUBLELIST
        //                          ** min :
        //                          ** max :
        //                          ** default : [0.0]
        //                          ** unit : MJ m2 d
        //                          ** uri : some url
        //            * name: listGAITTWindowForPTQ
        //                          ** description : List of daily GAI over TTWindowForPTQ thermal time period
        //                          ** variablecategory : state
        //                          ** inputtype : variable
        //                          ** datatype : DOUBLELIST
        //                          ** min :
        //                          ** max :
        //                          ** default : [0.0, 5.2]
        //                          ** unit : m2 m-2
        //                          ** uri : some url
        //            * name: pAR
        //                          ** description : Daily Photosyntetically Active Radiation
        //                          ** variablecategory : auxiliary
        //                          ** datatype : DOUBLE
        //                          ** default : 0.0
        //                          ** min : 0.0
        //                          ** max : 10000.0
        //                          ** unit : MJ m² d
        //                          ** uri : some url
        //                          ** inputtype : variable
        //            * name: deltaTT
        //                          ** description : daily delta TT
        //                          ** variablecategory : auxiliary
        //                          ** inputtype : variable
        //                          ** datatype : DOUBLE
        //                          ** min : 0.0
        //                          ** max : 100.0
        //                          ** default : 0.0
        //                          ** unit : °C d
        //                          ** uri : some url
        //- outputs:
        //            * name: listPARTTWindowForPTQ
        //                          ** description :  List of Daily PAR during TTWindowForPTQ thermal time period
        //                          ** variablecategory : state
        //                          ** datatype : DOUBLELIST
        //                          ** min :
        //                          ** max :
        //                          ** unit : MJ m2 d
        //            * name: listTTShootWindowForPTQ
        //                          ** description : List of Daily Shoot thermal time during TTWindowForPTQ thermal time period
        //                          ** variablecategory : state
        //                          ** datatype : DOUBLELIST
        //                          ** min :
        //                          ** max :
        //                          ** unit : °C d
        //            * name: ptq
        //                          ** description : Photothermal Quotient
        //                          ** variablecategory : state
        //                          ** datatype : DOUBLE
        //                          ** min : 0
        //                          ** max : 10000
        //                          ** unit : MJ °C-1 d m-2)
        List <double> listTTShootWindowForPTQ_t1 = s1.listTTShootWindowForPTQ;
        List <double> listPARTTWindowForPTQ_t1   = s1.listPARTTWindowForPTQ;
        List <double> listGAITTWindowForPTQ      = s.listGAITTWindowForPTQ;
        double        pAR     = a.pAR;
        double        deltaTT = a.deltaTT;
        List <double> listPARTTWindowForPTQ   = new List <double>();
        List <double> listTTShootWindowForPTQ = new List <double>();
        double        ptq;
        List <double> TTList  = new List <double>();
        List <double> PARList = new List <double>();
        int           i;
        int           count;
        double        SumTT;
        double        parInt = 0.0d;
        double        TTShoot;

        for (i = 0; i != listTTShootWindowForPTQ_t1.Count; i += 1)
        {
            TTList.Add(listTTShootWindowForPTQ_t1[i]);
            PARList.Add(listPARTTWindowForPTQ_t1[i]);
        }
        TTList.Add(deltaTT);
        PARList.Add(pAR);
        SumTT = TTList.Sum();
        count = 0;
        while (SumTT > tTWindowForPTQ)
        {
            SumTT = SumTT - TTList[count];
            count = count + 1;
        }
        for (i = count; i != TTList.Count; i += 1)
        {
            listTTShootWindowForPTQ.Add(TTList[i]);
            listPARTTWindowForPTQ.Add(PARList[i]);
        }
        for (i = 0; i != listTTShootWindowForPTQ.Count; i += 1)
        {
            parInt = parInt + (listPARTTWindowForPTQ[i] * (1 - Math.Exp(-kl * listGAITTWindowForPTQ[i])));
        }
        TTShoot = listTTShootWindowForPTQ.Sum();
        ptq     = parInt / TTShoot;
        s.listPARTTWindowForPTQ   = listPARTTWindowForPTQ;
        s.listTTShootWindowForPTQ = listTTShootWindowForPTQ;
        s.ptq = ptq;
    }
Exemple #15
0
    public void  CalculateModel(PhenologyState s, PhenologyState s1, PhenologyRate r, PhenologyAuxiliary a, PhenologyExogenous ex)
    {
        //- Name: PhylSowingDateCorrection -Version: 1.0, -Time step: 1
        //- Description:
        //            * Title: PhylSowingDateCorrection Model
        //            * Author: Loic Manceau
        //            * Reference: Modeling development phase in the
        //                Wheat Simulation Model SiriusQuality.
        //                See documentation at http://www1.clermont.inra.fr/siriusquality/?page_id=427
        //            * Institution: INRA Montpellier
        //            * Abstract: Correction of the Phyllochron Varietal parameter according to sowing date
        //- inputs:
        //            * name: sowingDay
        //                          ** description : Day of Year at sowing
        //                          ** parametercategory : species
        //                          ** datatype : INT
        //                          ** min : 1
        //                          ** max : 365
        //                          ** default : 1
        //                          ** unit : d
        //                          ** uri : some url
        //                          ** inputtype : parameter
        //            * name: latitude
        //                          ** description : Latitude
        //                          ** parametercategory : soil
        //                          ** datatype : DOUBLE
        //                          ** min : -90
        //                          ** max : 90
        //                          ** default : 0.0
        //                          ** unit : °
        //                          ** uri : some url
        //                          ** inputtype : parameter
        //            * name: sDsa_sh
        //                          ** description : Sowing date at which Phyllochrone is maximum in southern hemispher
        //                          ** parametercategory : species
        //                          ** inputtype : parameter
        //                          ** datatype : DOUBLE
        //                          ** min : 1
        //                          ** max : 365
        //                          ** default : 1.0
        //                          ** unit : d
        //                          ** uri : some url
        //            * name: rp
        //                          ** description : Rate of change of Phyllochrone with sowing date
        //                          ** parametercategory : species
        //                          ** inputtype : parameter
        //                          ** datatype : DOUBLE
        //                          ** min : 0
        //                          ** max : 365
        //                          ** default : 0
        //                          ** unit : d-1
        //                          ** uri : some url
        //            * name: sDws
        //                          ** description : Sowing date at which Phyllochrone is minimum
        //                          ** parametercategory : species
        //                          ** datatype : INT
        //                          ** default : 1
        //                          ** min : 1
        //                          ** max : 365
        //                          ** unit : d
        //                          ** uri : some url
        //                          ** inputtype : parameter
        //            * name: sDsa_nh
        //                          ** description : Sowing date at which Phyllochrone is maximum in northern hemispher
        //                          ** parametercategory : species
        //                          ** datatype : DOUBLE
        //                          ** default : 1.0
        //                          ** min : 1
        //                          ** max : 365
        //                          ** unit : d
        //                          ** uri : some url
        //                          ** inputtype : parameter
        //            * name: p
        //                          ** description : Phyllochron (Varietal parameter)
        //                          ** parametercategory : species
        //                          ** datatype : DOUBLE
        //                          ** default : 120
        //                          ** min : 0
        //                          ** max : 1000
        //                          ** unit : °C d leaf-1
        //                          ** uri : some url
        //                          ** inputtype : parameter
        //- outputs:
        //            * name: fixPhyll
        //                          ** description :  Phyllochron Varietal parameter
        //                          ** variablecategory : auxiliary
        //                          ** datatype : DOUBLE
        //                          ** min : 0
        //                          ** max : 1000
        //                          ** unit : °C d leaf-1
        double fixPhyll;

        if (latitude < 0.0d)
        {
            if (sowingDay > (int)(sDsa_sh))
            {
                fixPhyll = p * (1 - (rp * Math.Min((sowingDay - sDsa_sh), sDws)));
            }
            else
            {
                fixPhyll = p;
            }
        }
        else
        {
            if (sowingDay < (int)(sDsa_nh))
            {
                fixPhyll = p * (1 - (rp * Math.Min(sowingDay, sDws)));
            }
            else
            {
                fixPhyll = p;
            }
        }
        a.fixPhyll = fixPhyll;
    }
    public void Init(PhenologyState s, PhenologyState s1, PhenologyRate r, PhenologyAuxiliary a, PhenologyExogenous ex)
    {
        double        canopyShootNumber_t1;
        double        leafNumber;
        List <double> tilleringProfile_t1      = new List <double>();
        List <int>    leafTillerNumberArray_t1 = new List <int>();
        int           numberTillerCohort_t1;
        double        averageShootNumberPerPlant;
        double        canopyShootNumber;
        List <int>    leafTillerNumberArray = new List <int>();
        List <double> tilleringProfile      = new List <double>();
        int           numberTillerCohort;

        canopyShootNumber          = sowingDensity;
        averageShootNumberPerPlant = 1.0d;
        tilleringProfile.Add(sowingDensity);
        numberTillerCohort           = 1;
        leafTillerNumberArray        = new List <int> {
        };
        s.averageShootNumberPerPlant = averageShootNumberPerPlant;
        s.canopyShootNumber          = canopyShootNumber;
        s.leafTillerNumberArray      = leafTillerNumberArray;
        s.tilleringProfile           = tilleringProfile;
        s.numberTillerCohort         = numberTillerCohort;
    }
Exemple #17
0
    public void  CalculateModel(PhenologyState s, PhenologyState s1, PhenologyRate r, PhenologyAuxiliary a, PhenologyExogenous ex)
    {
        //- Name: VernalizationProgress -Version: 1.0, -Time step: 1
        //- Description:
        //            * Title: VernalizationProgress Model
        //            * Author: Pierre MARTRE
        //            * Reference: Modeling development phase in the
        //                Wheat Simulation Model SiriusQuality.
        //                See documentation at http://www1.clermont.inra.fr/siriusquality/?page_id=427
        //            * Institution: INRA Montpellier
        //            * Abstract: Calculate progress (VernaProg) towards vernalization, but there
        //                  is no vernalization below minTvern
        //                  and above maxTvern . The maximum value of VernaProg is 1.
        //                  Progress towards full vernalization is a linear function of shoot
        //                  temperature (soil temperature until leaf # reach MaxLeafSoil and then
        //                   canopy temperature)
        //
        //- inputs:
        //            * name: dayLength
        //                          ** description : day length
        //                          ** variablecategory : auxiliary
        //                          ** datatype : DOUBLE
        //                          ** min : 0
        //                          ** max : 10000
        //                          ** default : 12.3037621834005
        //                          ** unit : mm2 m-2
        //                          ** inputtype : variable
        //            * name: deltaTT
        //                          ** description : difference cumul TT between j and j-1 day
        //                          ** variablecategory : auxiliary
        //                          ** inputtype : variable
        //                          ** datatype : DOUBLE
        //                          ** min : -20
        //                          ** max : 100
        //                          ** default : 20.3429985011972
        //                          ** unit : °C d
        //            * name: cumulTT
        //                          ** description : cumul thermal times at currentdate
        //                          ** variablecategory : auxiliary
        //                          ** datatype : DOUBLE
        //                          ** min : -200
        //                          ** max : 10000
        //                          ** default : 112.330110409888
        //                          ** unit : °C d
        //                          ** inputtype : variable
        //            * name: leafNumber_t1
        //                          ** description : Actual number of phytomers
        //                          ** variablecategory : state
        //                          ** datatype : DOUBLE
        //                          ** min : 0
        //                          ** max : 25
        //                          ** default : 0
        //                          ** unit : leaf
        //                          ** inputtype : variable
        //            * name: calendarMoments_t1
        //                          ** description : List containing appearance of each stage
        //                          ** variablecategory : state
        //                          ** datatype : STRINGLIST
        //                          ** default : ['Sowing']
        //                          ** unit :
        //                          ** inputtype : variable
        //            * name: calendarDates_t1
        //                          ** description : List containing  the dates of the wheat developmental phases
        //                          ** variablecategory : state
        //                          ** datatype : DATELIST
        //                          ** default : ['2007/3/21']
        //                          ** unit :
        //                          ** inputtype : variable
        //            * name: calendarCumuls_t1
        //                          ** description : list containing for each stage occured its cumulated thermal times
        //                          ** variablecategory : state
        //                          ** datatype : DOUBLELIST
        //                          ** default : [0.0]
        //                          ** unit :
        //                          ** inputtype : variable
        //            * name: minTvern
        //                          ** description : Minimum temperature for vernalization to occur
        //                          ** parametercategory : species
        //                          ** datatype : DOUBLE
        //                          ** min : -20
        //                          ** max : 60
        //                          ** default : 0.0
        //                          ** unit : °C
        //                          ** inputtype : parameter
        //            * name: intTvern
        //                          ** description : Intermediate temperature for vernalization to occur
        //                          ** parametercategory : species
        //                          ** datatype : DOUBLE
        //                          ** min : -20
        //                          ** max : 60
        //                          ** default :  11.0
        //                          ** unit : °C
        //                          ** inputtype : parameter
        //            * name: vAI
        //                          ** description : Response of vernalization rate to temperature
        //                          ** parametercategory : species
        //                          ** datatype : DOUBLE
        //                          ** min : 0
        //                          ** max : 1
        //                          ** default :  0.015
        //                          ** unit : d-1 °C-1
        //                          ** inputtype : parameter
        //            * name: vBEE
        //                          ** description : Vernalization rate at 0°C
        //                          ** parametercategory : species
        //                          ** datatype : DOUBLE
        //                          ** min : 0
        //                          ** max : 1
        //                          ** default : 0.01
        //                          ** unit : d-1
        //                          ** inputtype : parameter
        //            * name: minDL
        //                          ** description : Threshold daylength below which it does influence vernalization rate
        //                          ** parametercategory : species
        //                          ** datatype : DOUBLE
        //                          ** min : 12
        //                          ** max : 24
        //                          ** default : 8.0
        //                          ** unit : h
        //                          ** inputtype : parameter
        //            * name: maxDL
        //                          ** description : Saturating photoperiod above which final leaf number is not influenced by daylength
        //                          ** parametercategory : species
        //                          ** datatype : DOUBLE
        //                          ** min : 0
        //                          ** max : 24
        //                          ** default : 15.0
        //                          ** unit : h
        //                          ** inputtype : parameter
        //            * name: maxTvern
        //                          ** description : Maximum temperature for vernalization to occur
        //                          ** parametercategory : species
        //                          ** datatype : DOUBLE
        //                          ** min : -20
        //                          ** max : 60
        //                          ** default :  23.0
        //                          ** unit : °C
        //                          ** inputtype : parameter
        //            * name: pNini
        //                          ** description : Number of primorida in the apex at emergence
        //                          ** parametercategory : species
        //                          ** datatype : DOUBLE
        //                          ** min : 0
        //                          ** max : 24
        //                          ** default : 4.0
        //                          ** unit : primordia
        //                          ** inputtype : parameter
        //            * name: aMXLFNO
        //                          ** description : Absolute maximum leaf number
        //                          ** parametercategory : species
        //                          ** datatype : DOUBLE
        //                          ** min : 0
        //                          ** max : 25
        //                          ** default : 24.0
        //                          ** unit : leaf
        //                          ** inputtype : parameter
        //            * name: vernaprog_t1
        //                          ** description : progression on a 0  to 1 scale of the vernalization
        //                          ** variablecategory : state
        //                          ** datatype : DOUBLE
        //                          ** min : 0
        //                          ** max : 1
        //                          ** default :  0.5517254187376879
        //                          ** unit :
        //                          ** inputtype : variable
        //            * name: currentdate
        //                          ** description : current date
        //                          ** variablecategory : auxiliary
        //                          ** datatype : DATE
        //                          ** default : 2007/3/27
        //                          ** inputtype : variable
        //                          ** unit :
        //            * name: isVernalizable
        //                          ** description : true if the plant is vernalizable
        //                          ** parametercategory : species
        //                          ** datatype : INT
        //                          ** min : 0
        //                          ** max : 1
        //                          ** default : 1
        //                          ** unit :
        //                          ** inputtype : parameter
        //            * name: minFinalNumber_t1
        //                          ** description : minimum final leaf number
        //                          ** datatype : DOUBLE
        //                          ** min : 0
        //                          ** max : 25
        //                          ** default : 5.5
        //                          ** unit : leaf
        //                          ** inputtype : variable
        //                          ** variablecategory : state
        //- outputs:
        //            * name: vernaprog
        //                          ** description : progression on a 0  to 1 scale of the vernalization
        //                          ** variablecategory : state
        //                          ** datatype : DOUBLE
        //                          ** min : 0
        //                          ** max : 10000
        //                          ** unit :
        //            * name: minFinalNumber
        //                          ** description : minimum final leaf number
        //                          ** variablecategory : state
        //                          ** datatype : DOUBLE
        //                          ** min : 0
        //                          ** max : 10000
        //                          ** unit : leaf
        //            * name: calendarMoments
        //                          ** description : List containing appearance of each stage
        //                          ** variablecategory : state
        //                          ** datatype : STRINGLIST
        //                          ** unit :
        //            * name: calendarDates
        //                          ** description : List containing  the dates of the wheat developmental phases
        //                          ** variablecategory : state
        //                          ** datatype : DATELIST
        //                          ** unit :
        //            * name: calendarCumuls
        //                          ** description : list containing for each stage occured its cumulated thermal times
        //                          ** variablecategory : state
        //                          ** datatype : DOUBLELIST
        //                          ** unit :
        double          dayLength          = a.dayLength;
        double          deltaTT            = a.deltaTT;
        double          cumulTT            = a.cumulTT;
        double          leafNumber_t1      = s1.leafNumber;
        List <string>   calendarMoments_t1 = s1.calendarMoments;
        List <DateTime> calendarDates_t1   = s1.calendarDates;
        List <double>   calendarCumuls_t1  = s1.calendarCumuls;
        double          vernaprog_t1       = s1.vernaprog;
        DateTime        currentdate        = a.currentdate;
        double          minFinalNumber_t1  = s1.minFinalNumber;
        double          vernaprog;
        double          minFinalNumber;
        List <string>   calendarMoments = new List <string>();
        List <DateTime> calendarDates   = new List <DateTime>();
        List <double>   calendarCumuls  = new List <double>();
        double          maxVernaProg;
        double          dLverna;
        double          primordno;
        double          minLeafNumber;
        double          potlfno;
        double          tt;

        calendarMoments = new List <string>(calendarMoments_t1);
        calendarCumuls  = new List <double>(calendarCumuls_t1);
        calendarDates   = new List <DateTime>(calendarDates_t1);
        minFinalNumber  = minFinalNumber_t1;
        vernaprog       = vernaprog_t1;
        if (isVernalizable == 1 && vernaprog_t1 < 1.0d)
        {
            tt = deltaTT;
            if (tt >= minTvern && tt <= intTvern)
            {
                vernaprog = vernaprog_t1 + (vAI * tt) + vBEE;
            }
            else
            {
                vernaprog = vernaprog_t1;
            }
            if (tt > intTvern)
            {
                maxVernaProg = vAI * intTvern + vBEE;
                dLverna      = Math.Max(minDL, Math.Min(maxDL, dayLength));
                vernaprog    = vernaprog + Math.Max(0.0d, maxVernaProg * (1.0d + ((intTvern - tt) / (maxTvern - intTvern) * ((dLverna - minDL) / (maxDL - minDL)))));
            }
            primordno     = 2.0d * leafNumber_t1 + pNini;
            minLeafNumber = minFinalNumber_t1;
            if (vernaprog >= 1.0d || primordno >= aMXLFNO)
            {
                minFinalNumber = Math.Max(primordno, minFinalNumber_t1);
                calendarMoments.Add("EndVernalisation");
                calendarCumuls.Add(cumulTT);
                calendarDates.Add(currentdate);
                vernaprog = Math.Max(1.0d, vernaprog);
            }
            else
            {
                potlfno = aMXLFNO - ((aMXLFNO - minLeafNumber) * vernaprog);
                if (primordno >= potlfno)
                {
                    minFinalNumber = Math.Max((potlfno + primordno) / 2.0d, minFinalNumber_t1);
                    vernaprog      = Math.Max(1.0d, vernaprog);
                    calendarMoments.Add("EndVernalisation");
                    calendarCumuls.Add(cumulTT);
                    calendarDates.Add(currentdate);
                }
            }
        }
        s.vernaprog       = vernaprog;
        s.minFinalNumber  = minFinalNumber;
        s.calendarMoments = calendarMoments;
        s.calendarDates   = calendarDates;
        s.calendarCumuls  = calendarCumuls;
    }
Exemple #18
0
 public PhenologyExogenous(PhenologyExogenous toCopy, bool copyAll) // copy constructor
 {
     if (copyAll)
     {
     }
 }
    public void  CalculateModel(PhenologyState s, PhenologyState s1, PhenologyRate r, PhenologyAuxiliary a, PhenologyExogenous ex)
    {
        //- Name: GAImean -Version: 1.0, -Time step: 1
        //- Description:
        //            * Title: Average GAI on a specific thermal time window
        //            * Author: Loïc Manceau
        //            * Reference: -
        //            * Institution: INRA
        //            * Abstract: -
        //- inputs:
        //            * name: gAI
        //                          ** description : Green Area Index of the day
        //                          ** inputtype : variable
        //                          ** variablecategory : auxiliary
        //                          ** datatype : DOUBLE
        //                          ** default : 0.0
        //                          ** min : 0.0
        //                          ** max : 500.0
        //                          ** unit : m2 leaf m-2 ground
        //                          ** uri :
        //            * name: tTWindowForPTQ
        //                          ** description : Thermal Time window for average
        //                          ** inputtype : parameter
        //                          ** parametercategory : constant
        //                          ** datatype : DOUBLE
        //                          ** default : 0.0
        //                          ** min : 0.0
        //                          ** max : 5000.0
        //                          ** unit : °C d
        //                          ** uri :
        //            * name: deltaTT
        //                          ** description : Thermal time increase of the day
        //                          ** inputtype : variable
        //                          ** variablecategory : auxiliary
        //                          ** datatype : DOUBLE
        //                          ** default : 0.0
        //                          ** min : 0.0
        //                          ** max : 100.0
        //                          ** unit : °C d
        //                          ** uri :
        //            * name: pastMaxAI_t1
        //                          ** description : Maximum Leaf Area Index reached the current day
        //                          ** inputtype : variable
        //                          ** variablecategory : state
        //                          ** datatype : DOUBLE
        //                          ** default : 0.0
        //                          ** min : 0.0
        //                          ** max : 5000.0
        //                          ** unit : m2 leaf m-2 ground
        //                          ** uri :
        //            * name: listTTShootWindowForPTQ1_t1
        //                          ** description : List of daily shoot thermal time in the window dedicated to average
        //                          ** inputtype : variable
        //                          ** variablecategory : state
        //                          ** datatype : DOUBLELIST
        //                          ** default : [0.0]
        //                          ** min :
        //                          ** max :
        //                          ** unit : °C d
        //                          ** uri :
        //            * name: listGAITTWindowForPTQ_t1
        //                          ** description : List of daily Green Area Index in the window dedicated to average
        //                          ** inputtype : variable
        //                          ** variablecategory : state
        //                          ** datatype : DOUBLELIST
        //                          ** default : [0.0]
        //                          ** min :
        //                          ** max :
        //                          ** unit : m2 leaf m-2 ground
        //                          ** uri :
        //- outputs:
        //            * name: gAImean
        //                          ** description : Mean Green Area Index
        //                          ** variablecategory : state
        //                          ** datatype : DOUBLE
        //                          ** min : 0.0
        //                          ** max : 500.0
        //                          ** unit : m2 leaf m-2 ground
        //                          ** uri :
        //            * name: pastMaxAI
        //                          ** description : Maximum Leaf Area Index reached the current day
        //                          ** variablecategory : state
        //                          ** datatype : DOUBLE
        //                          ** min : 0.0
        //                          ** max : 5000.0
        //                          ** unit : m2 leaf m-2 ground
        //                          ** uri :
        //            * name: listTTShootWindowForPTQ1
        //                          ** description : List of daily shoot thermal time in the window dedicated to average
        //                          ** variablecategory : state
        //                          ** datatype : DOUBLELIST
        //                          ** min :
        //                          ** max :
        //                          ** unit : °C d
        //                          ** uri :
        //            * name: listGAITTWindowForPTQ
        //                          ** description : List of daily Green Area Index in the window dedicated to average
        //                          ** variablecategory : state
        //                          ** datatype : DOUBLELIST
        //                          ** min :
        //                          ** max :
        //                          ** unit : m2 leaf m-2 ground
        //                          ** uri :
        double        gAI          = a.gAI;
        double        deltaTT      = a.deltaTT;
        double        pastMaxAI_t1 = s1.pastMaxAI;
        List <double> listTTShootWindowForPTQ1_t1 = s1.listTTShootWindowForPTQ1;
        List <double> listGAITTWindowForPTQ_t1    = s1.listGAITTWindowForPTQ;
        double        gAImean;
        double        pastMaxAI;
        List <double> listTTShootWindowForPTQ1 = new List <double>();
        List <double> listGAITTWindowForPTQ    = new List <double>();
        List <double> TTList  = new List <double>();
        List <double> GAIList = new List <double>();
        double        SumTT;
        int           count        = 0;
        double        gai_         = 0.0d;
        double        gaiMean_     = 0.0d;
        int           countGaiMean = 0;
        int           i;

        for (i = 0; i != listTTShootWindowForPTQ1_t1.Count; i += 1)
        {
            TTList.Add(listTTShootWindowForPTQ1_t1[i]);
            GAIList.Add(listGAITTWindowForPTQ_t1[i]);
        }
        TTList.Add(deltaTT);
        GAIList.Add(gAI);
        SumTT = TTList.Sum();
        while (SumTT > tTWindowForPTQ)
        {
            SumTT = SumTT - TTList[count];
            count = count + 1;
        }
        for (i = count; i != TTList.Count; i += 1)
        {
            listTTShootWindowForPTQ1.Add(TTList[i]);
            listGAITTWindowForPTQ.Add(GAIList[i]);
        }
        for (i = 0; i != listGAITTWindowForPTQ.Count; i += 1)
        {
            gaiMean_     = gaiMean_ + listGAITTWindowForPTQ[i];
            countGaiMean = countGaiMean + 1;
        }
        gaiMean_    = gaiMean_ / countGaiMean;
        gai_        = Math.Max(pastMaxAI_t1, gaiMean_);
        pastMaxAI   = gai_;
        gAImean     = gai_;
        s.gAImean   = gAImean;
        s.pastMaxAI = pastMaxAI;
        s.listTTShootWindowForPTQ1 = listTTShootWindowForPTQ1;
        s.listGAITTWindowForPTQ    = listGAITTWindowForPTQ;
    }