ALMaSS  1.2 (after EcoStack, March 2024)
The Animal, Landscape and Man Simulation System
PollenNectarDevelopmentCurveSet Class Reference

This class justs holds the set of resource curves related to a specific plant community or crop. It is a data class, with no behaviour, but is convenient to group curves together. More...

#include <PollenNectar.h>

Public Member Functions

double getNectar (int a_given_day)
 Returns the nectar quantity for the given day after day 0 in a year. More...
 
double getSugar (int a_given_day)
 Returns the sugar quantity for the given day after day 0 in a year. More...
 
double getPollen (int a_given_day)
 Returns the pollen quantity for the given day after day 0 in a year. More...
 
double getPollenQuality (int a_given_day)
 Returns the pollen quality for the given day after day 0 in a year. More...
 
double getResource (int a_given_day, vector< double > &a_resource_per_phase)
 Returns the resource for the given day after day o in a year. More...
 
 PollenNectarDevelopmentCurveSet ()
 
void ClearAll ()
 
double GetThreshold ()
 Returns the day degrees temperature threshold. More...
 
double GetMaxDDeg ()
 Returns the maximum day degrees that one day can have. More...
 
int GetRef ()
 Returns the reference number for the curve. More...
 
double GetStartingDDFlowering (void)
 Returns the staring dd of flowering period. More...
 
double GetEndingDDFlowering (void)
 Returns the ending dd of flowering period. More...
 
int GetStartingDayFlowering (void)
 Returns the starting day of flowering period. More...
 
int GetEndingDayFlowering (void)
 Returns the ending day of flowering period. More...
 
void SetStartingDayFlowering (int a_starting_day_flowering)
 Set the starting day of flowering period. More...
 
void SetEndingDayFlowering (int a_ending_day_flowering)
 Set the ending day of flowering period. More...
 
void UpdateFlowerResource (void)
 Update the flower resource for a year. More...
 

Public Attributes

bool m_flag_not_enough_data = false
 Flag to show not enough data is available, so this curve can't be used. More...
 
int m_curve_number
 The reference number for the curve. More...
 
double m_DDthreshold = 0
 The threshold temperature to calculate day degrees. More...
 
double m_MaxDDeg
 The maximum temperature that one day can accumulate. More...
 
double m_MinFlowerLength
 The minimum flowering length. More...
 
double m_MaxFlowerLength
 The maximum flowering length. More...
 
double m_MeanFlowerLength
 The mean flowering length. More...
 
double m_StdFlowerLength
 The standard value of flower length. More...
 
double m_starting_DD_flowering
 The starting degree days for starting flowering period. More...
 
double m_ending_DD_flowering
 The ending degree days for ending flowering period. More...
 
double m_total_nectar_whole_flowering
 The total amount of nectar in the whole flowering period –mg. More...
 
double m_total_sugar_whole_flowering
 The total amount of sugar in the whole flowering period –mg. More...
 
double m_total_pollen_whole_flowering
 The total amount of pollen in the whole flowering period –mg. More...
 
double m_pollen_quality
 The pollen quality when there is pollen, this also depends the species, by default it uses the apis value. More...
 
int m_starting_day_flowering
 The starting day number for flowering period in a year. More...
 
int m_ending_day_flowering
 The ending day number of flowering period in a year. More...
 
int m_flowering_length
 The flowering length in days. More...
 
int m_num_flowering_phases
 The number of flowering phases. More...
 
vector< double > m_nectar_per_phase
 The array to store the nectar in different period, the size is the number of the flowering period phases. More...
 
vector< double > m_sugar_per_phase
 The array to store the sugar in different period, the size is the number of the flowering period phases. More...
 
vector< double > m_pollen_per_phase
 The array to store the pollen in different period, the size is the number of the flowering period phases. More...
 
vector< int > m_day_flowering_phases
 The array to store the day number for different flowering periods, the size is the number of the flowering period phases + 1. More...
 

Detailed Description

This class justs holds the set of resource curves related to a specific plant community or crop. It is a data class, with no behaviour, but is convenient to group curves together.

Constructor & Destructor Documentation

◆ PollenNectarDevelopmentCurveSet()

Member Function Documentation

◆ ClearAll()

void PollenNectarDevelopmentCurveSet::ClearAll ( )
inline

Just clears all data from the curves

132  {
134  m_nectar_per_phase.clear();
135  m_sugar_per_phase.clear();
136  m_pollen_per_phase.clear();
137  m_day_flowering_phases.clear();
138  }

