Subversion Repositories public iLand

Rev

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

Rev Author Line No. Line
1
 
1033 werner 2
/********************************************************************************************
3
**    iLand - an individual based forest landscape and disturbance model
4
**    http://iland.boku.ac.at
5
**    Copyright (C) 2009-  Werner Rammer, Rupert Seidl
6
**
7
**    This program is free software: you can redistribute it and/or modify
8
**    it under the terms of the GNU General Public License as published by
9
**    the Free Software Foundation, either version 3 of the License, or
10
**    (at your option) any later version.
11
**
12
**    This program is distributed in the hope that it will be useful,
13
**    but WITHOUT ANY WARRANTY; without even the implied warranty of
14
**    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
**    GNU General Public License for more details.
16
**
17
**    You should have received a copy of the GNU General Public License
18
**    along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
********************************************************************************************/
20
 
811 werner 21
#ifndef FMUNIT_H
22
#define FMUNIT_H
1157 werner 23
#include <QString>
24
 
907 werner 25
namespace ABE {
811 werner 26
 
870 werner 27
 
811 werner 28
class Agent; // forward
889 werner 29
class Scheduler;
811 werner 30
/** The FMUnit represents a management unit, i.e. a collection of stands.
31
 *  */
32
class FMUnit
33
{
34
public:
889 werner 35
    FMUnit(const Agent *agent);
36
    ~FMUnit();
873 werner 37
    void setId(const QString &id);
38
    const QString &id() const {return mId; }
889 werner 39
    Scheduler *scheduler() {return mScheduler; }
40
    const Scheduler *constScheduler() const { return mScheduler; }
890 werner 41
    const Agent* agent() const { return mAgent; }
921 werner 42
    double area() const { return mTotalArea; } ///< total area of the unit (ha)
944 werner 43
    int numberOfStands() const { return mNumberOfStands; } ///< the total number of stands
44
    void setNumberOfStands(int new_number) { mNumberOfStands = new_number; } ///< set the number of stands
934 werner 45
    double volume() const { return mTotalVolume/area(); } ///< total volume of the unit (m3/ha)
46
    double annualIncrement() const { return mMAI; } ///< mean annual increment (m3/ha)
1157 werner 47
    void resetHarvestCounter();
940 werner 48
    // agent properties
49
    /// rotation period (years)
50
    double U() const { return mU; }
51
    /// thinning intensity (class); 1: low, 2: medium, 3: high
52
    int thinningIntensity() const { return mThinningIntensityClass; }
53
    /// species composition key
54
    int targetSpeciesIndex() const { return mSpeciesCompositionIndex; }
55
    const QString &harvestMode() const { return mHarvestMode; }
903 werner 56
 
940 werner 57
    void setU(const double rotation_length) { mU = rotation_length; }
58
    void setThinningIntensity(const int th_class) { mThinningIntensityClass = th_class; }
59
    void setTargetSpeciesCompositionIndex(const int index) { mSpeciesCompositionIndex = index; }
60
    void setHarvestMode(const QString new_mode) { mHarvestMode = new_mode; }
61
 
977 werner 62
    void setAverageMAI(const double avg_mai) { mAverageMAI = avg_mai; }
63
    double averageMAI() const { return mAverageMAI; }
811 werner 64
    // actions
903 werner 65
 
904 werner 66
    /// update decadal management objectives for the planning unit.
67
    void managementPlanUpdate();
68
 
977 werner 69
    /// run the agent main function
70
    void runAgent();
71
 
904 werner 72
    /// update objectives of the current year.
907 werner 73
    void updatePlanOfCurrentYear();
904 werner 74
 
922 werner 75
    /// record realized harvests on the unit (all harvests)
915 werner 76
    void addRealizedHarvest(const double harvest_m3) { mRealizedHarvest+=harvest_m3; }
77
 
889 werner 78
    void aggregate();
896 werner 79
    QStringList info() const;
811 werner 80
 
81
private:
922 werner 82
    double annualTotalHarvest() const {return mRealizedHarvest-mRealizedHarvestLastYear; } ///< total m3 produced in final harvests in this year
921 werner 83
    double annualThinningHarvest() const; ///< return the total m3 of thinning harvests (m3)
863 werner 84
    QString mId;
811 werner 85
    const Agent *mAgent;
889 werner 86
    Scheduler *mScheduler;
944 werner 87
    int mNumberOfStands; ///< the number of stands
921 werner 88
    double mAnnualHarvestTarget; ///< planned annual harvest (final harvests) (m3)
89
    double mAnnualThinningTarget; ///< planned annual harvests (thinnings and tendings) (m3)
90
    double mRealizedHarvest; ///< sum of realized harvest in the current planning period (final harvests) (m3)
91
    double mRealizedHarvestLastYear; ///< the sum of harvests up to the last year (final harvests) (m3)
92
    double mAnnualHarvest; ///< suf of the harvest of the current year (final harvests)
915 werner 93
    double mMAI; ///< mean annual increment (m3/ha)
94
    double mHDZ; ///< mean "haubarer" annual increment (m3/ha)
95
    double mMeanAge; ///< mean age of the planning unit
96
    double mTotalArea; ///< total area of the unit (ha)
922 werner 97
    double mTotalVolume; ///< total standing volume (m3)
98
    double mTotalPlanDeviation; ///< cumulative deviation from the planned harvest (m3/ha)
915 werner 99
 
940 werner 100
    double mU; ///< rotation length
101
    int mSpeciesCompositionIndex; ///< index of the active target species composition
102
    int mThinningIntensityClass; ///< currently active thinning intensity level
103
    QString mHarvestMode; ///< type of applicable harvesting technique (e.g. skidder, cablecrane)
104
 
977 werner 105
    double mAverageMAI; ///< reference value for mean annual increment
940 werner 106
 
977 werner 107
 
915 werner 108
    friend class UnitOut;
811 werner 109
};
110
 
870 werner 111
} // namespace
811 werner 112
#endif // FOMEUNITS_H