Go to the documentation of this file. 1 #ifndef MOJA_MODULES_CBM_CBMSPINUPSEQUENCER_H_
2 #define MOJA_MODULES_CBM_CBMSPINUPSEQUENCER_H_
4 #include "moja/modules/cbm/_modules.cbm_exports.h"
5 #include "moja/datetime.h"
6 #include "moja/flint/itiming.h"
7 #include "moja/flint/sequencermodulebase.h"
8 #include "moja/notificationcenter.h"
10 #include "moja/pocojsonutils.h"
13 #include <unordered_map>
24 const std::string returnInverval =
"return_interval";
25 const std::string maxRotation =
"max_rotations";
26 const std::string historicDistType =
"historic_disturbance_type";
27 const std::string lastDistType =
"last_pass_disturbance_type";
28 const std::string delay =
"delay";
29 const std::string inventoryDelay =
"inventory_delay";
31 void configure(
const DynamicObject& config)
override {
32 if (config.contains(
"ramp_start_date")) {
33 _rampStartDate = moja::parseSimpleDate(
34 config[
"ramp_start_date"].extract<std::string>());
39 timing.setStepLengthInYears(1);
42 bool Run(NotificationCenter& _notificationCenter, flint::ILandUnitController& luc)
override;
50 const std::set<std::string> _biomassPools{
54 "SoftwoodCoarseRoots",
59 "HardwoodCoarseRoots",
70 flint::IVariable* _lastPassDisturbanceTimeseries =
nullptr;
74 int _maxRotationValue{ 0 };
75 int _minimumRotation{ 0 };
76 int _ageReturnInterval{ 0 };
78 int _standRegenDelay{ 0 };
80 int _spinupGrowthCurveID{ -1 };
92 typedef std::tuple<int, std::string, int, int, double>
CacheKey;
93 std::unordered_map<CacheKey, std::vector<double>, moja::Hash>
_cache;
96 bool getSpinupParameters(flint::ILandUnitDataWrapper& landUnitData);
99 void runRegularSpinup(NotificationCenter& notificationCenter, flint::ILandUnitController& luc,
bool runMoss);
102 void runPeatlandSpinup(NotificationCenter& notificationCenter, flint::ILandUnitController& luc);
105 bool isSlowPoolStable(
double lastSlowPoolValue,
double currentSlowPoolValue);
108 bool isPeatlandApplicable();
111 bool isMossApplicable(
bool runPeatland);
114 void fireSpinupSequenceEvent(NotificationCenter& notificationCenter,
115 flint::ILandUnitController& luc,
120 void fireHistoricalLastDisturbanceEvent(NotificationCenter& notificationCenter,
121 flint::ILandUnitController& luc,
122 std::string disturbanceName);
129 #endif // MOJA_MODULES_CBM_CBMSPINUPSEQUENCER_H_
void configure(flint::ITiming &timing) override
Definition: cbmspinupsequencer.h:38
const flint::IPool * _aboveGroundSlowSoil
Definition: cbmspinupsequencer.h:45
const flint::IPool * _sphagnumMossSlow
Definition: cbmspinupsequencer.h:48
CBMSpinupSequencer()
Definition: cbmspinupsequencer.h:21
flint::IVariable * _regenDelay
Definition: cbmspinupsequencer.h:72
Definition: ageclasshelper.cpp:12
flint::IVariable * _spu
Definition: cbmspinupsequencer.h:68
flint::IVariable * _spinupMossOnly
Definition: cbmspinupsequencer.h:71
flint::IVariable * _mat
Definition: cbmspinupsequencer.h:67
virtual ~CBMSpinupSequencer()
Definition: cbmspinupsequencer.h:22
const flint::IPool * _featherMossSlow
Definition: cbmspinupsequencer.h:47
flint::IVariable * _delay
Definition: cbmspinupsequencer.h:66
flint::IVariable * _shrubAge
Definition: cbmspinupsequencer.h:64
std::unordered_map< std::string, int > _disturbanceOrder
Definition: cbmspinupsequencer.h:83
std::string _historicDistType
Definition: cbmspinupsequencer.h:81
flint::IVariable * _age
Definition: cbmspinupsequencer.h:63
flint::IVariable * _isDecaying
Definition: cbmspinupsequencer.h:69
std::string _lastPassDistType
Definition: cbmspinupsequencer.h:82
std::tuple< int, std::string, int, int, double > CacheKey
Definition: cbmspinupsequencer.h:92
Poco::Nullable< DateTime > _rampStartDate
Definition: cbmspinupsequencer.h:89
void configure(const DynamicObject &config) override
Definition: cbmspinupsequencer.h:31
Definition: cbmspinupsequencer.h:19
Definition: ageclasshelper.cpp:10
std::unordered_map< CacheKey, std::vector< double >, moja::Hash > _cache
Definition: cbmspinupsequencer.h:93
const flint::IPool * _belowGroundSlowSoil
Definition: cbmspinupsequencer.h:46
flint::IVariable * _smallTreeAge
Definition: cbmspinupsequencer.h:65