Rev 802 | Rev 1104 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1 | |||
671 | 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 | |||
436 | werner | 21 | #include "productionout.h" |
808 | werner | 22 | #include "debugtimer.h" |
436 | werner | 23 | #include "model.h" |
24 | #include "resourceunit.h" |
||
25 | #include "species.h" |
||
26 | #include "speciesresponse.h" |
||
27 | |||
28 | ProductionOut::ProductionOut() |
||
29 | { |
||
30 | setName("Production per month, species and resource unit", "production_month"); |
||
31 | setDescription("Details about the 3PG production submodule on monthly basis and for each species and resource unit."); |
||
570 | werner | 32 | columns() << OutputColumn::year() << OutputColumn::ru() << OutputColumn::id() << OutputColumn::species() |
436 | werner | 33 | << OutputColumn("month", "month of year", OutInteger) |
34 | << OutputColumn("tempResponse", "monthly average of daily respose value temperature", OutDouble) |
||
35 | << OutputColumn("waterResponse", "monthly average of daily respose value soil water", OutDouble) |
||
36 | << OutputColumn("vpdResponse", "monthly vapour pressure deficit respose.", OutDouble) |
||
37 | << OutputColumn("co2Response", "monthly response value for ambient co2.", OutDouble) |
||
38 | << OutputColumn("nitrogenResponse", "yearly respose value nitrogen", OutDouble) |
||
802 | werner | 39 | << OutputColumn("radiation_m2", "global radiation PAR in MJ per m2 and month", OutDouble) |
40 | << OutputColumn("utilizableRadiation_m2", "utilizable PAR in MJ per m2 and month (sum of daily rad*min(respVpd,respWater,respTemp))", OutDouble) |
||
778 | werner | 41 | << OutputColumn("GPP_kg_m2", "GPP (without Aging) in kg Biomass/m2", OutDouble); |
436 | werner | 42 | |
43 | } |
||
44 | |||
45 | void ProductionOut::setup() |
||
46 | { |
||
47 | } |
||
48 | |||
49 | void ProductionOut::execute(const ResourceUnitSpecies *rus) |
||
50 | { |
||
51 | const Production3PG &prod = rus->prod3PG(); |
||
52 | const SpeciesResponse *resp = prod.mResponse; |
||
53 | for (int i=0;i<12;i++) { |
||
570 | werner | 54 | *this << currentYear() << rus->ru()->index() << rus->ru()->id() << rus->species()->id(); |
436 | werner | 55 | *this << (i+1); // month |
56 | // responses |
||
57 | *this << resp->tempResponse()[i] |
||
58 | << resp->soilWaterResponse()[i] |
||
59 | << resp->vpdResponse()[i] |
||
60 | << resp->co2Response()[i] |
||
61 | << resp->nitrogenResponse() |
||
62 | << resp->globalRadiation()[i] |
||
63 | << prod.mUPAR[i] |
||
64 | << prod.mGPP[i]; |
||
65 | writeRow(); |
||
66 | } |
||
67 | } |
||
68 | |||
69 | void ProductionOut::exec() |
||
70 | { |
||
71 | DebugTimer t("ProductionOut"); |
||
72 | Model *m = GlobalSettings::instance()->model(); |
||
73 | |||
74 | foreach(ResourceUnit *ru, m->ruList()) { |
||
574 | werner | 75 | if (ru->id()==-1) |
76 | continue; // do not include if out of project area |
||
77 | |||
455 | werner | 78 | foreach(const ResourceUnitSpecies *rus, ru->ruSpecies()) { |
79 | execute(rus); |
||
436 | werner | 80 | } |
81 | } |
||
82 | } |