SORTIE Core C++ Documentation
|
Generalized Harvest Regime - Version 1.1. More...
#include <GeneralizedHarvestRegime.h>
Public Member Functions | |
clGeneralizedHarvestRegime (clSimManager *p_oSimManager) | |
Constructor. More... | |
~clGeneralizedHarvestRegime () | |
Destructor. More... | |
void | Action () |
Performs the harvest. More... | |
void | GetData (xercesc::DOMDocument *p_oDoc) |
Performs setup. More... | |
void | RegisterTreeDataMembers () |
Registers the "Cut Probability" tree float data member. More... | |
Public Member Functions inherited from clBehaviorBase | |
virtual float | GetBehaviorVersion () |
Gets the behavior version number. More... | |
clBehaviorBase (clSimManager *p_oSimManager) | |
Constructor. More... | |
virtual | ~clBehaviorBase () |
Destructor. More... | |
virtual short int | ValidateVersionNumber (float fTestVersion) |
Makes sure that the version number of a file passed is between the minimum and current version numbers. More... | |
virtual void | SetSpeciesTypeCombos (short int iNumCombos, stcSpeciesTypeCombo *p_whatCombos) |
Sets the species/type combos for a behavior. More... | |
virtual void | SetNameData (std::string sNameString) |
Sets the string for the parameter file behavior. More... | |
virtual short int | GetNewTreeInts () |
Gets the number of new tree integer data members this behavior wants to register. More... | |
virtual short int | GetNewTreeFloats () |
Gets the number of new tree float data members this behavior wants to register. More... | |
virtual short int | GetNewTreeChars () |
Gets the number of new tree character data members this behavior wants to register. More... | |
virtual short int | GetNewTreeBools () |
Gets the number of new tree bool data members this behavior wants to register. More... | |
virtual short int | GetNumSpeciesTypeCombos () |
Gets the number of species/type combos to which this behavior applies. More... | |
virtual short int | GetNumBehaviorSpecies () |
Gets the number of unique tree species to which this behavior applies. More... | |
struct stcSpeciesTypeCombo | GetSpeciesTypeCombo (short int iIndex) |
Gets one of this behavior's type/species combos. More... | |
virtual short int | GetBehaviorSpecies (short int iIndex) |
Gets one of the behavior's species. More... | |
short int | GetBehaviorListNumber () |
Gets the behavior list number for this behavior, which differentiates between multiple copies of the behavior in the behavior list. More... | |
void | SetBehaviorListNumber (short int iNumber) |
Sets the behavior list number for this behavior, which differentiates between multiple copies of the behavior in the behavior list. More... | |
std::string | FormatSpeciesTypeQueryString () |
Formats the string for species/types query. More... | |
virtual DOMElement * | GetParentParametersElement (xercesc::DOMDocument *p_oDoc) |
This will get the correct set of parameters for this behavior based on the behavior list position number. More... | |
Public Member Functions inherited from clWorkerBase | |
clWorkerBase (clSimManager *p_oSimManager) | |
Constructor. More... | |
virtual | ~clWorkerBase () |
Destructor. More... | |
std::string | GetName () |
Gets the object's namestring. More... | |
clSimManager * | GetSimManager () |
void | DoObjectSetup (xercesc::DOMDocument *p_oDoc, fileType iFileType) |
Triggers the setup process. More... | |
virtual void | TimestepCleanup () |
Performs any necessary cleanup operations at the end of a timestep. More... | |
virtual void | EndOfRunCleanup () |
Performs any necessary cleanup operations at the end of a run. More... | |
Protected Member Functions | |
void | ReadHarvestParameterFileData (xercesc::DOMDocument *p_oDoc) |
Reads harvest data from the parameter file. More... | |
bool | CutThisTimestep () |
Decides whether or not a harvest will occur this timestep. More... | |
void | GetDataCodes () |
Gets the "Biomass" data member code for adults of each species. More... | |
double | GetPercentToCut () |
Uses the appropriate distribution function to pick the percentage to cut. More... | |
Protected Member Functions inherited from clWorkerBase | |
void | AssembleFileCode (int iFileType, int iFileVersion, char *cCode) |
Creates the proper identifying filecode for an XML file. More... | |
Protected Attributes | |
clTreePopulation * | mp_oPop |
Stashed pointer to tree population. More... | |
short int * | mp_iBiomassCode |
Code for the "Biomass" float data member for adults of each species. More... | |
short int * | mp_iHarvestCode |
Code for the "Gen Harvest" bool data member for adults of each species. More... | |
double * | mp_fCutProbAlpha |
Alpha in the species specific cut probability function. More... | |
double * | mp_fCutProbBeta |
Beta in the species specific cut probability function. More... | |
double * | mp_fCutProbGamma |
Gamma in the species specific cut probability function. More... | |
double * | mp_fCutProbMu |
Mu in the species specific cut probability function. More... | |
double * | mp_fCutAmtIntensityClasses |
Upper bounds of intensity classes if we're using a user-defined probability distribution function for determining cut amount. More... | |
double * | mp_fCutAmtIntensityClassProb |
Probability of each intensity class if we're using a user-defined probability distribution function for determining cut amount. More... | |
double | m_fLogProbA |
Probability of logging a. More... | |
double | m_fLogProbM |
Probability of logging m. More... | |
double | m_fLogProbB |
Probability of logging b. More... | |
double | m_fGammaMeanRemoveA |
Removal amount alpha, if we're using gamma PDF for cut amount. More... | |
double | m_fGammaMeanRemoveB |
Removal amount beta, if we're using gamma PDF for cut amount. More... | |
double | m_fGammaMeanRemoveM |
Removal amount mu, if we're using gamma PDF for cut amount. More... | |
double | m_fScale |
Gamma random draw scale parameter. More... | |
double | m_fCutProbA |
A in the function for calculating sigma in the cut probability function. More... | |
double | m_fCutProbB |
B in the function for calculating sigma in the cut probability function. More... | |
double | m_fCutProbC |
C in the function for calculating sigma in the cut probability function. More... | |
double | m_fSapP |
p in the sapling mortality function More... | |
double | m_fSapM |
m in the sapling mortality function More... | |
double | m_fSapN |
n in the sapling mortality function More... | |
double | m_fAllowedRange |
Allowed max deviation from desired BA for one-pass harvesting. More... | |
double | m_fTotalBA |
Total plot BA this timestep. More... | |
double | m_fTotalBiomass |
Total plot biomass this timestep. More... | |
int | m_iNumSpecies |
Total number of species. More... | |
int | m_iNumUserDefDistSizeClasses |
Total number of user-defined size class. More... | |
deadCode | m_iReasonCode |
Reason code to pass to the tree population when trees are killed. More... | |
bool | m_bUseBiomass |
Whether to use biomass (true) or basal area (false) in cut decisions. More... | |
bool | m_bSaplingMortality |
Whether or not to incorporate sapling mortality. More... | |
bool | m_bUseGammaDist |
Whether to use the gamma distribution (true) or user-defined (false) More... | |
Protected Attributes inherited from clBehaviorBase | |
short int | m_iNumSpeciesTypeCombos |
How many type/species combos a behavior will act on. More... | |
short int | m_iNumBehaviorSpecies |
How many distinct species are in the combo list - important for filling species-specific values from parameter file. More... | |
short int * | mp_iWhatSpecies |
List of distinct species - for filling species-specific values from parameter file. More... | |
stcSpeciesTypeCombo * | mp_whatSpeciesTypeCombos |
Array of species/type combos that the behavior will act on. More... | |
short int | m_iNewTreeInts |
The number of new tree integer data members this behavior wants to add. More... | |
short int | m_iNewTreeFloats |
The number of new tree float data members this behavior wants to add. More... | |
short int | m_iNewTreeChars |
The number of new tree character data members this behavior wants to add. More... | |
short int | m_iNewTreeBools |
The number of new tree boolean data members this behavior wants to add. More... | |
short int | m_iBehaviorListNumber |
The number of this behavior in the behavior list, to differentiate between possible multiple copies of this behavior. More... | |
float | m_fVersionNumber |
Version number - this will be rounded to 2 digits after the decimal place. More... | |
std::string | m_sXMLRoot |
XML root that encloses the parameters for this behavior. More... | |
float | m_fMinimumVersionNumber |
Minimum version number - this behavior will run parameter data for a file marked between this number and the current version number, inclusive. More... | |
Protected Attributes inherited from clWorkerBase | |
std::string | m_sNameString |
If a behavior has registered a command line command with the sim manager, this allows it to be called. More... | |
clSimManager * | mp_oSimManager |
Pointer to the simulation manager object. More... | |
int * | mp_iAllowedFileTypes |
List of the input file types this object can handle. More... | |
int | m_iNumAllowedTypes |
Number of input file types this object can handle. More... | |
Generalized Harvest Regime - Version 1.1.
Logs based on plot basal area and/or biomass. The user chooses whether to base calculations on total plot adult basal area or biomass. In the case of biomass, the Dimension Analysis behavior must be applied.
The probability that the plot is logged in a given time step is a function of the total plot biomass or basal area, as follows: P = a * exp(-m * X^b) Where P is the probability, X is the total plot adult biomass in Mg/ha OR the total plot adult basal area in m2/ha, and a, m, and b are the log probability parameters. This is evaluated each time step; it does not matter whether logging occurred the previous time step.
If the plot is to be logged, the amount of adult basal area to remove can be calculated using one of two possible distributions. If the gamma distribution is chosen, the mean amount to remove is: BAR = alpha * exp(-mu * X^beta) where BAR is the percentage to remove (between 0 and 100), X is the total plot adult biomass OR basal area, and alpha, beta, and mu are removal parameters. This percentage is then used as the mean in a draw on a gamma distribution. Any draws over 100% cause a re-draw until the chosen value is less than 100%.
The other distribution is a user-defined function with 10 classes. The user supplies the midpoint of each class and the probability of that class. SORTIE will transform this into a cumulative distribution function and use a random draw to determine the class. A random number drawn on a uniform distribution determines the exact removal target from that class.
Individual trees have a cut preference function as follows: P = (1 - gamma * exp(-beta * R ^ alpha)) * (exp(-0.5*((DBH - mu)/sigma)^2)) where P is the cut probability, R is the plot percentage of BA to remove, gamma, beta, alpha, and mu are species-specific removal probability parameters, and sigma is a + b * R^c, where a, b, and c are parameters.
Each tree's removal probability is then compared with a random number to determine whether or not it will be removed. The removal probabilities cannot be depended upon to average the target percent of basal area to remove; so if the removed amount is not within a designated range of the target, a second pass will be made through the trees with all probabilities adjusted either up or down in order to get closer to the target. No more than two passes will be made.
If desired, sapling mortality can be incorporated as a consequence of harvesting in the plot. The probability of sapling mortality is a logistic function of the percent basal area removed:
Mort prob = p + ((1-p)/(1 + (PCR/m)^n))
where PCR is the percent basal area removed (0-100) and p, m, and n are parameters. This is turned on by a parameter flag. Saplings removed in this way have a reason code of "natural".
All adults of all species must participate. All must have "Dimension Analysis" applied if biomass is being used for cut decisions. Seedlings are always ignored by this behavior. Saplings are ignored if their optional mortality is not used.
The parameter file call string and namestring are "GeneralizedHarvestRegime".
Copyright 2011 Charles D. Canham.
Edit history:
--------------—
January 16, 2011 - Created (LEM)
July 7, 2013 - Added flag for BA or Biomass and made version 1.1 (LEM)
September 27, 2013 - Added gamma redraw if above 100, rather than a cap at 100 (which artificially raises the chances of 100) (LEM)
May 8, 2014 - Added sapling mortality
June 3, 2014 - Added user-defined cut distribution
clGeneralizedHarvestRegime::clGeneralizedHarvestRegime | ( | clSimManager * | p_oSimManager | ) |
Constructor.
p_oSimManager | Sim Manager object. |
clGeneralizedHarvestRegime::~clGeneralizedHarvestRegime | ( | ) |
Destructor.
|
virtual |
Performs the harvest.
CutThisTimestep() is called to determine whether a harvest occurs.
Reimplemented from clBehaviorBase.
|
protected |
Decides whether or not a harvest will occur this timestep.
This gets the total amount of biomass or basal area and evaluates the probability equation. The result is compared to a random number to determine logging probability.
While this is totaling biomass, it will also total basal area for m_fTotalBA.
|
virtual |
Performs setup.
This calls:
p_oDoc | DOM tree of parsed input file. |
Implements clWorkerBase.
|
protected |
Gets the "Biomass" data member code for adults of each species.
If basal area is being used, this function exits without doing anything.
modelErr | if there is a missing code. |
|
protected |
Uses the appropriate distribution function to pick the percentage to cut.
|
protected |
Reads harvest data from the parameter file.
p_oDoc | DOM tree of parsed input file. |
modelErr | if any of the following are true:
|
|
virtual |
Registers the "Cut Probability" tree float data member.
The return codes are captured in the mp_iCutProbCode array.
modelErr | if this behavior is not applied to adults of all species, or is applied to anything else. |
Reimplemented from clBehaviorBase.
|
protected |
Whether or not to incorporate sapling mortality.
|
protected |
Whether to use biomass (true) or basal area (false) in cut decisions.
|
protected |
Whether to use the gamma distribution (true) or user-defined (false)
|
protected |
Allowed max deviation from desired BA for one-pass harvesting.
|
protected |
A in the function for calculating sigma in the cut probability function.
|
protected |
B in the function for calculating sigma in the cut probability function.
|
protected |
C in the function for calculating sigma in the cut probability function.
|
protected |
Removal amount alpha, if we're using gamma PDF for cut amount.
|
protected |
Removal amount beta, if we're using gamma PDF for cut amount.
|
protected |
Removal amount mu, if we're using gamma PDF for cut amount.
|
protected |
Probability of logging a.
|
protected |
Probability of logging b.
|
protected |
Probability of logging m.
|
protected |
m in the sapling mortality function
|
protected |
n in the sapling mortality function
|
protected |
p in the sapling mortality function
|
protected |
Gamma random draw scale parameter.
|
protected |
Total plot BA this timestep.
|
protected |
Total plot biomass this timestep.
|
protected |
Total number of species.
|
protected |
Total number of user-defined size class.
|
protected |
Reason code to pass to the tree population when trees are killed.
|
protected |
Upper bounds of intensity classes if we're using a user-defined probability distribution function for determining cut amount.
These are expressed in proportions from 0 to 1.
|
protected |
Probability of each intensity class if we're using a user-defined probability distribution function for determining cut amount.
These are expressed in proportions from 0 to 1.
|
protected |
Alpha in the species specific cut probability function.
Array size is total number of species.
|
protected |
Beta in the species specific cut probability function.
Array size is total number of species.
|
protected |
Gamma in the species specific cut probability function.
Array size is total number of species.
|
protected |
Mu in the species specific cut probability function.
Array size is total number of species.
|
protected |
Code for the "Biomass" float data member for adults of each species.
|
protected |
Code for the "Gen Harvest" bool data member for adults of each species.
|
protected |
Stashed pointer to tree population.