Subversion Repositories public iLand

Rev

Rev 159 | Rev 179 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1
 
90 Werner 2
#ifndef SPECIES_H
3
#define SPECIES_H
38 Werner 4
 
103 Werner 5
 
91 Werner 6
#include "expression.h"
7
 
103 Werner 8
#include "speciesset.h"
102 Werner 9
 
91 Werner 10
class StampContainer; // forwards
38 Werner 11
class Stamp;
91 Werner 12
 
103 Werner 13
 
90 Werner 14
class Species
38 Werner 15
{
16
public:
111 Werner 17
    Species(SpeciesSet *set) { mSet = set; mIndex=set->count(); }
91 Werner 18
    // properties
19
    /// @property id 4-character unique identification of the tree species
111 Werner 20
    const QString &id() const { return mId; }
91 Werner 21
    /// the full name (e.g. Picea Abies) of the species
111 Werner 22
    const QString &name() const { return mName; }
145 Werner 23
    int index() const { return mIndex; } ///< unique index of species within current set
136 Werner 24
 
91 Werner 25
    // calculations: allometries
145 Werner 26
    double biomassFoliage(const double dbh) const;
27
    double biomassWoody(const double dbh) const;
28
    double biomassRoot(const double dbh) const;
29
    double allometricRatio_wf() const { return mWoody_b / mFoliage_b; }
30
    double allometricFractionStem(const double dbh) const;
136 Werner 31
 
116 Werner 32
    // turnover rates
145 Werner 33
    double turnoverLeaf() const { return mTurnoverLeaf; }
34
    double turnoverRoot() const { return mTurnoverRoot; }
119 Werner 35
    // hd-values
36
    void hdRange(const double dbh, double &rMinHD, double &rMaxHD);
125 Werner 37
    // growth
145 Werner 38
    double volumeFactor() const { return mVolumeFactor; } ///< factor for volume calculation: V = factor * D^2*H (incorporates density and the form of the bole)
39
    double density() const { return mWoodDensity; } ///< density of stem wood [kg/m3]
40
    double specificLeafArea() const { return mSpecificLeafArea; }
159 werner 41
    // mortality
42
    double deathProb_intrinsic() const { return mDeathProb_intrinsic; }
43
    double deathProb_stress() const { return mDeathProb_stress; }
169 werner 44
    // aging
45
    double aging(const float height, const int age);
110 Werner 46
 
136 Werner 47
    const Stamp* stamp(const float dbh, const float height) const { return mLIPs.stamp(dbh, height);}
39 Werner 48
    // maintenance
91 Werner 49
    void setup();
38 Werner 50
private:
90 Werner 51
    Q_DISABLE_COPY(Species);
136 Werner 52
    // helpers during setup
53
    double doubleVar(const QString s) { return mSet->var(s).toDouble(); }///< during setup: get value of variable @p s as a double.
54
    double intVar(const QString s) { return mSet->var(s).toInt(); } ///< during setup: get value of variable @p s as an integer.
55
    QString stringVar(const QString s) { return mSet->var(s).toString(); } ///< during setup: get value of variable @p s as a string.
56
 
91 Werner 57
    SpeciesSet *mSet; ///< ptr. to the "parent" set
136 Werner 58
    StampContainer mLIPs; ///< ptr to the container of the LIP-pattern
91 Werner 59
    QString mId;
60
    QString mName;
111 Werner 61
    int mIndex; ///< internal index within the SpeciesSet
136 Werner 62
    // biomass allometries:
63
    double mFoliage_a, mFoliage_b;  ///< allometry (biomass = a * dbh^b) for foliage
64
    double mWoody_a, mWoody_b; ///< allometry (biomass = a * dbh^b) for woody compartments aboveground
65
    double mRoot_a, mRoot_b; ///< allometry (biomass = a * dbh^b) for roots (compound, fine and coarse roots as one pool)
66
    double mBranch_a, mBranch_b; ///< allometry (biomass = a * dbh^b) for branches
67
 
110 Werner 68
    double mSpecificLeafArea; ///< conversion factor from kg OTS to m2 LeafArea
116 Werner 69
    // turnover rates
70
    double mTurnoverLeaf; ///< yearly turnover rate leafs
71
    double mTurnoverRoot; ///< yearly turnover rate root
119 Werner 72
    // height-diameter-relationships
73
    Expression mHDlow; ///< minimum HD-relation as f(d) (open grown tree)
74
    Expression mHDhigh; ///< maximum HD-relation as f(d)
125 Werner 75
    // stem density and taper
76
    double mWoodDensity; ///< density of the wood [kg/m3]
77
    double mFormFactor; ///< taper form factor of the stem [-] used for volume / stem-mass calculation calculation
78
    double mVolumeFactor; ///< factor for volume calculation
159 werner 79
    // mortality
80
    double mDeathProb_intrinsic;  ///< prob. of intrinsic death per year [0..1]
81
    double mDeathProb_stress; ///< max. prob. of death per year when tree suffering maximum stress
169 werner 82
    // Aging
83
    double mMaximumAge; ///< maximum age of species (years)
84
    double mMaximumHeight; ///< maximum height of species (m) for aging
85
    Expression mAging;
38 Werner 86
};
87
 
40 Werner 88
 
119 Werner 89
// inlined functions...
90
inline void Species::hdRange(const double dbh, double &rLowHD, double &rHighHD)
91
{
92
    rLowHD = mHDlow.calculate(dbh);
93
    rHighHD = mHDhigh.calculate(dbh);
94
}
95
 
90 Werner 96
#endif // SPECIES_H