SORTIE Core C++ Documentation
|
Bole Volume Calculator Version 1.0. More...
#include <BoleVolumeCalculator.h>
Public Member Functions | |
clBoleVolumeCalculator (clSimManager *p_oSimManager) | |
Constructor. More... | |
~clBoleVolumeCalculator () | |
Destructor. More... | |
void | Action () |
Makes volume calculations. More... | |
void | GetData (xercesc::DOMDocument *p_oDoc) |
Does setup for this behavior. More... | |
void | RegisterTreeDataMembers () |
Registers the "Bole Vol" 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 | |
int | GetBoleHeight (const float &fDBH, const int &iSpecies) |
Gets the merchantable bole height of a tree. More... | |
void | GetParameterFileData (xercesc::DOMDocument *p_oDoc) |
Reads values from the parameter file. More... | |
void | FormatQueryString () |
Formats the string in m_sQuery. More... | |
void | PopulateTaperTable () |
Populates the taper table. 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 | |
double * | mp_fB0 |
b0 in the volume equation. More... | |
double * | mp_fB1 |
b1 in the volume equation. More... | |
double * | mp_fB2 |
b2 in the volume equation. More... | |
double * | mp_fB3 |
b3 in the volume equation. More... | |
double * | mp_fB4 |
b4 in the volume equation. More... | |
double * | mp_fB5 |
b5 in the volume equation. More... | |
double * | mp_fFormClass |
Form classes. More... | |
float ** | mp_fTaperTable |
Taper table. More... | |
short int * | mp_iIndexes |
For quick access to the species-specific arrays. More... | |
std::string | m_sQuery |
String to pass to clTreePopulation::Find() in order to get the trees for which to calculate volume. More... | |
short int ** | mp_iVolumeCodes |
Holds data member codes for "Bole Vol" float data member. More... | |
short int | m_iMaxLogs |
The maximum number of logs a tree can have. More... | |
short int | m_iDBHIncs |
Number of DBH increments in the taper table. 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... | |
Bole Volume Calculator Version 1.0.
This class calculates merchantable tree volume according to a US Forest Service equation. The volume value is stored in an float tree data member that this behavior adds as a value in cubic feet.
Tree volume is calculated as follows:
Where:
The bole length is the number of 16-foot logs the tree can provide. The base of the bole is the top of the cut stump (whatever that is; it's ignored by this behavior); the top of the bole is the merchantable height. This behavior defines the merchantable height as the height at which the trunk diameter inside the bark tapers to 60% of DBH.
To determine at what bole length the merchantable height occurs, we try fitting as many 16-foot logs as possible in to see how many fit before the 60% taper occurs. The amount of taper at the top of the first 16-foot log is established by the form classes and is a fixed percentage entered by the user as a parameter.
The amount of taper at the top of the first 16-foot log is subtracted from the DBH, to see how much taper is left before the 60% merchantable-height taper is reached. There is no formula that establishes clearly how many logs will fit; we use a trial-and-error approach on a table until we find the correct number of logs. The table below, adapted from Messavage and Girard, is contained in the code. It represents the amount of taper at the top of the last log in a tree containing different numbers of logs.
DBH (in) | 2-log | 3-log | 4-log | 5-log | 6-log |
---|---|---|---|---|---|
10 | 1.4 | 2.6 | – | – | – |
12 | 1.6 | 2.8 | 4.4 | – | – |
14 | 1.7 | 3 | 4.7 | – | – |
16 | 1.9 | 3.2 | 4.9 | – | – |
18 | 2 | 3.4 | 5.2 | – | – |
20 | 2.1 | 3.6 | 5.6 | 7.8 | – |
22 | 2.2 | 3.8 | 5.9 | 8 | – |
24 | 2.3 | 4 | 6.3 | 8.4 | – |
26 | 2.4 | 4.2 | 6.5 | 8.7 | – |
28 | 2.5 | 4.4 | 6.8 | 9 | 12 |
30 | 2.6 | 4.6 | 7.2 | 9.4 | 12.1 |
32 | 2.7 | 4.7 | 7.3 | 9.9 | 12.3 |
34 | 2.8 | 4.8 | 7.6 | 10.2 | 12.6 |
36 | 2.8 | 4.9 | 7.8 | 10.4 | 13 |
38 | 2.9 | 4.9 | 7.9 | 10.5 | 13.4 |
40 | 2.9 | 5 | 8 | 10.9 | 13.9 |
Consider a maple tree with a 20-inch DBH. The user enters its form class as 79%. We calculate the merchantable height to be that height at which the tree diameter inside the bark is 20 * 0.6 = 12 inches. The diameter at the top of the first 16-foot log = 20 * 0.79 = 15.8 inches.
The diameter at merchantable height is 12 inches; at the top of the first log it is 15.8 inches. This means there is 3.8 inches of taper available left. The next job is to use the lookup table to determine how many logs will fit into this amount of taper.
Our DBH is 20 inches, which has an entry for itself in the lookup table. If our DBH was not an even multiple of 2 inches, we would round down to the next lowest multiple of 2. Any tree larger than 40 inches of DBH will use the 40-inch entry. Trees must have a DBH of at least 10 inches to get a volume.
We begin by assuming that our tree is a 2-log tree. The amount of taper to the top of the second log in the table is given as 2.1. This means our diameter at the top of the second log is 15.8 - 2.1 = 13.7 inches. This is greater than 12 inches; so we will go back and try to fit three logs in.
For a 3-log tree of 20 inches, the taper at the top of the third log is 3.6 inches. The diameter at the top of this log is 15.8 - 3.6 = 12.2. This is still greater than 12, so we will try to fit in four logs.
The diameter at the top of the fourth log of a 4-log tree of 20 inches DBH is 15.8 - 1.4 - 1.8 - 2.4, or 10.2. This is less than 12. Thus, 4 logs don't fit. Our bole length is 3 * 16 = 48 feet.
This behavior adds an float data member called "Bole Vol" to trees that holds the final volume calculation as a value in square meters.
This class's namestring and parameter call string are both "TreeBoleVolumeCalculator".
This behavior may not be applied to seedlings.
Edit history:
--------------—
October 20, 2011 - Wiped the slate clean for SORTIE 7.0 (LEM)
clBoleVolumeCalculator::clBoleVolumeCalculator | ( | clSimManager * | p_oSimManager | ) |
Constructor.
p_oSimManager | clSimManager object. |
clBoleVolumeCalculator::~clBoleVolumeCalculator | ( | ) |
Destructor.
Deletes arrays.
|
virtual |
Makes volume calculations.
A query is sent to the tree population to get all trees to which this behavior is applied. For each, the volume is calculated by GetTreeVolume(). This value is placed in the "Bole Vol" float tree data member.
Reimplemented from clBehaviorBase.
|
protected |
Formats the string in m_sQuery.
This value will be used in Action() to pass to clTreePopulation::Find() in order to get the trees to act on.
|
protected |
Gets the merchantable bole height of a tree.
This function calculates the taper to the top of the first log using the form class for the species. After determining how much taper is left, it uses the taper table to determine how many logs to add. It determines the DBH increment index by rounding down to the nearest even number and subtracting 10 (with a max index of 15). Then, for that index, it moves from 0 to m_iMaxLogs across the table until it finds the greatest entry that is less than or equal to the remaining taper. That array index is equal to the number of logs to add to the first one. Then the result is multiplied by 16 and returned.
This function does not weed out trees with a DBH of less than 10 inches.
fDBH | SORTIE's DBH value, in in |
iSpecies | Tree's species. |
|
virtual |
Does setup for this behavior.
Calls:
p_oDoc | DOM tree of parsed input file. |
Implements clWorkerBase.
|
protected |
Reads values from the parameter file.
p_oDoc | DOM tree of parsed input file. |
modelErr | if any value for form class is less than 60%. |
|
protected |
Populates the taper table.
The taper array is declared and the values populated according to the values in the documentation above.
|
virtual |
Registers the "Bole Vol" float data member.
The return codes are captured in the mp_iVolumeCodes array.
modelErr | if this behavior is being applied to any tree type except saplings, adults, and snags. |
Reimplemented from clBehaviorBase.
|
protected |
Number of DBH increments in the taper table.
Equal to 16 (DBH in 2-in increments from 10 to 40 inches).
|
protected |
The maximum number of logs a tree can have.
Equal to 6.
|
protected |
String to pass to clTreePopulation::Find() in order to get the trees for which to calculate volume.
This will instigate a species/type search for all the species and types to which this behavior applies.
|
protected |
b0 in the volume equation.
Array size is # behavior species.
|
protected |
b1 in the volume equation.
Array size is # behavior species.
|
protected |
b2 in the volume equation.
Array size is # behavior species.
|
protected |
b3 in the volume equation.
Array size is # behavior species.
|
protected |
b4 in the volume equation.
Array size is # behavior species.
|
protected |
b5 in the volume equation.
Array size is # behavior species.
|
protected |
Form classes.
This is the proportion of DBH that the diameter is at the top of the first log. This is entered by the user as a percentage between 60 and 100 but to save math we convert to a proportion and subtract it from 1 so it's the inverse. Array size is # behavior species.
|
protected |
Taper table.
This is the amount by which diameter is reduced, in inches, at the top of the last log in a 2-, 3-, 4-, 5-, or 6-log tree. First array index is 16 (m_iDBHIncs, DBH in 2-in increments from 10 to 40 inches); second index is 6 (m_iMaxLogs).
|
protected |
For quick access to the species-specific arrays.
Array size is # total species.
|
protected |
Holds data member codes for "Bole Vol" float data member.
First array index is # behavior species, second is number types (3 - sapling, adult, snag)