Rev 255 | Rev 436 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1 | |||
211 | werner | 2 | #ifndef PHENOLOGY_H |
3 | #define PHENOLOGY_H |
||
214 | werner | 4 | class Climate; |
211 | werner | 5 | |
6 | class Phenology |
||
7 | { |
||
8 | public: |
||
434 | werner | 9 | Phenology() {mClimate=0; mId=0; mMinVpd=mMaxVpd=mMinDayLength=mMaxDayLength=mMinTemp=mMaxTemp=0.; mDayStart=0;mDayEnd=365;mChillDaysBefore=-1; mChillDaysAfter=0;mChillDaysAfterLastYear=0;} |
255 | werner | 10 | Phenology(const int id, const Climate* climate, const double minVpd, const double maxVpd, |
211 | werner | 11 | const double minDayLength, const double maxDayLength, |
214 | werner | 12 | const double minTemp, const double maxTemp): mId(id), mClimate(climate), mMinVpd(minVpd), mMaxVpd(maxVpd), |
434 | werner | 13 | mMinDayLength(minDayLength), mMaxDayLength(maxDayLength), mMinTemp(minTemp), mMaxTemp(maxTemp),mChillDaysAfter(0),mChillDaysAfterLastYear(0) {} |
211 | werner | 14 | // access |
15 | const int id() const { return mId; } |
||
16 | /// calculate the phenology for the current year |
||
17 | void calculate(); |
||
226 | werner | 18 | /// get result of phenology calcualtion for this year (a pointer to a array of 12 values between 0..1: 0: no days with foliage) |
211 | werner | 19 | const double *month() const { return mPhenoFraction; } |
226 | werner | 20 | int vegetationPeriodLength() const { return mDayEnd - mDayStart; } ///< length of vegetation period in days, returs 365 for evergreens |
21 | int vegetationPeriodStart() const { return mDayStart; } ///< day of year when vegeation period starts |
||
22 | int vegetationPeriodEnd() const { return mDayEnd; } ///< day of year when vegeation period stops |
||
434 | werner | 23 | // chilling days |
24 | /// get days of year that meet chilling requirements: the days in the autumn of the last year + the days of this spring season |
||
25 | int chillingDays() const { return mChillDaysBefore + mChillDaysAfterLastYear; } |
||
26 | int chillingDaysLastYear() const { return mChillDaysAfterLastYear; } |
||
211 | werner | 27 | |
28 | |||
29 | private: |
||
30 | int mId; ///< identifier of this Phenology group |
||
255 | werner | 31 | const Climate *mClimate; ///< link to relevant climate source |
211 | werner | 32 | double mMinVpd; ///< minimum vpd [kPa] |
33 | double mMaxVpd; ///< maximum vpd [kPa] |
||
34 | double mMinDayLength; ///< minimum daylength [hours] |
||
35 | double mMaxDayLength; ///< maximum daylength [hours] |
||
36 | double mMinTemp; ///< minimum temperature [°] |
||
37 | double mMaxTemp; ///< maximum temperature [°] |
||
38 | double mPhenoFraction[12]; ///< fraction [0..1] of month i [0..11] to are inside the vegetation period, i.e. have leafs |
||
226 | werner | 39 | int mDayStart; ///< start of vegetation period (in day of year) |
40 | int mDayEnd; ///< end of vegetation period (in days of year, 1.1. = 0) |
||
434 | werner | 41 | // some special calculations used for establishment |
42 | void calculateChillDays(); |
||
43 | int mChillDaysBefore, mChillDaysAfter; ///< number of days that meet chilling requirements (>-5°, <+5°C) before and after the vegetation period in this yeaer |
||
44 | int mChillDaysAfterLastYear; ///< chilling days of the last years autumn/winter |
||
211 | werner | 45 | }; |
46 | |||
47 | #endif // PHENOLOGY_H |