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
********************************************************************************************/
19
 
811 werner 20
#ifndef FMUNIT_H
21
#define FMUNIT_H
1157 werner 22
#include <QString>
23
 
907 werner 24
namespace ABE {
811 werner 25
 
870 werner 26
 
811 werner 27
class Agent; // forward
889 werner 28
class Scheduler;
811 werner 29
/** The FMUnit represents a management unit, i.e. a collection of stands.
30
 *  */
31
class FMUnit
32
{
33
public:
889 werner 34
    FMUnit(const Agent *agent);
35
    ~FMUnit();
873 werner 36
    void setId(const QString &id);
37
    const QString &id() const {return mId; }
889 werner 38
    Scheduler *scheduler() {return mScheduler; }
39
    const Scheduler *constScheduler() const { return mScheduler; }
890 werner 40
    const Agent* agent() const { return mAgent; }
921 werner 41
    double area() const { return mTotalArea; } ///< total area of the unit (ha)
944 werner 42
    int numberOfStands() const { return mNumberOfStands; } ///< the total number of stands
43
    void setNumberOfStands(int new_number) { mNumberOfStands = new_number; } ///< set the number of stands
934 werner 44
    double volume() const { return mTotalVolume/area(); } ///< total volume of the unit (m3/ha)
45
    double annualIncrement() const { return mMAI; } ///< mean annual increment (m3/ha)
1157 werner 46
    void resetHarvestCounter();
940 werner 47
    // agent properties
48
    /// rotation period (years)
49
    double U() const { return mU; }
50
    /// thinning intensity (class); 1: low, 2: medium, 3: high
51
    int thinningIntensity() const { return mThinningIntensityClass; }
52
    /// species composition key
53
    int targetSpeciesIndex() const { return mSpeciesCompositionIndex; }
54
    const QString &harvestMode() const { return mHarvestMode; }
903 werner 55
 
940 werner 56
    void setU(const double rotation_length) { mU = rotation_length; }
57
    void setThinningIntensity(const int th_class) { mThinningIntensityClass = th_class; }
58
    void setTargetSpeciesCompositionIndex(const int index) { mSpeciesCompositionIndex = index; }
59
    void setHarvestMode(const QString new_mode) { mHarvestMode = new_mode; }
60
 
977 werner 61
    void setAverageMAI(const double avg_mai) { mAverageMAI = avg_mai; }
62
    double averageMAI() const { return mAverageMAI; }
811 werner 63
    // actions
903 werner 64
 
904 werner 65
    /// update decadal management objectives for the planning unit.
66
    void managementPlanUpdate();
67
 
977 werner 68
    /// run the agent main function
69
    void runAgent();
70
 
904 werner 71
    /// update objectives of the current year.
907 werner 72
    void updatePlanOfCurrentYear();
904 werner 73
 
922 werner 74
    /// record realized harvests on the unit (all harvests)
915 werner 75
    void addRealizedHarvest(const double harvest_m3) { mRealizedHarvest+=harvest_m3; }
76
 
889 werner 77
    void aggregate();
896 werner 78
    QStringList info() const;
811 werner 79
 
80
private:
922 werner 81
    double annualTotalHarvest() const {return mRealizedHarvest-mRealizedHarvestLastYear; } ///< total m3 produced in final harvests in this year
921 werner 82
    double annualThinningHarvest() const; ///< return the total m3 of thinning harvests (m3)
863 werner 83
    QString mId;
811 werner 84
    const Agent *mAgent;
889 werner 85
    Scheduler *mScheduler;
944 werner 86
    int mNumberOfStands; ///< the number of stands
921 werner 87
    double mAnnualHarvestTarget; ///< planned annual harvest (final harvests) (m3)
88
    double mAnnualThinningTarget; ///< planned annual harvests (thinnings and tendings) (m3)
89
    double mRealizedHarvest; ///< sum of realized harvest in the current planning period (final harvests) (m3)
90
    double mRealizedHarvestLastYear; ///< the sum of harvests up to the last year (final harvests) (m3)
91
    double mAnnualHarvest; ///< suf of the harvest of the current year (final harvests)
915 werner 92
    double mMAI; ///< mean annual increment (m3/ha)
93
    double mHDZ; ///< mean "haubarer" annual increment (m3/ha)
94
    double mMeanAge; ///< mean age of the planning unit
95
    double mTotalArea; ///< total area of the unit (ha)
922 werner 96
    double mTotalVolume; ///< total standing volume (m3)
97
    double mTotalPlanDeviation; ///< cumulative deviation from the planned harvest (m3/ha)
915 werner 98
 
940 werner 99
    double mU; ///< rotation length
100
    int mSpeciesCompositionIndex; ///< index of the active target species composition
101
    int mThinningIntensityClass; ///< currently active thinning intensity level
102
    QString mHarvestMode; ///< type of applicable harvesting technique (e.g. skidder, cablecrane)
103
 
977 werner 104
    double mAverageMAI; ///< reference value for mean annual increment
940 werner 105
 
977 werner 106
 
915 werner 107
    friend class UnitOut;
811 werner 108
};
109
 
870 werner 110
} // namespace
811 werner 111
#endif // FOMEUNITS_H