clMerchValueCalculator Class Reference

Merchantable Timber Value Calculator Version 1.0. More...

#include <MerchValueCalculator.h>

Inheritance diagram for clMerchValueCalculator:

clBehaviorBase clWorkerBase

List of all members.

Public Member Functions

 clMerchValueCalculator (clSimManager *p_oSimManager)
 Constructor.
 ~clMerchValueCalculator ()
 Destructor.
void Action ()
 Makes value calculations.
void GetData (xercesc::DOMDocument *p_oDoc)
 Does setup for this behavior.
void RegisterTreeDataMembers ()
 Registers the "Merch Val" float data member.

Protected Member Functions

float GetTreeValue (const float &fDBH, const int &iSpecies)
 Gets the value for a tree.
int GetNumLogs (const float &fDBH, const int &iSpecies)
 Gets the number of logs in the merchantable bole height of a tree.
void GetParameterFileData (xercesc::DOMDocument *p_oDoc, clTreePopulation *p_oPop)
 Reads values from the parameter file.
void FormatQueryString (clTreePopulation *p_oPop)
 Formats the string in m_cQuery.
void PopulateTables ()
 Populates the taper and form class board feet tables.
void SetupGrid ()
 Sets up the "Merchantable Timber Value" grid.

Protected Attributes

clGridBasemp_oValueGrid
 Grid holding total values for each species.
float * mp_fVal
 Value per thousand board feet of merchantable timber, in whatever currency the user prefers.
float * mp_fFormClass
 Form classes.
float ** mp_fTaperTable
 Taper table.
float ** mp_fFormClass78Table
 Table of board feet for form class 78.
float ** mp_fFormClass79Table
 Table of board feet for form class 79.
float ** mp_fFormClass80Table
 Table of board feet for form class 80.
float ** mp_fFormClass81Table
 Table of board feet for form class 81.
float ** mp_fFormClass84Table
 Table of board feet for form class 84.
float ** mp_fFormClass85Table
 Table of board feet for form class 85.
char * m_cQuery
 String to pass to clTreePopulation::Find() in order to get the trees for which to calculate volume.
short int ** mp_iMerchValCodes
 Holds data member codes for "Merch Val" float data member.
short int * mp_iValueCodes
 Holds data member codes for the "value_x" float data members of the "Merchantable Timber Value" grid.
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.
short int m_iFormDBHIncs
 Number of DBH increments in the form class board feet tables.
short int m_iNumTotalSpecies
 Total number of species.


Detailed Description

Merchantable Timber Value Calculator Version 1.0.

This class calculates merchantable tree timber value according to a US Forest Service equation. The value is stored in an float tree data member that this behavior adds, as a value in an unspecified currency (user's choice). This also creates a grid object with species total values.

The value is price per thousand board feet of timber. The amount of timber in a tree is based on the size of the tree and the number of 16-foot logs that can be extracted from a tree.

The number of 16-foot logs a tree can provide is based on the bole length. 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.

There's no simple equation to determine how many 16 foot logs fit into the length of the bole. This behavior uses a table along with trial-and-error to fit as many 16-foot logs as possible in 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.

All trees above the minimum DBH are assumed to have at least 1 16-foot log. The amount of taper at the top of this first log is subtracted from the DBH, to see how much taper is left before the 60% merchantable-height taper is reached. 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-log3-log4-log5-log6-log
101.42.6------
121.62.84.4----
141.734.7----
161.93.24.9----
1823.45.2----
202.13.65.67.8--
222.23.85.98--
242.346.38.4--
262.44.26.58.7--
282.54.46.8912
302.64.67.29.412.1
322.74.77.39.912.3
342.84.87.610.212.6
362.84.97.810.413
382.94.97.910.513.4
402.95810.913.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 tree thus provides 3 16-foot logs.

Once we know the number of 16-foot logs, then we can use another set of tables to find out how many board-feet of timber those logs provide. The table used is based on form class (again, from Messavage and Girard). The timber is assumed to be 0.25" in width.

VOLUME (BOARD FEET) BY NUMBER OF USABLE 16 FOOT LOGS
Form Class 78:
DBH (inches)1 log2 logs3 logs4 logs5 logs6 logs
10365973------
11467696------
125692120137----
1367112147168----
1478132174200----
1592156208242----
16106180241285----
17121206278330----
18136233314374----
19154264358427----
20171296401480542--
21191332450542616--
22211368500603691--
23231404552663714--
24251441605723782--
25275484665800865--
262995287258771,021--
273235727889521,111--
283476168501,0271,2011,358
293756679201,1121,3081,488
304037189911,1981,4151,619
314327721,0701,2991,5261,754
324628261,1491,4001,6371,888
334928801,2261,4951,7502,026
345219341,3041,5901,8642,163
355559981,3941,7022,0002,312
365891,0631,4851,8142,1352,461
376221,1241,5781,9262,2722,616
386561,1861,6702,0382,4102,771
396941,2581,7692,1662,5522,937
407311,3291,8682,2942,6933,103


Form Class 79:
DBH (inches)1 log2 logs3 logs4 logs5 logs6 logs
10386177------
114878100------
125896124141----
1370117153176----
1482138182211----
1595160214252----
16108183246292----
17124212286340----
18140240325388----
19158272370442----
20176305414496561--
21196342464558636--
22216378514621710--
23238418571687792--
24260458628753875--
25282499685826960--
263055407428991,046--
273315888109801,144--
283576358771,0611,2421,404
293856869481,1481,3501,537
304137371,0201,2351,4581,670
314447921,1001,3381,5721,808
324748481,1811,4401,6851,945
335069071,2651,5441,8082,094
345389661,3491,6471,9322,244
355701,0261,4351,7542,0002,384
366021,0871,5211,8602,1892,525
376381,1541,6201,9802,3382,694
386741,2201,7202,1012,4882,862
397121,2921,8222,2322,6323,031
407501,3651,9232,3622,7753,200


Form Class 80:
DBH (inches)1 log2 logs3 logs4 logs5 logs6 logs
10396380------
114980104------
125998127146----
1371120156181----
1483141186216----
1598166221260----
16112190256305----
17128219296354----
18144248336402----
19162281382457----
20181314427512580--
21201350478575656--
22221387528638732--
23244428586706816--
24266469644773899--
25290514706852992--
263155587679311,086--
273416068361,0141,185--
283676549041,0961,2841,453
293967069771,1841,3941,588
304247581,0501,2721,5031,723
314548141,1321,3761,6181,862
324858701,2131,4801,7332,001
335189301,2981,5861,8582,152
345509891,3831,6911,9842,304
355851,0551,4771,8062,1242,458
366201,1211,5711,9222,2642,612
376561,1881,6722,0442,4162,783
386931,2561,7722,1672,5682,954
397321,3301,8742,3002,7143,127
407701,4031,9772,4322,8603,300


Form Class 81:
DBH (inches)1 log2 logs3 logs4 logs5 logs6 logs
10406582------
115082106------
1260100130150----
1372122160186----
1485144190221----
15100170228268----
16115197265316----
17132226306366----
18148256346415----
19166290392471----
20185323439527598--
21206360492592676--
22227398544656754--
23250439602724838--
24272480659791923--
252985287268771,024--
263245757939631,124--
273516248631,0471,226--
283786749331,1311,3271,502
294067261,0061,2201,4381,640
304357791,0801,3101,5491,777
314668361,1621,4161,6661,918
324978921,2451,5221,7842,059
335309531,3321,6281,9102,214
345631,0141,4191,7342,0372,368
356001,0841,5181,8592,1882,534
366371,1541,6181,9842,3382,700
376741,2231,7212,1092,4942,874
387121,2921,8242,2342,6493,049
397511,3661,9282,3682,7963,224
407901,4412,0322,5022,9443,399


Form Class 84:
DBH (inches)1 log2 logs3 logs4 logs5 logs6 logs
10437191------
115491118------
1266111145168----
1380135178208----
1493159212248----
15108185249295----
16123211286342----
17142244332398----
18160277377453----
19180314428524----
20200351479576657--
21223392537649744--
22246434595722830--
23271480660798925--
242965257248731,020--
253225727909581,118--
263476198551,0421,217--
273766739321,1361,331--
284067271,0101,2301,4451,636
294387861,0921,3301,5691,790
304708441,1731,4291,6931,943
315049071,2651,5461,8232,101
325389701,3571,6641,9532,259
335741,0371,4531,7822,0962,431
346111,1041,5491,9012,2402,603
356471,1731,6482,0232,3872,766
366831,2421,7462,1452,5342,929
377241,3181,8592,2842,7063,123
387651,3931,9722,4222,8773,317
398081,4762,0882,5703,0423,512
408511,5582,2032,7193,2083,706


Form Class 85:
DBH (inches)1 log2 logs3 logs4 logs5 logs6 logs
10457494------
115694122------
1268114150173----
1382138184214----
1495163217254----
15111191257304----
16127219297355----
17146252342412----
18164285388468----
19184322440531----
20205360492594678--
21228402550667765--
22251444609740852--
23276490675818950--
243025377418951,047--
253305888129861,153--
263576388821,0761,259--
273876939611,1721,374--
284177451,0401,2671,4901,689
294488071,1221,3681,6161,844
304818661,2051,4691,7411,999
315169301,2981,5881,8742,160
325509931,3911,7062,0062,321
335871,0611,4881,8272,1502,495
346241,1291,5861,9482,2942,669
356631,2041,6922,0802,4542,846
367021,2781,7972,2122,6143,022
377441,3551,9122,3522,7883,219
387851,4322,0272,4932,9623,416
398281,5152,1442,6443,1303,614
408721,5982,2602,7953,2983,813

This behavior adds an float data member called "Merch Val" to trees that holds the value of the tree's timber.

This class's namestring and parameter call string are both "Merch Value Calculator".

This behavior may not be applied to seedlings.


Edit history:
-----------------
March 8, 2006 - Created (LEM)


Constructor & Destructor Documentation

clMerchValueCalculator::clMerchValueCalculator ( clSimManager p_oSimManager  ) 

Constructor.

Parameters:
p_oSimManager clSimManager object.

clMerchValueCalculator::~clMerchValueCalculator (  ) 

Destructor.

Deletes arrays.


Member Function Documentation

void clMerchValueCalculator::Action (  )  [virtual]

Makes value calculations.

First, the values in the "Merchantable Timber Value" grid are cleared. Then a query is sent to the tree population to get all trees to which this behavior is applied. For each, the value is calculated by GetTreeValue(). This value is placed in the "Merch Val" float tree data member. The species totals are put in the "Merchantable Timber Value" grid.

Reimplemented from clBehaviorBase.

void clMerchValueCalculator::GetData ( xercesc::DOMDocument *  p_oDoc  )  [virtual]

Does setup for this behavior.

Calls:

  1. GetParameterFileData()
  2. FormatQueryString()
  3. PopulateTables()
  4. SetupGrid()
  5. Action() so that the initial conditions value will be added
Parameters:
p_oDoc DOM tree of parsed input file.

Implements clWorkerBase.

void clMerchValueCalculator::RegisterTreeDataMembers (  )  [virtual]

Registers the "Merch Val" float data member.

The return codes are captured in the mp_iVolumeCodes array.

Exceptions:
modelErr if this behavior is being applied to any tree type except saplings, adults, and snags.

Reimplemented from clBehaviorBase.

float clMerchValueCalculator::GetTreeValue ( const float &  fDBH,
const int &  iSpecies 
) [protected]

Gets the value for a tree.

First, GetNumLogs() is called to find out how many 16-foot logs the tree has. Then this uses the form class table for the tree's species to determine the number of board feet in the tree. It determines the first array index by rounding down to the nearest integer and subtracting 10 (with a max index of 30). The second index is equal to the number of logs minus 1. This pair of indexes gets us the volume in board feet of the tree from the form class table. This volume is multiplied by the value for the species and returned.

If the dbh is less than the minimum, the value is 0.

Parameters:
fDBH SORTIE's DBH value, in in
iSpecies Tree's species.
Returns:
Tree's value, in whatever currency units mp_fVal is in.

int clMerchValueCalculator::GetNumLogs ( const float &  fDBH,
const int &  iSpecies 
) [protected]

Gets the number of logs in the merchantable bole height of a tree.

This function calculates the number of logs in a tree. It 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. The maximum value is 6.

This function does not weed out trees with a DBH of less than 10 inches.

Parameters:
fDBH SORTIE's DBH value, in in
iSpecies Tree's species.
Returns:
Number of 16-foot logs in a tree.

void clMerchValueCalculator::GetParameterFileData ( xercesc::DOMDocument *  p_oDoc,
clTreePopulation p_oPop 
) [protected]

Reads values from the parameter file.

Parameters:
p_oDoc DOM tree of parsed input file.
p_oPop Tree population object.
Exceptions:
modelErr if a form class value is not equal to 78, 79, 80, 81, 84, or 85.

void clMerchValueCalculator::FormatQueryString ( clTreePopulation p_oPop  )  [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.

Parameters:
p_oPop Tree population object.

void clMerchValueCalculator::PopulateTables (  )  [protected]

Populates the taper and form class board feet tables.

The table arrays are declared and the values populated according to the values in the documentation above.

void clMerchValueCalculator::SetupGrid (  )  [protected]

Sets up the "Merchantable Timber Value" grid.

This ignores any maps.


Member Data Documentation

Grid holding total values for each species.

The grid name is "Merchantable Timber Value". The grid contains only 1 grid cell. It has X float data members, where X = the total number of species. The data member names are "value_x", where "x" is the species number.

float* clMerchValueCalculator::mp_fVal [protected]

Value per thousand board feet of merchantable timber, in whatever currency the user prefers.

During parameter file reading this will be divided by 1000 to be value per foot of timber. Array size is # total species.

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.

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

Table of board feet for form class 78.

This is the volume, in board feet, for trees having 1 to 6 logs. First array index is m_iFormDBHIncs; second index is m_iMaxLogs.

Table of board feet for form class 79.

This is the volume, in board feet, for trees having 1 to 6 logs. First array index is m_iFormDBHIncs; second index is m_iMaxLogs.

Table of board feet for form class 80.

This is the volume, in board feet, for trees having 1 to 6 logs. First array index is m_iFormDBHIncs; second index is m_iMaxLogs.

Table of board feet for form class 81.

This is the volume, in board feet, for trees having 1 to 6 logs. First array index is m_iFormDBHIncs; second index is m_iMaxLogs.

Table of board feet for form class 84.

This is the volume, in board feet, for trees having 1 to 6 logs. First array index is m_iFormDBHIncs; second index is m_iMaxLogs.

Table of board feet for form class 85.

This is the volume, in board feet, for trees having 1 to 6 logs. First array index is m_iFormDBHIncs; second index is m_iMaxLogs.

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.

Holds data member codes for "Merch Val" float data member.

First array index is total # species, second is number types (3 - sapling, adult, snag)

Holds data member codes for the "value_x" float data members of the "Merchantable Timber Value" grid.

Array size is total # species.

short int clMerchValueCalculator::m_iMaxLogs [protected]

The maximum number of logs a tree can have.

Equal to 6.

short int clMerchValueCalculator::m_iDBHIncs [protected]

Number of DBH increments in the taper table.

Equal to 16 (DBH in 2-in increments from 10 to 40 inches).

Number of DBH increments in the form class board feet tables.

Equal to 31 (DBH in 1-in increments from 10 to 40 inches).

Total number of species.

For the destructor.


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

Generated on Wed Oct 28 13:58:46 2009 for SORTIE Core C++ Documentation by  doxygen 1.5.6