References m_day_flowering_phases, m_nectar_per_phase, m_pollen_per_phase, and m_sugar_per_phase.

◆ GetEndingDayFlowering()

int PollenNectarDevelopmentCurveSet::GetEndingDayFlowering ( void  )
inline

Returns the ending day of flowering period.

153 {return m_ending_day_flowering;}

References m_ending_day_flowering.

◆ GetEndingDDFlowering()

double PollenNectarDevelopmentCurveSet::GetEndingDDFlowering ( void  )
inline

Returns the ending dd of flowering period.

149 {return m_ending_DD_flowering;}

References m_ending_DD_flowering.

◆ GetMaxDDeg()

double PollenNectarDevelopmentCurveSet::GetMaxDDeg ( )
inline

Returns the maximum day degrees that one day can have.

143 {return m_MaxDDeg;}

References m_MaxDDeg.

◆ getNectar()

double PollenNectarDevelopmentCurveSet::getNectar ( int  a_given_day)
inline

Returns the nectar quantity for the given day after day 0 in a year.

96  {
97  return getResource(a_given_day, m_nectar_per_phase);
98  }

References getResource(), and m_nectar_per_phase.

◆ getPollen()

double PollenNectarDevelopmentCurveSet::getPollen ( int  a_given_day)
inline

Returns the pollen quantity for the given day after day 0 in a year.

106  {
107  return getResource(a_given_day, m_pollen_per_phase);
108  }

References getResource(), and m_pollen_per_phase.

◆ getPollenQuality()

double PollenNectarDevelopmentCurveSet::getPollenQuality ( int  a_given_day)
inline

Returns the pollen quality for the given day after day 0 in a year.

111  {
112  if(a_given_day < m_day_flowering_phases.front() || a_given_day > m_day_flowering_phases.back()) return 0;
113  else return m_pollen_quality;
114  }

References m_day_flowering_phases, and m_pollen_quality.

◆ GetRef()

int PollenNectarDevelopmentCurveSet::GetRef ( )
inline

Returns the reference number for the curve.

145 { return m_curve_number; }

References m_curve_number.

◆ getResource()

double PollenNectarDevelopmentCurveSet::getResource ( int  a_given_day,
vector< double > &  a_resource_per_phase 
)
inline

Returns the resource for the given day after day o in a year.

117  {
118  //before or after the flowering period, return 0
119  if (a_given_day < m_day_flowering_phases.front() || a_given_day >= m_day_flowering_phases.back()) return 0;
120 
121  //check which phase the given day is in
122  for (int i = 0; i < m_num_flowering_phases; i++) {
123  if (a_given_day >= m_day_flowering_phases[i] && a_given_day < m_day_flowering_phases[i + 1]) {
124  if(a_resource_per_phase[i] < 0) return 0; //data missing, return 0
125  return a_resource_per_phase[i];
126  }
127  }
128  }

References m_day_flowering_phases, and m_num_flowering_phases.

Referenced by getNectar(), getPollen(), and getSugar().

◆ GetStartingDayFlowering()

int PollenNectarDevelopmentCurveSet::GetStartingDayFlowering ( void  )
inline

Returns the starting day of flowering period.

151 {return m_starting_day_flowering;}

References m_starting_day_flowering.

◆ GetStartingDDFlowering()

double PollenNectarDevelopmentCurveSet::GetStartingDDFlowering ( void  )
inline

Returns the staring dd of flowering period.

147 {return m_starting_DD_flowering;}

References m_starting_DD_flowering.

◆ getSugar()

double PollenNectarDevelopmentCurveSet::getSugar ( int  a_given_day)
inline

Returns the sugar quantity for the given day after day 0 in a year.

101  {
102  return getResource(a_given_day, m_sugar_per_phase);
103  }

References getResource(), and m_sugar_per_phase.

◆ GetThreshold()

double PollenNectarDevelopmentCurveSet::GetThreshold ( )
inline

Returns the day degrees temperature threshold.

141 { return m_DDthreshold; }

References m_DDthreshold.

◆ SetEndingDayFlowering()

void PollenNectarDevelopmentCurveSet::SetEndingDayFlowering ( int  a_ending_day_flowering)
inline

Set the ending day of flowering period.

157 {m_ending_day_flowering = a_ending_day_flowering;}

References m_ending_day_flowering.

◆ SetStartingDayFlowering()

