ALMaSS Rabbit ODdox
1.00
The rabbit model description following ODdox protocol
|
#include <pesticide.h>
Public Member Functions | |
void | Tick (void) |
void | DailyQueueAdd (LE *a_element_sprayed, double a_amount) |
bool | GetAnythingToDecay () |
double | SupplyPesticide (int a_x, int a_y) |
double | SupplyPesticide (int a_polyref) |
Pesticide (RasterMap *a_land, Landscape *a_map) | |
virtual | ~Pesticide (void) |
bool | SavePPM (double *a_map, int a_beginx, int a_width, int a_beginy, int a_height, char *a_filename) |
void | DiffusionMaskInitTest (void) |
Protected Member Functions | |
void | DailyQueueClear (void) |
void | DailyQueueProcess (void) |
bool | ElementIsWater (int a_x, int a_y) |
void | MainMapDecay (void) |
void | TwinMapClear (int a_minx, int a_miny, int a_maxx, int a_maxy) |
void | TwinMapSpray (LE *a_element_spryaed, double a_amount, int a_minx, int a_miny, int a_maxx, int a_maxy) |
void | TwinMapSprayPixel (int a_large_map_x, int a_large_map_y, double a_fractional_amount) |
void | TwinMapSprayCorrectBorders (void) |
void | TwinMapDiffusion (int a_minx, int a_miny, int a_maxx, int a_maxy, double a_cover) |
void | DiffusionMaskInit (void) |
double | DiffusionFunction (double a_dist_meters) |
void | DiffusionSprayPixel (int a_x, int a_limit_x, int a_y, int a_limit_y, double a_amount, double a_cover) |
void | CalcRainWashOffFactors () |
Pre-calculates the constants required for rain wash off with increasing rainfall and stores this in m_RainWashoffFactor. More... | |
Protected Attributes | |
bool | m_something_to_decay |
int | m_x_excess |
int | m_y_excess |
double | m_prop |
double | m_corr_x |
double | m_corr_y |
int | m_wind |
double | m_pest_daily_decay_frac |
double | m_pest_daily_decay_frac_Veg |
double | m_pest_daily_decay_frac_Soil |
RasterMap * | m_land |
Landscape * | m_map |
double * | m_pest_map_main |
double * | m_pest_map_twin |
unsigned int | m_pest_map_size |
unsigned int | m_pest_map_width |
unsigned int | m_pest_map_height |
double | m_RainWashoffFactor [10000] |
a structure to hold pre-calculated pesticide rain wash off factor (Rw) More... | |
unsigned | m_rainfallcategory |
Daily rainfall saved here * 100 to use as an indext to the Pesticide::m_RainWashoffFactor array - an optimisation to stop repeated calls to Landscape::SupplyRain. More... | |
Diffusion_mask | m_diffusion_mask [4] |
Pre-calculated square diffusion map, assuming wind directions (4) Used after spraying an element in the pesticide map to determine how much of the sprayed material spreads into the surroundings. More... | |
vector< PesticideEvent * > | m_daily_spray_queue |
Definition at line 107 of file pesticide.h.
For vegetation fraction, the decay is based on ln(2)/DT50
For soil fraction, the decay is based on 10^(log10(0.5) /DT50)
Definition at line 490 of file pesticide.cpp.
References CalcRainWashOffFactors(), DiffusionMaskInit(), DiffusionMaskInitTest(), g_msg, l_pest_ai_half_life, l_pest_ai_half_life_Soil, l_pest_ai_half_life_Veg, l_pest_enable_pesticide_engine, m_corr_x, m_corr_y, m_land, m_map, m_pest_daily_decay_frac, m_pest_daily_decay_frac_Soil, m_pest_daily_decay_frac_Veg, m_pest_map_height, m_pest_map_main, m_pest_map_size, m_pest_map_twin, m_pest_map_width, m_prop, m_something_to_decay, m_x_excess, m_y_excess, RasterMap::MapHeight(), RasterMap::MapWidth(), PEST_GRIDAREA, PEST_GRIDSIZE, PEST_GRIDSIZE_POW2, CfgFloat::value(), CfgBool::value(), MapErrorMsg::Warn(), and WARN_FATAL.
|
virtual |
Definition at line 587 of file pesticide.cpp.
References DailyQueueClear(), l_pest_enable_pesticide_engine, m_diffusion_mask, m_pest_map_main, m_pest_map_twin, and CfgBool::value().
|
protected |
Pre-calculates the constants required for rain wash off with increasing rainfall and stores this in m_RainWashoffFactor.
Calculates the proportion of pesticide that is washed off the canopy for 0.1 to 10mm of rain and for 0 to 100% cover in 1% steps.
Definition at line 565 of file pesticide.cpp.
References m_RainWashoffFactor.
Referenced by Pesticide().
void Pesticide::DailyQueueAdd | ( | LE * | a_element_sprayed, |
double | a_amount | ||
) |
Definition at line 105 of file pesticide.cpp.
References m_daily_spray_queue.
Referenced by Orchard::DoDevelopment(), OrchardBand::DoDevelopment(), Farm::ProductApplication0(), Farm::ProductApplication1(), and Farm::Trial_PesticideTreat_DateLimited().
|
protected |
Empties and resets the pesticide action queue. On calling any event not yet carried out will be deleted.
Definition at line 93 of file pesticide.cpp.
References m_daily_spray_queue.
Referenced by Tick(), and ~Pesticide().
|
protected |
If we are spraying at least one field. Force the main pesticide map which forces the decay method to run tomorrow. First we add the amount in m_amount to the twin map (all squares covered with the polygon get m_amount added) using TwinMapSpray
Next this twin map is added to the main map and if necessary it is here we sort out the allocation between vegetation canopy and soil fractions. This is done by TwinMapDiffusion
Definition at line 115 of file pesticide.cpp.
References m_daily_spray_queue, m_something_to_decay, m_wind, Landscape::SupplyWindDirection(), TwinMapClear(), TwinMapDiffusion(), and TwinMapSpray().
Referenced by Tick().
|
protected |
The equation provided here is the one that determines the drift of pesticides with distance. It is important that if the drift is set to zero that the result of the equation is unity.
Definition at line 412 of file pesticide.cpp.
References l_pest_diffusion_slope, l_pest_zero_threshold, and CfgFloat::value().
Referenced by DiffusionMaskInit().
|
protected |
l_pest_diffusion_grid_count contains the number of grid points to consider e.g. 1 will be a grid of 9 squares centred at the spray point, 2 will be 25 squares (2*2+1)^2 , 3 will be 49, etc..
The proportion of the applicationcation rate assuming it was sprayed in the centre square is calculated for each surrounding square. Wind direction is taken into account and the mask is created for four wind directions and saved.
Definition at line 295 of file pesticide.cpp.
References DiffusionFunction(), l_pest_diffusion_grid_count, m_diffusion_mask, and CfgInt::value().
Referenced by Pesticide().
void Pesticide::DiffusionMaskInitTest | ( | void | ) |
Definition at line 618 of file pesticide.cpp.
References l_pest_diffusion_grid_count, m_diffusion_mask, and CfgInt::value().
Referenced by Pesticide().
|
inlineprotected |
This sprays the pesticide (a_amount) by placing this into a pesticide cell in the main map. If more detailed pesticide fate is needed then a_amount will be partitioned between soil and canopy.
First a test is made to ensure that the coordinates given are within the landscape. If not the pesticide is sprayed off world, and lost.
Partioning, if occuring, is done based on two components - the canopy and the soil. The pesticide is partioned between the two based on the asssumed vegetation cover of the crop based on Beer's Law.
Definition at line 272 of file pesticide.cpp.
References m_pest_map_main.
Referenced by TwinMapDiffusion().
|
inlineprotected |
Definition at line 254 of file pesticide.h.
References PEST_GRIDSIZE_POW2, tole_FishFarm, tole_Freshwater, tole_Pond, tole_River, and tole_Saltwater.
|
inline |
|
protected |
This is where the environmental decay takes place. Here we assume a first order decay based on a daily proportion of the cell total. If using detailed fate modelling then is calculation is more complex.
This is where the environmental decay takes place. Here we assume a first order decay based on a daily proportion of the cell total. If using detailed fate modelling then is calculation is more complex.
Definition at line 434 of file pesticide.cpp.
References g_landscape_p, l_pest_zero_threshold, m_pest_daily_decay_frac, m_pest_daily_decay_frac_Soil, m_pest_daily_decay_frac_Veg, m_pest_map_main, m_pest_map_size, m_pest_map_width, m_rainfallcategory, m_RainWashoffFactor, m_something_to_decay, PEST_GRIDSIZE_POW2, Landscape::SupplyVegCover(), and CfgFloat::value().
Referenced by Tick().
bool Pesticide::SavePPM | ( | double * | a_map, |
int | a_beginx, | ||
int | a_width, | ||
int | a_beginy, | ||
int | a_height, | ||
char * | a_filename | ||
) |
Definition at line 651 of file pesticide.cpp.
References g_msg, m_pest_map_height, m_pest_map_width, SV_UINT32, SV_UINT8, MapErrorMsg::Warn(), and WARN_FATAL.
|
inline |
a_x | the x-coord in landscape x units |
a_y | the y-coord in landscape x units |
Definition at line 320 of file pesticide.h.
References PEST_GRIDSIZE_POW2.
Referenced by Landscape::SupplyPesticide(), Landscape::SupplyPesticideP(), and Landscape::SupplyPesticideS().
|
inline |
Definition at line 338 of file pesticide.h.
void Pesticide::Tick | ( | void | ) |
Definition at line 75 of file pesticide.cpp.
References DailyQueueClear(), DailyQueueProcess(), l_pest_enable_pesticide_engine, m_rainfallcategory, MainMapDecay(), Landscape::SupplyRain(), and CfgBool::value().
Referenced by Landscape::Tick().
|
protected |
Definition at line 149 of file pesticide.cpp.
References m_pest_map_twin, and m_pest_map_width.
Referenced by DailyQueueProcess().
|
protected |
Definition at line 250 of file pesticide.cpp.
References DiffusionSprayPixel(), m_diffusion_mask, m_pest_map_height, m_pest_map_twin, m_pest_map_width, and m_wind.
Referenced by DailyQueueProcess().
|
protected |
This is where the initial pesticide concentration is applied to the map. A twin of the real maps is used for spraying the amount of pesticide that is sprayed over each cell and then copied to the real one by using a 'diffusion' process to spread it out to all surrounding cells for drift.
Going through the whole landscape is very slow and unnecessary for small polygons. Since our polygons do not extend beyond the edge of the map ie do not wrap round, then we only need a measure of minx, maxx, miny, maxy. This is set up at the start of the simulation.
Definition at line 162 of file pesticide.cpp.
References RasterMap::Get(), LE::GetMapIndex(), m_land, m_prop, TwinMapSprayCorrectBorders(), and TwinMapSprayPixel().
Referenced by DailyQueueProcess().
|
protected |
Definition at line 204 of file pesticide.cpp.
References m_corr_x, m_corr_y, m_pest_map_height, m_pest_map_size, m_pest_map_twin, m_pest_map_width, m_x_excess, m_y_excess, and PEST_GRIDAREA.
Referenced by TwinMapSpray().
|
inlineprotected |
Definition at line 348 of file pesticide.h.
References PEST_GRIDSIZE_POW2.
Referenced by TwinMapSpray().
|
protected |
Definition at line 152 of file pesticide.h.
Referenced by Pesticide(), and TwinMapSprayCorrectBorders().
|
protected |
Definition at line 153 of file pesticide.h.
Referenced by Pesticide(), and TwinMapSprayCorrectBorders().
|
protected |
Definition at line 191 of file pesticide.h.
Referenced by DailyQueueAdd(), DailyQueueClear(), and DailyQueueProcess().
|
protected |
Pre-calculated square diffusion map, assuming wind directions (4)
Used after spraying an element in the pesticide map to determine how much of the sprayed material spreads into the surroundings.
Definition at line 188 of file pesticide.h.
Referenced by DiffusionMaskInit(), DiffusionMaskInitTest(), TwinMapDiffusion(), and ~Pesticide().
|
protected |
Definition at line 163 of file pesticide.h.
Referenced by Pesticide(), and TwinMapSpray().
|
protected |
Definition at line 166 of file pesticide.h.
Referenced by Pesticide().
|
protected |
Definition at line 158 of file pesticide.h.
Referenced by MainMapDecay(), and Pesticide().
|
protected |
Definition at line 160 of file pesticide.h.
Referenced by MainMapDecay(), and Pesticide().
|
protected |
Definition at line 159 of file pesticide.h.
Referenced by MainMapDecay(), and Pesticide().
|
protected |
Definition at line 179 of file pesticide.h.
Referenced by Pesticide(), SavePPM(), TwinMapDiffusion(), and TwinMapSprayCorrectBorders().
|
protected |
Definition at line 174 of file pesticide.h.
Referenced by DiffusionSprayPixel(), MainMapDecay(), Pesticide(), and ~Pesticide().
|
protected |
Definition at line 177 of file pesticide.h.
Referenced by MainMapDecay(), Pesticide(), and TwinMapSprayCorrectBorders().
|
protected |
Definition at line 176 of file pesticide.h.
Referenced by Pesticide(), TwinMapClear(), TwinMapDiffusion(), TwinMapSprayCorrectBorders(), and ~Pesticide().
|
protected |
Definition at line 178 of file pesticide.h.
Referenced by MainMapDecay(), Pesticide(), SavePPM(), TwinMapClear(), TwinMapDiffusion(), and TwinMapSprayCorrectBorders().
|
protected |
Definition at line 151 of file pesticide.h.
Referenced by Pesticide(), and TwinMapSpray().
|
protected |
Daily rainfall saved here * 100 to use as an indext to the Pesticide::m_RainWashoffFactor array - an optimisation to stop repeated calls to Landscape::SupplyRain.
Definition at line 184 of file pesticide.h.
Referenced by MainMapDecay(), and Tick().
|
protected |
a structure to hold pre-calculated pesticide rain wash off factor (Rw)
Definition at line 182 of file pesticide.h.
Referenced by CalcRainWashOffFactors(), and MainMapDecay().
|
protected |
Definition at line 144 of file pesticide.h.
Referenced by DailyQueueProcess(), MainMapDecay(), and Pesticide().
|
protected |
Definition at line 154 of file pesticide.h.
Referenced by DailyQueueProcess(), and TwinMapDiffusion().
|
protected |
Definition at line 149 of file pesticide.h.
Referenced by Pesticide(), and TwinMapSprayCorrectBorders().
|
protected |
Definition at line 150 of file pesticide.h.
Referenced by Pesticide(), and TwinMapSprayCorrectBorders().