#include <CompetitionHarvest.h>
Public Member Functions | |
clCompetitionHarvest (clSimManager *p_oSimManager) | |
Constructor. | |
~clCompetitionHarvest () | |
Destructor. | |
void | Action () |
Performs the harvesting. | |
void | RegisterTreeDataMembers () |
Registers the "COE" tree float data member. | |
Protected Types | |
enum | cutType { interval, ba_amt, ba_prop } |
Type of harvest. More... | |
Protected Member Functions | |
void | ResetResultsGrid () |
Resets all the values in the "Competition Harvest Results" grid. | |
void | GetData (xercesc::DOMDocument *p_oDoc) |
Performs setup. | |
void | ReadParameterFileData (xercesc::DOMDocument *p_oDoc, clTreePopulation *p_oPop) |
Reads harvest data from the parameter file. | |
void | SetupGrids () |
Sets up the "Competition Harvest Results" grid and gets all the return codes. | |
void | SetupCOEGrids (clTreePopulation *p_oPop) |
Sets up the mp_oHighestCOE and mp_fCOE arrays. | |
void | CutTreesSpeciesSpecific (const float &fPlotBA) |
Performs species-specific harvests. | |
void | CutTreesNotSpeciesSpecific (const float &fPlotBA) |
Performs non-species-specific harvests. | |
void | CalculateAllCOEsSpeciesSpecific (clTreePopulation *p_oPop) |
Calculates competitive effects for those trees that are eligible for harvest. | |
void | CalculateAllCOEsNotSpeciesSpecific (clTreePopulation *p_oPop) |
Calculates competitive effects for those trees that are eligible for harvest. | |
void | RecalculateCOESpeciesSpecific (clTreePopulation *p_oPop, const float &fX, const float &fY) |
Recalculates COEs in the neighborhood of a recently cut tree. | |
void | RecalculateCOENotSpeciesSpecific (clTreePopulation *p_oPop, const float &fX, const float &fY) |
Recalculates COEs in the neighborhood of a recently cut tree. | |
float | GetBasalArea () |
Gets the basal area across the plot for those trees that are eligible for harvest. | |
float | CalculateOneCOE (clPlot *p_oPlot, clTreePopulation *p_oPop, clTree *p_oTree) |
Calculates the competitive effect for one tree. | |
Protected Attributes | |
clGridBase * | mp_oResultsGrid |
RESULTS GRID This grid is called "Competition Harvest Results". | |
clTree *** | mp_oHighestCOE |
Which tree in each grid cell (matching the cells of the clTreePopulation class) has the highest COE. | |
float ** | mp_fCOE |
The value for the COE of each tree in mp_oHighestCOE. | |
float ** | mp_fLambda |
Lambda for NCI. | |
short int ** | mp_iCOECodes |
Data member codes for the "COE" tree float data member. | |
float * | mp_fAlpha |
Target DBH effect on each neighbor species. | |
float * | mp_fBeta |
Target distance effect. | |
float * | mp_fC |
Crowding effect slope. | |
float * | mp_fD |
Crowding effect steepness. | |
float * | mp_fGamma |
Size sensitivity to competition parameter. | |
float * | mp_fMaxCrowdingRadius |
Maximum radius, in meters, for which a target has a crowding effect on neighbors. | |
float * | mp_fTargetToCut |
Holds the target left to cut for each species. | |
float * | mp_fAlreadyCut |
The amount cut this timestep for each species. | |
float * | mp_fPropToCut |
Proportion of each species to cut as a value between 0 and 1. | |
short int * | mp_iDenCutCodes |
Data member codes for the "Cut Density_sp" data member of the "Competition Harvest Results" grid. | |
short int * | mp_iBaCutCodes |
Data member codes for the "Cut Basal Area_sp" data member of the "Competition Harvest Results" grid. | |
std::string | m_sHarvestListFilename |
The filename to which to write the list of all trees harvested each timestep. | |
float | m_fMaxMaxCrowdingRadius |
Maximum crowding radius across all species - used when recalculating COEs after a tree has been cut. | |
float | m_fQ |
Target DBH divisor. | |
float | m_fMinHarvestDBH |
Mininum DBH for harvesting. | |
float | m_fMaxHarvestDBH |
Maxinum DBH for harvesting. | |
float | m_fAmtToCut |
Cut amount - if this is a fixed interval harvest, this is the amount to which the plot is cut back, in m2 of basal area; if this is a fixed BA threshold harvest with fixed amount to cut, this is that amount to cut, in m2 of basal area; if this is a fixed BA threshold harvest with proportion to cut, this is the proportion to cut between 0 and 1. | |
float | m_fBAThreshold |
For fixed BA threshold harvests, the BA threshold that triggers a harvest. | |
float | m_fMinSaplingHeight |
Minimum sapling height. | |
int | m_iInterval |
For fixed BA threshold harvests, the minimum interval between harvests. | |
short int | m_iReasonCode |
Reason code to pass to the tree population when trees are killed. | |
short int | m_iTimeSinceLastHarvest |
How many timesteps it's been since the last harvest. | |
short int | m_iNumX |
Number of cells in the X direction for the mp_oHighestCOE and mp_fCOE arrays. | |
short int | m_iNumY |
Number of cells in the Y direction for the mp_oHighestCOE and mp_fCOE arrays. | |
short int | m_iNumSpecies |
Number of species. | |
enum clCompetitionHarvest::cutType | harvest |
Type of harvest. | |
bool | m_bIsSpeciesSpecific |
Whether or not this is a species-specific harvest. |
This is a behavior which performs harvests by preferentially removing those trees that exert the most competitive pressure on their neighbors. This behavior is also more autonomous - it decides for itself when harvests occur and how much cutting to do based on criteria provided by the user.
There are two ways to specify when harvests occur.
1) Fixed basal area threshold. A harvest occurs every time the total plot basal area exceeds a threshold set by the user. There is a minimum interval between harvests which can be used to make sure they do not occur too frequently. The harvests cut either an absolute amount of basal area or a percentage of the total.
2) Fixed interval. The user specifies how often harvests occur. The harvests cut the plot back to a set total basal area.
Either way, the user can specify a minimum and maximum DBH for trees to harvest.
Harvests may be species-specific or non-species-specific. If they are species-specific, the user specifies the relative amounts to remove of each species (including 0 for non-participating species). 100% participation for all species indicates that all species can be treated as a single group. Only participating species and size ranges are used to establish basal area criteria for initiating a harvest.
The harvest preferentially removes the most competitive trees. The competitive effect (COE) of a tree i on neighbors j within a given radius is calculated as follows:
summed over all neighbors. The values of C, gamma, alpha, beta, and D are specific to the neighbor's species. Lambda is for the effect of the target species i on the neighbor species j. DBH is the neighbor's DBH, and distance is the distance in meters between the target and neighbor. Optionally, DBH can be divided by a divisor term if there needs to be a units correction.
Trees in the plot are ranked by COE. The harvest behavior works its way down the list, removing trees in order, until the amount to harvest requirements have been met. After each tree is removed, the COE of all trees in its immediate vicinity are recalculated and the COE list will be resorted.
If removing a tree will cause the harvest to overshoot its cutting target, a random number will be compared to the amount of overshoot to determine if the tree will be removed. Harvesting ends with this tree.
If the cut is species-specific, a tree high on the competitiveness list will be skipped if a sufficient amount of that species has already been removed.
The behavior uses a grid to report on actual harvest amounts removed across the plot, and optionally can provide a list of all individuals removed each timestep, along with their basal area, biomass and bole volume.
Seedlings, snags, and dead trees have neither competitive effect on neighbors or have competitive effects put on them by other trees. In other words, they are always ignored.
This adds one float data member to trees to which it is applied to hold their competitive effect. This member is called "COE". It has limited usefulness outside of this behavior.
This behavior's namestring and parameter file call string are both "Competition Harvest".
Copyright 2007 Charles D. Canham.
enum clCompetitionHarvest::cutType [protected] |
clCompetitionHarvest::clCompetitionHarvest | ( | clSimManager * | p_oSimManager | ) |
Constructor.
p_oSimManager | Sim Manager object. |
clCompetitionHarvest::~clCompetitionHarvest | ( | ) |
Destructor.
void clCompetitionHarvest::Action | ( | ) | [virtual] |
Performs the harvesting.
First this calls ResetResultsGrid(). Then this decides whether a harvest will occur. If this is a fixed interval harvest, it checks the amount of time that has passed. If this is a fixed BA harvest, this calls GetBasalArea() to find out whether the basal area is over the threshold. If a harvest is to occur, this calls CutTreesSpeciesSpecific() or CutTreesNotSpeciesSpecific().
Reimplemented from clBehaviorBase.
void clCompetitionHarvest::RegisterTreeDataMembers | ( | ) | [virtual] |
Registers the "COE" tree float data member.
The return codes are captured in the mp_iCOECodes array.
modelErr | if this behavior is being applied to any tree type except saplings and adults. |
Reimplemented from clBehaviorBase.
void clCompetitionHarvest::ResetResultsGrid | ( | ) | [protected] |
Resets all the values in the "Competition Harvest Results" grid.
All values are set to 0.
void clCompetitionHarvest::GetData | ( | xercesc::DOMDocument * | p_oDoc | ) | [protected, virtual] |
Performs setup.
p_oDoc | DOM tree of parsed input file. |
Implements clWorkerBase.
void clCompetitionHarvest::ReadParameterFileData | ( | xercesc::DOMDocument * | p_oDoc, | |
clTreePopulation * | p_oPop | |||
) | [protected] |
Reads harvest data from the parameter file.
p_oDoc | DOM tree of parsed input file. | |
p_oPop | Tree population object. |
modelErr | if:
|
void clCompetitionHarvest::SetupGrids | ( | ) | [protected] |
Sets up the "Competition Harvest Results" grid and gets all the return codes.
void clCompetitionHarvest::SetupCOEGrids | ( | clTreePopulation * | p_oPop | ) | [protected] |
Sets up the mp_oHighestCOE and mp_fCOE arrays.
p_oPop | Tree population object. |
void clCompetitionHarvest::CutTreesSpeciesSpecific | ( | const float & | fPlotBA | ) | [protected] |
Performs species-specific harvests.
This calculates basal area cut targets, depending on the type of harvest being performed. Then this calls CalculateCOESpeciesSpecific() to get tree competitive effects. The most competitive tree across the entire plot is cut, and then RecalculateCOESpeciesSpecific() is called. This process is repeated until cut targets have been reached. Only the highest-COE trees of species that are left are put in the mp_oHighestCOE and mp_fCOE arrays. If cutting a tree would cause an overshoot of that species' target BA, then a random number is compared to the amount of difference between the target and the overshoot to decide whether that tree is cut.
fPlotBA | Basal area of the plot. |
void clCompetitionHarvest::CutTreesNotSpeciesSpecific | ( | const float & | fPlotBA | ) | [protected] |
Performs non-species-specific harvests.
This calculates basal area cut targets, depending on the type of harvest being performed. Then this calls CalculateCOENotSpeciesSpecific() to get tree competitive effects. The most competitive tree across the entire plot is cut, and then RecalculateCOENotSpeciesSpecific() is called. This process is repeated until cut targets have been reached. If cutting a tree would cause an overshoot of the target BA, then a random number is compared to the amount of difference between the target and the overshoot to decide whether that tree is cut.
fPlotBA | Basal area of the plot. |
void clCompetitionHarvest::CalculateAllCOEsSpeciesSpecific | ( | clTreePopulation * | p_oPop | ) | [protected] |
Calculates competitive effects for those trees that are eligible for harvest.
After calculating the COE, this finds the tree with the highest COE in each grid cell and populates the mp_oHighestCOE and mp_fCOE arrays. Eligible trees are those that have a COE tree data member, and whose species has a positive difference between mp_fTargetToCut and mp_fAlreadyCut.
void clCompetitionHarvest::CalculateAllCOEsNotSpeciesSpecific | ( | clTreePopulation * | p_oPop | ) | [protected] |
Calculates competitive effects for those trees that are eligible for harvest.
After calculating the COE, this finds the tree with the highest COE in each grid cell and populates the mp_oHighestCOE and mp_fCOE arrays. Eligible trees are those that have a COE tree data member.
void clCompetitionHarvest::RecalculateCOESpeciesSpecific | ( | clTreePopulation * | p_oPop, | |
const float & | fX, | |||
const float & | fY | |||
) | [protected] |
Recalculates COEs in the neighborhood of a recently cut tree.
All trees within a distance of m_fMaxMaxCrowdingRadius from the point fX, fY have their COEs recalculated. Any applicable updates are made to mp_oHighestCOE and mp_fCOE. Only trees whose species still have a positive difference between mp_fTargetToCut and mp_fAlreadyCut are recalculated and considered for a spot on mp_oHighestCOE.
p_oPop | Tree population object. | |
fX | X coordinate of tree that was removed. | |
fY | Y coordinate of tree that was removed. |
void clCompetitionHarvest::RecalculateCOENotSpeciesSpecific | ( | clTreePopulation * | p_oPop, | |
const float & | fX, | |||
const float & | fY | |||
) | [protected] |
Recalculates COEs in the neighborhood of a recently cut tree.
All trees within a distance of m_fMaxMaxCrowdingRadius from the point fX, fY have their COEs recalculated. Any applicable updates are made to mp_oHighestCOE and mp_fCOE.
p_oPop | Tree population object. | |
fX | X coordinate of tree that was removed. | |
fY | Y coordinate of tree that was removed. |
float clCompetitionHarvest::GetBasalArea | ( | ) | [protected] |
Gets the basal area across the plot for those trees that are eligible for harvest.
Eligible trees are those that are of a species participating in harvests (those to which this behavior is applied) whose DBHs are between the minimum and the maximum.
float clCompetitionHarvest::CalculateOneCOE | ( | clPlot * | p_oPlot, | |
clTreePopulation * | p_oPop, | |||
clTree * | p_oTree | |||
) | [protected] |
Calculates the competitive effect for one tree.
If the tree is dead, the answer is zero. All dead trees are also excluded as neighbors.
p_oPlot | Plot object. | |
p_oPop | Tree population object. | |
p_oTree | Tree for which to calculate competitive effect. |
clGridBase* clCompetitionHarvest::mp_oResultsGrid [protected] |
RESULTS GRID This grid is called "Competition Harvest Results".
It holds the actual amount cut for the current timestep. The grid's cell resolution is up to the user, but defaults to one grid cell covering the whole plot. The data is stored raw - no conversion to per-hectare amounts.
Any parameter file grid map for this grid it will be ignored.
Data member name | Type | Description |
---|---|---|
Cut Density_sp | int | Number of trees cut. There is one for each species; sp is the species number. |
Cut Basal Area_sp | float | Total basal area cut. There is one for each species; sp is the species number. |
clTree*** clCompetitionHarvest::mp_oHighestCOE [protected] |
Which tree in each grid cell (matching the cells of the clTreePopulation class) has the highest COE.
Array size is number of X cells (in variable m_iNumX) by number of Y cells (held in variable m_iNumY).
float** clCompetitionHarvest::mp_fCOE [protected] |
The value for the COE of each tree in mp_oHighestCOE.
Array size is number of X cells (in variable m_iNumX) by number of Y cells (held in variable m_iNumY).
float** clCompetitionHarvest::mp_fLambda [protected] |
Lambda for NCI.
Array is sized number of species by number of species. The first index is for targets, the second for neighbors. Thus mp_fLambda[2][3] is the effect of target species 2 on species 3 neighbors.
short int** clCompetitionHarvest::mp_iCOECodes [protected] |
Data member codes for the "COE" tree float data member.
Array size is number of species by 2 (saplings and adults).
float* clCompetitionHarvest::mp_fAlpha [protected] |
Target DBH effect on each neighbor species.
α variable in COE equation above. Array is sized number of species and is required for all species.
float* clCompetitionHarvest::mp_fBeta [protected] |
Target distance effect.
β variable in COE equation above. Array is sized number of species and is required for all species.
float* clCompetitionHarvest::mp_fC [protected] |
Crowding effect slope.
C in COE equation above. Array is sized number of species and is required for all species.
float* clCompetitionHarvest::mp_fD [protected] |
Crowding effect steepness.
D in COE equation above. Array is sized number of species and is required for all species.
float* clCompetitionHarvest::mp_fGamma [protected] |
Size sensitivity to competition parameter.
γ in COE equation above. Array is sized number of species and is required for all species.
float* clCompetitionHarvest::mp_fMaxCrowdingRadius [protected] |
Maximum radius, in meters, for which a target has a crowding effect on neighbors.
Array is sized number of species but is only required for those species to which this behavior applies.
float* clCompetitionHarvest::mp_fTargetToCut [protected] |
Holds the target left to cut for each species.
Ignored unless m_bIsSpeciesSpecific is true. CutTrees() manages this array to properly direct the behavior of the other functions. Array size is number of species.
float* clCompetitionHarvest::mp_fAlreadyCut [protected] |
The amount cut this timestep for each species.
Ignored unless m_bIsSpeciesSpecific is true. This can be compared against the mp_fTargetToCut array to decide whether an individual of a certain species is eligible for cutting. Array size is number of species.
float* clCompetitionHarvest::mp_fPropToCut [protected] |
Proportion of each species to cut as a value between 0 and 1.
All 1s mean treat the species as a common pool (and m_bSpeciesSpecific = false). Array is sized number of species but is only required for those species to which this behavior applies.
short int* clCompetitionHarvest::mp_iDenCutCodes [protected] |
Data member codes for the "Cut Density_sp" data member of the "Competition Harvest Results" grid.
Array size is number species.
short int* clCompetitionHarvest::mp_iBaCutCodes [protected] |
Data member codes for the "Cut Basal Area_sp" data member of the "Competition Harvest Results" grid.
Array size is number species.
std::string clCompetitionHarvest::m_sHarvestListFilename [protected] |
The filename to which to write the list of all trees harvested each timestep.
This is optional. If the file is to be written, it is a tab-delimited text file. The columns are X, Y, Species, DBH, and Timestep cut.
float clCompetitionHarvest::m_fMaxMaxCrowdingRadius [protected] |
Maximum crowding radius across all species - used when recalculating COEs after a tree has been cut.
float clCompetitionHarvest::m_fQ [protected] |
Target DBH divisor.
The target's DBH is divided by this term before being used in the COE equation. This is in case any units corrections need to be made.
float clCompetitionHarvest::m_fMinHarvestDBH [protected] |
Mininum DBH for harvesting.
float clCompetitionHarvest::m_fMaxHarvestDBH [protected] |
Maxinum DBH for harvesting.
float clCompetitionHarvest::m_fAmtToCut [protected] |
Cut amount - if this is a fixed interval harvest, this is the amount to which the plot is cut back, in m2 of basal area; if this is a fixed BA threshold harvest with fixed amount to cut, this is that amount to cut, in m2 of basal area; if this is a fixed BA threshold harvest with proportion to cut, this is the proportion to cut between 0 and 1.
BA amounts are read as per ha from the parameter file, but they are stored as a total amount here to avoid having to convert back and forth.
float clCompetitionHarvest::m_fBAThreshold [protected] |
For fixed BA threshold harvests, the BA threshold that triggers a harvest.
This is read in from the parameter file as m2/ha, but stored as total m2 of basal area.
float clCompetitionHarvest::m_fMinSaplingHeight [protected] |
Minimum sapling height.
For doing neighbor searches.
int clCompetitionHarvest::m_iInterval [protected] |
For fixed BA threshold harvests, the minimum interval between harvests.
For fixed interval harvests, the interval between harvests. This is read from the parameter file in years but is stored as timesteps.
short int clCompetitionHarvest::m_iReasonCode [protected] |
Reason code to pass to the tree population when trees are killed.
short int clCompetitionHarvest::m_iTimeSinceLastHarvest [protected] |
How many timesteps it's been since the last harvest.
short int clCompetitionHarvest::m_iNumX [protected] |
Number of cells in the X direction for the mp_oHighestCOE and mp_fCOE arrays.
short int clCompetitionHarvest::m_iNumY [protected] |
Number of cells in the Y direction for the mp_oHighestCOE and mp_fCOE arrays.
short int clCompetitionHarvest::m_iNumSpecies [protected] |
Number of species.
For destructor.
enum clCompetitionHarvest::cutType clCompetitionHarvest::harvest [protected] |
Type of harvest.
What kind of harvest is being used for this run
bool clCompetitionHarvest::m_bIsSpeciesSpecific [protected] |
Whether or not this is a species-specific harvest.