void PollenNectarDevelopmentCurveSet::SetStartingDayFlowering ( int  a_starting_day_flowering)
inline

Set the starting day of flowering period.

155 {m_starting_day_flowering = a_starting_day_flowering;}

References m_starting_day_flowering.

◆ UpdateFlowerResource()

void PollenNectarDevelopmentCurveSet::UpdateFlowerResource ( void  )

Update the flower resource for a year.

454  {
455  //first get the flowering period updated
457 
458 
459  /*
460  //too long period, make it to the max length
461  if(m_flowering_length > m_MaxFlowerLength && m_MaxFlowerLength > 0){
462  m_flowering_length = m_MaxFlowerLength;
463  m_ending_day_flowering = m_starting_day_flowering + m_flowering_length;
464  }
465 
466  //there is no maximum length, we use the default value
467  if(m_MaxFlowerLength <= 0 && m_flowering_length > cfg_GeneralMaxFloweringPeriod.value()){
468  m_flowering_length = cfg_GeneralMaxFloweringPeriod.value();
469  m_ending_day_flowering = m_starting_day_flowering + m_flowering_length;
470  }
471 
472  //too short period, make it to the min length
473  if(m_flowering_length < m_MinFlowerLength && m_MinFlowerLength > 0){
474  m_flowering_length = m_MinFlowerLength;
475  m_starting_day_flowering = m_ending_day_flowering - m_flowering_length;
476  }
477  */
478 
479  //set the starting day for flowering
481  //set the ending day for flowering
483  //set the first second and the last second
486  //for (int i = 1; i < m_num_flowering_phases; i++){
487  // m_day_flowering_phases[i] = m_day_flowering_phases[i-1] + m_flowering_length*(cfg_FloweringPeriodPhasesLengthArray.value())[i-1];
488  //}
489 
490 
491  //now update the resource values
492  //nectar
493  for (int i=0; i<m_nectar_per_phase.size(); i++){
495  }
496  //sugar
497  for (int i=0; i<m_sugar_per_phase.size(); i++){
499  }
500  //pollen
501  for (int i=0; i<m_pollen_per_phase.size(); i++){
503  }
504 
505 }

References cfg_FloweringPeriodPhasesLengthArray, cfg_FloweringPeriodPhasesProportionArray, m_day_flowering_phases, m_ending_day_flowering, m_flowering_length, m_nectar_per_phase, m_pollen_per_phase, m_starting_day_flowering, m_sugar_per_phase, m_total_nectar_whole_flowering, m_total_pollen_whole_flowering, m_total_sugar_whole_flowering, and CfgArray_Double::value().

Member Data Documentation

◆ m_curve_number

int PollenNectarDevelopmentCurveSet::m_curve_number

◆ m_day_flowering_phases

vector<int> PollenNectarDevelopmentCurveSet::m_day_flowering_phases

The array to store the day number for different flowering periods, the size is the number of the flowering period phases + 1.

Referenced by ClearAll(), getPollenQuality(), getResource(), PollenNectarDevelopmentCurveSet(), and UpdateFlowerResource().

◆ m_DDthreshold

double PollenNectarDevelopmentCurveSet::m_DDthreshold = 0

The threshold temperature to calculate day degrees.

Referenced by GetThreshold(), and PollenNectarDevelopmentData::PollenNectarDevelopmentData().

◆ m_ending_day_flowering

int PollenNectarDevelopmentCurveSet::m_ending_day_flowering

The ending day number of flowering period in a year.

Referenced by GetEndingDayFlowering(), SetEndingDayFlowering(), and UpdateFlowerResource().

◆ m_ending_DD_flowering

double PollenNectarDevelopmentCurveSet::m_ending_DD_flowering

The ending degree days for ending flowering period.

Referenced by GetEndingDDFlowering(), and PollenNectarDevelopmentData::PollenNectarDevelopmentData().

◆ m_flag_not_enough_data

bool PollenNectarDevelopmentCurveSet::m_flag_not_enough_data = false

Flag to show not enough data is available, so this curve can't be used.

Contains an integer reference to a curve number, which is <10000 for plant communities and 10000 upwards for single crop curves. It then contains four curves and an associated day degree index. This data is a core part of the the PollenNectarDevelopmentData class where it is held in a list, one for each resource model defined.

Referenced by PollenNectarDevelopmentCurveSet(), and PollenNectarDevelopmentData::PollenNectarDevelopmentData().

◆ m_flowering_length

