iLand
fmunit.h
Go to the documentation of this file.
1/********************************************************************************************
2** iLand - an individual based forest landscape and disturbance model
3** http://iland-model.org
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
20#ifndef FMUNIT_H
21#define FMUNIT_H
22#include <QString>
23
24namespace ABE {
25
26
27class Agent; // forward
28class Scheduler;
31class FMUnit
32{
33public:
34 FMUnit(const Agent *agent);
35 ~FMUnit();
36 void setId(const QString &id);
37 const QString &id() const {return mId; }
38 Scheduler *scheduler() {return mScheduler; }
39 const Scheduler *constScheduler() const { return mScheduler; }
40 const Agent* agent() const { return mAgent; }
41 double area() const { return mTotalArea; }
42 int numberOfStands() const { return mNumberOfStands; }
43 void setNumberOfStands(int new_number) { mNumberOfStands = new_number; }
44 double volume() const { return mTotalVolume/area(); }
45 double annualIncrement() const { return mMAI; }
47 // agent properties
49 double U() const { return mU; }
51 int thinningIntensity() const { return mThinningIntensityClass; }
53 int targetSpeciesIndex() const { return mSpeciesCompositionIndex; }
54 const QString &harvestMode() const { return mHarvestMode; }
55
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
61 void setAverageMAI(const double avg_mai) { mAverageMAI = avg_mai; }
62 double averageMAI() const { return mAverageMAI; }
63 // actions
64
67
69 void setForceUpdateManagementPlan() { mForceUpdateManagementPlan = true; }
70 bool forceUpdateManagementPlan() const { return mForceUpdateManagementPlan; }
71
73 void runAgent();
74
77
79 void addRealizedHarvest(const double harvest_m3) { mRealizedHarvest+=harvest_m3; }
80
81 void aggregate();
82 QStringList info() const;
83
84private:
85 double annualTotalHarvest() const {return mRealizedHarvest-mRealizedHarvestLastYear; }
86 double annualThinningHarvest() const;
87 QString mId;
88 const Agent *mAgent;
89 Scheduler *mScheduler;
90 int mNumberOfStands;
91 double mAnnualHarvestTarget;
92 double mAnnualThinningTarget;
93 double mRealizedHarvest;
94 double mRealizedHarvestLastYear;
95 double mAnnualHarvest;
96 double mMAI;
97 double mHDZ;
98 double mMeanAge;
99 double mTotalArea;
100 double mTotalVolume;
101 double mTotalPlanDeviation;
102
103 double mU;
104 int mSpeciesCompositionIndex;
105 int mThinningIntensityClass;
106 QString mHarvestMode;
107
108 double mAverageMAI;
109 bool mForceUpdateManagementPlan;
110
111
112 friend class UnitOut;
113};
114
115} // namespace
116#endif // FOMEUNITS_H
The Agent is the core element of the agent based forest management model and simulates a foresters de...
Definition: agent.h:35
The FMUnit represents a management unit, i.e.
Definition: fmunit.h:32
FMUnit(const Agent *agent)
Definition: fmunit.cpp:93
int targetSpeciesIndex() const
species composition key
Definition: fmunit.h:53
void resetHarvestCounter()
Definition: fmunit.cpp:126
~FMUnit()
Definition: fmunit.cpp:115
void setId(const QString &id)
Definition: fmunit.cpp:121
void setHarvestMode(const QString new_mode)
Definition: fmunit.h:59
void managementPlanUpdate()
update decadal management objectives for the planning unit.
Definition: fmunit.cpp:132
double annualIncrement() const
mean annual increment (m3/ha)
Definition: fmunit.h:45
double U() const
rotation period (years)
Definition: fmunit.h:49
int numberOfStands() const
the total number of stands
Definition: fmunit.h:42
void runAgent()
run the agent main function
Definition: fmunit.cpp:219
const Agent * agent() const
Definition: fmunit.h:40
const QString & id() const
Definition: fmunit.h:37
int thinningIntensity() const
thinning intensity (class); 1: low, 2: medium, 3: high
Definition: fmunit.h:51
double volume() const
total volume of the unit (m3/ha)
Definition: fmunit.h:44
double area() const
total area of the unit (ha)
Definition: fmunit.h:41
QStringList info() const
Definition: fmunit.cpp:69
void setAverageMAI(const double avg_mai)
Definition: fmunit.h:61
void addRealizedHarvest(const double harvest_m3)
record realized harvests on the unit (all harvests)
Definition: fmunit.h:79
void updatePlanOfCurrentYear()
update objectives of the current year.
Definition: fmunit.cpp:242
void setForceUpdateManagementPlan()
tell the unit to update management plan next year
Definition: fmunit.h:69
Scheduler * scheduler()
Definition: fmunit.h:38
bool forceUpdateManagementPlan() const
Definition: fmunit.h:70
void setNumberOfStands(int new_number)
set the number of stands
Definition: fmunit.h:43
double averageMAI() const
Definition: fmunit.h:62
const Scheduler * constScheduler() const
Definition: fmunit.h:39
void setU(const double rotation_length)
Definition: fmunit.h:56
void aggregate()
Definition: fmunit.cpp:42
void setTargetSpeciesCompositionIndex(const int index)
Definition: fmunit.h:58
const QString & harvestMode() const
Definition: fmunit.h:54
void setThinningIntensity(const int th_class)
Definition: fmunit.h:57
The Scheduler class schedules the forest management activities on a planning unit.
Definition: scheduler.h:56
Definition: unitout.h:26
Definition: abegrid.h:22