Subversion Repositories public iLand

Rev

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