Subversion Repositories public iLand

Rev

Rev 145 | Rev 169 | 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; }
110 Werner 44
 
136 Werner 45
    const Stamp* stamp(const float dbh, const float height) const { return mLIPs.stamp(dbh, height);}
39 Werner 46
    // maintenance
91 Werner 47
    void setup();
38 Werner 48
private:
90 Werner 49
    Q_DISABLE_COPY(Species);
136 Werner 50
    // helpers during setup
51
    double doubleVar(const QString s) { return mSet->var(s).toDouble(); }///< during setup: get value of variable @p s as a double.
52
    double intVar(const QString s) { return mSet->var(s).toInt(); } ///< during setup: get value of variable @p s as an integer.
53
    QString stringVar(const QString s) { return mSet->var(s).toString(); } ///< during setup: get value of variable @p s as a string.
54
 
91 Werner 55
    SpeciesSet *mSet; ///< ptr. to the "parent" set
136 Werner 56
    StampContainer mLIPs; ///< ptr to the container of the LIP-pattern
91 Werner 57
    QString mId;
58
    QString mName;
111 Werner 59
    int mIndex; ///< internal index within the SpeciesSet
136 Werner 60
    // biomass allometries:
61
    double mFoliage_a, mFoliage_b;  ///< allometry (biomass = a * dbh^b) for foliage
62
    double mWoody_a, mWoody_b; ///< allometry (biomass = a * dbh^b) for woody compartments aboveground
63
    double mRoot_a, mRoot_b; ///< allometry (biomass = a * dbh^b) for roots (compound, fine and coarse roots as one pool)
64
    double mBranch_a, mBranch_b; ///< allometry (biomass = a * dbh^b) for branches
65
 
110 Werner 66
    double mSpecificLeafArea; ///< conversion factor from kg OTS to m2 LeafArea
116 Werner 67
    // turnover rates
68
    double mTurnoverLeaf; ///< yearly turnover rate leafs
69
    double mTurnoverRoot; ///< yearly turnover rate root
119 Werner 70
    // height-diameter-relationships
71
    Expression mHDlow; ///< minimum HD-relation as f(d) (open grown tree)
72
    Expression mHDhigh; ///< maximum HD-relation as f(d)
125 Werner 73
    // stem density and taper
74
    double mWoodDensity; ///< density of the wood [kg/m3]
75
    double mFormFactor; ///< taper form factor of the stem [-] used for volume / stem-mass calculation calculation
76
    double mVolumeFactor; ///< factor for volume calculation
159 werner 77
    // mortality
78
    double mDeathProb_intrinsic;  ///< prob. of intrinsic death per year [0..1]
79
    double mDeathProb_stress; ///< max. prob. of death per year when tree suffering maximum stress
38 Werner 80
};
81
 
40 Werner 82
 
119 Werner 83
// inlined functions...
84
inline void Species::hdRange(const double dbh, double &rLowHD, double &rHighHD)
85
{
86
    rLowHD = mHDlow.calculate(dbh);
87
    rHighHD = mHDhigh.calculate(dbh);
88
}
89
 
90 Werner 90
#endif // SPECIES_H