Rev 280 | Rev 287 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 280 | Rev 281 | ||
---|---|---|---|
1 | Redirecting to URL 'https://iland.boku.ac.at/svn/iland/tags/release_1.0/src/core/resourceunit.h': |
1 | Redirecting to URL 'https://iland.boku.ac.at/svn/iland/tags/release_1.0/src/core/resourceunit.h': |
2 | #ifndef RESOURCEUNIT_H
|
2 | #ifndef RESOURCEUNIT_H
|
3 | #define RESOURCEUNIT_H
|
3 | #define RESOURCEUNIT_H
|
4 | 4 | ||
5 | #include "tree.h"
|
5 | #include "tree.h"
|
6 | #include "resourceunitspecies.h"
|
6 | #include "resourceunitspecies.h"
|
7 | #include "standstatistics.h"
|
7 | #include "standstatistics.h"
|
8 | 8 | ||
9 | class SpeciesSet; |
9 | class SpeciesSet; |
10 | class Climate; |
10 | class Climate; |
11 | class WaterCycle; |
11 | class WaterCycle; |
- | 12 | struct ResourceUnitVariables
|
|
- | 13 | {
|
|
- | 14 | double nitrogenAvailable; ///< nitrogen content (kg/m2/year) |
|
- | 15 | }; |
|
12 | 16 | ||
13 | class ResourceUnit
|
17 | class ResourceUnit
|
14 | {
|
18 | {
|
15 | public: |
19 | public: |
16 | ResourceUnit(const int index); |
20 | ResourceUnit(const int index); |
17 | ~ResourceUnit(); |
21 | ~ResourceUnit(); |
18 | 22 | ||
19 | // access to elements
|
23 | // access to elements
|
20 | const Climate *climate() const { return mClimate; } ///< link to the climate on this resource unit |
24 | const Climate *climate() const { return mClimate; } ///< link to the climate on this resource unit |
21 | const WaterCycle *waterCycle() const { return mWater; } ///< water model of the unit |
25 | const WaterCycle *waterCycle() const { return mWater; } ///< water model of the unit |
22 | SpeciesSet *speciesSet() const { return mSpeciesSet; } ///< get SpeciesSet this RU links to. |
26 | SpeciesSet *speciesSet() const { return mSpeciesSet; } ///< get SpeciesSet this RU links to. |
23 | ResourceUnitSpecies &resourceUnitSpecies(const Species *species); ///< get RU-Species-container of @p species from the RU |
27 | ResourceUnitSpecies &resourceUnitSpecies(const Species *species); ///< get RU-Species-container of @p species from the RU |
24 | const QVector<ResourceUnitSpecies> ruSpecies() const { return mRUSpecies; } |
28 | const QVector<ResourceUnitSpecies> ruSpecies() const { return mRUSpecies; } |
25 | QVector<Tree> &trees() { return mTrees; } ///< reference to the tree list. |
29 | QVector<Tree> &trees() { return mTrees; } ///< reference to the tree list. |
26 | const QVector<Tree> &constTrees() const { return mTrees; } ///< reference to the tree list. |
30 | const QVector<Tree> &constTrees() const { return mTrees; } ///< reference to the tree list. |
- | 31 | const ResourceUnitVariables &resouceUnitVariables() const { return mUnitVariables; } ///< access to variables that are specific to resourceUnit (e.g. nitrogenAvailable) |
|
27 | 32 | ||
28 | // properties
|
33 | // properties
|
29 | int index() const { return mIndex; } |
34 | int index() const { return mIndex; } |
30 | const QRectF &boundingBox() const { return mBoundingBox; } |
35 | const QRectF &boundingBox() const { return mBoundingBox; } |
31 | double area() const { return mPixelCount*100; } ///< get the resuorce unit area in m2 |
36 | double area() const { return mPixelCount*100; } ///< get the resuorce unit area in m2 |
32 | double stockedArea() const { return mStockedArea; } ///< get the stocked area in m2 |
37 | double stockedArea() const { return mStockedArea; } ///< get the stocked area in m2 |
33 | double productiveArea() const { return mEffectiveArea; } ///< TotalArea - Unstocked Area - loss due to BeerLambert (m2) |
38 | double productiveArea() const { return mEffectiveArea; } ///< TotalArea - Unstocked Area - loss due to BeerLambert (m2) |
34 | 39 | ||
35 | // actions
|
40 | // actions
|
36 | /// returns a modifiable reference to a free space inside the tree-vector. should be used for tree-init.
|
41 | /// returns a modifiable reference to a free space inside the tree-vector. should be used for tree-init.
|
37 | Tree &newTree(); |
42 | Tree &newTree(); |
38 | /// addWLA() is called by each tree to aggregate the total weighted leaf area on a unit
|
43 | /// addWLA() is called by each tree to aggregate the total weighted leaf area on a unit
|
39 | void addWLA(const float LA, const float LRI) { mAggregatedWLA += LA*LRI; mAggregatedLA += LA; } |
44 | void addWLA(const float LA, const float LRI) { mAggregatedWLA += LA*LRI; mAggregatedLA += LA; } |
40 | void addLR(const float LA, const float LightResponse) { mAggregatedLR += LA*LightResponse; } |
45 | void addLR(const float LA, const float LightResponse) { mAggregatedLR += LA*LightResponse; } |
41 | /// function that distributes effective interception area according to the weight of Light response and LeafArea of the indivudal (@sa production())
|
46 | /// function that distributes effective interception area according to the weight of Light response and LeafArea of the indivudal (@sa production())
|
42 | double interceptedArea(const double LA, const double LightResponse) { return mEffectiveArea_perWLA * LA * LightResponse; } |
47 | double interceptedArea(const double LA, const double LightResponse) { return mEffectiveArea_perWLA * LA * LightResponse; } |
43 | void calculateInterceptedArea(); |
48 | void calculateInterceptedArea(); |
44 | const double &LRImodifier() const { return mLRI_modification; } |
49 | const double &LRImodifier() const { return mLRI_modification; } |
45 | 50 | ||
46 | // model flow
|
51 | // model flow
|
47 | void newYear(); ///< reset values for a new simulation year |
52 | void newYear(); ///< reset values for a new simulation year |
48 | void production(); ///< called after the LIP/LIF calc, before growth of individual trees |
53 | void production(); ///< called after the LIP/LIF calc, before growth of individual trees |
49 | void yearEnd(); ///< called after the growth of individuals |
54 | void yearEnd(); ///< called after the growth of individuals |
50 | 55 | ||
51 | // stocked area calculation
|
56 | // stocked area calculation
|
52 | void countStockedPixel(bool pixelIsStocked) { mPixelCount++; if (pixelIsStocked) mStockedPixelCount++; } |
57 | void countStockedPixel(bool pixelIsStocked) { mPixelCount++; if (pixelIsStocked) mStockedPixelCount++; } |
53 | void createStandStatistics(); |
58 | void createStandStatistics(); |
54 | // setup/maintenance
|
59 | // setup/maintenance
|
55 | void cleanTreeList(); ///< remove dead trees from the tree storage. |
60 | void cleanTreeList(); ///< remove dead trees from the tree storage. |
56 | void setup(); ///< setup operations after the creation of the model space. |
61 | void setup(); ///< setup operations after the creation of the model space. |
57 | void setSpeciesSet(SpeciesSet *set); |
62 | void setSpeciesSet(SpeciesSet *set); |
58 | void setClimate(Climate* climate) { mClimate = climate; } |
63 | void setClimate(Climate* climate) { mClimate = climate; } |
59 | void setBoundingBox(const QRectF &bb) { mBoundingBox = bb; } |
64 | void setBoundingBox(const QRectF &bb) { mBoundingBox = bb; } |
60 | private: |
65 | private: |
61 | int mIndex; // internal index |
66 | int mIndex; // internal index |
62 | Climate *mClimate; ///< pointer to the climate object of this RU |
67 | Climate *mClimate; ///< pointer to the climate object of this RU |
63 | SpeciesSet *mSpeciesSet; ///< pointer to the species set for this RU |
68 | SpeciesSet *mSpeciesSet; ///< pointer to the species set for this RU |
64 | WaterCycle *mWater; ///< link to the Soil water calculation engine |
69 | WaterCycle *mWater; ///< link to the Soil water calculation engine |
65 | QVector<ResourceUnitSpecies> mRUSpecies; ///< data for this ressource unit per species |
70 | QVector<ResourceUnitSpecies> mRUSpecies; ///< data for this ressource unit per species |
66 | QVector<Tree> mTrees; ///< storage container for tree individuals |
71 | QVector<Tree> mTrees; ///< storage container for tree individuals |
67 | QRectF mBoundingBox; ///< bounding box (metric) of the RU |
72 | QRectF mBoundingBox; ///< bounding box (metric) of the RU |
68 | double mAggregatedLA; ///< sum of leafArea |
73 | double mAggregatedLA; ///< sum of leafArea |
69 | double mAggregatedWLA; ///< sum of lightResponse * LeafArea for all trees |
74 | double mAggregatedWLA; ///< sum of lightResponse * LeafArea for all trees |
70 | double mAggregatedLR; ///< sum of lightresponse*LA of the current unit |
75 | double mAggregatedLR; ///< sum of lightresponse*LA of the current unit |
71 | double mEffectiveArea; ///< total "effective" area per resource unit, i.e. area of RU - non-stocked - beerLambert-loss |
76 | double mEffectiveArea; ///< total "effective" area per resource unit, i.e. area of RU - non-stocked - beerLambert-loss |
72 | double mEffectiveArea_perWLA; ///< |
77 | double mEffectiveArea_perWLA; ///< |
73 | double mLRI_modification; |
78 | double mLRI_modification; |
74 | 79 | ||
75 | int mPixelCount; ///< count of (Heightgrid) pixels thare are inside the RU |
80 | int mPixelCount; ///< count of (Heightgrid) pixels thare are inside the RU |
76 | int mStockedPixelCount; ///< count of pixels that are stocked with trees |
81 | int mStockedPixelCount; ///< count of pixels that are stocked with trees |
77 | double mStockedArea; ///< size of stocked area |
82 | double mStockedArea; ///< size of stocked area |
78 | StandStatistics mStatistics; ///< aggregate values on stand value |
83 | StandStatistics mStatistics; ///< aggregate values on stand value |
- | 84 | ResourceUnitVariables mUnitVariables;
|
|
79 | 85 | ||
80 | friend class RUWrapper; |
86 | friend class RUWrapper; |
81 | }; |
87 | }; |
82 | 88 | ||
83 | #endif // RESOURCEUNIT_H
|
89 | #endif // RESOURCEUNIT_H
|
84 | 90 |