ALMaSS Rabbit ODdox
1.1
The rabbit model description following ODdox protocol
|
#include <weather.h>
Public Member Functions | |
Weather (const char *a_weatherdatafile) | |
~Weather (void) | |
double | GetDDDegs (long a_date) |
double | GetGlobalRadiation (long a_date) |
double | GetGlobalRadiation (void) |
double | GetTemp (long a_date) |
Get the temperature on a particular date. More... | |
double | GetTemp (void) |
Get the temperature today. More... | |
double | GetHumidity (void) |
Get the humidity score today. More... | |
double | GetMeanTemp (long a_date, unsigned int a_period) |
double | GetRain (long a_date) |
double | GetRain (void) |
double | GetWind (long a_date) |
double | GetWind (void) |
int | GetWindDirection (void) |
bool | GetSnow (long a_date) |
bool | GetSnow (void) |
double | GetSnowDepth (void) |
Get the current snow depth. More... | |
bool | Raining (void) |
double | GetRainPeriod (long a_date, unsigned int a_period) |
double | GetWindPeriod (long a_date, unsigned int a_period) |
double | GetTempPeriod (long a_date, unsigned int a_period) |
void | Tick (void) |
Private Attributes | |
vector< double > | m_rain |
vector< double > | m_wind |
vector< double > | m_winddir |
vector< double > | m_temp |
double | m_temptoday |
double | m_raintoday |
double | m_windtoday |
int | m_winddirtoday |
bool | m_snowtoday |
bool | m_rainingtoday |
double | m_insolation |
double | m_humiditytoday |
bool | m_wind_valid |
bool | m_winddir_valid |
long | m_datemodulus |
double | m_snowdepth |
The snow depth in cm. More... | |
Weather::Weather | ( | const char * | a_weatherdatafile | ) |
Definition at line 167 of file weather.cpp.
References g_date, g_msg, Calendar::GetLastYear(), l_weather_starting_year, m_datemodulus, m_rain, m_snowdepth, m_temp, m_wind, Calendar::Reset(), Calendar::SetFirstYear(), Calendar::SetLastYear(), Tick(), CfgInt::value(), MapErrorMsg::Warn(), and WARN_FILE.
Weather::~Weather | ( | void | ) |
Definition at line 249 of file weather.cpp.
double Weather::GetDDDegs | ( | long | a_date | ) |
Definition at line 155 of file weather.cpp.
References m_datemodulus, and m_temp.
Referenced by VegElement::DoDevelopment(), UnsprayedFieldMargin::DoDevelopment(), and VegElement::SetGrowthPhase().
|
inline |
Definition at line 414 of file weather.h.
References c_insolation.
Referenced by Landscape::SupplyGlobalRadiation().
|
inline |
Get the humidity score today.
Definition at line 421 of file weather.h.
Referenced by Landscape::SupplyHumidity().
double Weather::GetMeanTemp | ( | long | a_date, |
unsigned int | a_period | ||
) |
Definition at line 120 of file weather.cpp.
References GetTemp().
Referenced by Landscape::SupplyMeanTemp().
|
inline |
|
inline |
double Weather::GetRainPeriod | ( | long | a_date, |
unsigned int | a_period | ||
) |
Definition at line 253 of file weather.cpp.
References GetRain().
Referenced by Farm::BulbHarvest(), Farm::BurnStrawStubble(), Farm::CutToHay(), Farm::Harvest(), OptimisingFarm::Harvest(), Farm::HarvestLong(), Farm::HayBailing(), Farm::HayTurning(), Farm::RowCultivation(), Farm::StrawChopping(), Farm::Strigling(), Farm::StriglingSow(), Farm::StubbleHarrowing(), and Landscape::SupplyRainPeriod().
bool Weather::GetSnow | ( | long | a_date | ) |
Definition at line 132 of file weather.cpp.
References Calendar::Date(), g_date, m_datemodulus, m_rain, m_snowtoday, and m_temp.
Referenced by Landscape::SupplySnowcover().
|
inline |
Get the current snow depth.
Definition at line 431 of file weather.h.
Referenced by Landscape::SupplySnowDepth().
|
inline |
Get the temperature on a particular date.
Definition at line 417 of file weather.h.
Referenced by Farm::FA_Manure(), Farm::FA_Sludge(), Farm::FA_Slurry(), Farm::FP_Manure(), Farm::FP_Sludge(), Farm::FP_Slurry(), Landscape::SupplyTemp(), and Pesticide::Tick().
|
inline |
Get the temperature today.
Definition at line 419 of file weather.h.
Referenced by GetMeanTemp(), and GetTempPeriod().
double Weather::GetTempPeriod | ( | long | a_date, |
unsigned int | a_period | ||
) |
Sums the temperature for the period from a_date back a_period days.
[in] | a_date | the day to start summing degrees |
[in] | a_period | the number of days perĂod to sum |
Definition at line 272 of file weather.cpp.
References GetTemp().
Referenced by Landscape::SupplyTempPeriod(), and Tick().
|
inline |
Definition at line 425 of file weather.h.
Referenced by Farm::FungicideTreat(), OptimisingFarm::FungicideTreat(), Farm::GrowthRegulator(), Farm::HerbicideTreat(), OptimisingFarm::HerbicideTreat(), Farm::InsecticideTreat(), OptimisingFarm::InsecticideTreat(), Farm::Molluscicide(), Farm::ProductApplication(), and Landscape::SupplyWind().
|
inline |
|
inline |
double Weather::GetWindPeriod | ( | long | a_date, |
unsigned int | a_period | ||
) |
Definition at line 262 of file weather.cpp.
References GetWind().
Referenced by Landscape::SupplyWindPeriod().
|
inline |
Definition at line 432 of file weather.h.
Referenced by Farm::AutumnHarrow(), Farm::AutumnPlough(), Farm::AutumnRoll(), Farm::AutumnSow(), Farm::BedForming(), Farm::Biocide(), Farm::CutOrch(), Farm::CutToSilage(), Farm::CutWeeds(), Farm::DeepPlough(), Farm::FA_AmmoniumSulphate(), Farm::FA_Calcium(), Farm::FA_GreenManure(), Farm::FA_ManganeseSulphate(), Farm::FA_Manure(), Farm::FA_NPK(), Farm::FA_NPKS(), Farm::FA_PK(), Farm::FA_RSM(), Farm::FA_Sludge(), Farm::FA_Slurry(), Farm::FlowerCutting(), Farm::FP_AmmoniumSulphate(), Farm::FP_Calcium(), Farm::FP_GreenManure(), Farm::FP_LiquidNH3(), Farm::FP_ManganeseSulphate(), Farm::FP_Manure(), Farm::FP_NPK(), Farm::FP_NPKS(), Farm::FP_PK(), Farm::FP_RSM(), Farm::FP_Sludge(), Farm::FP_Slurry(), Farm::FungicideTreat(), OptimisingFarm::FungicideTreat(), Farm::GrowthRegulator(), Farm::HeavyCultivatorAggregate(), Farm::HerbicideTreat(), OptimisingFarm::HerbicideTreat(), Farm::HillingUp(), Farm::InsecticideTreat(), OptimisingFarm::InsecticideTreat(), Farm::Molluscicide(), Farm::PreseedingCultivator(), Farm::PreseedingCultivatorSow(), Farm::ProductApplication(), Farm::ShallowHarrow(), Farm::SpringHarrow(), Farm::SpringPlough(), Farm::SpringRoll(), Farm::SpringSow(), Farm::SpringSowWithFerti(), Farm::StrawCovering(), Farm::StrawRemoval(), Farm::StriglingHill(), Farm::StubbleCultivatorHeavy(), Farm::StubblePlough(), Farm::Swathing(), Farm::Water(), and Farm::WinterPlough().
void Weather::Tick | ( | void | ) |
The complicated calculation of weatherday is due to the potential to run off either end of the rain data, especially since this is called on Day0
Humidity calculation. This is based on an assumption that humidity is relative to rainfall in the days before. The humidity score is the mean of rainfall over the last 5 days assuming 50% loss each day. Therefore rainfall of 10,0,0,2,0 mm in the previous 5 days would give a humidity of 0.625+0+0+1+0 = 1.625/5 = 0.325 But we also need to calculate temperature into this. Lets assume <10 degrees has no effect, 10-20 and this figure is halved, 20-40 and it is half again.
datemodulus is added to prevent negative overun on the rain or temperature data array, important since this is called on Day0
Wind directions is based on probabilities. Can also use the WindDirections array which allows montly probabilities
Definition at line 58 of file weather.cpp.
References c_insolation, Calendar::Date(), Calendar::DayInYear(), g_date, g_rand_uni, GetRain(), GetTempPeriod(), m_datemodulus, m_humiditytoday, m_insolation, m_rain, m_rainingtoday, m_raintoday, m_snowdepth, m_snowtoday, m_temp, m_temptoday, m_wind, m_winddirtoday, and m_windtoday.
Referenced by Landscape::Tick(), and Weather().
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |