GCBM
|
#include <cbmtransitionrulesmodule.h>
Public Member Functions | |
CBMTransitionRulesModule (std::shared_ptr< StandGrowthCurveFactory > gcFactory, std::shared_ptr< VolumeToBiomassCarbonGrowth > volumeToBioGrowth) | |
virtual | ~CBMTransitionRulesModule ()=default |
void | subscribe (NotificationCenter ¬ificationCenter) override |
flint::ModuleTypes | moduleType () |
virtual void | doDisturbanceEvent (DynamicVar) override |
virtual void | doLocalDomainInit () override |
virtual void | doTimingInit () override |
virtual void | doTimingShutdown () override |
Public Member Functions inherited from CBMModuleBase | |
virtual | ~CBMModuleBase ()=default |
void | onSystemInit () override |
void | onSystemShutdown () override |
void | onLocalDomainInit () override |
void | onLocalDomainShutdown () override |
void | onLocalDomainProcessingUnitInit () override |
void | onLocalDomainProcessingUnitShutdown () override |
void | onPreTimingSequence () override |
void | onTimingInit () override |
void | onTimingPrePostInit () override |
void | onTimingPostInit () override |
void | onTimingPostInit2 () override |
void | onTimingShutdown () override |
void | onTimingStep () override |
void | onTimingPreEndStep () override |
void | onTimingEndStep () override |
void | onTimingPostStep () override |
void | onOutputStep () override |
void | onPrePostDisturbanceEvent () override |
void | onPostDisturbanceEvent () override |
void | onPostDisturbanceEvent2 () override |
void | onError (std::string msg) override |
void | onDisturbanceEvent (DynamicVar e) override |
void | onPostNotification (short preMessageSignal) override |
virtual void | doSystemInit () |
virtual void | doSystemShutdown () |
virtual void | doLocalDomainShutdown () |
virtual void | doLocalDomainProcessingUnitInit () |
virtual void | doLocalDomainProcessingUnitShutdown () |
virtual void | doPreTimingSequence () |
virtual void | doTimingPrePostInit () |
virtual void | doTimingPostInit () |
virtual void | doTimingPostInit2 () |
virtual void | doTimingStep () |
virtual void | doTimingPreEndStep () |
virtual void | doTimingEndStep () |
virtual void | doTimingPostStep () |
virtual void | doOutputStep () |
virtual void | doError (std::string msg) |
virtual void | doPrePostDisturbanceEvent () |
virtual void | doPostDisturbanceEvent () |
virtual void | doPostDisturbanceEvent2 () |
virtual void | doPostNotification (short preMessageSignal) |
Private Member Functions | |
int | findTransitionRule (const std::string &disturbanceType) |
int | findYieldCurveAge () |
double | calculateBiomass () |
Private Attributes | |
flint::IVariable * | _age |
flint::IVariable * | _cset |
flint::IVariable * | _regenDelay |
flint::IVariable * | _transitionRuleMatches |
std::unordered_map< int, TransitionRule > | _transitions |
bool | _allowMatchingRules = false |
std::shared_ptr< VolumeToBiomassCarbonGrowth > | _volumeToBioGrowth |
std::shared_ptr< StandGrowthCurveFactory > | _gcFactory |
const flint::IPool * | _softwoodMerch |
const flint::IPool * | _softwoodOther |
const flint::IPool * | _softwoodFoliage |
const flint::IPool * | _softwoodCoarseRoots |
const flint::IPool * | _softwoodFineRoots |
const flint::IPool * | _hardwoodMerch |
const flint::IPool * | _hardwoodOther |
const flint::IPool * | _hardwoodFoliage |
const flint::IPool * | _hardwoodCoarseRoots |
const flint::IPool * | _hardwoodFineRoots |
flint::IVariable * | _gcId |
flint::IVariable * | _spuId |
Int64 | _standSpuId |
CBMTransitionRulesModule | ( | std::shared_ptr< StandGrowthCurveFactory > | gcFactory, |
std::shared_ptr< VolumeToBiomassCarbonGrowth > | volumeToBioGrowth | ||
) |
|
virtualdefault |
|
private |
Assign double variable totalAgBiomass as 0.0
for each pool in the array,add the pool value to totalAgBiomass.
return totalAgBiomass.
|
overridevirtual |
Assign transitionRuleId as -1.
if parameter n contains "transition", assign transitionRuleId as "transition" of parameter n.
if CBMTransitionRulesModule._allowMatchingRules and transitionRuleId are both equal to -1,
Invoke findTransitionRule() using "disturbance" of parameter n as a parameter and assign the value to transitionRuleId. Assign transition as transitionRuleId of CBMTransitionRulesModule._transitions value.
Assign CBMTransitionRulesModule._regenDelay value as transition CBMTransitionRulesModule._regenDelay.
Assign cset as CBMTransitionRulesModule._cset value. For each classifer in transition CBMTransitionRulesModule._classifers,
if the second element of classifer is not equal to "?", Assign first element of classifer of cset as second element of classifier.
Assign CBMTransitionRulesModule._cset value as cset.
Assign variables resetType as transition TransitionRule._resetType and resetAge as transition TransitionRule._resetAge .
if resetAge is equal to AgeResetType::Absolute and resetAge is greater than -1, Assign CBMTransitionRulesModule._age value as resetAge. else if resetAge is equal to AgeResetType::Relative, assign integer variables currentAge as CBMTransitionRulesModule._age value and
newAge as the max of 0 and sum of currentAge and resetAge.
Assign CBMTransitionRulesModule._age value as newAge.
else if resetType is equal to AgeResetType::Yield, invoke findYieldCurveAge() and assign the value to integer variable newAge.
Assign CBMTransitionRulesModule._age value as newAge.
Simulation | Error : Handles error during simulation. |
n | DynamicVar |
Reimplemented from CBMModuleBase.
|
overridevirtual |
Initialise CBMTransitionRulesModule._gcId,CBMTransitionRulesModule._spuId,CBMTransitionRulesModule._age,
CBMTransitionRulesModule._cset,CBMTransitionRulesModule._regenDelay,CBMTransitionRulesModule._softwoodMerch,
CBMTransitionRulesModule._softwoodFoliage,CBMTransitionRulesModule._softwoodOther,CBMTransitionRulesModule._softwoodCoarseRoots,
CBMTransitionRulesModule._softwoodFineRoots,CBMTransitionRulesModule._hardwoodMerch,CBMTransitionRulesModule._hardwoodFoliage,
CBMTransitionRulesModule._hardwoodOther,CBMTransitionRulesModule._hardwoodCoarseRoots and CBMTransitionRulesModule._hardwoodFineRoots.
If _landUnitData has variable "transition_rules_matches", assign CBMTransitionRulesModule._transitionRuleMatches as "transition_rule_matches" in _landUnitData and
CBMTransitionRulesModule._allowMatchingRules as true.
Assign a constant variable transitionRules as "transition_rules" value in _landUnitData.
If transitionRules is a vector,
for each transitionRuleData in transitionRules, create a TransitionRule object using transitionRuleData as a parameter and
assign the index TransitionRule object Id in CBMTransitionRulesModule._transitions as the TransitionRule object.
else, create a TransitionRule object using a dynamic object of transitionRules and
assign the index TransistionRule object Id in CBMTransitionRulesModule._transitions as the TransitionRule object.
Assign a constant variable transitionRuleClassifiers as "transition_rule_classifiers" value in _landUnitData.
if transitionRuleClassifers is not empty,check if transitionRuleClassifiers is a vector and
for each transitionRule in transitionRuleClassifiers,
add classifier using "classifer_name" and "classifer_value" in transistionRule to index transitionRule id in CBMTransitionRulesModule._transitions.
if transistionRuleClassifiers is not a vector,
add classifier using "classifer_name" and "classifer_value" in transistionRuleClassifers to index transitionRuleClassifers id in CBMTransitionRulesModule._transitions.
Reimplemented from CBMModuleBase.
|
overridevirtual |
Assign CBMTransitionRulesModule._regenDelay value as 0 and
CBMTransitionRulesModule._standSpuId as CBMTransitionRulesModule._spuId value.
Reimplemented from CBMModuleBase.
|
overridevirtual |
Assign CBMTransitionRulesModule._regenDelay value as 0.
Reimplemented from CBMModuleBase.
|
private |
If CBMTransitionRulesModule._transitionRuleMatches value contains parameter disturbanceType, return the index disturbanceType in CBMTransitionRulesModule._transitionRuleMatches. else return -1.
disturbanceType | string |
|
private |
If CBMTransitionRulesModule._gcId is empty, assign variable standGrowthCurveId as - 1,
else assign standGrowthCurveId as CBMTransitionRulesModule._gcId.
Assign boolean variable carbonCurveFound as stand growth curve and related yield table from memory.
If carbonCurveFound is false, Create stand growth curve using standGrowthCurveId, CBMTransitionRulesModule._standSpuId and *_landUnitData.
Generate Biomass Carbon curve using standGrowthCurve as a parameter.
Invoke calculateBiomass() and assign the value to standBiomass.
Invoke VolumeToBiomassCarbonGrowth.getAboveGroundCarbonCurve() using standGrowthCurveId and CBMTransitionRulesModule._standSpuId and assign it to agCarbonCurve.
Assign integer variable matchingAge as the size of agCarbonCurve -1.
For each iteration in ageCarbonCurve, check if ageCarbonCurve is greater than standBiomass and
assign matchingAge as the index. return matchingAge.
flint::ModuleTypes moduleType | ( | ) |
|
override |
Subscribe to signals LocalDomainInit,DisturbanceEvent,TimingInit and TimingShutdown.
notificationCenter | NotificationCenter& |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |