SORTIE Core C++ Documentation
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
clGeneralizedHarvestRegime Class Reference

Generalized Harvest Regime - Version 1.1. More...

#include <GeneralizedHarvestRegime.h>

Inheritance diagram for clGeneralizedHarvestRegime:
clBehaviorBase clWorkerBase

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...
 
clSimManagerGetSimManager ()
 
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

clTreePopulationmp_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...
 
stcSpeciesTypeCombomp_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...
 
clSimManagermp_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...
 

Detailed Description

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.

Author
Lora E. Murphy


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

Constructor & Destructor Documentation

◆ clGeneralizedHarvestRegime()

clGeneralizedHarvestRegime::clGeneralizedHarvestRegime ( clSimManager p_oSimManager)

Constructor.

Parameters
p_oSimManagerSim Manager object.

◆ ~clGeneralizedHarvestRegime()

clGeneralizedHarvestRegime::~clGeneralizedHarvestRegime ( )

Destructor.

Member Function Documentation

◆ Action()

void clGeneralizedHarvestRegime::Action ( )
virtual

Performs the harvest.

CutThisTimestep() is called to determine whether a harvest occurs.

Reimplemented from clBehaviorBase.

◆ CutThisTimestep()

bool clGeneralizedHarvestRegime::CutThisTimestep ( )
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.

Returns
True if logging is to occur, false if not.

◆ GetData()

void clGeneralizedHarvestRegime::GetData ( xercesc::DOMDocument *  p_oDoc)
virtual

Performs setup.

This calls:

  • ReadHarvestParameterFileData
  • GetDataCodes
Parameters
p_oDocDOM tree of parsed input file.

Implements clWorkerBase.

◆ GetDataCodes()

void clGeneralizedHarvestRegime::GetDataCodes ( )
protected

Gets the "Biomass" data member code for adults of each species.

If basal area is being used, this function exits without doing anything.

Exceptions
modelErrif there is a missing code.

◆ GetPercentToCut()

double clGeneralizedHarvestRegime::GetPercentToCut ( )
protected

Uses the appropriate distribution function to pick the percentage to cut.

Returns
Percentage to cut as a value between 0 and 100.

◆ ReadHarvestParameterFileData()

void clGeneralizedHarvestRegime::ReadHarvestParameterFileData ( xercesc::DOMDocument *  p_oDoc)
protected

Reads harvest data from the parameter file.

Parameters
p_oDocDOM tree of parsed input file.
Exceptions
modelErrif any of the following are true:
  • Any value in harvest intensity classes is not between 0 and 1
  • Any value in harvest intensity class probabilities is not between 0 and 1
  • Harvest class probabilities don't add up to 1
  • Harvest intensity classes are not monotonically increasing

◆ RegisterTreeDataMembers()

void clGeneralizedHarvestRegime::RegisterTreeDataMembers ( )
virtual

Registers the "Cut Probability" tree float data member.

The return codes are captured in the mp_iCutProbCode array.

Exceptions
modelErrif this behavior is not applied to adults of all species, or is applied to anything else.

Reimplemented from clBehaviorBase.

Member Data Documentation

◆ m_bSaplingMortality

bool clGeneralizedHarvestRegime::m_bSaplingMortality
protected

Whether or not to incorporate sapling mortality.

◆ m_bUseBiomass

bool clGeneralizedHarvestRegime::m_bUseBiomass
protected

Whether to use biomass (true) or basal area (false) in cut decisions.

◆ m_bUseGammaDist

bool clGeneralizedHarvestRegime::m_bUseGammaDist
protected

Whether to use the gamma distribution (true) or user-defined (false)

◆ m_fAllowedRange

double clGeneralizedHarvestRegime::m_fAllowedRange
protected

Allowed max deviation from desired BA for one-pass harvesting.

◆ m_fCutProbA

double clGeneralizedHarvestRegime::m_fCutProbA
protected

A in the function for calculating sigma in the cut probability function.

◆ m_fCutProbB

double clGeneralizedHarvestRegime::m_fCutProbB
protected

B in the function for calculating sigma in the cut probability function.

◆ m_fCutProbC

double clGeneralizedHarvestRegime::m_fCutProbC
protected

C in the function for calculating sigma in the cut probability function.

◆ m_fGammaMeanRemoveA

double clGeneralizedHarvestRegime::m_fGammaMeanRemoveA
protected

Removal amount alpha, if we're using gamma PDF for cut amount.

◆ m_fGammaMeanRemoveB

double clGeneralizedHarvestRegime::m_fGammaMeanRemoveB
protected

Removal amount beta, if we're using gamma PDF for cut amount.

◆ m_fGammaMeanRemoveM

double clGeneralizedHarvestRegime::m_fGammaMeanRemoveM
protected

Removal amount mu, if we're using gamma PDF for cut amount.

◆ m_fLogProbA

double clGeneralizedHarvestRegime::m_fLogProbA
protected

Probability of logging a.

◆ m_fLogProbB

double clGeneralizedHarvestRegime::m_fLogProbB
protected

Probability of logging b.

◆ m_fLogProbM

double clGeneralizedHarvestRegime::m_fLogProbM
protected

Probability of logging m.

◆ m_fSapM

double clGeneralizedHarvestRegime::m_fSapM
protected

m in the sapling mortality function

◆ m_fSapN

double clGeneralizedHarvestRegime::m_fSapN
protected

n in the sapling mortality function

◆ m_fSapP

double clGeneralizedHarvestRegime::m_fSapP
protected

p in the sapling mortality function

◆ m_fScale

double clGeneralizedHarvestRegime::m_fScale
protected

Gamma random draw scale parameter.

◆ m_fTotalBA

double clGeneralizedHarvestRegime::m_fTotalBA
protected

Total plot BA this timestep.

◆ m_fTotalBiomass

double clGeneralizedHarvestRegime::m_fTotalBiomass
protected

Total plot biomass this timestep.

◆ m_iNumSpecies

int clGeneralizedHarvestRegime::m_iNumSpecies
protected

Total number of species.

◆ m_iNumUserDefDistSizeClasses

int clGeneralizedHarvestRegime::m_iNumUserDefDistSizeClasses
protected

Total number of user-defined size class.

◆ m_iReasonCode

deadCode clGeneralizedHarvestRegime::m_iReasonCode
protected

Reason code to pass to the tree population when trees are killed.

◆ mp_fCutAmtIntensityClasses

double* clGeneralizedHarvestRegime::mp_fCutAmtIntensityClasses
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.

◆ mp_fCutAmtIntensityClassProb

double* clGeneralizedHarvestRegime::mp_fCutAmtIntensityClassProb
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.

◆ mp_fCutProbAlpha

double* clGeneralizedHarvestRegime::mp_fCutProbAlpha
protected

Alpha in the species specific cut probability function.

Array size is total number of species.

◆ mp_fCutProbBeta

double* clGeneralizedHarvestRegime::mp_fCutProbBeta
protected

Beta in the species specific cut probability function.

Array size is total number of species.

◆ mp_fCutProbGamma

double* clGeneralizedHarvestRegime::mp_fCutProbGamma
protected

Gamma in the species specific cut probability function.

Array size is total number of species.

◆ mp_fCutProbMu

double* clGeneralizedHarvestRegime::mp_fCutProbMu
protected

Mu in the species specific cut probability function.

Array size is total number of species.

◆ mp_iBiomassCode

short int* clGeneralizedHarvestRegime::mp_iBiomassCode
protected

Code for the "Biomass" float data member for adults of each species.

◆ mp_iHarvestCode

short int* clGeneralizedHarvestRegime::mp_iHarvestCode
protected

Code for the "Gen Harvest" bool data member for adults of each species.

◆ mp_oPop

clTreePopulation* clGeneralizedHarvestRegime::mp_oPop
protected

Stashed pointer to tree population.


The documentation for this class was generated from the following file: