GCBM
|
ADT - Tree yield table More...
#include <treeyieldtable.h>
Public Member Functions | |
TreeYieldTable () | |
virtual | ~TreeYieldTable ()=default |
int | maxAge () const |
Maximum age of the yield table More... | |
double | totalVolume () const |
Total volume of the speciese growth curve More... | |
std::vector< double > & | yieldsAtEachAge () |
Vector of volume (m^3/ha) at each age stop, 1 ha = 10,000 m^2 More... | |
double | operator[] (int age) const |
SpeciesType | speciesType () const |
TreeYieldTable (const std::vector< DynamicObject > &yieldTable, SpeciesType speciesType) | |
Create a yield table for a specified type with the transform result yield data More... | |
Private Member Functions | |
void | Initialize (const std::vector< DynamicObject > &yieldTable) |
Load original yield table data[age, volume] Interpolate to get volume at each age Calculate the maximum volume More... | |
void | InterpolateVolumeAtEachAge () |
Lineraly Interpolate the tree yield table to assign the volume at each age year More... | |
void | preProcessYieldData () |
There should be a volume data at each age. The yield table is not valid if there are ZERO values after the last valid non-zero volume. For example, the volume data like[0,0,0,0,10,20,30,50,60,70,0,0,0,0]. In current CBM, all the trialling ZEROs should be replaced by the last non-zero data - 70. The volume data like[0,0,0,0,10,20,30,50,60,70,70,70,70,70]. More... | |
double | linear (double x, double x0, double x1, double y0, double y1) |
http://stackoverflow.com/questions/12838007/c-sharp-linear-interpolation More... | |
Private Attributes | |
int | _maxAge |
int | _ageInterval |
double | _totalVolume |
SpeciesType | _speciesType |
std::vector< double > | _yieldsAtEachAge |
ADT - Tree yield table
TreeYieldTable | ( | ) |
Overloaded Constructor
Initialise TreeYieldTable._maxAge to 0, TreeYieldTable._ageInterval to 0
|
virtualdefault |
TreeYieldTable | ( | const std::vector< DynamicObject > & | yieldTable, |
SpeciesType | speciesType | ||
) |
Create a yield table for a specified type with the transform result yield data
yieldTable | It has [Age, Volume] |
specieseType | species type, either softwood or hardwood |
Overloaded Constructor - Create a yield table for a specified type with the transform result yield data parameter speciesType either be softwood or hardwood
Initialise TreeYieldTable._maxAge to 0, TreeYieldTable._speciesType to parameter speciesType
, If yieldTable is not empty, initialise TreeYieldTable._maxAge as the last value of "age" in parameter yieldTable,
TreeYieldTable._ageInterval as the difference between the second and first "age" values in parameter yieldTable
Invoke TreeYieldTable.Initialize() with paramter yieldTable
yieldTable | const vector<DynamicObject>& |
speciesType | SpeciesType |
|
private |
Load original yield table data[age, volume] Interpolate to get volume at each age Calculate the maximum volume
rows |
Load original yield table data, interpolate to get volume at each age and calculate the maximum volume
Resize TreeYieldTable._yieldsAtEachAge to TreeYieldTable._maxAge + 1 and initialise it to 9
Add the value of "merchantable_volume" attribute corresponding to each in parameter yieldTable to TreeYieldTable._yieldsAtEachAge
More than one value in the yield table for a given age means tha there are multiple hardwood or softwood species components - CBM3 Toolbox behaviour is to add the yields together
Invoke TreeYieldTable.preProcessYieldData() and TreeYieldTable.InterpolateVolumeAtEachAge() Assign the sum of TreeYieldTable._yieldsAtEachAge to TreeYieldTable._totalVolume
yieldTable | const vector<DynamicObject>& |
|
private |
Lineraly Interpolate the tree yield table to assign the volume at each age year
Linearly Interpolate the tree yield table to assign the volume at each age year
For each value in the range 0 to TreeYieldTable._maxAge separated by TreeYieldTable._ageInterval, assign x0 as value, x1 as value + TreeYieldTable._ageInterval, y0 as value of x0 in TreeYieldTable._yieldsAtEachAge, y1 as value of x1 in TreeYieldTable._yieldsAtEachAge
For each age in the range x0 to x1, assign the result of the interpolation using TreeYieldTable.linear() with arguments age, x0, x1, y0, y1
|
private |
int maxAge | ( | ) | const |
Maximum age of the yield table
double operator[] | ( | int | age | ) | const |
Indexer to get the volume at each age
Return value of parameter age in TreeYieldTable._yieldsAtEachAge
age | int |
|
private |
There should be a volume data at each age. The yield table is not valid if there are ZERO values after the last valid non-zero volume. For example, the volume data like[0,0,0,0,10,20,30,50,60,70,0,0,0,0]. In current CBM, all the trialling ZEROs should be replaced by the last non-zero data - 70. The volume data like[0,0,0,0,10,20,30,50,60,70,70,70,70,70].
Volume data at each age should exist. The yield table is not valid if there are ZERO values after the last valid non-zero volume.
If TreeYieldTable.yieldsAtEachAge is not empty, for ages in the range 0 and TreeYieldTable._maxAge, if the value of the current age in TreeYieldTable._yieldsAtEachAge is not equal to the value of age+1 in TreeYieldTable._yieldsAtEachAge and value of age+1 in TreeYieldTable._yieldsAtEachAge is 0, set the value of age+1 equal to the value of age in TreeYieldTable._yieldsAtEachAge
Example : If the volume data like[0,0,0,0,10,20,30,50,60,70,0,0,0,0], it is not valid
In current CBM, all the trialling ZEROs should be replaced by the last non-zero data - 70 The volume data should be like[0,0,0,0,10,20,30,50,60,70,70,70,70,70].
SpeciesType speciesType | ( | ) | const |
double totalVolume | ( | ) | const |
Total volume of the speciese growth curve
std::vector<double>& yieldsAtEachAge | ( | ) |
Vector of volume (m^3/ha) at each age stop, 1 ha = 10,000 m^2
|
private |
|
private |
|
private |
|
private |
|
private |