clCarbonValueCalculator Class Reference

Carbon Value Calculator Version 1.0. More...

#include <CarbonValueCalculator.h>

Inheritance diagram for clCarbonValueCalculator:

clBehaviorBase clWorkerBase

List of all members.

Public Member Functions

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

Protected Member Functions

void GetBiomassCodes (clTreePopulation *p_oPop)
 Retrieves the "Biomass" float data member.
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 SetupGrid ()
 Sets up the "Carbon Value" grid.

Protected Attributes

clGridBasemp_oValueGrid
 Grid holding total values for each species.
float * mp_fCPercentBiomass
 Percent of biomass that is carbon.
char * m_cQuery
 String to pass to clTreePopulation::Find() in order to get the trees for which to calculate volume.
short int ** mp_iBiomassCodes
 Holds data member codes for "Biomass" float data member (registered by the clDimensionAnalysis class).
short int ** mp_iTreeCarbonCodes
 Holds data member codes for "Carbon" float data member.
short int * mp_iValueCodes
 Holds data member codes for the "value_x" float data members of the "Carbon Value" grid.
short int * mp_iCarbonCodes
 Holds data member codes for the "carbon_x" float data members of the "Carbon Value" grid.
float m_fPricePerTonCarbon
 Price per metric ton of carbon - currency unimportant.
short int m_iNumTotalSpecies
 Total number of species.


Detailed Description

Carbon Value Calculator Version 1.0.

This behavior calculates carbon value per species. The amount of carbon is given by the user as a percent of biomass for each species. This behavior expects the Dimension Analysis behavior (clDimensionAnalysis) to calculate tree biomass.

The user also supplies a price per metric ton of carbon. This is multipled by the amount of carbon and added up into a total value of carbon per species. The species carbon totals and carbon value totals are stored in a grid called "Carbon Value".

Each tree gets a data member called "Carbon". This contains the tree's own carbon value.

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

This behavior may not be applied to seedlings.


Edit history:
-----------------
March 14, 2006 - Created (LEM)
April 25, 2006 - Added a value tree data member to each tree (LEM)


Constructor & Destructor Documentation

clCarbonValueCalculator::clCarbonValueCalculator ( clSimManager p_oSimManager  ) 

Constructor.

Parameters:
p_oSimManager clSimManager object.

clCarbonValueCalculator::~clCarbonValueCalculator (  ) 

Destructor.

Deletes arrays.


Member Function Documentation

void clCarbonValueCalculator::Action (  )  [virtual]

Makes value calculations.

First, the values in the "Carbon 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 amount of biomass (in metric tons) is retrieved, and the carbon amount and value calculated. Then the species values are totaled and placed in the "Carbon Value" grid.

Reimplemented from clBehaviorBase.

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

Does setup for this behavior.

Calls:

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

Implements clWorkerBase.

void clCarbonValueCalculator::RegisterTreeDataMembers (  )  [virtual]

Registers the "Carbon" tree float data member.

The return codes are captured in the mp_iTreeCarbonCodes array.

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

Reimplemented from clBehaviorBase.

void clCarbonValueCalculator::GetBiomassCodes ( clTreePopulation p_oPop  )  [protected]

Retrieves the "Biomass" float data member.

The return codes are captured in the mp_iBiomassCodes array.

Exceptions:
modelErr if any code comes back -1 for a tree to which this behavior is applied.

void clCarbonValueCalculator::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 the percentage of biomass that is carbon is less than 0 or greater than 100.

void clCarbonValueCalculator::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 clCarbonValueCalculator::SetupGrid (  )  [protected]

Sets up the "Carbon Value" grid.

This ignores any maps.


Member Data Documentation

Grid holding total values for each species.

The grid name is "Carbon Value". The grid contains only 1 grid cell. It has 2 times X float data members, where X = the total number of species. The data member names are "carbon_x" (where "x" is the species number) for amount of carbon, and "value_x" for value of carbon.

Percent of biomass that is carbon.

In the parameter file, this is as a percentage between 0 and 100. We convert this upon reading to a proportion between 0 and 1. Array size is # total species.

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 "Biomass" float data member (registered by the clDimensionAnalysis class).

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

Holds data member codes for "Carbon" 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 "Carbon Value" grid.

Array size is total # species.

Holds data member codes for the "carbon_x" float data members of the "Carbon Value" grid.

Array size is total # species.

Price per metric ton of carbon - currency unimportant.

Total number of species.

For the destructor.


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

Generated on Tue Apr 19 13:56:07 2011 for SORTIE Core C++ Documentation by  doxygen 1.5.6