Subversion Repositories public iLand

Rev

Rev 370 | Rev 431 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 370 Rev 376
Line 37... Line 37...
37
void ResourceUnit::setup()
37
void ResourceUnit::setup()
38
{
38
{
39
    mWater->setup(this);
39
    mWater->setup(this);
40
    // setup variables
40
    // setup variables
41
    mUnitVariables.nitrogenAvailable = GlobalSettings::instance()->settings().valueDouble("model.site.availableNitrogen", 40);
41
    mUnitVariables.nitrogenAvailable = GlobalSettings::instance()->settings().valueDouble("model.site.availableNitrogen", 40);
-
 
42
    mAverageAging = 0.;
42
43
43
}
44
}
44
45
45
/// set species and setup the species-per-RU-data
46
/// set species and setup the species-per-RU-data
46
void ResourceUnit::setSpeciesSet(SpeciesSet *set)
47
void ResourceUnit::setSpeciesSet(SpeciesSet *set)
Line 186... Line 187...
186
    // invoke species specific calculation (3PG)
187
    // invoke species specific calculation (3PG)
187
    for (i=mRUSpecies.begin(); i!=iend; ++i) {
188
    for (i=mRUSpecies.begin(); i!=iend; ++i) {
188
        i->statistics().clear();
189
        i->statistics().clear();
189
        i->calculate();
190
        i->calculate();
190
        if (i->LAIfactor()>0)
191
        if (i->LAIfactor()>0)
191
            qDebug() << "species" << (*i).species()->id() << "LAIfraction" << i->LAIfactor() << "raw_gpp_m2" << i->prod3PG().GPPperArea() << "area:" << productiveArea() << "gpp:" << productiveArea()*i->prod3PG().GPPperArea();
-
 
-
 
192
            qDebug() << "ru" << mIndex << "species" << (*i).species()->id() << "LAIfraction" << i->LAIfactor() << "raw_gpp_m2"
-
 
193
                     << i->prod3PG().GPPperArea() << "area:" << productiveArea() << "gpp:"
-
 
194
                     << productiveArea()*i->prod3PG().GPPperArea()
-
 
195
                     << "aging(lastyear):" << averageAging();
192
    }
196
    }
193
}
197
}
194
198
195
void ResourceUnit::calculateInterceptedArea()
199
void ResourceUnit::calculateInterceptedArea()
196
{
200
{
Line 199... Line 203...
199
        return;
203
        return;
200
    }
204
    }
201
    Q_ASSERT(mAggregatedLR>0.);
205
    Q_ASSERT(mAggregatedLR>0.);
202
    mEffectiveArea_perWLA = mEffectiveArea / mAggregatedLR;
206
    mEffectiveArea_perWLA = mEffectiveArea / mAggregatedLR;
203
    qDebug() << "RU: aggregated lightresponse:" << mAggregatedLR  << "eff.area./wla:" << mEffectiveArea_perWLA;
207
    qDebug() << "RU: aggregated lightresponse:" << mAggregatedLR  << "eff.area./wla:" << mEffectiveArea_perWLA;
-
 
208
}
-
 
209
-
 
210
// function is called immediately before the growth of individuals
-
 
211
void ResourceUnit::beforeGrow()
-
 
212
{
-
 
213
    mAverageAging = 0.;
-
 
214
}
-
 
215
-
 
216
// function is called after finishing the indivdual growth / mortality.
-
 
217
void ResourceUnit::afterGrow()
-
 
218
{
-
 
219
    mAverageAging = leafArea()>0.?mAverageAging/leafArea():0; // calculate aging value (calls to addAverageAging() by individual trees)
-
 
220
    if (mAverageAging>0. && mAverageAging<0.00001)
-
 
221
        qDebug() << "ru" << mIndex << "aging <0.00001";
204
}
222
}
205
223
206
void ResourceUnit::yearEnd()
224
void ResourceUnit::yearEnd()
207
{
225
{
208
    // calculate statistics for all tree species of the ressource unit
226
    // calculate statistics for all tree species of the ressource unit
Line 237... Line 255...
237
    for (int i=0;i<mRUSpecies.count();i++) {
255
    for (int i=0;i<mRUSpecies.count();i++) {
238
        mRUSpecies[i].statistics().calculate();
256
        mRUSpecies[i].statistics().calculate();
239
        mStatistics.add(mRUSpecies[i].statistics());
257
        mStatistics.add(mRUSpecies[i].statistics());
240
    }
258
    }
241
    mStatistics.calculate();
259
    mStatistics.calculate();
-
 
260
    mAverageAging = mStatistics.leafAreaIndex()>0.?mAverageAging / (mStatistics.leafAreaIndex()*area()):0.;
242
}
261
}