Subversion Repositories public iLand

Rev

Rev 1221 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1033 werner 1
/********************************************************************************************
2
**    iLand - an individual based forest landscape and disturbance model
3
**    http://iland.boku.ac.at
4
**    Copyright (C) 2009-  Werner Rammer, Rupert Seidl
5
**
6
**    This program is free software: you can redistribute it and/or modify
7
**    it under the terms of the GNU General Public License as published by
8
**    the Free Software Foundation, either version 3 of the License, or
9
**    (at your option) any later version.
10
**
11
**    This program is distributed in the hope that it will be useful,
12
**    but WITHOUT ANY WARRANTY; without even the implied warranty of
13
**    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
**    GNU General Public License for more details.
15
**
16
**    You should have received a copy of the GNU General Public License
17
**    along with this program.  If not, see <http://www.gnu.org/licenses/>.
18
********************************************************************************************/
915 werner 19
#include "unitout.h"
20
#include "globalsettings.h"
21
 
22
#include "forestmanagementengine.h"
23
#include "fmunit.h"
24
#include "scheduler.h"
25
 
26
namespace ABE {
27
 
28
UnitOut::UnitOut()
29
{
30
    setName("Annual harvests and harvest plan on unit level.", "abeUnit");
922 werner 31
    setDescription("The output provides planned and realized harvests on the level of planning units. " \
32
                   "Note that the planning unit area, mean age, mean volume and MAI are only updated every 10 years. "\
33
                   "Harvested timber is given as 'realizedHarvest', which is the sum of 'finalHarvest' and 'thinningHarvest.' "\
34
                   "The 'salvageHarvest' is provided extra, but already accounted for in the 'finalHarvest' column");
915 werner 35
    columns() << OutputColumn::year()
36
              << OutputColumn("id", "unique identifier of the planning unit", OutString)
37
              << OutputColumn("area", "total area of the unit (ha)", OutDouble)
38
              << OutputColumn("age", "mean stand age (area weighted) (updated every 10yrs)", OutDouble)
978 werner 39
              << OutputColumn("U", "default rotation length for stands of the unit (years)", OutInteger)
40
              << OutputColumn("thinningIntensity", "default thinning intensity for the unit", OutDouble)
915 werner 41
              << OutputColumn("volume", "mean standing volume (updated every 10yrs), m3/ha", OutDouble)
42
              << OutputColumn("MAI", "mean annual increment (updated every 10yrs), m3/ha*yr", OutDouble)
43
              << OutputColumn("decadePlan", "planned mean harvest per year for the decade (m3/ha*yr)", OutDouble)
44
              << OutputColumn("annualPlan", "updated annual plan for the year, m3/ha*yr", OutDouble)
922 werner 45
              << OutputColumn("runningDelta", "current aggregated difference between planned and realied harvests; positive: more realized than planned harvests, m3/ha*yr", OutDouble)
915 werner 46
              << OutputColumn("realizedHarvest", "total harvested timber volume, m3/ha*yr", OutDouble)
921 werner 47
              << OutputColumn("finalHarvest", "total harvested timber of planned final harvests (including salvage harvests), m3/ha*yr", OutDouble)
915 werner 48
              << OutputColumn("thinningHarvest", "total harvested timber due to tending and thinning operations, m3/ha*yr", OutDouble)
922 werner 49
              << OutputColumn("salvageHarvest", "total harvested timber due to salvage operations (also included in final harvests), m3/ha*yr", OutDouble);
915 werner 50
 
51
 
52
}
53
 
54
 
916 werner 55
void UnitOut::exec()
915 werner 56
{
57
    FMUnit *unit;
916 werner 58
    double salvage_harvest, annual_target;
915 werner 59
    foreach(unit, ForestManagementEngine::instance()->mUnits) {
60
        *this << currentYear() << unit->id(); // keys
916 werner 61
        *this << unit->area();
978 werner 62
        *this << unit->mMeanAge;
63
        *this << unit->U() << unit->thinningIntensity();
64
        *this << unit->mTotalVolume/unit->area() << unit->mMAI;
916 werner 65
        *this << unit->mAnnualHarvestTarget;
66
        if (unit->scheduler()) {
921 werner 67
            salvage_harvest = unit->scheduler()->mExtraHarvest / unit->area();
68
            annual_target = unit->scheduler()->mFinalCutTarget;
916 werner 69
        } else {
70
            salvage_harvest = 0.;
71
            annual_target = 0.;
921 werner 72
 
916 werner 73
        }
921 werner 74
        double thin_h = unit->annualThinningHarvest()/unit->area();
922 werner 75
        *this << annual_target << unit->mTotalPlanDeviation
76
                               << unit->annualTotalHarvest()/unit->area() // total realized
77
                               << unit->annualTotalHarvest()/unit->area() - thin_h  // final
78
                               << thin_h // thinning
79
                               << salvage_harvest; // salvaging
916 werner 80
 
81
        writeRow();
915 werner 82
     }
83
}
84
 
85
void ABE::UnitOut::setup()
86
{
87
 
88
}
89
 
90
 
91
} // namespace