Rev 438 | Rev 442 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1 | |||
247 | werner | 2 | /** @class ResourceUnitSpecies |
3 | The class contains data available at ResourceUnit x Species scale. |
||
111 | Werner | 4 | Data stored is either statistical (i.e. number of trees per species) or used |
5 | within the model (e.g. fraction of utilizable Radiation) |
||
6 | */ |
||
7 | #include "global.h" |
||
189 | iland | 8 | #include "resourceunitspecies.h" |
111 | Werner | 9 | |
10 | #include "species.h" |
||
189 | iland | 11 | #include "resourceunit.h" |
376 | werner | 12 | |
440 | werner | 13 | |
376 | werner | 14 | double ResourceUnitSpecies::leafArea() const |
15 | { |
||
16 | // Leaf area of the species: |
||
17 | // total leaf area on the RU * fraction of leafarea |
||
18 | return mLAIfactor * ru()->leafAreaIndex(); |
||
19 | } |
||
20 | |||
235 | werner | 21 | void ResourceUnitSpecies::setup(Species *species, ResourceUnit *ru) |
22 | { |
||
23 | mSpecies = species; |
||
24 | mRU = ru; |
||
25 | mResponse.setup(this); |
||
26 | m3PG.setResponse(&mResponse); |
||
440 | werner | 27 | mEstablishment.setup(ru->climate(), this); |
235 | werner | 28 | mStatistics.setResourceUnitSpecies(this); |
277 | werner | 29 | mStatisticsDead.setResourceUnitSpecies(this); |
278 | werner | 30 | mStatisticsMgmt.setResourceUnitSpecies(this); |
440 | werner | 31 | |
277 | werner | 32 | mRemovedGrowth = 0.; |
438 | werner | 33 | mLastYear = -1; |
235 | werner | 34 | } |
111 | Werner | 35 | |
36 | |||
440 | werner | 37 | void ResourceUnitSpecies::calculate(const bool fromEstablishment) |
226 | werner | 38 | { |
438 | werner | 39 | if (mLastYear == GlobalSettings::instance()->currentYear()) |
40 | return; |
||
41 | mLastYear = GlobalSettings::instance()->currentYear(); |
||
42 | |||
43 | statistics().clear(); |
||
440 | werner | 44 | if (mLAIfactor>0 || fromEstablishment==true) { |
369 | werner | 45 | mResponse.calculate();///< calculate environmental responses per species (vpd, temperature, ...) |
46 | m3PG.calculate();///< production of NPP |
||
47 | } else { |
||
48 | // if no LAI is present, then just clear the respones. |
||
376 | werner | 49 | // note: subject to change when regeneration is added... |
369 | werner | 50 | mResponse.clear(); |
51 | m3PG.clear(); |
||
52 | } |
||
226 | werner | 53 | } |
277 | werner | 54 | |
55 | |||
56 | void ResourceUnitSpecies::updateGWL() |
||
57 | { |
||
58 | // removed growth is the running sum of all removed |
||
59 | // tree volume. the current "GWL" therefore is current volume (standing) + mRemovedGrowth. |
||
278 | werner | 60 | mRemovedGrowth+=statisticsDead().volume() + statisticsMgmt().volume(); |
277 | werner | 61 | } |
440 | werner | 62 | |
63 | void ResourceUnitSpecies::calclulateEstablishment() |
||
64 | { |
||
65 | mEstablishment.calculate(); |
||
66 | |||
67 | if ( logLevelDebug() ) |
||
68 | qDebug() << "establishment of RU" << mRU->index() << "species" << species()->id() |
||
69 | << "seeds density:" << mEstablishment.avgSeedDensity() |
||
70 | << "abiotic environment:" << mEstablishment.abioticEnvironment() |
||
71 | << "f_env,yr:" << m3PG.fEnvYear() |
||
72 | << "N(established):" << mEstablishment.numberEstablished(); |
||
73 | |||
74 | } |