int PollenNectarDevelopmentCurveSet::m_flowering_length

The flowering length in days.

Referenced by UpdateFlowerResource().

◆ m_MaxDDeg

double PollenNectarDevelopmentCurveSet::m_MaxDDeg

The maximum temperature that one day can accumulate.

Referenced by GetMaxDDeg(), and PollenNectarDevelopmentData::PollenNectarDevelopmentData().

◆ m_MaxFlowerLength

double PollenNectarDevelopmentCurveSet::m_MaxFlowerLength

The maximum flowering length.

Referenced by PollenNectarDevelopmentData::PollenNectarDevelopmentData().

◆ m_MeanFlowerLength

double PollenNectarDevelopmentCurveSet::m_MeanFlowerLength

The mean flowering length.

Referenced by PollenNectarDevelopmentData::PollenNectarDevelopmentData().

◆ m_MinFlowerLength

double PollenNectarDevelopmentCurveSet::m_MinFlowerLength

The minimum flowering length.

Referenced by PollenNectarDevelopmentData::PollenNectarDevelopmentData().

◆ m_nectar_per_phase

vector<double> PollenNectarDevelopmentCurveSet::m_nectar_per_phase

The array to store the nectar in different period, the size is the number of the flowering period phases.

Referenced by ClearAll(), getNectar(), PollenNectarDevelopmentCurveSet(), and UpdateFlowerResource().

◆ m_num_flowering_phases

int PollenNectarDevelopmentCurveSet::m_num_flowering_phases

The number of flowering phases.

Referenced by getResource(), and PollenNectarDevelopmentCurveSet().

◆ m_pollen_per_phase

vector<double> PollenNectarDevelopmentCurveSet::m_pollen_per_phase

The array to store the pollen in different period, the size is the number of the flowering period phases.

Referenced by ClearAll(), getPollen(), PollenNectarDevelopmentCurveSet(), and UpdateFlowerResource().

◆ m_pollen_quality

double PollenNectarDevelopmentCurveSet::m_pollen_quality

The pollen quality when there is pollen, this also depends the species, by default it uses the apis value.

Referenced by getPollenQuality(), PollenNectarDevelopmentData::PollenNectarDevelopmentData(), and VegElement::PollenNectarPhenologyCalculation().

◆ m_starting_day_flowering

int PollenNectarDevelopmentCurveSet::m_starting_day_flowering

The starting day number for flowering period in a year.

Referenced by GetStartingDayFlowering(), SetStartingDayFlowering(), and UpdateFlowerResource().

◆ m_starting_DD_flowering

double PollenNectarDevelopmentCurveSet::m_starting_DD_flowering

The starting degree days for starting flowering period.

Referenced by GetStartingDDFlowering(), and PollenNectarDevelopmentData::PollenNectarDevelopmentData().

◆ m_StdFlowerLength

double PollenNectarDevelopmentCurveSet::m_StdFlowerLength

The standard value of flower length.

Referenced by PollenNectarDevelopmentData::PollenNectarDevelopmentData().

◆ m_sugar_per_phase

vector<double> PollenNectarDevelopmentCurveSet::m_sugar_per_phase

The array to store the sugar in different period, the size is the number of the flowering period phases.

Referenced by ClearAll(), getSugar(), PollenNectarDevelopmentCurveSet(), and UpdateFlowerResource().

◆ m_total_nectar_whole_flowering

double PollenNectarDevelopmentCurveSet::m_total_nectar_whole_flowering

The total amount of nectar in the whole flowering period –mg.

Referenced by PollenNectarDevelopmentData::PollenNectarDevelopmentData(), and UpdateFlowerResource().

◆ m_total_pollen_whole_flowering

double PollenNectarDevelopmentCurveSet::m_total_pollen_whole_flowering

The total amount of pollen in the whole flowering period –mg.

Referenced by PollenNectarDevelopmentData::PollenNectarDevelopmentData(), and UpdateFlowerResource().

◆ m_total_sugar_whole_flowering

double PollenNectarDevelopmentCurveSet::m_total_sugar_whole_flowering

The total amount of sugar in the whole flowering period –mg.

Referenced by PollenNectarDevelopmentData::PollenNectarDevelopmentData(), and UpdateFlowerResource().


