#include <BoleVolumeCalculator.h>
Inheritance diagram for clBoleVolumeCalculator:
Public Member Functions | |
clBoleVolumeCalculator (clSimManager *p_oSimManager) | |
Constructor. | |
~clBoleVolumeCalculator () | |
Destructor. | |
void | Action () |
Makes volume calculations. | |
void | GetData (xercesc::DOMDocument *p_oDoc) |
Does setup for this behavior. | |
void | RegisterTreeDataMembers () |
Registers the "Bole Vol" float data member. | |
Protected Member Functions | |
int | GetBoleHeight (const float &fDBH, const int &iSpecies) |
Gets the merchantable bole height of a tree. | |
void | GetParameterFileData (xercesc::DOMDocument *p_oDoc) |
Reads values from the parameter file. | |
void | FormatQueryString () |
Formats the string in m_cQuery. | |
void | PopulateTaperTable () |
Populates the taper table. | |
Protected Attributes | |
float * | mp_fB0 |
b0 in the volume equation. | |
float * | mp_fB1 |
b1 in the volume equation. | |
float * | mp_fB2 |
b2 in the volume equation. | |
float * | mp_fB3 |
b3 in the volume equation. | |
float * | mp_fB4 |
b4 in the volume equation. | |
float * | mp_fB5 |
b5 in the volume equation. | |
float * | mp_fFormClass |
Form classes. | |
float ** | mp_fTaperTable |
Taper table. | |
short int * | mp_iIndexes |
For quick access to the species-specific arrays. | |
char * | m_cQuery |
String to pass to clTreePopulation::Find() in order to get the trees for which to calculate volume. | |
short int ** | mp_iVolumeCodes |
Holds data member codes for "Bole Vol" float data member. | |
short int | m_iMaxLogs |
The maximum number of logs a tree can have. | |
short int | m_iDBHIncs |
Number of DBH increments in the taper table. |
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 dont 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 "tree bole volume calculator".
This behavior may not be applied to seedlings.
clBoleVolumeCalculator::clBoleVolumeCalculator | ( | clSimManager * | p_oSimManager | ) |
clBoleVolumeCalculator::~clBoleVolumeCalculator | ( | ) |
Destructor.
Deletes arrays.
void clBoleVolumeCalculator::Action | ( | ) | [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.
void clBoleVolumeCalculator::FormatQueryString | ( | ) | [protected] |
Formats the string in m_cQuery.
This value will be used in Action() to pass to clTreePopulation::Find() in order to get the trees to act on.
int clBoleVolumeCalculator::GetBoleHeight | ( | const float & | fDBH, | |
const int & | iSpecies | |||
) | [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. |
void clBoleVolumeCalculator::GetData | ( | xercesc::DOMDocument * | p_oDoc | ) | [virtual] |
Does setup for this behavior.
Calls:
p_oDoc | DOM tree of parsed input file. |
Implements clWorkerBase.
void clBoleVolumeCalculator::GetParameterFileData | ( | xercesc::DOMDocument * | p_oDoc | ) | [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%. |
void clBoleVolumeCalculator::PopulateTaperTable | ( | ) | [protected] |
Populates the taper table.
The taper array is declared and the values populated according to the values in the documentation above.
void clBoleVolumeCalculator::RegisterTreeDataMembers | ( | ) | [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.
char* clBoleVolumeCalculator::m_cQuery [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.
short int clBoleVolumeCalculator::m_iDBHIncs [protected] |
Number of DBH increments in the taper table.
Equal to 16 (DBH in 2-in increments from 10 to 40 inches).
short int clBoleVolumeCalculator::m_iMaxLogs [protected] |
The maximum number of logs a tree can have.
Equal to 6.
float* clBoleVolumeCalculator::mp_fB0 [protected] |
b0 in the volume equation.
Array size is # behavior species.
float* clBoleVolumeCalculator::mp_fB1 [protected] |
b1 in the volume equation.
Array size is # behavior species.
float* clBoleVolumeCalculator::mp_fB2 [protected] |
b2 in the volume equation.
Array size is # behavior species.
float* clBoleVolumeCalculator::mp_fB3 [protected] |
b3 in the volume equation.
Array size is # behavior species.
float* clBoleVolumeCalculator::mp_fB4 [protected] |
b4 in the volume equation.
Array size is # behavior species.
float* clBoleVolumeCalculator::mp_fB5 [protected] |
b5 in the volume equation.
Array size is # behavior species.
float* clBoleVolumeCalculator::mp_fFormClass [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.
float** clBoleVolumeCalculator::mp_fTaperTable [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).
short int* clBoleVolumeCalculator::mp_iIndexes [protected] |
For quick access to the species-specific arrays.
Array size is # total species.
short int** clBoleVolumeCalculator::mp_iVolumeCodes [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)