The documentation for this class was generated from the following files:
PollenNectarDevelopmentCurveSet::m_pollen_per_phase
vector< double > m_pollen_per_phase
The array to store the pollen in different period, the size is the number of the flowering period pha...
Definition: PollenNectar.h:91
PollenNectarDevelopmentCurveSet::m_starting_day_flowering
int m_starting_day_flowering
The starting day number for flowering period in a year.
Definition: PollenNectar.h:79
PollenNectarDevelopmentCurveSet::m_ending_DD_flowering
double m_ending_DD_flowering
The ending degree days for ending flowering period.
Definition: PollenNectar.h:69
PollenNectarDevelopmentCurveSet::m_starting_DD_flowering
double m_starting_DD_flowering
The starting degree days for starting flowering period.
Definition: PollenNectar.h:67
PollenNectarDevelopmentCurveSet::m_MaxDDeg
double m_MaxDDeg
The maximum temperature that one day can accumulate.
Definition: PollenNectar.h:57
PollenNectarDevelopmentCurveSet::m_curve_number
int m_curve_number
The reference number for the curve.
Definition: PollenNectar.h:53
PollenNectarDevelopmentCurveSet::m_total_sugar_whole_flowering
double m_total_sugar_whole_flowering
The total amount of sugar in the whole flowering period –mg.
Definition: PollenNectar.h:73
PollenNectarDevelopmentCurveSet::m_flowering_length
int m_flowering_length
The flowering length in days.
Definition: PollenNectar.h:83
PollenNectarDevelopmentCurveSet::m_total_pollen_whole_flowering
double m_total_pollen_whole_flowering
The total amount of pollen in the whole flowering period –mg.
Definition: PollenNectar.h:75
PollenNectarDevelopmentCurveSet::m_sugar_per_phase
vector< double > m_sugar_per_phase
The array to store the sugar in different period, the size is the number of the flowering period phas...
Definition: PollenNectar.h:89
PollenNectarDevelopmentCurveSet::m_flag_not_enough_data
bool m_flag_not_enough_data
Flag to show not enough data is available, so this curve can't be used.
Definition: PollenNectar.h:51
PollenNectarDevelopmentCurveSet::m_nectar_per_phase
vector< double > m_nectar_per_phase
The array to store the nectar in different period, the size is the number of the flowering period pha...
Definition: PollenNectar.h:87
CfgArray_Double::get_array_size
int get_array_size()
Definition: Configurator.h:222
PollenNectarDevelopmentCurveSet::getResource
double getResource(int a_given_day, vector< double > &a_resource_per_phase)
Returns the resource for the given day after day o in a year.
Definition: PollenNectar.h:117
CfgArray_Double::value
std::vector< double > value() const
Definition: Configurator.h:219
cfg_FloweringPeriodPhasesProportionArray
CfgArray_Double cfg_FloweringPeriodPhasesProportionArray("FLOWERING_PERIOD_PHASES_PROPORTION_ARRAY", CFG_CUSTOM, 3, vector< double >{0.15, 0.7, 0.15})
Vector to store the proportions for flowering period phases, for now there are three phases; beginnin...
PollenNectarDevelopmentCurveSet::m_total_nectar_whole_flowering
double m_total_nectar_whole_flowering
The total amount of nectar in the whole flowering period –mg.
Definition: PollenNectar.h:71
PollenNectarDevelopmentCurveSet::m_ending_day_flowering
int m_ending_day_flowering
The ending day number of flowering period in a year.
Definition: PollenNectar.h:81
PollenNectarDevelopmentCurveSet::m_num_flowering_phases
int m_num_flowering_phases
The number of flowering phases.
Definition: PollenNectar.h:85
cfg_FloweringPeriodPhasesLengthArray
CfgArray_Double cfg_FloweringPeriodPhasesLengthArray("FLOWERING_PERIOD_PHASES_LENGTH_ARRAY", CFG_CUSTOM, 3, vector< double >{0.275, 0.45, 0.275})
Vector to store the length proportion for flowering period phases.
PollenNectarDevelopmentCurveSet::m_pollen_quality
double m_pollen_quality
The pollen quality when there is pollen, this also depends the species, by default it uses the apis v...
Definition: PollenNectar.h:77
PollenNectarDevelopmentCurveSet::m_DDthreshold
double m_DDthreshold
The threshold temperature to calculate day degrees.
Definition: PollenNectar.h:55
PollenNectarDevelopmentCurveSet::m_day_flowering_phases
vector< int > m_day_flowering_phases
The array to store the day number for different flowering periods, the size is the number of the flow...
Definition: PollenNectar.h:93