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

The base class for all farm types. More...

#include <Farm.h>

Inheritance diagram for Farm:
AgroChemIndustryCerealFarm1 AgroChemIndustryCerealFarm2 AgroChemIndustryCerealFarm3 ConventionalCattle ConventionalPig ConventionalPlant ConvMarginalJord NoPesticideBaseFarm NoPesticideNoPFarm OrganicCattle OrganicPig OrganicPlant PesticideTrialControl PesticideTrialToxicControl PesticideTrialTreatment UserDefinedFarm UserDefinedFarm1 UserDefinedFarm10 UserDefinedFarm11 UserDefinedFarm12 UserDefinedFarm13 UserDefinedFarm14 UserDefinedFarm15 UserDefinedFarm16 UserDefinedFarm17 UserDefinedFarm2 UserDefinedFarm3 UserDefinedFarm4 UserDefinedFarm5 UserDefinedFarm6 UserDefinedFarm7 UserDefinedFarm8 UserDefinedFarm9

Public Member Functions

virtual void FarmActions (void)
 FarmActions() will use the global date to manage all queued field events. More...
 
bool FarmerActions (void)
 The starting point for farmer behaviour not part of crop management e.g. decision making. More...
 
virtual void InitiateManagement (void)
 Kicks off the farm's management. More...
 
void AddField (LE *a_newfield)
 Adds a field to a farm. More...
 
void RemoveField (LE *a_field)
 Removes a field from a farm. More...
 
 Farm (FarmManager *a_manager)
 Farm constructor - creates an instance of each possible crop type. More...
 
virtual ~Farm (void)
 Farm destructor - deletes all crop instances and empties event queues. More...
 
void SetFarmNumber (int a_farm_num)
 
int GetFarmNumber (void)
 
virtual bool Spraying_herbicides (TTypesOfVegetation)
 
virtual bool Spraying_fungins (TTypesOfVegetation)
 
virtual double Prob_multiplier ()
 
void Assign_rotation (vector< TTypesOfVegetation >a_new_rotation)
 
FarmManagerGetFarmManager ()
 
virtual void Harvested (TTypesOfCrops a_toc, double a_yield)
 Records harvest results. More...
 
virtual void Insecticide (int a_area)
 Records the costs of insecticide treatment, and associated score changes. More...
 
virtual void Herbicide (int a_area)
 Records the costs of herbicide treatment, and associated score change. More...
 
TTypesOfFarm GetFarmType ()
 Returns the farm type. More...
 
polylistListOpenFields (int a_openness)
 Returns a list of fields with openness above a_openness. More...
 
void Centroids ()
 Finds farm's centroids - x and y. More...
 
int GetNoFields ()
 Returns the number of the fields owned. More...
 
int GetNoOpenFields (int a_openness)
 Returns the number of the fields above an openness of a_openness. More...
 
int GetAreaOpenFields (int a_openness)
 Returns the area of the fields above an openness of a_openness. More...
 
APoint GetValidCoords ()
 Returns the valid coordinates of the first field owned by a farm. More...
 
int GetMaxOpenness ()
 Returns the maximum openness score of the fields. More...
 
Farmer * GetFarmer ()
 Returns the pointer to this farm's farmer. More...
 
LESetFunctionData (LE *, double, double, int, FarmToDo)
 carries out standard setting of data and deals with possible unsprayed margins, returns a pointer to UM or nullptr More...
 
void SetFunctionDataNoUM (LE *, double, double, int, FarmToDo)
 carries out standard setting of data when UMs should be ignored
More...
 
virtual bool SleepAllDay (LE *a_field, double a_user, int a_days)
 Nothing to to today on a_field. More...
 
virtual bool AutumnPlough (LE *a_field, double a_user, int a_days)
 Carry out a ploughing event in the autumn on a_field. More...
 
void CalculateTreatmentCosts (FarmToDo a_treatment, LE *a_field)
 
virtual bool StubblePlough (LE *a_field, double a_user, int a_days)
 Carry out a stubble ploughing event on a_field. This is similar to normal plough but shallow (normally 6-8cm, is special cases up to 12-15cm). Done as a part of after-harvest treatments (instead of stubble cultivation) More...
 
virtual bool StubbleCultivatorHeavy (LE *a_field, double a_user, int a_days)
 Carry out a stubble cultivation event on a_field. This is non-inversion type of cultivation which can be done instead of autumn plough (on a depth up to 40 cm even, if necessary) More...
 
virtual bool AutumnHarrow (LE *a_field, double a_user, int a_days)
 Carry out a harrow event in the autumn on a_field. More...
 
virtual bool AutumnRoll (LE *a_field, double a_user, int a_days)
 Carry out a roll event in the autumn on a_field. More...
 
virtual bool PreseedingCultivator (LE *a_field, double a_user, int a_days)
 Carry out preseeding cultivation on a_field (tilling set including cultivator and string roller to compact soil) More...
 
virtual bool PreseedingCultivatorSow (LE *a_field, double a_user, int a_days, double a_seed_coating_amount=-1, PlantProtectionProducts a_ppp=ppp_foobar)
 Carry out preseeding cultivation together with sow on a_field (tilling and sowing set including cultivator and string roller to compact soil) More...
 
virtual bool AutumnSow (LE *a_field, double a_user, int a_days, double a_seed_coating_amount=-1, PlantProtectionProducts a_ppp=ppp_foobar)
 Carry out a sowing event in the autumn on a_field. More...
 
virtual bool WinterPlough (LE *a_field, double a_user, int a_days)
 Carry out a ploughing event in the winter on a_field. More...
 
virtual bool WinterHarrow (LE *a_field, double a_user, int a_days)
 Carry out a harrow event in the winter on a_field. More...
 
virtual bool DeepPlough (LE *a_field, double a_user, int a_days)
 Carry out a deep ploughing event on a_field. More...
 
virtual bool SpringPlough (LE *a_field, double a_user, int a_days)
 Carry out a ploughing event in the spring on a_field. More...
 
virtual bool SpringHarrow (LE *a_field, double a_user, int a_days)
 Carry out a harrow event in the spring on a_field. More...
 
virtual bool SpringRoll (LE *a_field, double a_user, int a_days)
 Carry out a roll event in the spring on a_field. More...
 
virtual bool SpringSow (LE *a_field, double a_user, int a_days, double a_seed_coating_amount=-1, PlantProtectionProducts a_ppp=ppp_foobar)
 Carry out a sowing event in the spring on a_field. More...
 
virtual bool SpringSowWithFerti (LE *a_field, double a_user, int a_days, double a_seed_coating_amount=-1, PlantProtectionProducts a_ppp=ppp_foobar)
 Carry out a sowing event with start fertilizer in the spring on a_field. More...
 
virtual bool AutumnSowWithFerti (LE *a_field, double a_user, int a_days, double a_seed_coating_amount=-1, PlantProtectionProducts a_ppp=ppp_foobar)
 Carry out a sowing event with start fertilizer in the autumn on a_field. More...
 
virtual bool HerbicideTreat (LE *a_field, double a_user, int a_days)
 Apply herbicide to a_field. More...
 
virtual bool GrowthRegulator (LE *a_field, double a_user, int a_days)
 Apply growth regulator to a_field. More...
 
virtual bool FungicideTreat (LE *a_field, double a_user, int a_days)
 Apply fungicide to a_field. More...
 
virtual bool InsecticideTreat (LE *a_field, double a_user, int a_days)
 Apply insecticide to a_field. More...
 
virtual bool BiocideTreat (LE *a_field, double a_user, int a_days)
 Apply Biocide to a_field. More...
 
virtual bool OrganicInsecticide (LE *a_field, double a_user, int a_days)
 Biocide applied on a_field. More...
 
virtual bool OrganicHerbicide (LE *a_field, double a_user, int a_days)
 Biocide applied on a_field. More...
 
virtual bool OrganicFungicide (LE *a_field, double a_user, int a_days)
 Biocide applied on a_field. More...
 
virtual bool Pheromone (LE *a_field, double a_user, int a_days)
 Pheromone applied on a_field - same as with org. pesticides for now. More...
 
virtual bool ProductApplication (LE *a_field, double a_user, int a_days, double a_applicationrate, PlantProtectionProducts a_ppp, bool a_isgranularpesticide=false, int a_orcharddrifttype=0)
 Apply test pesticide to a_field. More...
 
virtual bool ProductApplication_DateLimited (LE *a_field, double, int, double a_applicationrate, PlantProtectionProducts a_ppp, bool a_isgranularpesticide=false)
 Special pesticide trial functionality. More...
 
virtual bool Molluscicide (LE *a_field, double a_user, int a_days)
 Apply molluscicide to a_field. More...
 
virtual bool RowCultivation (LE *a_field, double a_user, int a_days)
 Carry out a harrowing between crop rows on a_field. More...
 
virtual bool Strigling (LE *a_field, double a_user, int a_days)
 Carry out a mechanical weeding on a_field. More...
 
virtual bool StriglingSow (LE *a_field, double a_user, int a_days, double a_seed_coating_amount=-1, PlantProtectionProducts a_ppp=ppp_foobar)
 Carry out a mechanical weeding followed by sowing on a_field. More...
 
virtual bool StriglingHill (LE *a_field, double a_user, int a_days)
 Carry out a mechanical weeding on a_field followed by hilling up (probably on potatoes) More...
 
virtual bool HillingUp (LE *a_field, double a_user, int a_days)
 Do hilling up on a_field, probably of potatoes. More...
 
virtual bool Water (LE *a_field, double a_user, int a_days)
 Carry out a watering on a_field. More...
 
virtual bool Swathing (LE *a_field, double a_user, int a_days)
 Cut the crop on a_field and leave it lying (probably rape) More...
 
virtual bool Harvest (LE *a_field, double a_user, int a_days)
 Carry out a harvest on a_field. More...
 
virtual bool HarvestLong (LE *a_field, double a_user, int a_days)
 Carry out a harvest on a_field (only differs in the DoIt chance cf harvest) More...
 
virtual bool HarvestBushFruit (LE *a_field, double a_user, int a_days)
 Harvest bush fruit on a_field - no tramlines since fruits are picked by hand, the bush stays on field with same vegetation height, thus suspects same % insects. More...
 
virtual bool HarvestBF_Machine (LE *a_field, double a_user, int a_days)
 Harvest bush fruit on a_field - tramlines since fruits are picked by machine, the bush stays on field with same vegetation height, thus suspects same % insects. More...
 
virtual bool CattleOut (LE *a_field, double a_user, int a_days)
 Start a grazing event on a_field today. More...
 
virtual bool CattleOut (LE *a_field, double a_user, int a_days, bool a_should_eat)
 Start an intensive grazing event on a_field today. More...
 
virtual bool CattleOutLowGrazing (LE *a_field, double a_user, int a_days)
 Start a extensive grazing event on a_field today. More...
 
virtual bool CattleIsOut (LE *a_field, double a_user, int a_days, int a_max)
 Generate a 'cattle_out' event for every day the cattle are on a_field. More...
 
virtual bool CattleIsOut (LE *a_field, double a_user, int a_days, int a_max, bool a_should_eat)
 Generate a 'cattle_out' event for every day the cattle are on a_field. More...
 
virtual bool CattleIsOutLow (LE *a_field, double a_user, int a_days, int a_max)
 Generate a 'cattle_out_low' event for every day the cattle are on a_field. More...
 
virtual bool CattleIsOutLow2 (LE *a_field, double a_user, int a_days, int a_max, int a_max_days)
 Generate a 'cattle_out_low2' event for every day the cattle are on a_field, cattle is low grazing and can stay on the field till a_max date but no more days than defined by a_max_days a_days defines the number of days from the day the cattle is put on the field (set by a flag in the management plan) More...
 
virtual bool PigsOut (LE *a_field, double a_user, int a_days)
 Generate a 'pigs_out' event for every day the cattle are on a_field. More...
 
virtual bool PigsAreOut (LE *a_field, double a_user, int a_days)
 Start a pig grazing event on a_field today or soon. More...
 
virtual bool PigsAreOutForced (LE *a_field, double a_user, int a_days)
 Start a pig grazing event on a_field today - no exceptions. More...
 
virtual bool CutToHay (LE *a_field, double a_user, int a_days)
 Carry out hay cutting on a_field. More...
 
virtual bool CutWeeds (LE *a_field, double a_user, int a_days)
 Carry out weed topping on a_field. More...
 
virtual bool CutToSilage (LE *a_field, double a_user, int a_days)
 Cut vegetation for silage on a_field. More...
 
virtual bool CutOrch (LE *a_field, double a_user, int a_days)
 Cut vegetation on orchard crop. //based on cut to silage - values from cutting function of orchard. More...
 
virtual bool StrawChopping (LE *a_field, double a_user, int a_days)
 Carry out straw chopping on a_field. More...
 
virtual bool HayTurning (LE *a_field, double a_user, int a_days)
 Carry out hay turning on a_field. More...
 
virtual bool HayBailing (LE *a_field, double a_user, int a_days)
 Carry out hay bailing on a_field. More...
 
virtual bool BurnStrawStubble (LE *a_field, double a_user, int a_days)
 Burn stubble on a_field. More...
 
virtual bool BurnTop (LE *a_field, double a_user, int a_days)
 Burn tops of e.g. potatoes on a_field. More...
 
virtual bool StubbleHarrowing (LE *a_field, double a_user, int a_days)
 Carry out stubble harrowing on a_field. More...
 
virtual bool FP_NPKS (LE *a_field, double a_user, int a_days)
 Apply NPKS fertilizer, on a_field owned by an arable farmer. More...
 
virtual bool FP_NPK (LE *a_field, double a_user, int a_days)
 Apply NPK fertilizer, on a_field owned by an arable farmer. More...
 
virtual bool FP_NC (LE *a_field, double a_user, int a_days)
 Apply NC fertilizer, on a_field owned by an arable farmer. More...
 
virtual bool FP_NK (LE *a_field, double a_user, int a_days)
 Apply NK fertilizer, on a_field owned by an arable farmer. More...
 
virtual bool FP_NS (LE *a_field, double a_user, int a_days)
 Apply NS fertilizer, on a_field owned by an arable farmer. More...
 
virtual bool FP_N (LE *a_field, double a_user, int a_days)
 Apply N fertilizer, on a_field owned by an arable farmer. More...
 
virtual bool FP_PK (LE *a_field, double a_user, int a_days)
 Apply PK fertilizer, on a_field owned by an arable farmer. More...
 
virtual bool FP_P (LE *a_field, double a_user, int a_days)
 Apply P fertilizer, on a_field owned by an arable farmer. More...
 
virtual bool FP_K (LE *a_field, double a_user, int a_days)
 Apply K fertilizer, on a_field owned by an arable farmer. More...
 
virtual bool FP_SK (LE *a_field, double a_user, int a_days)
 Apply SK fertilizer, on a_field owned by an arable farmer. More...
 
virtual bool FP_LiquidNH3 (LE *a_field, double a_user, int a_days)
 Apply liquid ammonia fertilizer to a_field owned by an arable farmer. More...
 
virtual bool FP_Slurry (LE *a_field, double a_user, int a_days)
 Apply slurry to a_field owned by an arable farmer. More...
 
virtual bool FP_ManganeseSulphate (LE *a_field, double a_user, int a_days)
 Apply Manganse Sulphate to a_field owned by an arable farmer. More...
 
virtual bool FP_Boron (LE *a_field, double a_user, int a_days)
 Apply soluble Boron to a_field owned by an arable farmer. More...
 
virtual bool FP_AmmoniumSulphate (LE *a_field, double a_user, int a_days)
 Apply Ammonium Sulphate to a_field owned by an arable farmer. More...
 
virtual bool FP_Manure (LE *a_field, double a_user, int a_days)
 Spread manure on a_field owned by an arable farmer. More...
 
virtual bool FP_GreenManure (LE *a_field, double a_user, int a_days)
 Spread green manure on a_field owned by an arable farmer. More...
 
virtual bool FP_Sludge (LE *a_field, double a_user, int a_days)
 Spread sewege on a_field owned by an arable farmer. More...
 
virtual bool FP_RSM (LE *a_field, double a_user, int a_days)
 RSM (ammonium nitrate solution) applied on a_field owned by an arable farmer. More...
 
virtual bool FP_Calcium (LE *a_field, double a_user, int a_days)
 Calcium applied on a_field owned by an arable farmer. More...
 
virtual bool FA_NK (LE *a_field, double a_user, int a_days)
 Apply NK fertilizer, on a_field owned by an stock farmer. More...
 
virtual bool FA_NPKS (LE *a_field, double a_user, int a_days)
 Apply NPKS fertilizer, on a_field owned by a stock farmer. More...
 
virtual bool FA_NPK (LE *a_field, double a_user, int a_days)
 Apply NPK fertilizer to a_field owned by an stock farmer. More...
 
virtual bool FA_PK (LE *a_field, double a_user, int a_days)
 Apply PK fertilizer to a_field owned by an stock farmer. More...
 
virtual bool FA_P (LE *a_field, double a_user, int a_days)
 Apply P fertilizer, on a_field owned by stock farmer. More...
 
virtual bool FA_K (LE *a_field, double a_user, int a_days)
 Apply K fertilizer, on a_field owned by stock farmer. More...
 
virtual bool FA_SK (LE *a_field, double a_user, int a_days)
 Apply SK fertilizer, on a_field owned by an stock farmer. More...
 
virtual bool FA_Slurry (LE *a_field, double a_user, int a_days)
 Spready slurry on a_field owned by an stock farmer. More...
 
virtual bool FA_ManganeseSulphate (LE *a_field, double a_user, int a_days)
 Apply manganese sulphate to a_field owned by an stock farmer. More...
 
virtual bool FA_AmmoniumSulphate (LE *a_field, double a_user, int a_days)
 Apply ammonium sulphate to a_field owned by an stock farmer. More...
 
virtual bool FA_Manure (LE *a_field, double a_user, int a_days)
 Spread manure on a_field owned by an stock farmer. More...
 
virtual bool FA_GreenManure (LE *a_field, double a_user, int a_days)
 Spread green manure on a_field owned by an stock farmer. More...
 
virtual bool FA_Sludge (LE *a_field, double a_user, int a_days)
 Spread sewege sludge on a_field owned by an stock farmer. More...
 
virtual bool FA_RSM (LE *a_field, double a_user, int a_days)
 RSM (ammonium nitrate solution) applied on a_field owned by a stock farmer. More...
 
virtual bool FA_Calcium (LE *a_field, double a_user, int a_days)
 Calcium applied on a_field owned by a stock farmer. More...
 
virtual bool BedForming (LE *a_field, double a_user, int a_days)
 Do bed forming up on a_field, probably of carrots. More...
 
virtual bool ShallowHarrow (LE *a_field, double a_user, int a_days)
 Carry out a shallow harrow event on a_field, e.g., after grass cutting event. More...
 
virtual bool HeavyCultivatorAggregate (LE *a_field, double a_user, int a_days)
 Carry out a heavy cultivation event on a_field. This is non-inversion type of cultivation which can be done after fertilizers application on spring for a spring crop. More...
 
virtual bool FlowerCutting (LE *a_field, double a_user, int a_days)
 Flower cutting applied on a_field. More...
 
virtual bool BulbHarvest (LE *a_field, double a_user, int a_days)
 Carry out a bulb harvest on a_field. More...
 
virtual bool StrawCovering (LE *a_field, double a_user, int a_days)
 Straw covering applied on a_field. More...
 
virtual bool StrawRemoval (LE *a_field, double a_user, int a_days)
 Straw covering applied on a_field. More...
 
virtual bool IrrigationStart (LE *a_field, double a_user, int a_days)
 Start a irrigation event on a_field today. More...
 
virtual bool Irrigation (LE *a_field, double a_user, int a_days, int a_max)
 Generate an 'irrigation' event with a frequency defined by a_freq in the irrigation period on a_field. More...
 
virtual bool Pruning (LE *a_field, double a_user, int a_days)
 Pruning applied on a_field - details needs to be added (e.g., impact on biomass, influence/impacts in species code)! More...
 
virtual bool Shredding (LE *a_field, double a_user, int a_days)
 Shredding (destruction of the pruning residues with a shredders using hammer mower) applied on a_field. More...
 
virtual bool LeafThinning (LE *a_field, double a_user, int a_days)
 LeafThinning (leaf removal to increase areation and sun exposure of fruits, e.g., grapes) applied on a_field. More...
 
virtual bool GreenHarvest (LE *a_field, double a_user, int a_days)
 GreenHarvest (remove of excess production that may affect the desired quality of the fruits, e.g., grapes) applied on a_field. More...
 
virtual bool FruitHarvest (LE *a_field, double a_user, int a_days)
 FruitHarvest (harvest of the mature fruits, e.g., grapes) applied on a_field. More...
 
virtual bool Suckering (LE *a_field, double a_user, int a_days)
 
virtual bool Mowing (LE *a_field, double a_user, int a_days)
 Physical/mechanical weed control in the between-row area using a rotary mower cutter. More...
 
virtual bool FiberCovering (LE *a_field, double a_user, int a_days)
 Fiber covering applied on a_field. More...
 
virtual bool FiberRemoval (LE *a_field, double a_user, int a_days)
 Fiber covering removed from a_field. More...
 
virtual bool FP_Cu (LE *a_field, double a_user, int a_days)
 Apply Cu fertilizer, on a_field owned by plant farmer (orchard) More...
 
virtual bool FA_N (LE *a_field, double a_user, int a_days)
 Apply N fertilizer, on a_field owned by a stock farmer. More...
 
virtual bool FA_Cu (LE *a_field, double a_user, int a_days)
 Apply Cu fertilizer, on a_field owned by stock farmer (orchard) More...
 
virtual bool FA_Boron (LE *a_field, double a_user, int a_days)
 Apply soluble Boron to a_field owned by a stock farmer. More...
 
virtual bool FA_PKS (LE *a_field, double a_user, int a_days)
 Apply PKS fertilizer to a_field owned by an stock farmer. More...
 
virtual bool FP_PKS (LE *a_field, double a_user, int a_days)
 Apply PKS fertilizer to a_field owned by an arable farmer. More...
 
virtual bool HarvestShoots (LE *a_field, double a_user, int a_days)
 HarvestShoots applied on a_field (e.g. asparagus) - details needs to be added (e.g., impact on biomass, influence/impacts in species code)! More...
 
virtual bool ManualWeeding (LE *a_field, double a_user, int a_days)
 Manual weeding on a_field - no tramlines since weeding by hand, the bush stays on field with same vegetation height, thus suspects same % insects. More...
 
void AddNewEvent (TTypesOfVegetation a_event, long a_date, LE *a_field, int a_todo, long a_num, bool a_lock, int a_start, bool a_first_year, TTypesOfVegetation a_crop, FarmManagementCategory a_fmc, bool a_forcespring, bool a_forcespringOK)
 Adds an event to the event queue for a farm. More...
 
bool DoIt (double a_probability)
 Return chance out of 0 to 100. More...
 
bool DoIt_prob (double a_probability)
 Return chance out of 0 to 1. More...
 
TTypesOfFarm GetType (void)
 
string GetRotFilename (void)
 
int GetArea (void)
 Returns the area of arable fields owned by that farm. More...
 
int GetTotalArea (void)
 Returns the area of all fields owned by that farm. More...
 
double GetAreaDouble (void)
 Returns the area of arable fields owned by that farm. More...
 
bool IsStockFarmer (void)
 
virtual void MakeStockFarmer (void)
 
double GetIntensity (void)
 
void SetIntensity (double a_intensity)
 
APoint GetCentroids ()
 
TTypesOfVegetation GetPreviousTov (int a_index)
 
TTypesOfVegetation GetCrop (int a_index)
 
TTypesOfVegetation GetNextCrop (int a_index)
 
int GetNoCrops ()
 
void AddHunter (Hunter *a_hunter)
 
void RemoveHunter (Hunter *a_hunter)
 
int GetNextCropStartDate (LE *a_field, TTypesOfVegetation &a_curr_veg)
 Returns the start date of the next crop in the rotation. More...
 

Public Attributes

string m_rotfilename
 

Protected Member Functions

int GetFirstDate (TTypesOfVegetation a_tov)
 Gets the start date for a crop type. More...
 
int GetForceSpringOK (TTypesOfVegetation a_tov)
 Gets the start date for a crop type. More...
 
virtual int GetFirstCropIndex (TTypesOfLandscapeElement a_type)
 Gets the first crop for the farm. More...
 
virtual int GetNextCropIndex (int a_rot_index)
 Returns the next crop in the rotation. More...
 
virtual void HandleEvents (void)
 If there are events to carry out do this, and perhaps start a new crop. More...
 
bool LeSwitch (FarmEvent *ev)
 Call do function for any crop with an outstanding event. Signal if the crop has terminated. More...
 
void CheckRotationManagementLoop (FarmEvent *ev)
 
void ReadRotation (std::string fname)
 Reads a rotation file into the rotation. More...
 
void AssignPermanentCrop (TTypesOfVegetation tov, int pct)
 Used to assign a permanent crop to an otherwise rotational field polygon. More...
 
int InvIntPartition (vector< tpct > *items, int target)
 Finds all possible sums of the integers in the items array. More...
 

Protected Attributes

FarmManagerm_OurManager
 Pointer to the FarmManager. More...
 
Farmer * m_OurFarmer
 
LowPriority< FarmEvent * > m_queue
 
vector< LE * > m_fields
 
vector< TTypesOfVegetationm_rotation
 
vector< PermCropDatam_PermCrops
 
TTypesOfFarm m_farmtype
 
HunterList m_HuntersList
 A list of hunters allocated to this farm. More...
 
bool m_stockfarmer
 
int m_farm_num
 
int m_rotation_sync_index
 
double m_intensity
 indicates the farm intensity - 1 = normal, otherwise linear scale More...
 
int m_farm_centroidx
 Farm's centroid, value x. Equal to the average of the x centroid values of all farm's fields. More...
 
int m_farm_centroidy
 Farm's centroid, value y. Equal to the average of the y centroid values of all farm's fields. More...
 
TTypesOfFarm m_FarmType
 The farms farm type - see TTypesOfFarm enum for types - note the use of UserDefined farms. More...
 

Detailed Description

The base class for all farm types.

Constructor & Destructor Documentation

◆ Farm()

Farm::Farm ( FarmManager a_manager)

Farm constructor - creates an instance of each possible crop type.

1052 {
1053  m_OurManager = a_manager;
1054  m_rotation_sync_index = -1;
1055  // Defaults that need to be overridden when necessary
1057  m_stockfarmer = false;
1058  m_intensity = 0.0; // Unless changed
1059  m_HuntersList.resize(0); // Set the number of hunters to zero at the start.
1060  m_OurFarmer = new Farmer(0,0,a_manager->GetLandscape(), a_manager->GetFarmerList(), this);
1061 }

References FarmManager::GetFarmerList(), FarmManager::GetLandscape(), and tof_Foobar.

◆ ~Farm()

Farm::~Farm ( void  )
virtual

Farm destructor - deletes all crop instances and empties event queues.

1068  {
1069 
1070  delete m_OurFarmer;
1071 
1073 
1074  while (!m_queue.Empty()) {
1075  pair = m_queue.Bottom();
1076  m_queue.Pop();
1077  delete pair.m_element;
1078  }
1079 }

References LowPriPair< ELEMTYPE >::m_element.

Member Function Documentation

◆ AddField()

void Farm::AddField ( LE a_newfield)

Adds a field to a farm.

1198  {
1199  int i = (int) m_fields.size();
1200 
1201  m_fields.resize( i + 1 );
1202  m_fields[ i ] = a_newfield;
1203  // Must set the rot index to something other than -1, but identify it as not usefully set as yet.
1204  TTypesOfLandscapeElement ele = a_newfield->GetElementType();
1205  switch (ele) {
1207  case tole_YoungForest:
1208  case tole_PermPasture:
1211  case tole_Orchard:
1212  case tole_BushFruit:
1213  case tole_OBushFruit:
1214  case tole_OOrchard:
1215  case tole_PlantNursery:
1216  case tole_OliveGrove:
1217  case tole_WoodyEnergyCrop:
1218  case tole_PermPasturePigs:
1219  case tole_OPermPasturePigs:
1220  case tole_OPermPasture:
1222  case tole_ChristmasTrees:
1223  case tole_OChristmasTrees:
1224  case tole_SolarPanel:
1225  case tole_EnergyCrop:
1226  case tole_OEnergyCrop:
1227  case tole_FarmForest:
1228  case tole_OFarmForest:
1229  case tole_FarmYoungForest:
1230  case tole_OFarmYoungForest:
1231  case tole_AlmondPlantation:
1232  case tole_WalnutPlantation:
1233  case tole_FarmBufferZone:
1234  case tole_NaturalFarmGrass:
1235  case tole_GreenFallow:
1237  case tole_FlowersPerm:
1239  case tole_AsparagusPerm:
1240  case tole_MushroomPerm:
1241  case tole_OtherPermCrop:
1242  case tole_OAsparagusPerm:
1243  m_fields[i]->SetRotIndex(-2);
1244  break;
1245  default:
1246  m_fields[ i ]->SetRotIndex(-1);
1247  }
1248 }

References tole_AlmondPlantation, tole_AsparagusPerm, tole_BushFruit, tole_ChristmasTrees, tole_EnergyCrop, tole_FarmBufferZone, tole_FarmFeedingGround, tole_FarmForest, tole_FarmYoungForest, tole_FlowersPerm, tole_GreenFallow, tole_MushroomPerm, tole_NaturalFarmGrass, tole_OAsparagusPerm, tole_OBushFruit, tole_OChristmasTrees, tole_OEnergyCrop, tole_OFarmForest, tole_OFarmYoungForest, tole_OliveGrove, tole_OOrchard, tole_OPermPasture, tole_OPermPastureLowYield, tole_OPermPasturePigs, tole_Orchard, tole_OtherPermCrop, tole_PermanentSetaside, tole_PermPasture, tole_PermPastureLowYield, tole_PermPasturePigs, tole_PermPastureTussocky, tole_PermPastureTussockyWet, tole_PlantNursery, tole_SolarPanel, tole_WalnutPlantation, tole_WoodyEnergyCrop, and tole_YoungForest.

◆ AddHunter()

void Farm::AddHunter ( Hunter *  a_hunter)
inline
982  {
983  m_HuntersList.push_back(a_hunter);
984  }

References m_HuntersList.

◆ AddNewEvent()

void Farm::AddNewEvent ( TTypesOfVegetation  a_event,
long  a_date,
LE a_field,
int  a_todo,
long  a_num,
bool  a_lock,
int  a_start,
bool  a_first_year,
TTypesOfVegetation  a_crop,
FarmManagementCategory  a_fmc,
bool  a_forcespring,
bool  a_forcespringOK 
)

◆ Assign_rotation()

void Farm::Assign_rotation ( vector< TTypesOfVegetation a_new_rotation)
1269  {
1270 
1271  m_rotation.clear();
1272  m_rotation = a_new_rotation;
1273 
1274 }

◆ AssignPermanentCrop()

void Farm::AssignPermanentCrop ( TTypesOfVegetation  tov,
int  pct 
)
protected

Used to assign a permanent crop to an otherwise rotational field polygon.

3734  {
3735  // Assumes that m_fields has all the fields already in it, and those that are occupied by permanent tole types
3736  // are denoted by -2 or -4 in rotindex, -1 is unassigned - can't use enum because positive values have other meanings
3737 
3738  // Here we can save some time if we have to allocate all the fields to one permanent crop
3739  if (a_pct == 100)
3740  {
3741  for (auto cfi = m_fields.begin(); cfi != m_fields.end(); ++cfi)
3742  {
3743  // Set the field as non-rotating
3744  (*cfi)->SetRotIndex(-4);
3745  // Assign the crop, and weeds are assumed to be undefined
3746  (*cfi)->SetVegType(a_tov, tov_Undefined);
3747  }
3748  return;
3749  }
3750 
3751  tpct a_tpct;
3752  // create a copy of the field vector and call it fields_cpy
3753  vector<LE*> fields_cpy;
3754  fields_cpy.resize(m_fields.size());
3755  copy(m_fields.begin(), m_fields.end(), fields_cpy.begin());
3756  vector<tpct> pcts;
3757  double area = 0.0;
3758 
3759 
3760  // First get the areas of all fields and then convert these to percentages
3761  int sz = (int) fields_cpy.size();
3762  // loop through the fields vector and remove any fields already assigned to permanent crops
3763  for (int i = sz - 1; i >= 0; i--) {
3764  if (fields_cpy[i]->GetRotIndex() < -1) {
3765  fields_cpy.erase(fields_cpy.begin() + i);
3766  }
3767  }
3768  // sum up the area
3769  for (auto cfi = fields_cpy.begin(); cfi != fields_cpy.end(); ++cfi) area += (*cfi)->GetArea();
3770 
3771  // Here we can take action if we only have a single field
3772  int fnos = (int) fields_cpy.size();
3773  if (fnos<1) return; // No fields to allocate, jump out
3774  else if (fnos==1) {
3775  // Use the pct as the chance that our single field is assigned
3776  if (g_random_fnc(100)>=a_pct) return;
3777  else {
3778  // Add field by default
3779  fields_cpy[0]->SetRotIndex(-4);
3780  // Assign the crop
3781  fields_cpy[0]->SetVegType(a_tov, tov_Undefined);
3782  return;
3783  }
3784  }
3785  // By here we have more than one field to potentially allocate to
3786  for (int i=0; i<fnos; i++) {
3787  a_tpct.pct = (int) floor(0.5+((fields_cpy[i]->GetArea()/area)*100));
3788  a_tpct.index = i;
3789  pcts.push_back(a_tpct);
3790  }
3791  // We need to look for combinations of fields that are close to our target.
3792  // First we can sort the array and ignore any that are greater than pct
3793  sort (pcts.begin(), pcts.end(), CompPcts); // results in ordering on increasing pct
3794  // now remove all those with pct>target+10% to save loads of time in the inverse integer partition
3795  int index=-1;
3796  int ind=0;
3797  int apct=a_pct+10; // Lets assume we have a tolerance of 10%
3798  while ((index==-1) && (ind< (int)pcts.size())) {
3799  if (pcts[ind++].pct>apct) index=ind;
3800  }
3801  if (index!=-1) pcts.erase(pcts.begin()+index,pcts.end());
3802  // Now find the best combination of fields to get close to our target & set them
3803  int bits = InvIntPartition(&pcts,a_pct);
3804  int mask=1;
3805  ind = 0;
3806  int used=0;
3807  //double pctused = 0.0;
3808  double check = 0.0;
3809  for (int h=0; h< (int)pcts.size(); h++) check+=fields_cpy[pcts[h].index]->GetArea();
3810  while (bits>0) {
3811  if ((bits & mask) > 0) {
3812  // Set the field as non-rotating
3813  fields_cpy[pcts[ind].index]->SetRotIndex(-4);
3814  // Assign the crop
3815  fields_cpy[pcts[ind].index]->SetVegType(a_tov, tov_Undefined);
3816  used += (int) fields_cpy[pcts[ind].index]->GetArea();
3817  //pctused = used/area;
3818  bits -= mask;
3819  }
3820  mask = mask << 1;
3821  ind++;
3822  }
3823 }

References CompPcts(), g_random_fnc(), GetArea(), tpct::index, InvIntPartition(), m_fields, tpct::pct, and tov_Undefined.

◆ AutumnHarrow()

bool Farm::AutumnHarrow ( LE a_field,
double  a_user,
int  a_days 
)
virtual

Carry out a harrow event in the autumn on a_field.

carries out standard setting of data and deals with possible unsprayed margins, returns a pointer to UM or nullptr

286 {
287  if ( (0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
289  SetFunctionData(a_field, 0.1, 0.0, 0,autumn_harrow);
290  return true;
291  }
292  return false;
293 }

References autumn_harrow, DO_IT_PROB, g_weather, and Weather::Raining().

Referenced by WinterRapeStrigling::Do(), DK_OLegume::Do(), OWinterBarleyExt::Do(), OWinterBarley::Do(), OWinterRye::Do(), DE_OWinterWheat::Do(), OTriticale::Do(), DK_OWinterBarley::Do(), UKBeans::Do(), DK_OSugarBeet::Do(), DK_OFodderBeet::Do(), DE_OWinterRape::Do(), OWinterWheat::Do(), OWinterWheatUndersown::Do(), OWinterWheatUndersownExt::Do(), Triticale::Do(), UKBeet::Do(), OWinterRape::Do(), UKSpringBarley::Do(), UKWinterBarley::Do(), DK_OWinterRape::Do(), DE_OCarrots::Do(), DK_WinterBarley::Do(), DKOBroadBeans_test::Do(), UKWinterWheat::Do(), WinterRyeStrigling::Do(), PLCarrots::Do(), UKWinterRape::Do(), WinterRye::Do(), DK_Cabbages::Do(), PTBeans::Do(), PTTurnipGrazed::Do(), DK_WinterWheat::Do(), DK_WinterWheat_CC::Do(), PTOtherDryBeans::Do(), PTHorticulture::Do(), PLFodderLucerne1::Do(), DK_Potato::Do(), DK_OBushFruit_Perm2::Do(), PTOats::Do(), DE_HerbsPerennial_1year::Do(), DE_OHerbsPerennial_1year::Do(), WinterWheatStrigling::Do(), WinterWheatStriglingSingle::Do(), WinterWheatStriglingCulm::Do(), PLBeans::Do(), PTWinterBarley::Do(), PTWinterRye::Do(), PTWinterWheat::Do(), DK_WinterRape::Do(), PTTriticale::Do(), PTGrassGrazed::Do(), PTYellowLupin::Do(), WinterRape::Do(), WinterBarleyStrigling::Do(), DK_PotatoSeed::Do(), DK_PotatoIndustry::Do(), PTRyegrass::Do(), WinterBarley::Do(), PLWinterRye::Do(), DK_OBushFruit_Perm1::Do(), FR_Sorghum::Do(), FR_Maize::Do(), DK_OWinterWheat_CC::Do(), FR_Maize_Silage::Do(), PLMaizeSilage::Do(), PLSpringBarley::Do(), DK_OWinterWheat::Do(), PLMaize::Do(), FR_WinterTriticale::Do(), FI_OWinterRye::Do(), PLWinterTriticale::Do(), FR_Sunflower::Do(), DK_OWinterFodderGrass::Do(), DE_OTriticale::Do(), DE_OWinterRye::Do(), FI_OWinterWheat::Do(), PLWinterBarley::Do(), PLWinterWheat::Do(), PLBeet::Do(), DK_OWinterCloverGrassGrazedSown::Do(), PLWinterWheatLate::Do(), PLSpringWheat::Do(), PLPotatoes::Do(), PLWinterRape::Do(), DE_GrasslandSilageAnnual::Do(), FR_WinterBarley::Do(), FI_WinterWheat::Do(), DK_BushFruit_Perm2::Do(), IRWinterBarley::Do(), IRWinterOats::Do(), FI_WinterRye::Do(), DE_Triticale::Do(), FR_WinterWheat::Do(), IRWinterWheat::Do(), FR_WinterRape::Do(), DE_WinterRape::Do(), WinterWheat::Do(), DE_Potatoes::Do(), DE_PotatoesIndustry::Do(), DK_OChristmasTrees_Perm::Do(), and DK_ChristmasTrees_Perm::Do().

◆ AutumnPlough()

bool Farm::AutumnPlough ( LE a_field,
double  a_user,
int  a_days 
)
virtual

Carry out a ploughing event in the autumn on a_field.

213 {
214  // LE is a pointer to the field element
215  // a_user is a pointer to the farm
216  // a_days is the end of the operation time - today
217  // if a_days <0 then the time to do it is passed
218  // the line below reads 'plough if last day possible OR if not raining and pass a probability test
219  if ( (0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
220  // Set the data for this, in this case 90% insect mortality and remove all veg, not tramline open time, the treatment is autumn plough
221  SetFunctionData(a_field, 0.1, 0.0, 0, autumn_plough);
222  return true; // completed
223  }
224  return false; // not completed
225 }

References autumn_plough, DO_IT_PROB, g_weather, and Weather::Raining().

Referenced by NorwegianOats::Do(), WinterRapeStrigling::Do(), NorwegianSpringBarley::Do(), DK_OLegume::Do(), DK_CerealLegume_Whole::Do(), DK_CerealLegume::Do(), FI_OPotato_North::Do(), FI_OPotato_South::Do(), FI_OPotatoIndustry_North::Do(), FI_OPotatoIndustry_South::Do(), DK_Legume_Peas::Do(), FI_OStarchPotato_South::Do(), FI_OStarchPotato_North::Do(), DK_SpringBarley_Green::Do(), OWinterBarleyExt::Do(), DK_SpringBarleySilage::Do(), OWinterBarley::Do(), DK_FodderBeet::Do(), DK_MaizeSilage::Do(), OWinterRye::Do(), DK_Legume_Beans::Do(), DK_OWinterRye::Do(), FI_SugarBeet::Do(), DK_SpringOats::Do(), DK_SugarBeet::Do(), DK_SpringOats_CC::Do(), DK_OWinterRye_CC::Do(), DK_OCerealLegume_Whole::Do(), Maize::Do(), DE_OWinterWheat::Do(), MaizeSilage::Do(), MaizeStrigling::Do(), OTriticale::Do(), DK_OWinterBarley::Do(), DK_Maize::Do(), DK_SpringWheat::Do(), Oats::Do(), OSpringBarleyExt::Do(), DK_OSugarBeet::Do(), SpringBarleySeed::Do(), DK_Legume_Whole::Do(), DK_OCerealLegume::Do(), OSpringBarley::Do(), SpringBarleyCloverGrassStrigling::Do(), FI_Potato_North::Do(), FieldPeas::Do(), FieldPeasSilage::Do(), FieldPeasStrigling::Do(), DK_OFodderBeet::Do(), DE_OWinterRape::Do(), OWinterWheat::Do(), OWinterWheatUndersown::Do(), OWinterWheatUndersownExt::Do(), FI_StarchPotato_North::Do(), SpringBarleyCloverGrass::Do(), FI_PotatoIndustry_North::Do(), OFodderBeet::Do(), Triticale::Do(), FI_Potato_South::Do(), FI_PotatoIndustry_South::Do(), FI_StarchPotato_South::Do(), OWinterRape::Do(), DE_OCabbages::Do(), DK_OVegSeeds::Do(), DE_OSugarBeet::Do(), DK_SpringBarleyCloverGrass::Do(), UKSpringBarley::Do(), UKWinterBarley::Do(), DK_WinterFodderGrass::Do(), DK_OMaizeSilage::Do(), SpringBarleyPeaCloverGrassStrigling::Do(), DK_OWinterRape::Do(), DK_SpringBarley::Do(), DK_SpringBarley_CC::Do(), DK_OMaize::Do(), DK_WinterCloverGrassGrazedSown::Do(), DK_OSpringBarleySilage::Do(), DK_OCabbages::Do(), PotatoesIndustry::Do(), DK_WinterBarley::Do(), DKOBroadBeans_test::Do(), Potatoes::Do(), FodderBeet::Do(), NorwegianPotatoes::Do(), DK_VegSeeds::Do(), DK_WinterRye::Do(), DK_WinterRye_CC::Do(), SpringBarleySKManagement::Do(), UKWinterWheat::Do(), WinterRyeStrigling::Do(), SpringBarleySilage::Do(), UKWinterRape::Do(), SpringBarleyStrigling::Do(), SpringBarleyStriglingSingle::Do(), SpringBarleyPTreatment::Do(), SpringBarleyStriglingCulm::Do(), WinterRye::Do(), PTTurnipGrazed::Do(), PTBeans::Do(), NLWinterWheat::Do(), DK_OPotato::Do(), DK_WinterWheat::Do(), DK_OPotatoIndustry::Do(), DK_OPotatoSeed::Do(), DK_WinterWheat_CC::Do(), PTOtherDryBeans::Do(), SpringBarley::Do(), PTHorticulture::Do(), DK_OSeedGrassRye_Spring::Do(), DK_OBushFruit_Perm2::Do(), WinterWheatStrigling::Do(), WinterWheatStriglingSingle::Do(), WinterWheatStriglingCulm::Do(), DK_WinterRape::Do(), PTFodderMix::Do(), FI_OSpringBarley_Malt::Do(), WinterBarleyStrigling::Do(), WinterRape::Do(), PTGrassGrazed::Do(), FI_OFabaBean::Do(), FI_OTurnipRape::Do(), FI_OSpringOats::Do(), FI_OSpringRape::Do(), FI_OSpringWheat::Do(), WinterBarley::Do(), FI_OSpringBarley_Fodder::Do(), PLWinterRye::Do(), FI_TurnipRape::Do(), DK_OWinterWheat_CC::Do(), DK_OWinterWheat::Do(), FI_FabaBean::Do(), FI_SpringRape::Do(), NLTulips::Do(), FI_OWinterRye::Do(), FI_SpringBarley_Malt::Do(), PLWinterTriticale::Do(), SE_SpringBarley::Do(), PTCloverGrassGrazed1::Do(), FI_OWinterWheat::Do(), DE_WinterRye::Do(), DK_OWinterFodderGrass::Do(), DE_OTriticale::Do(), DE_OWinterRye::Do(), DK_OWinterCloverGrassGrazedSown::Do(), DE_OWinterBarley::Do(), PLWinterBarley::Do(), PLWinterWheat::Do(), FI_SpringWheat::Do(), FI_SpringOats::Do(), PLWinterWheatLate::Do(), PTPermanentGrassGrazed::Do(), SE_WinterRape_Seed::Do(), FI_SpringBarley_Fodder::Do(), DE_WinterBarley::Do(), SE_WinterWheat::Do(), DK_SeedGrassRye_Spring::Do(), PLWinterRape::Do(), FI_WinterWheat::Do(), DK_BushFruit_Perm2::Do(), FR_WinterBarley::Do(), IRWinterBarley::Do(), IRWinterOats::Do(), FR_WinterWheat::Do(), DE_WinterWheat::Do(), FI_WinterRye::Do(), DE_WinterWheatLate::Do(), DE_Triticale::Do(), FR_WinterRape::Do(), IRWinterWheat::Do(), DE_WinterRape::Do(), DK_SeedGrassFescue_Spring::Do(), WinterWheat::Do(), DK_OrchCherry::Do(), DK_OChristmasTrees_Perm::Do(), and DK_ChristmasTrees_Perm::Do().

◆ AutumnRoll()

◆ AutumnSow()

bool Farm::AutumnSow ( LE a_field,
double  a_user,
int  a_days,
double  a_seed_coating_amount = -1,
PlantProtectionProducts  a_ppp = ppp_foobar 
)
virtual

Carry out a sowing event in the autumn on a_field.

361 {
362  if ((0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
363  LE* um = SetFunctionData(a_field, 1.0, 0.0, 0, autumn_sow);
364  a_field->SetGrowthPhase(sow); // as with AutumnSow treatment
365  a_field->SetLastSownVeg(a_field->GetVegType()); // as with AutumnSow treatment
366  //start the flowering period.
367  if(a_field->GetPollenNectarCurveRef()<0){
368  a_field->CalculateFlowerResourceForCropSow(a_field->GetVegType());
369  }
370  // Apply seed coating if turned on
371  if (a_seed_coating_amount > 0) {
372  g_pest->DailyQueueAddSeedCoating(a_field, a_seed_coating_amount/10000, a_ppp); // Application rate is changed from g/ha to g/m2
373  }
374  if (um != nullptr) {
375  um->SetGrowthPhase(sow);
376  um->SetLastSownVeg(a_field->GetVegType());
377  //start the flowering period.
378  if(um->GetPollenNectarCurveRef()<0){
379  um->CalculateFlowerResourceForCropSow(um->GetVegType());
380  }
381  // Apply seed coating if turned on
382  if (a_seed_coating_amount > 0) {
383  g_pest->DailyQueueAddSeedCoating(um, a_seed_coating_amount/10000, a_ppp); // Application rate is changed from g/ha to g/m2
384  }
385  }
386  return true;
387  }
388  return false;
389 }

References autumn_sow, LE::CalculateFlowerResourceForCropSow(), Pesticide::DailyQueueAddSeedCoating(), DO_IT_PROB, g_pest, g_weather, LE::GetPollenNectarCurveRef(), Weather::Raining(), LE::SetGrowthPhase(), LE::SetLastSownVeg(), and sow.

Referenced by GenericCatchCrop::Do(), WinterRapeStrigling::Do(), DK_OCatchCrop::Do(), OWinterBarleyExt::Do(), DK_CatchCrop::Do(), OWinterBarley::Do(), OWinterRye::Do(), DK_OWinterRye::Do(), OTriticale::Do(), DE_OWinterWheat::Do(), DK_OWinterRye_CC::Do(), DK_OWinterBarley::Do(), UKBeans::Do(), DE_OWinterRape::Do(), OWinterWheat::Do(), OWinterWheatUndersown::Do(), OWinterWheatUndersownExt::Do(), Triticale::Do(), OWinterRape::Do(), DK_WinterFodderGrass::Do(), DK_OWinterRape::Do(), DK_WinterCloverGrassGrazedSown::Do(), UKWinterWheat::Do(), WinterRyeStrigling::Do(), UKWinterRape::Do(), WinterRye::Do(), PTTurnipGrazed::Do(), PTBeans::Do(), PTOtherDryBeans::Do(), DK_WinterWheat_CC::Do(), PTHorticulture::Do(), PTOats::Do(), DK_OBushFruit_Perm2::Do(), WinterWheatStrigling::Do(), WinterWheatStriglingCulm::Do(), WinterWheatStriglingSingle::Do(), PTWinterBarley::Do(), PTWinterRye::Do(), PTWinterWheat::Do(), PTTriticale::Do(), DK_WinterRape::Do(), PTFodderMix::Do(), PTYellowLupin::Do(), WinterBarleyStrigling::Do(), WinterRape::Do(), PTGrassGrazed::Do(), PTRyegrass::Do(), WinterBarley::Do(), PLWinterRye::Do(), DK_OBushFruit_Perm1::Do(), DK_OWinterWheat_CC::Do(), DK_OWinterWheat::Do(), FI_OWinterRye::Do(), NLTulips::Do(), PLWinterTriticale::Do(), PTCloverGrassGrazed1::Do(), FI_OWinterWheat::Do(), DK_OWinterFodderGrass::Do(), DE_WinterRye::Do(), DE_OWinterRye::Do(), DE_OTriticale::Do(), DK_OWinterCloverGrassGrazedSown::Do(), DE_OWinterBarley::Do(), PLWinterWheat::Do(), PLWinterBarley::Do(), PLWinterWheatLate::Do(), PTPermanentGrassGrazed::Do(), DE_WinterBarley::Do(), SE_WinterWheat::Do(), PLWinterRape::Do(), FR_WinterBarley::Do(), FI_WinterWheat::Do(), DK_BushFruit_Perm2::Do(), IRWinterOats::Do(), IRSpringBarley::Do(), IRSpringOats::Do(), IRWinterBarley::Do(), DE_Triticale::Do(), FR_WinterWheat::Do(), FI_WinterRye::Do(), IRSpringWheat::Do(), DE_WinterWheat::Do(), DE_WinterWheatLate::Do(), IRWinterWheat::Do(), FR_WinterRape::Do(), DE_WinterRape::Do(), WinterWheat::Do(), DK_OChristmasTrees_Perm::Do(), and DK_ChristmasTrees_Perm::Do().

◆ AutumnSowWithFerti()

bool Farm::AutumnSowWithFerti ( LE a_field,
double  a_user,
int  a_days,
double  a_seed_coating_amount = -1,
PlantProtectionProducts  a_ppp = ppp_foobar 
)
virtual

Carry out a sowing event with start fertilizer in the autumn on a_field.

593 {
594  FarmToDo treatment = autumn_sow_with_ferti;
595  if ((0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
596  LE* um = SetFunctionData(a_field, 1.0, 1.0, 0, treatment);
597  a_field->SetGrowthPhase(sow);
598  a_field->SetLastSownVeg(a_field->GetVegType());
599  //start the flowering period.
600  if(a_field->GetPollenNectarCurveRef()<0){
601  a_field->CalculateFlowerResourceForCropSow(a_field->GetVegType());
602  }
603  // Apply seed coating if turned on
604  if (a_seed_coating_amount > 0) {
605  g_pest->DailyQueueAddSeedCoating(a_field, a_seed_coating_amount/10000, a_ppp); // Application rate is changed from g/ha to g/m2
606  }
607  if (um != nullptr)
608  {
609  um->SetGrowthPhase(sow);
610  um->SetLastSownVeg(um->GetVegType());
611  //start the flowering period.
612  if(um->GetPollenNectarCurveRef()<0){
613  um->CalculateFlowerResourceForCropSow(um->GetVegType());
614  }
615  // Apply seed coating if turned on
616  if (a_seed_coating_amount > 0) {
617  g_pest->DailyQueueAddSeedCoating(um, a_seed_coating_amount/10000, a_ppp); // Application rate is changed from g/ha to g/m2
618  }
619  }
620  return true;
621  }
622  return false;
623 }

References autumn_sow_with_ferti, LE::CalculateFlowerResourceForCropSow(), Pesticide::DailyQueueAddSeedCoating(), DO_IT_PROB, g_pest, g_weather, LE::GetPollenNectarCurveRef(), Weather::Raining(), LE::SetGrowthPhase(), LE::SetLastSownVeg(), and sow.

Referenced by SE_WinterRape_Seed::Do(), and SE_WinterWheat::Do().

◆ BedForming()

bool Farm::BedForming ( LE a_field,
double  a_user,
int  a_days 
)
virtual

Do bed forming up on a_field, probably of carrots.

1317 {
1318  FarmToDo treatment = bed_forming;
1319  if ((0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
1320  SetFunctionData(a_field, 0.9, 0.0, EL_TRAMLINE_DECAYTIME, treatment);
1321  return true;
1322  }
1323  return false;
1324 }

References bed_forming, DO_IT_PROB, EL_TRAMLINE_DECAYTIME, g_weather, and Weather::Raining().

Referenced by NLCarrotsSpring::Do(), DE_OCarrots::Do(), DK_OCarrots::Do(), NLCarrots::Do(), DK_Carrots_Spring::Do(), PLCarrots::Do(), DK_Carrots::Do(), UKPotatoes::Do(), PTPotatoes::Do(), NLPotatoesSpring::Do(), NLPotatoes::Do(), NLTulips::Do(), and DE_Carrots::Do().

◆ BiocideTreat()

bool Farm::BiocideTreat ( LE a_field,
double  a_user,
int  a_days 
)
virtual

Apply Biocide to a_field.

2176 {
2177  constexpr FarmToDo treatment = biocide;
2178  if ((0 >= a_days) || ((g_weather->GetWind() < cfg_pest_max_wind.value()) && (!g_weather->Raining()) && DoIt(DO_IT_PROB))) {
2179  a_field->Trace(treatment);
2180  a_field->SetLastTreatment(treatment);
2182  a_field->Insecticide(1-(0.64*(1-cfg_biocide_reduction_val.value())));
2183  }
2185  CalculateTreatmentCosts(treatment, a_field);
2186  return true;
2187  }
2188  return false;
2189 }

References biocide, cfg_biocide_reduction_val, cfg_pest_max_wind, DO_IT_PROB, EL_TRAMLINE_DECAYTIME, g_weather, Weather::GetWind(), LE::Insecticide(), l_farm_insecticide_kills, Weather::Raining(), LE::SetLastTreatment(), LE::SetTramlinesDecay(), CfgFloat::value(), and CfgBool::value().

Referenced by FI_SugarBeet::Do(), FI_Potato_North::Do(), FI_StarchPotato_North::Do(), FI_PotatoIndustry_North::Do(), FI_Potato_South::Do(), FI_PotatoIndustry_South::Do(), FI_StarchPotato_South::Do(), BEWinterWheatCC::Do(), BEWinterWheat::Do(), NLWinterWheat::Do(), DK_WinterWheat::Do(), DK_WinterWheat_CC::Do(), DK_Potato::Do(), DK_WinterRape::Do(), BEPotatoesSpring::Do(), DK_PotatoSeed::Do(), DK_PotatoIndustry::Do(), NLPotatoesSpring::Do(), BEPotatoes::Do(), FR_Maize::Do(), FR_Maize_Silage::Do(), PLMaizeSilage::Do(), NLPotatoes::Do(), PLMaize::Do(), FI_SpringRape::Do(), PLWinterWheat::Do(), FI_SpringWheat::Do(), PLWinterWheatLate::Do(), PLPotatoes::Do(), PLWinterRape::Do(), FI_WinterWheat::Do(), DE_WinterWheatLate::Do(), DE_WinterWheat::Do(), FR_WinterWheat::Do(), FR_WinterRape::Do(), FR_Potatoes::Do(), DE_WinterRape::Do(), DE_Potatoes::Do(), and DE_PotatoesIndustry::Do().

◆ BulbHarvest()

bool Farm::BulbHarvest ( LE a_field,
double  a_user,
int  a_days 
)
virtual

Carry out a bulb harvest on a_field.

1707 {
1708  FarmToDo treatment = bulb_harvest;
1709  //5 days good weather before
1710  if ((0 >= a_days) || ((g_weather->GetRainPeriod(g_date->Date(), 5) < 0.1) && DoIt(DO_IT_PROB))) {
1711  LE* um = SetFunctionData(a_field, 0.3, 0.0, EL_TRAMLINE_DECAYTIME, treatment);
1712  double insects = a_field->GetInsectPop();
1713  a_field->SetGrowthPhase(harvest1);
1714  double biomassBefore = a_field->GetVegBiomass();
1715  a_field->RecalculateBugsNStuff();
1716  double reduc = a_field->GetVegBiomass() / biomassBefore;
1717  if (reduc > 0 && reduc < 1) g_pest->ReducePlantPesticide(a_field->GetMinX(), a_field->GetMaxX(), a_field->GetMinY(), a_field->GetMaxY(), a_field->GetMapIndex(), reduc, true);
1718  a_field->ResetDigestibility();
1719  a_field->PollenNectarReset();
1720  if (um != nullptr) {
1721  um->SetGrowthPhase(harvest1);
1722  double biomassBefore = um->GetVegBiomass();
1723  um->RecalculateBugsNStuff();
1724  double reduc = um->GetVegBiomass() / biomassBefore;
1725  if (reduc > 0 && reduc < 1) g_pest->ReducePlantPesticide(um->GetMinX(), um->GetMaxX(), um->GetMinY(), um->GetMapIndex(), reduc, true);
1726  um->ResetDigestibility();
1727  um->PollenNectarReset();
1728  }
1729  return true;
1730  }
1731  return false;
1732 }

References bulb_harvest, Calendar::Date(), DO_IT_PROB, EL_TRAMLINE_DECAYTIME, g_date, g_pest, g_weather, LE::GetInsectPop(), LE::GetMapIndex(), LE::GetMaxX(), LE::GetMaxY(), LE::GetMinX(), LE::GetMinY(), Weather::GetRainPeriod(), LE::GetVegBiomass(), harvest1, LE::PollenNectarReset(), LE::RecalculateBugsNStuff(), Pesticide::ReducePlantPesticide(), LE::ResetDigestibility(), and LE::SetGrowthPhase().

Referenced by NLTulips::Do().

◆ BurnStrawStubble()

bool Farm::BurnStrawStubble ( LE a_field,
double  a_user,
int  a_days 
)
virtual

Burn stubble on a_field.

1568 {
1569  FarmToDo treatment = burn_straw_stubble;
1570  if ((0 >= a_days) && (g_weather->GetRainPeriod(g_date->Date(), 3) > 0.1))
1571  {
1572  return true;
1573  }
1574  if ((0 >= a_days) || ((g_weather->GetRainPeriod(g_date->Date(), 3) < 0.1)
1575  && DoIt(DO_IT_PROB)))
1576  {
1577  SetFunctionData(a_field, 0.4, 0.2, 0, treatment);
1578  return true;
1579  }
1580  return false;
1581 }

References burn_straw_stubble, Calendar::Date(), DO_IT_PROB, g_date, g_weather, and Weather::GetRainPeriod().

Referenced by OSeedGrass1::Do(), OSeedGrass2::Do(), SeedGrass1::Do(), SeedGrass2::Do(), SpringBarleySeed::Do(), DE_OCarrots::Do(), DK_OCarrots::Do(), DK_SeedGrassRye_Spring::Do(), and DK_SeedGrassFescue_Spring::Do().

◆ BurnTop()

bool Farm::BurnTop ( LE a_field,
double  a_user,
int  a_days 
)
virtual

Burn tops of e.g. potatoes on a_field.

1588 {
1589  FarmToDo treatment = burn_top;
1590  if ((0 >= a_days) && (g_weather->GetRainPeriod(g_date->Date(), 3) > 0.1))
1591  {
1592  return true;
1593  }
1594  if ((0 >= a_days) || ((g_weather->GetRainPeriod(g_date->Date(), 3) < 0.1)
1595  && DoIt(DO_IT_PROB)))
1596  {
1597  SetFunctionData(a_field, 0.4, 0.2, 0, treatment);
1598  return true;
1599  }
1600  return false;
1601 }

References burn_top, Calendar::Date(), DO_IT_PROB, g_date, g_weather, and Weather::GetRainPeriod().

Referenced by DK_OPotato::Do(), DK_OPotatoSeed::Do(), and DK_OPotatoIndustry::Do().

◆ CalculateTreatmentCosts()

void Farm::CalculateTreatmentCosts ( FarmToDo  a_treatment,
LE a_field 
)
6354 {
6355 
6357  FarmFuncsCostBenefits FFCB = m_OurManager->Get_FarmFuncsCB(a_treatment);
6358  double area = a_field->GetArea();
6359  double total_economic_cost_of_the_treatment = FFCB.EconomicCost * area;
6360  double total_labour_cost_of_the_treatment = FFCB.LabourCost * area;
6361  m_OurFarmer->AddCost(total_economic_cost_of_the_treatment);
6362  m_OurFarmer->AddLabourCost(total_labour_cost_of_the_treatment);
6363  m_OurFarmer->ChangeRiskScore(FFCB.RiskAvoidance);
6364  m_OurFarmer->ChangeEnvironmentScore(FFCB.EnvImpact * area);
6366  }

References LE::AddManagementActionDone(), cfg_UseSocioEconomicFarm, FarmFuncsCostBenefits::EconomicCost, FarmFuncsCostBenefits::EnvImpact, FarmManager::Get_FarmFuncsCB(), LE::GetArea(), FarmFuncsCostBenefits::LabourCost, m_OurFarmer, m_OurManager, FarmFuncsCostBenefits::ManagementCategory, FarmFuncsCostBenefits::RiskAvoidance, and CfgBool::value().

◆ CattleIsOut() [1/2]

bool Farm::CattleIsOut ( LE a_field,
double  a_user,
int  a_days,
int  a_max 
)
virtual

Generate a 'cattle_out' event for every day the cattle are on a_field.

This is the main grazing method and as such is called by all grazed field management plans each day the cattle are out.

2471 {
2475  FarmToDo treatment = cattle_out;
2476  double biomass = a_field->GetVegBiomass();
2477  if (biomass > 100.0)
2478  {
2479  a_field->SetLastTreatment(treatment);
2480  a_field->Trace(treatment);
2481  // Reduce the vegetation because of grazing
2482  //double h=a_field->GetVegHeight();
2483  //double reduc = 1-(l_farm_cattle_veg_reduce.value()*((h-15)/15));
2484  //a_field->ReduceVeg_Extended( reduc );
2485  a_field->GrazeVegetation(l_farm_cattle_veg_reduce.value(), false);
2486  int pref = a_field->GetUnsprayedMarginPolyRef();
2487  if (pref != -1)
2488  {
2489  // Must have an unsprayed margin so need to pass the information on to it
2490  LE* um = g_landscape_ptr->SupplyLEPointer(pref);
2491  um->SetLastTreatment(treatment);
2493  }
2494  }
2495  int d1 = g_date->DayInYear(10, 9);
2496  if (d1 > a_max) d1 = a_max;
2497  if ((((g_date->DayInYear() > d1) && (10 >= a_days)) && DoIt(10)) || (0 >= a_days))
2498  {
2499  a_field->ToggleCattleGrazing();
2500  int pref = a_field->GetUnsprayedMarginPolyRef();
2501  if (pref != -1) {
2502  // Must have an unsprayed margin so need to pass the information on to it
2503  LE* um = g_landscape_ptr->SupplyLEPointer(pref);
2504  um->ToggleCattleGrazing();
2505  }
2506  CalculateTreatmentCosts(treatment, a_field);
2507  return true;
2508  }
2509  return false;
2510 }

References cattle_out, Calendar::DayInYear(), g_date, g_landscape_ptr, LE::GetUnsprayedMarginPolyRef(), LE::GetVegBiomass(), LE::GrazeVegetation(), l_farm_cattle_veg_reduce, LE::SetLastTreatment(), Landscape::SupplyLEPointer(), LE::ToggleCattleGrazing(), and CfgFloat::value().

Referenced by DK_GrassTussocky_Perm::Do(), PermanentGrassLowYield::Do(), DK_OGrassLowYield_Perm::Do(), OPermanentGrassGrazed::Do(), DK_GrassLowYield_Perm::Do(), PermanentGrassGrazed::Do(), OBarleyPeaCloverGrass::Do(), SpringBarleyCloverGrassStrigling::Do(), SpringBarleyCloverGrass::Do(), DK_WinterFodderGrass::Do(), SpringBarleyPeaCloverGrassStrigling::Do(), DK_WinterCloverGrassGrazedSown::Do(), DK_SpringFodderGrass::Do(), NLGrassGrazedExtensive2::Do(), NLPermanentGrassGrazedExtensive::Do(), SetAside::Do(), NLGrassGrazedExtensive1Spring::Do(), NLGrassGrazedExtensiveLast::Do(), NLGrassGrazedExtensive1::Do(), DK_OGrassGrazed_Perm::Do(), DK_GrassGrazed_Perm::Do(), DE_OPermanentGrassLowYield::Do(), DE_PermanentGrassLowYield::Do(), DE_PermanentGrassGrazed::Do(), FR_Grassland_Perm::Do(), UKPermanentGrass::Do(), DE_GreenFallow_1year::Do(), UKTempGrass::Do(), FI_GreenFallow_1year::Do(), FI_NaturalGrassland_Perm::Do(), DE_OGreenFallow_1year::Do(), NLGrassGrazed2::Do(), NLPermanentGrassGrazed::Do(), DK_CloverGrassGrazed1::Do(), FI_GreenFallow_Perm::Do(), NLGrassGrazedLast::Do(), NLGrassGrazed1Spring::Do(), FI_BufferZone::Do(), FI_BufferZone_Perm::Do(), FI_NaturalGrassland::Do(), NLGrassGrazed1::Do(), FI_GrasslandPasturePerennial2::Do(), FI_GrasslandSilagePerennial1::Do(), FI_GrasslandPasturePerennial1::Do(), FI_FeedingGround::Do(), FI_GrasslandSilagePerennial2::Do(), DK_OSpringFodderGrass::Do(), FI_GrasslandSilageAnnual::Do(), DK_OCloverGrassGrazed3::Do(), DK_OCloverGrassGrazed1::Do(), DK_OCloverGrassGrazed2::Do(), DK_OWinterFodderGrass::Do(), DK_OWinterCloverGrassGrazedSown::Do(), DK_CloverGrassGrazed3::Do(), DK_CloverGrassGrazed2::Do(), FR_Grassland::Do(), IRGrassland_no_reseed::Do(), and IRGrassland_reseed::Do().

◆ CattleIsOut() [2/2]

bool Farm::CattleIsOut ( LE a_field,
double  a_user,
int  a_days,
int  a_max,
bool  a_should_eat 
)
virtual

Generate a 'cattle_out' event for every day the cattle are on a_field.

This is the main grazing method and as such is called by all grazed field management plans each day the cattle are out.

2517 {
2521 
2522  FarmToDo treatment = cattle_out;
2523  if (a_should_eat) {
2524  a_field->SetLastTreatment(treatment);
2525  a_field->Trace(treatment);
2527  a_field->SetGrowthPhase(harvest2);
2528 
2529  int pref = a_field->GetUnsprayedMarginPolyRef();
2530  if (pref != -1)
2531  {
2532  // Must have an unsprayed margin so need to pass the information on to it
2533  LE* um = g_landscape_ptr->SupplyLEPointer(pref);
2534  um->SetLastTreatment(treatment);
2536  um->SetGrowthPhase(harvest2);
2537  }
2538  }
2539  int d1 = g_date->DayInYear(10, 9);
2540  if (d1 > a_max) d1 = a_max;
2541  if ((((g_date->DayInYear() > d1) && (10 >= a_days)) && DoIt(10)) || (0 >= a_days))
2542  {
2543  a_field->ToggleCattleGrazing();
2544  int pref = a_field->GetUnsprayedMarginPolyRef();
2545  if (pref != -1) {
2546  // Must have an unsprayed margin so need to pass the information on to it
2547  LE* um = g_landscape_ptr->SupplyLEPointer(pref);
2548  um->ToggleCattleGrazing();
2549  }
2550  CalculateTreatmentCosts(treatment, a_field);
2551  return true;
2552  }
2553  return false;
2554 }

References cattle_out, cfg_farm_cattle_reduce_height, Calendar::DayInYear(), g_date, g_landscape_ptr, LE::GetCattleGrazing(), LE::GetUnsprayedMarginPolyRef(), LE::GrazeVegetationHeight(), harvest2, LE::SetGrowthPhase(), LE::SetLastTreatment(), Landscape::SupplyLEPointer(), LE::ToggleCattleGrazing(), and CfgArray_Double::value().

◆ CattleIsOutLow()

bool Farm::CattleIsOutLow ( LE a_field,
double  a_user,
int  a_days,
int  a_max 
)
virtual

Generate a 'cattle_out_low' event for every day the cattle are on a_field.

2562 {
2563  FarmToDo treatment = cattle_out_low;
2564  // Generate a 'cattle_in_out' event for every day the cattle is on the
2565  // field.
2566  double biomass = a_field->GetVegBiomass();
2567  if (biomass > 100.0)
2568  {
2569  a_field->SetLastTreatment(treatment);
2570  a_field->Trace(treatment);
2571  // Reduce the vegetation because of grazing
2572  //double h=a_field->GetVegHeight();
2573  //double reduc = 1-(l_farm_cattle_veg_reduce2.value()*((h-15)/15));
2574  //a_field->ReduceVeg_Extended( reduc );
2575  a_field->GrazeVegetation(l_farm_cattle_veg_reduce2.value(), false);
2576  int pref = a_field->GetUnsprayedMarginPolyRef();
2577  if (pref != -1)
2578  {
2579  // Must have an unsprayed margin so need to pass the information on to it
2580  LE* um = g_landscape_ptr->SupplyLEPointer(pref);
2581  um->SetLastTreatment(treatment);
2583  }
2584  }
2585  int d1 = g_date->DayInYear(10, 9);
2586  if (d1 > a_max) d1 = a_max;
2587  if ((((g_date->DayInYear() > d1) && (10 >= a_days)) && DoIt(10)) || (0 >= a_days))
2588  {
2589  a_field->ToggleCattleGrazing();
2590  int pref = a_field->GetUnsprayedMarginPolyRef();
2591  if (pref != -1) {
2592  // Must have an unsprayed margin so need to pass the information on to it
2593  LE* um = g_landscape_ptr->SupplyLEPointer(pref);
2594  um->ToggleCattleGrazing();
2595  }
2596  CalculateTreatmentCosts(treatment, a_field);
2597  return true;
2598  }
2599  return false;
2600 }

References cattle_out_low, Calendar::DayInYear(), g_date, g_landscape_ptr, LE::GetUnsprayedMarginPolyRef(), LE::GetVegBiomass(), LE::GrazeVegetation(), l_farm_cattle_veg_reduce2, LE::SetLastTreatment(), Landscape::SupplyLEPointer(), LE::ToggleCattleGrazing(), and CfgFloat::value().

Referenced by PermanentGrassTussocky::Do(), OPermanentGrassGrazed::Do(), OBarleyPeaCloverGrass::Do(), and DE_OPermanentGrassGrazed::Do().

◆ CattleIsOutLow2()

bool Farm::CattleIsOutLow2 ( LE a_field,
double  a_user,
int  a_days,
int  a_max,
int  a_max_days 
)
virtual

Generate a 'cattle_out_low2' event for every day the cattle are on a_field, cattle is low grazing and can stay on the field till a_max date but no more days than defined by a_max_days a_days defines the number of days from the day the cattle is put on the field (set by a flag in the management plan)

2608 {
2609  FarmToDo treatment = cattle_out_low;
2610  // Generate a 'cattle_in_out' event for every day the cattle is on the
2611  // field.
2612  double biomass = a_field->GetVegBiomass();
2613  if (biomass > 100.0)
2614  {
2615  a_field->SetLastTreatment(treatment);
2616  a_field->Trace(treatment);
2617  // Reduce the vegetation because of grazing
2618  //double h=a_field->GetVegHeight();
2619  //double reduc = 1-(l_farm_cattle_veg_reduce2.value()*((h-15)/15));
2620  //a_field->ReduceVeg_Extended( reduc );
2621  a_field->GrazeVegetation(l_farm_cattle_veg_reduce2.value(), false);
2622  int pref = a_field->GetUnsprayedMarginPolyRef();
2623  if (pref != -1)
2624  {
2625  // Must have an unsprayed margin so need to pass the information on to it
2626  LE* um = g_landscape_ptr->SupplyLEPointer(pref);
2627  um->SetLastTreatment(treatment);
2629  }
2630  }
2631  if ((g_date->DayInYear() > a_max) || (a_max_days < a_days))
2632  {
2633  a_field->ToggleCattleGrazing();
2634  int pref = a_field->GetUnsprayedMarginPolyRef();
2635  if (pref != -1) {
2636  // Must have an unsprayed margin so need to pass the information on to it
2637  LE* um = g_landscape_ptr->SupplyLEPointer(pref);
2638  um->ToggleCattleGrazing();
2639  }
2640  CalculateTreatmentCosts(treatment, a_field);
2641  return true;
2642  }
2643  return false;
2644 }

References cattle_out_low, Calendar::DayInYear(), g_date, g_landscape_ptr, LE::GetUnsprayedMarginPolyRef(), LE::GetVegBiomass(), LE::GrazeVegetation(), l_farm_cattle_veg_reduce2, LE::SetLastTreatment(), Landscape::SupplyLEPointer(), LE::ToggleCattleGrazing(), and CfgFloat::value().

Referenced by PTTurnipGrazed::Do(), PTShrubPastures::Do(), PTCloverGrassGrazed2::Do(), PTFodderMix::Do(), PTGrassGrazed::Do(), PTYellowLupin::Do(), PTCloverGrassGrazed1::Do(), and PTPermanentGrassGrazed::Do().

◆ CattleOut() [1/2]

bool Farm::CattleOut ( LE a_field,
double  a_user,
int  a_days 
)
virtual

Start a grazing event on a_field today.

This is the main initiate grazing method and as such is called by all grazed field management plans at the moment cattle are put out.

2369 {
2373  FarmToDo treatment = cattle_out;
2374  if ((0 >= a_days) || DoIt(DO_IT_PROB))
2375  {
2376  a_field->ToggleCattleGrazing();
2377  a_field->Trace(treatment);
2378  a_field->SetLastTreatment(treatment);
2379  // Reduce the vegetation because of grazing
2380  //double h=a_field->GetVegHeight();
2381  //double reduc = 1-(l_farm_cattle_veg_reduce.value()*((h-15)/15));
2382  //a_field->ReduceVeg_Extended( reduc );
2383  a_field->GrazeVegetation(l_farm_cattle_veg_reduce.value(), false);
2384  int pref = a_field->GetUnsprayedMarginPolyRef();
2385  if (pref != -1)
2386  {
2387  // Must have an unsprayed margin so need to pass the information on to it
2388  // This happens if all arable fields are given unsprayed margins - they have no effect on grass unless it is sprayed with pesticides
2389  LE* um = g_landscape_ptr->SupplyLEPointer(pref);
2390  um->ToggleCattleGrazing();
2391  um->SetLastTreatment(treatment);
2393  }
2394  CalculateTreatmentCosts(treatment, a_field);
2395  return true;
2396  }
2397  return false;
2398 }

References cattle_out, DO_IT_PROB, g_landscape_ptr, LE::GetUnsprayedMarginPolyRef(), LE::GrazeVegetation(), l_farm_cattle_veg_reduce, LE::SetLastTreatment(), Landscape::SupplyLEPointer(), LE::ToggleCattleGrazing(), and CfgFloat::value().

Referenced by DK_GrassTussocky_Perm::Do(), PermanentGrassLowYield::Do(), DK_OGrassLowYield_Perm::Do(), OPermanentGrassGrazed::Do(), DK_GrassLowYield_Perm::Do(), PermanentGrassGrazed::Do(), OBarleyPeaCloverGrass::Do(), SpringBarleyCloverGrassStrigling::Do(), SpringBarleyCloverGrass::Do(), DK_WinterFodderGrass::Do(), SpringBarleyPeaCloverGrassStrigling::Do(), DK_WinterCloverGrassGrazedSown::Do(), DK_SpringFodderGrass::Do(), NLGrassGrazedExtensive2::Do(), NLPermanentGrassGrazedExtensive::Do(), SetAside::Do(), NLGrassGrazedExtensive1Spring::Do(), NLGrassGrazedExtensiveLast::Do(), NLGrassGrazedExtensive1::Do(), DK_OGrassGrazed_Perm::Do(), DK_GrassGrazed_Perm::Do(), DE_OPermanentGrassLowYield::Do(), DE_PermanentGrassLowYield::Do(), DE_PermanentGrassGrazed::Do(), FR_Grassland_Perm::Do(), UKPermanentGrass::Do(), DE_GreenFallow_1year::Do(), UKTempGrass::Do(), FI_GreenFallow_1year::Do(), FI_NaturalGrassland_Perm::Do(), DE_OGreenFallow_1year::Do(), NLGrassGrazed2::Do(), NLPermanentGrassGrazed::Do(), DK_CloverGrassGrazed1::Do(), FI_GreenFallow_Perm::Do(), NLGrassGrazedLast::Do(), NLGrassGrazed1Spring::Do(), FI_BufferZone::Do(), FI_BufferZone_Perm::Do(), FI_NaturalGrassland::Do(), NLGrassGrazed1::Do(), FI_GrasslandPasturePerennial2::Do(), FI_GrasslandSilagePerennial1::Do(), FI_GrasslandPasturePerennial1::Do(), FI_FeedingGround::Do(), FI_GrasslandSilagePerennial2::Do(), DK_OSpringFodderGrass::Do(), FI_GrasslandSilageAnnual::Do(), DK_OCloverGrassGrazed3::Do(), DK_OCloverGrassGrazed1::Do(), DK_OCloverGrassGrazed2::Do(), DK_OWinterFodderGrass::Do(), DK_OWinterCloverGrassGrazedSown::Do(), DK_CloverGrassGrazed3::Do(), DK_CloverGrassGrazed2::Do(), FR_Grassland::Do(), IRGrassland_no_reseed::Do(), and IRGrassland_reseed::Do().

◆ CattleOut() [2/2]

bool Farm::CattleOut ( LE a_field,
double  a_user,
int  a_days,
bool  a_should_eat 
)
virtual

Start an intensive grazing event on a_field today.

This is the main initiate grazing method and as such is called by all grazed field management plans at the moment cattle are put out.

2405 {
2409 
2410  FarmToDo treatment = cattle_out;
2411  if ((0 >= a_days) || DoIt(DO_IT_PROB))
2412  {
2413  a_field->ToggleCattleGrazing();
2414  if (a_should_eat){
2415  a_field->Trace(treatment);
2416  a_field->SetLastTreatment(treatment);
2418  int pref = a_field->GetUnsprayedMarginPolyRef();
2419  if (pref != -1)
2420  {
2421  // Must have an unsprayed margin so need to pass the information on to it
2422  //This happens if all arable fields are given unsprayed margins - they have no effect on grass unless it is sprayed with pesticides
2423  LE* um = g_landscape_ptr->SupplyLEPointer(pref);
2424  um->ToggleCattleGrazing();
2425  um->SetLastTreatment(treatment);
2427  }
2428  CalculateTreatmentCosts(treatment, a_field);
2429  }
2430  return true;
2431  }
2432  return false;
2433 }

References cattle_out, cfg_farm_cattle_reduce_height, DO_IT_PROB, g_landscape_ptr, LE::GetCattleGrazing(), LE::GetUnsprayedMarginPolyRef(), LE::GrazeVegetationHeight(), LE::SetLastTreatment(), Landscape::SupplyLEPointer(), LE::ToggleCattleGrazing(), and CfgArray_Double::value().

◆ CattleOutLowGrazing()

bool Farm::CattleOutLowGrazing ( LE a_field,
double  a_user,
int  a_days 
)
virtual

Start a extensive grazing event on a_field today.

2440 {
2441  FarmToDo treatment = cattle_out_low;
2442  if ((0 >= a_days) || DoIt(DO_IT_PROB)) {
2443  a_field->ToggleCattleGrazing();
2444  a_field->Trace(treatment);
2445  a_field->SetLastTreatment(treatment);
2446  // Reduce the vegetation because of grazing
2447  //double h=a_field->GetVegHeight();
2448  //double reduc = 1-(l_farm_cattle_veg_reduce.value()*((h-15)/15));
2449  //a_field->ReduceVeg_Extended( reduc );
2450  a_field->GrazeVegetation(l_farm_cattle_veg_reduce2.value(), false);
2451  int pref = a_field->GetUnsprayedMarginPolyRef();
2452  if (pref != -1) {
2453  // Must have an unsprayed margin so need to pass the information on to it
2454  // This happens if all arable fields are given unsprayed margins - they have no effect on grass unless it is sprayed with pesticides
2455  LE* um = g_landscape_ptr->SupplyLEPointer(pref);
2456  um->ToggleCattleGrazing();
2457  um->SetLastTreatment(treatment);
2459  }
2460  CalculateTreatmentCosts(treatment, a_field);
2461  return true;
2462  }
2463  return false;
2464 }

References cattle_out_low, DO_IT_PROB, g_landscape_ptr, LE::GetUnsprayedMarginPolyRef(), LE::GrazeVegetation(), l_farm_cattle_veg_reduce2, LE::SetLastTreatment(), Landscape::SupplyLEPointer(), LE::ToggleCattleGrazing(), and CfgFloat::value().

Referenced by PermanentGrassTussocky::Do(), OPermanentGrassGrazed::Do(), OBarleyPeaCloverGrass::Do(), PTTurnipGrazed::Do(), DE_OPermanentGrassGrazed::Do(), PTShrubPastures::Do(), PTFodderMix::Do(), PTCloverGrassGrazed2::Do(), PTGrassGrazed::Do(), PTYellowLupin::Do(), PTCloverGrassGrazed1::Do(), and PTPermanentGrassGrazed::Do().

◆ Centroids()

void Farm::Centroids ( )

Finds farm's centroids - x and y.

Calculate a farm's centroid as an average of its fields' centroids.

For now we assume the farmer location is the same as the farm centroid.

6012  {
6014 
6015  int sum_centroidx = 0;
6016  int sum_centroidy = 0;
6017  int no_fields = (int)m_fields.size();
6018  for (int i=0; i<no_fields; i++){
6019  sum_centroidx += m_fields[i]->GetCentroidX();
6020  sum_centroidy += m_fields[i]->GetCentroidY();
6021  }
6022  if (no_fields>0){
6023  m_farm_centroidx = sum_centroidx/no_fields;
6024  m_farm_centroidy = sum_centroidy/no_fields;
6025  }
6026  else{
6027  g_msg->Warn("Farm::Centroids", "Farm with no fields ("+ to_string(GetFarmNumber())+ ") is detected. Proceeding.");
6028  cout<<"Farm::Centroids: Farm with no fields ("<<GetFarmNumber() << ") is detected. Proceeding."<<endl;
6029  m_farm_centroidx = 0;
6030  m_farm_centroidy = 0;
6031  }
6032 
6036 }

References g_msg, GetFarmNumber(), m_farm_centroidx, m_farm_centroidy, m_fields, m_OurFarmer, and MapErrorMsg::Warn().

◆ CheckRotationManagementLoop()

void Farm::CheckRotationManagementLoop ( FarmEvent ev)
protected

Rotation error check function

895  {
896  if ( ev->m_field->GetMgtLoopDetectDate() == g_date->Date() ) {
897  // The last crop managment plan stopped on the same day as
898  // it was started.
899 
900  // Bump loop counter.
901  ev->m_field->SetMgtLoopDetectCount( ev->m_field->GetMgtLoopDetectCount() + 1 );
902 
903  if ( ev->m_field->GetMgtLoopDetectCount() > ( long )( m_rotation.size() + 2 ) ) {
904  // We have a loop.
905  char errornum[ 20 ];
906  sprintf( errornum, "%d", m_farmtype );
907  g_msg->Warn( WARN_BUG, "Rotation management loop detected in farmtype ", errornum );
908  exit( 1 );
909  }
910  } else {
911  ev->m_field->SetMgtLoopDetectCount( 0 );
912  }
913 }

References Calendar::Date(), g_date, g_msg, FarmEvent::m_field, MapErrorMsg::Warn(), and WARN_BUG.

◆ CutOrch()

bool Farm::CutOrch ( LE a_field,
double  a_user,
int  a_days 
)
virtual

Cut vegetation on orchard crop. //based on cut to silage - values from cutting function of orchard.

1667 {
1668  FarmToDo treatment = mow;
1669  if ((0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
1670  LE* um = SetFunctionData(a_field, 0.4, 0.2, 0, treatment);
1671  a_field->SetMownDecay(12); // 12 days of not suitable
1672  a_field->SetVegParameters(l_el_o_cut_height.value(), l_el_o_cut_total.value(), l_el_o_cut_green.value(), 0); //is 0 ok for weed biomass
1673  if (um != nullptr) {
1675  um->SetMownDecay(12); // 12 days of not suitable
1676  }
1677  return true;
1678  }
1679  return false;
1680 }

References DO_IT_PROB, g_weather, l_el_o_cut_green, l_el_o_cut_height, l_el_o_cut_total, mow, Weather::Raining(), LE::SetMownDecay(), LE::SetVegParameters(), and CfgFloat::value().

Referenced by OrchardCrop::Do(), BEOrchardCrop::Do(), NLOrchardCrop::Do(), DK_OBushFruit_Perm2::Do(), DK_OOrchCherry::Do(), DK_OOrchPear::Do(), DK_OOrchApple::Do(), DK_OOrchardCrop_Perm::Do(), PTVineyards::Do(), DK_BushFruit_Perm2::Do(), DK_OrchCherry::Do(), DK_OrchPear::Do(), DK_OrchOther::Do(), DK_OrchardCrop_Perm::Do(), DK_OrchApple::Do(), and ITOOrchard::Do().

◆ CutToHay()

bool Farm::CutToHay ( LE a_field,
double  a_user,
int  a_days 
)
virtual

◆ CutToSilage()

bool Farm::CutToSilage ( LE a_field,
double  a_user,
int  a_days 
)
virtual

Cut vegetation for silage on a_field.

1645 {
1646  FarmToDo treatment = cut_to_silage;
1647  if ( (0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
1648  LE* um = SetFunctionData(a_field, 0.4, 0.2, 0, treatment);
1649  a_field->SetVegHeight( 10 );
1650  a_field->SetGrowthPhase(harvest1);
1651  a_field->ResetDigestibility();
1652  if (um != nullptr) {
1653  um->SetVegHeight(10);
1654  um->SetGrowthPhase(harvest1);
1655  um->ResetDigestibility();
1656  }
1657  return true;
1658  }
1659  return false;
1660 }

References cut_to_silage, DO_IT_PROB, g_weather, harvest1, Weather::Raining(), LE::ResetDigestibility(), LE::SetGrowthPhase(), and LE::SetVegHeight().

Referenced by OSBarleySilage::Do(), OBarleyPeaCloverGrass::Do(), PLFodderLucerne2::Do(), DK_WinterFodderGrass::Do(), NLGrassGrazedExtensive2::Do(), DK_SpringFodderGrass::Do(), NLPermanentGrassGrazedExtensive::Do(), DK_WinterCloverGrassGrazedSown::Do(), SetAside::Do(), NLGrassGrazedExtensive1Spring::Do(), NLGrassGrazedExtensiveLast::Do(), NLGrassGrazedExtensive1::Do(), DE_OPermanentGrassLowYield::Do(), DE_PermanentGrassLowYield::Do(), DE_PermanentGrassGrazed::Do(), PLFodderLucerne1::Do(), UKPermanentGrass::Do(), FR_Grassland_Perm::Do(), FI_GreenFallow_1year::Do(), UKTempGrass::Do(), DE_GreenFallow_1year::Do(), DE_OGreenFallow_1year::Do(), DE_OPermanentGrassGrazed::Do(), FI_NaturalGrassland_Perm::Do(), DK_CloverGrassGrazed1::Do(), NLGrassGrazed2::Do(), NLPermanentGrassGrazed::Do(), NLGrassGrazed1Spring::Do(), NLGrassGrazedLast::Do(), FI_GreenFallow_Perm::Do(), DE_OGrasslandSilageAnnual::Do(), FI_BufferZone::Do(), FI_BufferZone_Perm::Do(), PTMaize_Hort::Do(), PTMaize::Do(), ITGrassland::Do(), PTFodderMix::Do(), FI_NaturalGrassland::Do(), NLGrassGrazed1::Do(), FI_GrasslandPasturePerennial1::Do(), FI_GrasslandSilagePerennial1::Do(), FI_GrasslandSilagePerennial2::Do(), DK_OSpringFodderGrass::Do(), DK_OCloverGrassGrazed3::Do(), DK_OCloverGrassGrazed1::Do(), DK_OCloverGrassGrazed2::Do(), DK_OWinterFodderGrass::Do(), DK_CloverGrassGrazed3::Do(), DK_OWinterCloverGrassGrazedSown::Do(), DK_CloverGrassGrazed2::Do(), DE_GrasslandSilageAnnual::Do(), FR_Grassland::Do(), IRGrassland_no_reseed::Do(), and IRGrassland_reseed::Do().

◆ CutWeeds()

bool Farm::CutWeeds ( LE a_field,
double  a_user,
int  a_days 
)
virtual

◆ DeepPlough()

◆ DoIt()

bool Farm::DoIt ( double  a_probability)

Return chance out of 0 to 100.

856  {
857  return (g_rand_uni_fnc() < (a_probability/100.0));
858 }

References g_rand_uni_fnc().

Referenced by OrchardCrop::Do(), PermanentGrassTussocky::Do(), WinterRapeStrigling::Do(), DK_GrassTussocky_Perm::Do(), NorwegianSpringBarley::Do(), NorwegianOats::Do(), OSeedGrass1::Do(), BroadBeans::Do(), OSeedGrass2::Do(), PermanentGrassLowYield::Do(), OSBarleySilage::Do(), DK_OGrassLowYield_Perm::Do(), OFieldPeas::Do(), OFieldPeasSilage::Do(), OPermanentGrassGrazed::Do(), SeedGrass1::Do(), OCarrots::Do(), DK_GrassLowYield_Perm::Do(), PermanentGrassGrazed::Do(), OBarleyPeaCloverGrass::Do(), OMaizeSilage::Do(), OWinterBarleyExt::Do(), SeedGrass2::Do(), OWinterBarley::Do(), OWinterRye::Do(), DK_OSpringBarleyCloverGrass::Do(), DE_OMaizeSilage::Do(), DE_OOats::Do(), DK_OptimalFlowerMix3::Do(), OOats::Do(), DE_OSpringRye::Do(), DE_OWinterWheat::Do(), DK_OSpringBarley_CC::Do(), Maize::Do(), MaizeSilage::Do(), MaizeStrigling::Do(), DE_OMaize::Do(), OTriticale::Do(), Oats::Do(), OSpringBarleyExt::Do(), DK_OSpringBarley::Do(), SpringBarleySeed::Do(), OSpringBarley::Do(), SpringBarleyCloverGrassStrigling::Do(), FieldPeas::Do(), FieldPeasSilage::Do(), FieldPeasStrigling::Do(), DummyCropPestTesting::Do(), OPotatoes::Do(), DE_OWinterRape::Do(), OWinterWheat::Do(), OWinterWheatUndersownExt::Do(), OWinterWheatUndersown::Do(), SpringBarleyCloverGrass::Do(), OFodderBeet::Do(), OWinterRape::Do(), PLFodderLucerne2::Do(), Triticale::Do(), Carrots::Do(), DE_OSugarBeet::Do(), SpringBarleyPeaCloverGrassStrigling::Do(), DE_OPotatoes::Do(), SetAside::Do(), PotatoesIndustry::Do(), SugarBeet::Do(), Potatoes::Do(), FodderBeet::Do(), DKOBroadBeans_test::Do(), NorwegianPotatoes::Do(), SpringBarleySKManagement::Do(), PLCarrots::Do(), PTSetAside::Do(), SpringBarleySilage::Do(), WinterRyeStrigling::Do(), SpringBarleySpr::Do(), SpringBarleyStriglingCulm::Do(), DE_PermanentGrassLowYield::Do(), SpringBarleyPTreatment::Do(), DE_OPermanentGrassLowYield::Do(), WinterRye::Do(), SpringBarleyStriglingSingle::Do(), SpringBarleyStrigling::Do(), PLSpringBarleySpr::Do(), FI_OCaraway2::Do(), SpringBarley::Do(), PLFodderLucerne1::Do(), DE_GreenFallow_1year::Do(), FI_GreenFallow_1year::Do(), FI_NaturalGrassland_Perm::Do(), FI_Caraway2::Do(), SpringRape::Do(), DE_OGreenFallow_1year::Do(), PLBeetSpr::Do(), PLBeans::Do(), WinterWheatStrigling::Do(), WinterWheatStriglingCulm::Do(), WinterWheatStriglingSingle::Do(), FI_GreenFallow_Perm::Do(), DE_OGrasslandSilageAnnual::Do(), FI_BufferZone::Do(), FI_BufferZone_Perm::Do(), FI_NaturalGrassland::Do(), FI_OSpringBarley_Malt::Do(), DK_SetAside::Do(), DK_OSetAside_PerennialFlower::Do(), DK_OSetAside_SummerMow::Do(), WinterBarleyStrigling::Do(), WinterRape::Do(), DK_OSetAside::Do(), FI_OCaraway1::Do(), FI_OFabaBean::Do(), FR_SpringBarley::Do(), FI_OSpringRape::Do(), FI_OSpringWheat::Do(), FI_OTurnipRape::Do(), OSpringBarleyPigs::Do(), FI_OSpringOats::Do(), DK_SetAside_SummerMow::Do(), FI_GrasslandPasturePerennial1::Do(), FI_GrasslandPasturePerennial2::Do(), FI_GrasslandSilagePerennial1::Do(), FR_SpringOats::Do(), FI_OSpringBarley_Fodder::Do(), WinterBarley::Do(), PLWinterRye::Do(), FI_FeedingGround::Do(), FI_GrasslandSilagePerennial2::Do(), FI_TurnipRape::Do(), FR_Sorghum::Do(), DK_OSpringFodderGrass::Do(), FI_GrasslandSilageAnnual::Do(), DK_OCloverGrassGrazed3::Do(), FR_Maize_Silage::Do(), FR_Maize::Do(), DK_OCloverGrassGrazed1::Do(), DK_OCloverGrassGrazed2::Do(), PLMaizeSilage::Do(), PLSpringBarley::Do(), PLMaize::Do(), FI_FabaBean::Do(), FI_OWinterRye::Do(), FR_WinterTriticale::Do(), FI_SpringRape::Do(), FI_Caraway1::Do(), PLWinterTriticale::Do(), FR_Sunflower::Do(), FI_SpringBarley_Malt::Do(), SE_SpringBarley::Do(), DE_OWinterRye::Do(), FI_OWinterWheat::Do(), DE_OTriticale::Do(), DE_WinterRye::Do(), DK_OWinterFodderGrass::Do(), PLBeet::Do(), FI_SprSpringBarley_Fodder::Do(), DE_OWinterBarley::Do(), FI_SpringWheat::Do(), DK_OWinterCloverGrassGrazedSown::Do(), PLWinterBarley::Do(), FI_SpringOats::Do(), PLWinterWheatLate::Do(), PLSpringWheat::Do(), SE_WinterRape_Seed::Do(), FI_SpringBarley_Fodder::Do(), PLPotatoes::Do(), SE_WinterWheat::Do(), FR_SpringWheat::Do(), DE_WinterBarley::Do(), PLWinterRape::Do(), DE_GrasslandSilageAnnual::Do(), FI_WinterWheat::Do(), FR_WinterBarley::Do(), FR_Grassland::Do(), DE_Triticale::Do(), DE_WinterWheat::Do(), FI_WinterRye::Do(), DE_WinterWheatLate::Do(), FR_WinterWheat::Do(), FR_Potatoes::Do(), FR_WinterRape::Do(), DE_WinterRape::Do(), WinterWheat::Do(), DE_SugarBeet::Do(), DE_Potatoes::Do(), DE_PotatoesIndustry::Do(), DK_OChristmasTrees_Perm::Do(), DK_ChristmasTrees_Perm::Do(), WinterRape::HerbiZero(), SpringRape::RowcolOne(), and WinterRape::RowcolOne().

◆ DoIt_prob()

bool Farm::DoIt_prob ( double  a_probability)

Return chance out of 0 to 1.

864  {
865  return (g_rand_uni_fnc() < a_probability);
866 }

References g_rand_uni_fnc().

Referenced by UKMaize::Do(), BECatchPeaCrop::Do(), DK_OLegume::Do(), DE_OPeas::Do(), DK_OCatchCrop::Do(), DK_CerealLegume::Do(), DK_CerealLegume_Whole::Do(), DK_Legume_Peas::Do(), DK_SpringBarley_Green::Do(), FI_OPotato_North::Do(), FI_OPotato_South::Do(), FI_OPotatoIndustry_North::Do(), FI_OPotatoIndustry_South::Do(), FI_OStarchPotato_North::Do(), FI_OStarchPotato_South::Do(), DK_OLegume_Peas_CC::Do(), DE_OLegume::Do(), DK_SpringBarleySilage::Do(), DK_OLegume_Beans::Do(), DK_OLegume_Beans_CC::Do(), DK_OLegume_Peas::Do(), DK_OLentils::Do(), BEOrchardCrop::Do(), DK_CatchCrop::Do(), DK_MaizeSilage::Do(), DK_FodderBeet::Do(), DK_OLupines::Do(), NLOrchardCrop::Do(), DK_OSpringBarleyCloverGrass::Do(), DK_OWinterRye::Do(), DK_Legume_Beans::Do(), DK_SpringOats::Do(), DK_SpringOats_CC::Do(), DK_SugarBeet::Do(), FI_SugarBeet::Do(), DE_OMaizeSilage::Do(), DK_OWinterRye_CC::Do(), DE_OWinterWheat::Do(), DK_OCerealLegume_Whole::Do(), DK_OLegume_Whole_CC::Do(), DK_OLegume_Whole::Do(), DK_OLegumeCloverGrass_Whole::Do(), DE_OMaize::Do(), DK_OptimalFlowerMix1::Do(), DK_OSpringBarley_CC::Do(), UKBeans::Do(), DK_Maize::Do(), DK_SpringWheat::Do(), NLMaizeSpring::Do(), DK_OWinterBarley::Do(), DK_Legume_Whole::Do(), DK_OCerealLegume::Do(), DK_OSpringBarley::Do(), DK_OSugarBeet::Do(), DK_OFodderBeet::Do(), FI_Potato_North::Do(), FI_StarchPotato_North::Do(), FI_PotatoIndustry_North::Do(), UKBeet::Do(), BEMaize::Do(), FI_Potato_South::Do(), FI_PotatoIndustry_South::Do(), FI_StarchPotato_South::Do(), DK_OSpringOats::Do(), DK_OSpringWheat::Do(), DK_SpringBarleyCloverGrass::Do(), DE_OSugarBeet::Do(), DE_OCabbages::Do(), NLBeetSpring::Do(), NLMaize::Do(), DK_OVegSeeds::Do(), UKSpringBarley::Do(), UKWinterBarley::Do(), DK_WinterFodderGrass::Do(), DE_OBushFruitPerm::Do(), DK_OSpringOats_CC::Do(), DK_OWinterRape::Do(), DE_OPotatoes::Do(), DK_SpringBarley::Do(), DK_SpringBarley_CC::Do(), DK_OMaize::Do(), DK_OMaizeSilage::Do(), NLCarrotsSpring::Do(), DK_OCabbages::Do(), DK_SpringFodderGrass::Do(), DK_WinterCloverGrassGrazedSown::Do(), DK_OEnergyCrop_Perm::Do(), NLBeet::Do(), NLGrassGrazedExtensive2::Do(), NLPermanentGrassGrazedExtensive::Do(), DK_OSpringBarleySilage::Do(), DK_OCarrots::Do(), NLCarrots::Do(), NLGrassGrazedExtensive1Spring::Do(), NLGrassGrazedExtensiveLast::Do(), DK_WinterBarley::Do(), NLCabbageSpring::Do(), BEWinterBarley::Do(), BEWinterBarleyCC::Do(), NLSpringBarleySpring::Do(), BEWinterWheat::Do(), DK_VegSeeds::Do(), BEWinterWheatCC::Do(), DK_EnergyCrop_Perm::Do(), NLGrassGrazedExtensive1::Do(), DK_WinterRye::Do(), DK_WinterRye_CC::Do(), NLCabbage::Do(), DK_Carrots_Spring::Do(), UKWinterWheat::Do(), DK_OGrassGrazed_Perm::Do(), PTSetAside::Do(), DK_Carrots::Do(), UKWinterRape::Do(), DK_GrassGrazed_Perm::Do(), TestCrop::Do(), NLSpringBarley::Do(), DK_Cabbages::Do(), DK_OMixedVeg::Do(), NLWinterWheat::Do(), DK_WinterWheat::Do(), DK_WinterWheat_CC::Do(), DE_PermanentGrassGrazed::Do(), DK_OPotato::Do(), PTCabbage_Hort::Do(), DK_OPotatoIndustry::Do(), DK_OPotatoSeed::Do(), DK_Potato::Do(), UKPermanentGrass::Do(), FR_Grassland_Perm::Do(), UKPotatoes::Do(), UKTempGrass::Do(), PTOliveGroveTraditional::Do(), DK_OBushFruit_Perm2::Do(), PTOats::Do(), DK_OSeedGrassRye_Spring::Do(), DE_HerbsPerennial_after1year::Do(), DE_OPermanentGrassGrazed::Do(), DE_HerbsPerennial_1year::Do(), DK_MixedVeg::Do(), DE_OHerbsPerennial_after1year::Do(), DK_CloverGrassGrazed1::Do(), NLPermanentGrassGrazed::Do(), NLGrassGrazed2::Do(), NLGrassGrazed1Spring::Do(), DE_OHerbsPerennial_1year::Do(), NLGrassGrazedLast::Do(), PTWinterWheat::Do(), FI_BufferZone::Do(), FI_BufferZone_Perm::Do(), DE_OGrasslandSilageAnnual::Do(), PTWinterRye::Do(), PTMaize_Hort::Do(), PTWinterBarley::Do(), PTFodderMix::Do(), DK_SetAside::Do(), DK_WinterRape::Do(), FI_NaturalGrassland::Do(), PTTriticale::Do(), ITGrassland::Do(), PTCloverGrassGrazed2::Do(), DK_PotatoSeed::Do(), DK_OSetAside_AnnualFlower::Do(), BEPotatoesSpring::Do(), DK_OSetAside_PerennialFlower::Do(), PTGrassGrazed::Do(), PTYellowLupin::Do(), NLGrassGrazed1::Do(), DE_Maize::Do(), DE_BushFruitPerm::Do(), DK_PotatoIndustry::Do(), DK_SetAside_SummerMow::Do(), DE_MaizeSilage::Do(), DE_OAsparagusEstablishedPlantation::Do(), FR_SpringBarley::Do(), NLPotatoesSpring::Do(), FR_SpringOats::Do(), FI_GrasslandSilagePerennial2::Do(), DE_SpringBarley::Do(), DK_OOrchCherry::Do(), DK_OSpringFodderGrass::Do(), DK_OBushFruit_Perm1::Do(), FI_GrasslandSilageAnnual::Do(), FR_Sorghum::Do(), BEPotatoes::Do(), DK_OWinterWheat_CC::Do(), FR_Maize_Silage::Do(), DK_OCloverGrassGrazed3::Do(), DE_AsparagusEstablishedPlantation::Do(), FR_Maize::Do(), DK_OWinterWheat::Do(), DK_OCloverGrassGrazed2::Do(), NLPotatoes::Do(), DK_OCloverGrassGrazed1::Do(), FR_WinterTriticale::Do(), FI_SpringRape::Do(), NLTulips::Do(), DE_Peas::Do(), DE_Legumes::Do(), FR_Sunflower::Do(), PTCloverGrassGrazed1::Do(), FI_Caraway1::Do(), DE_OWinterRye::Do(), DE_OTriticale::Do(), FI_OWinterWheat::Do(), DE_WinterRye::Do(), DK_OOrchPear::Do(), DK_OWinterFodderGrass::Do(), DE_OWinterBarley::Do(), DK_CloverGrassGrazed3::Do(), DK_OOrchOther::Do(), PLWinterWheat::Do(), DK_OOrchApple::Do(), DK_OOrchardCrop_Perm::Do(), DK_OWinterCloverGrassGrazedSown::Do(), DE_Carrots::Do(), DK_CloverGrassGrazed2::Do(), PLWinterWheatLate::Do(), DK_BushFruit_Perm1::Do(), PTPermanentGrassGrazed::Do(), PLPotatoes::Do(), SE_WinterRape_Seed::Do(), FI_SpringBarley_Fodder::Do(), DE_Oats::Do(), SE_WinterWheat::Do(), DE_Cabbage::Do(), FR_SpringWheat::Do(), DE_WinterBarley::Do(), DE_SpringRye::Do(), DK_SeedGrassRye_Spring::Do(), PLWinterRape::Do(), FR_WinterBarley::Do(), FI_WinterWheat::Do(), DK_BushFruit_Perm2::Do(), IRSpringOats::Do(), IRWinterBarley::Do(), FR_Grassland::Do(), IRWinterOats::Do(), IRSpringBarley::Do(), IRSpringWheat::Do(), DE_Triticale::Do(), DE_WinterWheat::Do(), DE_WinterWheatLate::Do(), FR_WinterWheat::Do(), IRWinterWheat::Do(), FR_Potatoes::Do(), FR_WinterRape::Do(), DE_WinterRape::Do(), DE_Orchard::Do(), DK_SeedGrassFescue_Spring::Do(), DE_SugarBeet::Do(), DK_OrchCherry::Do(), IRGrassland_no_reseed::Do(), DE_Potatoes::Do(), DK_OrchPear::Do(), DK_OrchOther::Do(), DK_OrchApple::Do(), DK_OrchardCrop_Perm::Do(), DE_PotatoesIndustry::Do(), DE_OOrchard::Do(), IRGrassland_reseed::Do(), ITOrchard::Do(), DK_OChristmasTrees_Perm::Do(), ITOOrchard::Do(), and DK_ChristmasTrees_Perm::Do().

◆ FA_AmmoniumSulphate()

bool Farm::FA_AmmoniumSulphate ( LE a_field,
double  a_user,
int  a_days 
)
virtual

Apply ammonium sulphate to a_field owned by an stock farmer.

1082 {
1083  FarmToDo treatment = fa_ammoniumsulphate;
1084  if ((0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
1085  SetFunctionData(a_field, 1.0, 1.0, EL_TRAMLINE_DECAYTIME, treatment);
1086  return true;
1087  }
1088  return false;
1089 }

References DO_IT_PROB, EL_TRAMLINE_DECAYTIME, fa_ammoniumsulphate, g_weather, and Weather::Raining().

Referenced by UKMaize::Do(), DK_SpringOats::Do(), DK_SpringOats_CC::Do(), DK_SpringWheat::Do(), NLMaizeSpring::Do(), UKBeet::Do(), NLBeetSpring::Do(), NLMaize::Do(), UKSpringBarley::Do(), UKWinterBarley::Do(), NLCarrotsSpring::Do(), DK_OWinterRape::Do(), NLBeet::Do(), NLCarrots::Do(), NLCabbageSpring::Do(), NLSpringBarleySpring::Do(), DK_WinterBarley::Do(), NLCabbage::Do(), UKWinterWheat::Do(), WinterRyeStrigling::Do(), PLCarrots::Do(), UKWinterRape::Do(), WinterRye::Do(), NLSpringBarley::Do(), NLWinterWheat::Do(), PLSpringBarleySpr::Do(), DK_WinterWheat::Do(), DK_WinterWheat_CC::Do(), UKPotatoes::Do(), PLBeetSpr::Do(), PLBeans::Do(), DK_WinterRape::Do(), DE_Maize::Do(), DE_MaizeSilage::Do(), NLPotatoesSpring::Do(), DE_SpringBarley::Do(), PLWinterRye::Do(), PLSpringBarley::Do(), NLPotatoes::Do(), PLMaize::Do(), PLMaizeSilage::Do(), NLTulips::Do(), PLWinterTriticale::Do(), DE_WinterRye::Do(), PLBeet::Do(), PLWinterBarley::Do(), PLWinterWheat::Do(), DE_Carrots::Do(), PLWinterWheatLate::Do(), PLSpringWheat::Do(), PLPotatoes::Do(), DE_Oats::Do(), DE_Cabbage::Do(), DE_WinterBarley::Do(), DK_SeedGrassRye_Spring::Do(), DE_SpringRye::Do(), PLWinterRape::Do(), IRSpringOats::Do(), IRWinterOats::Do(), IRWinterBarley::Do(), IRSpringBarley::Do(), DE_Triticale::Do(), DE_WinterWheat::Do(), DE_WinterWheatLate::Do(), IRSpringWheat::Do(), IRWinterWheat::Do(), DE_WinterRape::Do(), DE_Orchard::Do(), DK_SeedGrassFescue_Spring::Do(), DE_SugarBeet::Do(), DE_Potatoes::Do(), and DE_PotatoesIndustry::Do().

◆ FA_Boron()

bool Farm::FA_Boron ( LE a_field,
double  a_user,
int  a_days 
)
virtual

◆ FA_Calcium()

◆ FA_Cu()

bool Farm::FA_Cu ( LE a_field,
double  a_user,
int  a_days 
)
virtual

Apply Cu fertilizer, on a_field owned by stock farmer (orchard)

1989 {
1990  FarmToDo treatment = fa_cu;
1991  if ((0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
1992  SetFunctionData(a_field, 1.0, 1.0, 0, treatment);
1993  return true;
1994  }
1995  return false;
1996 }

References DO_IT_PROB, fa_cu, g_weather, and Weather::Raining().

Referenced by DK_OOrchApple::Do(), DK_OOrchardCrop_Perm::Do(), DK_OOrchOther::Do(), DK_OrchApple::Do(), DK_OrchardCrop_Perm::Do(), and DK_OrchOther::Do().

◆ FA_GreenManure()

bool Farm::FA_GreenManure ( LE a_field,
double  a_user,
int  a_days 
)
virtual

Spread green manure on a_field owned by an stock farmer.

1126 {
1127  FarmToDo treatment = fa_greenmanure;
1128  if ((0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
1129  SetFunctionData(a_field, 1.0, 1.0, EL_TRAMLINE_DECAYTIME, treatment);
1130  return true;
1131  }
1132  return false;
1133 }

References DO_IT_PROB, EL_TRAMLINE_DECAYTIME, fa_greenmanure, g_weather, and Weather::Raining().

◆ FA_K()

bool Farm::FA_K ( LE a_field,
double  a_user,
int  a_days 
)
virtual

Apply K fertilizer, on a_field owned by stock farmer.

1039 {
1040  FarmToDo treatment = fa_k;
1041  if ((0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
1042  SetFunctionData(a_field, 1.0, 1.0, EL_TRAMLINE_DECAYTIME, treatment);
1043  return true;
1044  }
1045  return false;
1046 }

References DO_IT_PROB, EL_TRAMLINE_DECAYTIME, fa_k, g_weather, and Weather::Raining().

Referenced by DE_WinterWheatLate::Do(), and DE_WinterRape::Do().

◆ FA_ManganeseSulphate()

◆ FA_Manure()

bool Farm::FA_Manure ( LE a_field,
double  a_user,
int  a_days 
)
virtual

Spread manure on a_field owned by an stock farmer.

1111 {
1112  FarmToDo treatment = fa_manure;
1113  if ((0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
1114  SetFunctionData(a_field, 1.0, 1.0, EL_TRAMLINE_DECAYTIME, treatment);
1115  return true;
1116  }
1117  return false;
1118 }

References DO_IT_PROB, EL_TRAMLINE_DECAYTIME, fa_manure, g_weather, and Weather::Raining().

Referenced by WinterRapeStrigling::Do(), OSBarleySilage::Do(), NLCatchCropPea::Do(), OBarleyPeaCloverGrass::Do(), OMaizeSilage::Do(), OWinterBarleyExt::Do(), OWinterBarley::Do(), OWinterRye::Do(), DE_OSpringRye::Do(), DE_OOats::Do(), DE_OMaizeSilage::Do(), OOats::Do(), DE_OWinterWheat::Do(), OTriticale::Do(), DE_OMaize::Do(), Maize::Do(), DK_OCerealLegume_Whole::Do(), MaizeStrigling::Do(), MaizeSilage::Do(), OSpringBarleyExt::Do(), Oats::Do(), DK_Legume_Whole::Do(), DK_OSugarBeet::Do(), DK_OCerealLegume::Do(), OSpringBarley::Do(), SpringBarleyCloverGrassStrigling::Do(), FieldPeas::Do(), FieldPeasSilage::Do(), FieldPeasStrigling::Do(), DK_OFodderBeet::Do(), OPotatoes::Do(), DE_OWinterRape::Do(), OWinterWheat::Do(), OWinterWheatUndersown::Do(), OWinterWheatUndersownExt::Do(), SpringBarleyCloverGrass::Do(), OFodderBeet::Do(), OWinterRape::Do(), Triticale::Do(), DE_OSugarBeet::Do(), DE_OPotatoes::Do(), SpringBarleyPeaCloverGrassStrigling::Do(), DE_OCarrots::Do(), DK_OCarrots::Do(), FodderBeet::Do(), SpringBarleySKManagement::Do(), WinterRyeStrigling::Do(), SpringBarleySilage::Do(), DK_OGrassGrazed_Perm::Do(), SpringBarleyStriglingCulm::Do(), DK_GrassGrazed_Perm::Do(), SpringBarleyStrigling::Do(), SpringBarleyStriglingSingle::Do(), WinterRye::Do(), SpringBarleyPTreatment::Do(), DK_OMixedVeg::Do(), DE_PermanentGrassGrazed::Do(), PTCabbage::Do(), PTCabbage_Hort::Do(), SpringBarley::Do(), PTHorticulture::Do(), PTPotatoes::Do(), SpringRape::Do(), DK_OBushFruit_Perm2::Do(), WinterWheatStriglingSingle::Do(), WinterWheatStrigling::Do(), WinterWheatStriglingCulm::Do(), WinterRape::Do(), WinterBarleyStrigling::Do(), DE_OAsparagusEstablishedPlantation::Do(), WinterBarley::Do(), DK_OOrchCherry::Do(), DK_OSpringFodderGrass::Do(), DE_AsparagusEstablishedPlantation::Do(), DK_OCloverGrassGrazed3::Do(), DK_OCloverGrassGrazed1::Do(), DK_OCloverGrassGrazed2::Do(), NLTulips::Do(), DK_OOrchPear::Do(), DK_OWinterFodderGrass::Do(), DE_OTriticale::Do(), DE_OWinterRye::Do(), DK_OOrchApple::Do(), DK_OOrchardCrop_Perm::Do(), DE_OWinterBarley::Do(), DK_OOrchOther::Do(), DK_OWinterCloverGrassGrazedSown::Do(), DE_Triticale::Do(), DE_Orchard::Do(), WinterWheat::Do(), DK_OrchCherry::Do(), DK_OrchPear::Do(), DK_OrchardCrop_Perm::Do(), DK_OrchOther::Do(), DK_OrchApple::Do(), DE_OOrchard::Do(), DK_OChristmasTrees_Perm::Do(), and DK_ChristmasTrees_Perm::Do().

◆ FA_N()

bool Farm::FA_N ( LE a_field,
double  a_user,
int  a_days 
)
virtual

Apply N fertilizer, on a_field owned by a stock farmer.

714 {
715  if ((0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
716  SetFunctionData(a_field, 1.0, 1.0, EL_TRAMLINE_DECAYTIME, fa_n);
717  return true;
718  }
719  return false;
720 }

References DO_IT_PROB, EL_TRAMLINE_DECAYTIME, fa_n, g_weather, and Weather::Raining().

Referenced by DE_HerbsPerennial_after1year::Do(), DE_HerbsPerennial_1year::Do(), DE_OHerbsPerennial_after1year::Do(), DE_OHerbsPerennial_1year::Do(), DE_OAsparagusEstablishedPlantation::Do(), DE_AsparagusEstablishedPlantation::Do(), and DK_BushFruit_Perm1::Do().

◆ FA_NK()

bool Farm::FA_NK ( LE a_field,
double  a_user,
int  a_days 
)
virtual

Apply NK fertilizer, on a_field owned by an stock farmer.

780 {
781 
782  if ((0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
783  SetFunctionData(a_field, 1.0, 1.0, EL_TRAMLINE_DECAYTIME, fa_nk);
784  return true;
785  }
786  return false;
787 }

References DO_IT_PROB, EL_TRAMLINE_DECAYTIME, fa_nk, g_weather, and Weather::Raining().

Referenced by DK_OBushFruit_Perm1::Do().

◆ FA_NPK()

bool Farm::FA_NPK ( LE a_field,
double  a_user,
int  a_days 
)
virtual

Apply NPK fertilizer to a_field owned by an stock farmer.

983 {
984  FarmToDo treatment = fa_npk;
985  if ((0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
986  SetFunctionData(a_field, 1.0, 1.0, EL_TRAMLINE_DECAYTIME, treatment);
987  return true;
988  }
989  return false;
990 }

References DO_IT_PROB, EL_TRAMLINE_DECAYTIME, fa_npk, g_weather, and Weather::Raining().

Referenced by OMaizeSilage::Do(), PermanentGrassGrazed::Do(), Maize::Do(), OTriticale::Do(), MaizeSilage::Do(), MaizeStrigling::Do(), SpringBarleyCloverGrassStrigling::Do(), OFodderBeet::Do(), SpringBarleyCloverGrass::Do(), Triticale::Do(), UKBeet::Do(), Carrots::Do(), NLBeetSpring::Do(), DE_OBushFruitPerm::Do(), DK_WinterFodderGrass::Do(), UKSpringBarley::Do(), SpringBarleyPeaCloverGrassStrigling::Do(), NLCarrotsSpring::Do(), NLPermanentGrassGrazedExtensive::Do(), NLGrassGrazedExtensive2::Do(), DK_SpringFodderGrass::Do(), NLBeet::Do(), DK_WinterCloverGrassGrazedSown::Do(), NLGrassGrazedExtensiveLast::Do(), NLCarrots::Do(), NLGrassGrazedExtensive1Spring::Do(), NLSpringBarleySpring::Do(), PotatoesIndustry::Do(), DK_WinterBarley::Do(), NLCabbageSpring::Do(), SugarBeet::Do(), FodderBeet::Do(), NorwegianPotatoes::Do(), Potatoes::Do(), DK_WinterRye_CC::Do(), NLCabbage::Do(), SpringBarleySKManagement::Do(), DK_Carrots_Spring::Do(), NLGrassGrazedExtensive1::Do(), DK_WinterRye::Do(), PLCarrots::Do(), SpringBarleySilage::Do(), SpringBarleySpr::Do(), DK_Carrots::Do(), NLSpringBarley::Do(), SpringBarleyStriglingSingle::Do(), SpringBarleyPTreatment::Do(), SpringBarleyStrigling::Do(), UKWinterRape::Do(), SpringBarleyStriglingCulm::Do(), PLSpringBarleySpr::Do(), PTBeans::Do(), DK_OPotato::Do(), DK_WinterWheat::Do(), DK_WinterWheat_CC::Do(), DK_OPotatoSeed::Do(), DK_OPotatoIndustry::Do(), PTCabbage::Do(), PTCabbage_Hort::Do(), PTOtherDryBeans::Do(), SpringBarley::Do(), PLFodderLucerne1::Do(), PTHorticulture::Do(), DK_Potato::Do(), UKPermanentGrass::Do(), UKPotatoes::Do(), UKTempGrass::Do(), PTPotatoes::Do(), DK_OSeedGrassRye_Spring::Do(), PTOats::Do(), NLPermanentGrassGrazed::Do(), NLGrassGrazed2::Do(), WinterWheatStriglingCulm::Do(), NLGrassGrazedLast::Do(), FI_GreenFallow_Perm::Do(), NLGrassGrazed1Spring::Do(), WinterWheatStriglingSingle::Do(), WinterWheatStrigling::Do(), PTWinterWheat::Do(), FI_BufferZone::Do(), FI_BufferZone_Perm::Do(), PTMaize::Do(), PTWinterBarley::Do(), PTWinterRye::Do(), PTMaize_Hort::Do(), FI_NaturalGrassland::Do(), PTFodderMix::Do(), PTCloverGrassGrazed2::Do(), PTTriticale::Do(), ITGrassland::Do(), PTGrassGrazed::Do(), PTSorghum::Do(), PTYellowLupin::Do(), WinterBarleyStrigling::Do(), DK_PotatoSeed::Do(), DE_BushFruitPerm::Do(), NLGrassGrazed1::Do(), FI_GrasslandPasturePerennial2::Do(), DK_PotatoIndustry::Do(), WinterBarley::Do(), PTRyegrass::Do(), NLPotatoesSpring::Do(), FI_GrasslandSilagePerennial2::Do(), DK_OBushFruit_Perm1::Do(), NLPotatoes::Do(), PLSpringBarley::Do(), PTCloverGrassGrazed1::Do(), DE_Carrots::Do(), PTPermanentGrassGrazed::Do(), DK_BushFruit_Perm1::Do(), DE_Cabbage::Do(), DE_Oats::Do(), DE_SpringRye::Do(), DE_GrasslandSilageAnnual::Do(), DK_BushFruit_Perm2::Do(), IRSpringOats::Do(), IRSpringBarley::Do(), IRSpringWheat::Do(), DE_WinterRape::Do(), DE_Orchard::Do(), DK_SeedGrassFescue_Spring::Do(), WinterWheat::Do(), IRGrassland_no_reseed::Do(), DE_OOrchard::Do(), IRGrassland_reseed::Do(), ITOrchard::Do(), DK_OChristmasTrees_Perm::Do(), ITOOrchard::Do(), and DK_ChristmasTrees_Perm::Do().

◆ FA_NPKS()

bool Farm::FA_NPKS ( LE a_field,
double  a_user,
int  a_days 
)
virtual

◆ FA_P()

bool Farm::FA_P ( LE a_field,
double  a_user,
int  a_days 
)
virtual

Apply P fertilizer, on a_field owned by stock farmer.

1025 {
1026  FarmToDo treatment = fa_p;
1027  if ((0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
1028  SetFunctionData(a_field, 1.0, 1.0, EL_TRAMLINE_DECAYTIME, treatment);
1029  return true;
1030  }
1031  return false;
1032 }

References DO_IT_PROB, EL_TRAMLINE_DECAYTIME, fa_p, g_weather, and Weather::Raining().

Referenced by DE_WinterWheatLate::Do().

◆ FA_PK()

◆ FA_PKS()

bool Farm::FA_PKS ( LE a_field,
double  a_user,
int  a_days 
)
virtual

Apply PKS fertilizer to a_field owned by an stock farmer.

997 {
998  FarmToDo treatment = fa_pks;
999  if ((0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
1000  SetFunctionData(a_field, 1.0, 1.0, EL_TRAMLINE_DECAYTIME, treatment);
1001  return true;
1002  }
1003  return false;
1004 }

References DO_IT_PROB, EL_TRAMLINE_DECAYTIME, fa_pks, g_weather, and Weather::Raining().

Referenced by DE_OPeas::Do(), and DE_OLegume::Do().

◆ FA_RSM()

bool Farm::FA_RSM ( LE a_field,
double  a_user,
int  a_days 
)
virtual

RSM (ammonium nitrate solution) applied on a_field owned by a stock farmer.

1155 {
1156  FarmToDo treatment = fa_rsm;
1157  if ((0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
1158  SetFunctionData(a_field, 1.0, 1.0, EL_TRAMLINE_DECAYTIME, treatment);
1159  return true;
1160  }
1161  return false;
1162 }

References DO_IT_PROB, EL_TRAMLINE_DECAYTIME, fa_rsm, g_weather, and Weather::Raining().

Referenced by PLSpringBarleySpr::Do(), PLWinterRye::Do(), PLMaize::Do(), PLMaizeSilage::Do(), PLSpringBarley::Do(), PLWinterTriticale::Do(), PLWinterWheat::Do(), PLWinterBarley::Do(), PLSpringWheat::Do(), PLWinterWheatLate::Do(), and PLWinterRape::Do().

◆ FA_SK()

bool Farm::FA_SK ( LE a_field,
double  a_user,
int  a_days 
)
virtual

◆ FA_Sludge()

bool Farm::FA_Sludge ( LE a_field,
double  a_user,
int  a_days 
)
virtual

Spread sewege sludge on a_field owned by an stock farmer.

1141 {
1142  FarmToDo treatment = fa_sludge;
1143  if ((0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
1144  SetFunctionData(a_field, 1.0, 1.0, EL_TRAMLINE_DECAYTIME, treatment);
1145  return true;
1146  }
1147  return false;
1148 }

References DO_IT_PROB, EL_TRAMLINE_DECAYTIME, fa_sludge, g_weather, and Weather::Raining().

Referenced by WinterRyeStrigling::Do(), and WinterRye::Do().

◆ FA_Slurry()

bool Farm::FA_Slurry ( LE a_field,
double  a_user,
int  a_days 
)
virtual

Spready slurry on a_field owned by an stock farmer.

1068 {
1069  FarmToDo treatment = fa_slurry;
1070  if ((0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
1071  SetFunctionData(a_field, 1.0, 1.0, EL_TRAMLINE_DECAYTIME, treatment);
1072  return true;
1073  }
1074  return false;
1075 }

References DO_IT_PROB, EL_TRAMLINE_DECAYTIME, fa_slurry, g_weather, and Weather::Raining().

Referenced by UKMaize::Do(), OSBarleySilage::Do(), NLCatchCropPea::Do(), OPermanentGrassGrazed::Do(), OCarrots::Do(), DK_CerealLegume::Do(), DK_CerealLegume_Whole::Do(), OBarleyPeaCloverGrass::Do(), OMaizeSilage::Do(), DK_SpringBarley_Green::Do(), OWinterBarleyExt::Do(), DK_SpringBarleySilage::Do(), OWinterBarley::Do(), DK_OSpringBarleyCloverGrass::Do(), DK_MaizeSilage::Do(), OWinterRye::Do(), DK_OWinterRye::Do(), DE_OMaizeSilage::Do(), DK_SpringOats::Do(), DK_SpringOats_CC::Do(), OOats::Do(), DK_OSpringBarley_CC::Do(), DK_OWinterRye_CC::Do(), Maize::Do(), MaizeSilage::Do(), DE_OMaize::Do(), MaizeStrigling::Do(), DE_OWinterWheat::Do(), OTriticale::Do(), DK_OWinterBarley::Do(), DK_Maize::Do(), Oats::Do(), DK_SpringWheat::Do(), OSpringBarleyExt::Do(), DK_OSpringBarley::Do(), OSpringBarley::Do(), SpringBarleyCloverGrassStrigling::Do(), OPotatoes::Do(), OWinterWheat::Do(), OWinterWheatUndersown::Do(), OWinterWheatUndersownExt::Do(), SpringBarleyCloverGrass::Do(), OFodderBeet::Do(), DK_OSpringOats::Do(), DK_OSpringWheat::Do(), Triticale::Do(), OWinterRape::Do(), Carrots::Do(), DK_SpringBarleyCloverGrass::Do(), NLMaize::Do(), DE_OCabbages::Do(), DK_OSpringOats_CC::Do(), UKSpringBarley::Do(), UKWinterBarley::Do(), DK_WinterFodderGrass::Do(), SpringBarleyPeaCloverGrassStrigling::Do(), DK_OWinterRape::Do(), DE_OPotatoes::Do(), DK_SpringBarley::Do(), DK_SpringBarley_CC::Do(), DK_OMaize::Do(), DK_OMaizeSilage::Do(), DK_OSpringBarleySilage::Do(), NLGrassGrazedExtensive2::Do(), NLPermanentGrassGrazedExtensive::Do(), DK_SpringFodderGrass::Do(), DK_OEnergyCrop_Perm::Do(), DK_WinterCloverGrassGrazedSown::Do(), NLGrassGrazedExtensive1Spring::Do(), NLGrassGrazedExtensiveLast::Do(), PotatoesIndustry::Do(), SugarBeet::Do(), DK_WinterBarley::Do(), Potatoes::Do(), FodderBeet::Do(), NorwegianPotatoes::Do(), DK_EnergyCrop_Perm::Do(), SpringBarleySKManagement::Do(), NLCabbage::Do(), NLGrassGrazedExtensive1::Do(), DK_WinterRye::Do(), DK_WinterRye_CC::Do(), SpringBarleySilage::Do(), UKWinterWheat::Do(), WinterRyeStrigling::Do(), WinterRye::Do(), SpringBarleyStrigling::Do(), SpringBarleyStriglingSingle::Do(), UKWinterRape::Do(), SpringBarleyPTreatment::Do(), SpringBarleyStriglingCulm::Do(), NLSpringBarley::Do(), NLWinterWheat::Do(), DK_OMixedVeg::Do(), DE_PermanentGrassGrazed::Do(), SpringBarley::Do(), DK_WinterWheat::Do(), DK_WinterWheat_CC::Do(), PLFodderLucerne1::Do(), UKPermanentGrass::Do(), UKPotatoes::Do(), UKTempGrass::Do(), PTOats::Do(), DK_OBushFruit_Perm2::Do(), NLGrassGrazed2::Do(), NLPermanentGrassGrazed::Do(), WinterWheatStriglingSingle::Do(), WinterWheatStrigling::Do(), NLGrassGrazed1Spring::Do(), NLGrassGrazedLast::Do(), WinterWheatStriglingCulm::Do(), FI_GreenFallow_Perm::Do(), PLBeans::Do(), DE_OGrasslandSilageAnnual::Do(), FI_BufferZone_Perm::Do(), PTWinterBarley::Do(), PTWinterRye::Do(), PTWinterWheat::Do(), FI_BufferZone::Do(), FI_NaturalGrassland::Do(), PTTriticale::Do(), DK_WinterRape::Do(), PTYellowLupin::Do(), WinterBarleyStrigling::Do(), FI_OCaraway1::Do(), NLGrassGrazed1::Do(), DE_Maize::Do(), FI_GrasslandPasturePerennial1::Do(), FI_GrasslandSilagePerennial1::Do(), DE_MaizeSilage::Do(), PTRyegrass::Do(), WinterBarley::Do(), FI_OSpringBarley_Fodder::Do(), PLWinterRye::Do(), FI_GrasslandSilagePerennial2::Do(), DK_OOrchCherry::Do(), FI_GrasslandSilageAnnual::Do(), DK_OWinterWheat_CC::Do(), PLMaize::Do(), PLSpringBarley::Do(), NLPotatoes::Do(), PLMaizeSilage::Do(), DK_OWinterWheat::Do(), FI_Caraway1::Do(), FR_Sunflower::Do(), PTCloverGrassGrazed1::Do(), SE_SpringBarley::Do(), PLWinterTriticale::Do(), DE_OTriticale::Do(), DE_OWinterRye::Do(), PLWinterBarley::Do(), FI_SprSpringBarley_Fodder::Do(), PLBeet::Do(), DE_OWinterBarley::Do(), PLWinterWheat::Do(), PLWinterWheatLate::Do(), PLSpringWheat::Do(), PTPermanentGrassGrazed::Do(), FI_SpringBarley_Fodder::Do(), PLPotatoes::Do(), DE_Cabbage::Do(), DE_Oats::Do(), DE_SpringRye::Do(), PLWinterRape::Do(), DE_GrasslandSilageAnnual::Do(), IRWinterOats::Do(), IRWinterBarley::Do(), IRSpringOats::Do(), IRSpringBarley::Do(), IRSpringWheat::Do(), IRWinterWheat::Do(), WinterWheat::Do(), DE_SugarBeet::Do(), DK_OrchCherry::Do(), IRGrassland_no_reseed::Do(), DE_Potatoes::Do(), DE_PotatoesIndustry::Do(), and IRGrassland_reseed::Do().

◆ FarmActions()

void Farm::FarmActions ( void  )
virtual

FarmActions() will use the global date to manage all queued field events.

Starts the main management loop for the farm and performs some error checking.

The main crop management events are done in HandleEvents by the crop management method within CropManagement. This calls all the fields and actions any events on the queue. Subsequently there are some checks for runaway or stuck management codes The FarmerBehaviour section allows for implementation of Farmer behaviour - it implements the Step code of the animals populations approach to allow for complex behaviours to be added.

768  {
773  HandleEvents();
774  for ( unsigned int i = 0; i < m_fields.size(); i++ ) {
775  // Check for infinite loop in management plan.
776  int count = m_fields[ i ]->GetVegStore();
777  if ( count >= 0 )
778  m_fields[ i ]->SetVegStore( ++count );
779  if ( count > 800 ) {
780  // More than two years where nothing happened.
781  // Raise 'Merry Christmas'!
782  char error_num[ 20 ];
783  sprintf( error_num, "%d", m_fields[ i ]->GetVegType() );
784  g_msg->Warn( WARN_BUG, "I the Farm Manager caught infinite loop in tov type:", error_num );
785  sprintf( error_num, "%d", m_fields[ i ]->m_tried_to_do );
786  g_msg->Warn( WARN_BUG, "It was last seen trying to perform action # ""(or thereabouts):", error_num );
787  exit( 1 );
788  }
789  }
790 }

References count, g_msg, MapErrorMsg::Warn(), and WARN_BUG.

◆ FarmerActions()

bool Farm::FarmerActions ( void  )

The starting point for farmer behaviour not part of crop management e.g. decision making.

Call farmer behaviour each day.

This is called each day and call the farmer Step method to exhibit behaviour. This is a simplified form of the animal behaviour but could be expanded by adding BeginStep and EndStep. When a farmer is done for the day GetStepDone returns true.

795  {
801  m_OurFarmer->Step();
802  return m_OurFarmer->GetStepDone();
803 }

◆ FiberCovering()

bool Farm::FiberCovering ( LE a_field,
double  a_user,
int  a_days 
)
virtual

Fiber covering applied on a_field.

1767 {
1768  FarmToDo treatment = fiber_covering;
1769  if ((0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
1770  SetFunctionData(a_field, 1.0, 1.0, 0, treatment);
1771  return true;
1772  }
1773  return false;
1774 }

References DO_IT_PROB, fiber_covering, g_weather, and Weather::Raining().

Referenced by DK_MixedVeg::Do(), and DK_BushFruit_Perm1::Do().

◆ FiberRemoval()

bool Farm::FiberRemoval ( LE a_field,
double  a_user,
int  a_days 
)
virtual

Fiber covering removed from a_field.

1781 {
1782  FarmToDo treatment = fiber_removal;
1783  if ((0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
1784  SetFunctionData(a_field, 1.0, 1.0, 0, treatment);
1785  return true;
1786  }
1787  return false;
1788 }

References DO_IT_PROB, fiber_removal, g_weather, and Weather::Raining().

Referenced by DK_MixedVeg::Do(), and DK_BushFruit_Perm1::Do().

◆ FlowerCutting()

bool Farm::FlowerCutting ( LE a_field,
double  a_user,
int  a_days 
)
virtual

Flower cutting applied on a_field.

1689 {
1690  FarmToDo treatment = flower_cutting;
1691  if ((0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
1692  LE* um = SetFunctionData(a_field, 0.5, 0.8, EL_TRAMLINE_DECAYTIME, treatment);
1693  a_field->SetVegHeight(35);
1694  if (um != nullptr) {
1695  um->SetVegHeight(35);
1696  }
1697  return true;
1698  }
1699  return false;
1700 }

References DO_IT_PROB, EL_TRAMLINE_DECAYTIME, flower_cutting, g_weather, Weather::Raining(), and LE::SetVegHeight().

Referenced by NLTulips::Do().

◆ FP_AmmoniumSulphate()

bool Farm::FP_AmmoniumSulphate ( LE a_field,
double  a_user,
int  a_days 
)
virtual

Apply Ammonium Sulphate to a_field owned by an arable farmer.

883 {
884  FarmToDo treatment = fp_ammoniumsulphate;
885  if ((0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
886  SetFunctionData(a_field, 1.0, 1.0, EL_TRAMLINE_DECAYTIME, treatment);
887  return true;
888  }
889  return false;
890 }

References DO_IT_PROB, EL_TRAMLINE_DECAYTIME, fp_ammoniumsulphate, g_weather, and Weather::Raining().

Referenced by UKMaize::Do(), DK_SpringOats::Do(), DK_SpringOats_CC::Do(), DK_SpringWheat::Do(), NLMaizeSpring::Do(), UKBeet::Do(), NLBeetSpring::Do(), NLMaize::Do(), UKSpringBarley::Do(), UKWinterBarley::Do(), DK_OWinterRape::Do(), NLCarrotsSpring::Do(), NLBeet::Do(), NLCarrots::Do(), NLCabbageSpring::Do(), DK_WinterBarley::Do(), NLSpringBarleySpring::Do(), NLCabbage::Do(), UKWinterWheat::Do(), PLCarrots::Do(), UKWinterRape::Do(), NLSpringBarley::Do(), PLSpringBarleySpr::Do(), NLWinterWheat::Do(), DK_WinterWheat::Do(), DK_WinterWheat_CC::Do(), UKPotatoes::Do(), PLBeetSpr::Do(), PLBeans::Do(), DK_WinterRape::Do(), DE_Maize::Do(), DE_MaizeSilage::Do(), NLPotatoesSpring::Do(), PLWinterRye::Do(), DE_SpringBarley::Do(), NLPotatoes::Do(), PLMaize::Do(), PLMaizeSilage::Do(), PLSpringBarley::Do(), FR_WinterTriticale::Do(), NLTulips::Do(), PLWinterTriticale::Do(), DE_WinterRye::Do(), PLWinterBarley::Do(), PLWinterWheat::Do(), PLBeet::Do(), PLSpringWheat::Do(), PLWinterWheatLate::Do(), DE_Carrots::Do(), PLPotatoes::Do(), FR_SpringWheat::Do(), DE_Cabbage::Do(), DE_Oats::Do(), DE_WinterBarley::Do(), DK_SeedGrassRye_Spring::Do(), DE_SpringRye::Do(), PLWinterRape::Do(), FI_WinterWheat::Do(), FR_WinterBarley::Do(), IRWinterOats::Do(), IRSpringOats::Do(), IRSpringBarley::Do(), IRWinterBarley::Do(), IRSpringWheat::Do(), DE_WinterWheatLate::Do(), DE_Triticale::Do(), DE_WinterWheat::Do(), FI_WinterRye::Do(), FR_WinterWheat::Do(), IRWinterWheat::Do(), FR_Potatoes::Do(), FR_WinterRape::Do(), DE_WinterRape::Do(), DE_Orchard::Do(), DK_SeedGrassFescue_Spring::Do(), DE_SugarBeet::Do(), DE_Potatoes::Do(), and DE_PotatoesIndustry::Do().

◆ FP_Boron()

bool Farm::FP_Boron ( LE a_field,
double  a_user,
int  a_days 
)
virtual

◆ FP_Calcium()

◆ FP_Cu()

bool Farm::FP_Cu ( LE a_field,
double  a_user,
int  a_days 
)
virtual

Apply Cu fertilizer, on a_field owned by plant farmer (orchard)

1975 {
1976  FarmToDo treatment = fp_cu;
1977  if ((0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
1978  SetFunctionData(a_field, 1.0, 1.0, 0, treatment);
1979  return true;
1980  }
1981  return false;
1982 }

References DO_IT_PROB, fp_cu, g_weather, and Weather::Raining().

Referenced by DK_OOrchApple::Do(), DK_OOrchardCrop_Perm::Do(), DK_OOrchOther::Do(), DK_OrchApple::Do(), DK_OrchardCrop_Perm::Do(), and DK_OrchOther::Do().

◆ FP_GreenManure()

bool Farm::FP_GreenManure ( LE a_field,
double  a_user,
int  a_days 
)
virtual

Spread green manure on a_field owned by an arable farmer.

912 {
913  FarmToDo treatment = fp_greenmanure;
914  if ((0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
915  SetFunctionData(a_field, 1.0, 1.0, EL_TRAMLINE_DECAYTIME, treatment);
916  return true;
917  }
918  return false;
919 }

References DO_IT_PROB, EL_TRAMLINE_DECAYTIME, fp_greenmanure, g_weather, and Weather::Raining().

◆ FP_K()

bool Farm::FP_K ( LE a_field,
double  a_user,
int  a_days 
)
virtual

Apply K fertilizer, on a_field owned by an arable farmer.

727 {
728  if ((0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
729  SetFunctionData(a_field, 1.0, 1.0, EL_TRAMLINE_DECAYTIME, fp_k);
730  return true;
731  }
732  return false;
733 }

References DO_IT_PROB, EL_TRAMLINE_DECAYTIME, fp_k, g_weather, and Weather::Raining().

Referenced by DE_WinterWheatLate::Do(), and DE_WinterRape::Do().

◆ FP_LiquidNH3()

bool Farm::FP_LiquidNH3 ( LE a_field,
double  a_user,
int  a_days 
)
virtual

Apply liquid ammonia fertilizer to a_field owned by an arable farmer.

809 {
810  FarmToDo treatment = fp_liquidNH3;
811  if ( (0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
812  SetFunctionData(a_field, 1.0, 1.0, EL_TRAMLINE_DECAYTIME, treatment);
813  return true;
814  }
815  return false;
816 }

References DO_IT_PROB, EL_TRAMLINE_DECAYTIME, fp_liquidNH3, g_weather, and Weather::Raining().

Referenced by SpringBarleySeed::Do(), SpringBarleySKManagement::Do(), SpringBarleySilage::Do(), SpringBarleySpr::Do(), SpringBarleyPTreatment::Do(), SpringBarleyStriglingSingle::Do(), SpringBarleyStriglingCulm::Do(), SpringBarleyStrigling::Do(), and SpringBarley::Do().

◆ FP_ManganeseSulphate()

bool Farm::FP_ManganeseSulphate ( LE a_field,
double  a_user,
int  a_days 
)
virtual

◆ FP_Manure()

bool Farm::FP_Manure ( LE a_field,
double  a_user,
int  a_days 
)
virtual

Spread manure on a_field owned by an arable farmer.

897 {
898  FarmToDo treatment = fp_manure;
899  if ((0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
900  SetFunctionData(a_field, 1.0, 1.0, EL_TRAMLINE_DECAYTIME, treatment);
901  return true;
902  }
903  return false;
904 }

References DO_IT_PROB, EL_TRAMLINE_DECAYTIME, fp_manure, g_weather, and Weather::Raining().

Referenced by NLCatchCropPea::Do(), OWinterBarleyExt::Do(), OWinterBarley::Do(), OWinterRye::Do(), DE_OMaizeSilage::Do(), DE_OMaize::Do(), DK_OCerealLegume_Whole::Do(), DE_OWinterWheat::Do(), OSpringBarleyExt::Do(), DK_Legume_Whole::Do(), DK_OSugarBeet::Do(), DK_OCerealLegume::Do(), OSpringBarley::Do(), FieldPeas::Do(), FieldPeasSilage::Do(), FieldPeasStrigling::Do(), DK_OFodderBeet::Do(), OPotatoes::Do(), DE_OWinterRape::Do(), OWinterWheat::Do(), OWinterWheatUndersown::Do(), OWinterWheatUndersownExt::Do(), OWinterRape::Do(), DE_OSugarBeet::Do(), DE_OPotatoes::Do(), DE_OCarrots::Do(), DK_OCarrots::Do(), DK_OGrassGrazed_Perm::Do(), DK_Cabbages::Do(), DK_GrassGrazed_Perm::Do(), DK_OMixedVeg::Do(), PTCabbage::Do(), PTCabbage_Hort::Do(), DE_PermanentGrassGrazed::Do(), PTHorticulture::Do(), PTPotatoes::Do(), DK_OBushFruit_Perm2::Do(), FR_SpringBarley::Do(), DE_OAsparagusEstablishedPlantation::Do(), FR_SpringOats::Do(), DK_OOrchCherry::Do(), DK_OSpringFodderGrass::Do(), DE_AsparagusEstablishedPlantation::Do(), FR_Maize::Do(), FR_Maize_Silage::Do(), DK_OCloverGrassGrazed3::Do(), DK_OCloverGrassGrazed1::Do(), DK_OCloverGrassGrazed2::Do(), NLTulips::Do(), SE_SpringBarley::Do(), FR_Sunflower::Do(), DE_OWinterRye::Do(), DK_OOrchPear::Do(), DE_OTriticale::Do(), DK_OWinterFodderGrass::Do(), DK_OWinterCloverGrassGrazedSown::Do(), DK_OOrchardCrop_Perm::Do(), DK_OOrchOther::Do(), DE_OWinterBarley::Do(), DK_OOrchApple::Do(), FR_SpringWheat::Do(), DE_Triticale::Do(), FR_Potatoes::Do(), DE_Orchard::Do(), DK_OrchCherry::Do(), DK_OrchPear::Do(), DK_OrchOther::Do(), DK_OrchApple::Do(), DK_OrchardCrop_Perm::Do(), DE_OOrchard::Do(), DK_OChristmasTrees_Perm::Do(), and DK_ChristmasTrees_Perm::Do().

◆ FP_N()

bool Farm::FP_N ( LE a_field,
double  a_user,
int  a_days 
)
virtual

◆ FP_NC()

bool Farm::FP_NC ( LE a_field,
double  a_user,
int  a_days 
)
virtual

Apply NC fertilizer, on a_field owned by an arable farmer.

754 {
755  if ((0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
756  SetFunctionData(a_field, 1.0, 1.0, EL_TRAMLINE_DECAYTIME, fp_nc);
757  return true;
758  }
759  return false;
760 }

References DO_IT_PROB, EL_TRAMLINE_DECAYTIME, fp_nc, g_weather, and Weather::Raining().

Referenced by FR_SpringWheat::Do(), and SE_WinterWheat::Do().

◆ FP_NK()

bool Farm::FP_NK ( LE a_field,
double  a_user,
int  a_days 
)
virtual

Apply NK fertilizer, on a_field owned by an arable farmer.

767 {
768  if ((0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
769  SetFunctionData(a_field, 1.0, 1.0, EL_TRAMLINE_DECAYTIME, fp_nk);
770  return true;
771  }
772  return false;
773 }

References DO_IT_PROB, EL_TRAMLINE_DECAYTIME, fp_nk, g_weather, and Weather::Raining().

Referenced by FI_OCaraway2::Do(), FI_Caraway2::Do(), and DK_OBushFruit_Perm1::Do().

◆ FP_NPK()

bool Farm::FP_NPK ( LE a_field,
double  a_user,
int  a_days 
)
virtual

Apply NPK fertilizer, on a_field owned by an arable farmer.

646 {
647  FarmToDo treatment = fp_npk;
648  if ( (0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
649  SetFunctionData(a_field, 1.0, 1.0, EL_TRAMLINE_DECAYTIME, treatment);
650  return true;
651  }
652  return false;
653 }

References DO_IT_PROB, EL_TRAMLINE_DECAYTIME, fp_npk, g_weather, and Weather::Raining().

Referenced by OSeedGrass1::Do(), OSeedGrass2::Do(), SeedGrass1::Do(), PermanentGrassGrazed::Do(), SeedGrass2::Do(), FI_SugarBeet::Do(), SpringBarleySeed::Do(), UKBeet::Do(), Carrots::Do(), NLBeetSpring::Do(), DK_WinterFodderGrass::Do(), UKSpringBarley::Do(), DE_OBushFruitPerm::Do(), NLCarrotsSpring::Do(), DK_SpringFodderGrass::Do(), DK_WinterCloverGrassGrazedSown::Do(), NLGrassGrazedExtensive2::Do(), NLPermanentGrassGrazedExtensive::Do(), DK_OEnergyCrop_Perm::Do(), NLBeet::Do(), NLCarrots::Do(), NLGrassGrazedExtensive1Spring::Do(), NLGrassGrazedExtensiveLast::Do(), NLCabbageSpring::Do(), DK_WinterBarley::Do(), NLSpringBarleySpring::Do(), PotatoesIndustry::Do(), NorwegianPotatoes::Do(), Potatoes::Do(), PTOliveGroveIntensive::Do(), DK_EnergyCrop_Perm::Do(), NLGrassGrazedExtensive1::Do(), DK_Carrots_Spring::Do(), DK_WinterRye::Do(), DK_WinterRye_CC::Do(), NLCabbage::Do(), SpringBarleySKManagement::Do(), WinterRyeStrigling::Do(), PLCarrots::Do(), SpringBarleySilage::Do(), DK_Carrots::Do(), SpringBarleySpr::Do(), SpringBarleyStriglingSingle::Do(), UKWinterRape::Do(), WinterRye::Do(), SpringBarleyStriglingCulm::Do(), NLSpringBarley::Do(), SpringBarleyPTreatment::Do(), SpringBarleyStrigling::Do(), PLSpringBarleySpr::Do(), PTBeans::Do(), PTOliveGroveSuperIntensive::Do(), DK_WinterWheat::Do(), DK_WinterWheat_CC::Do(), DK_OPotato::Do(), FI_OCaraway2::Do(), PTCabbage::Do(), PTCabbage_Hort::Do(), DK_OPotatoIndustry::Do(), DK_OPotatoSeed::Do(), PTOtherDryBeans::Do(), SpringBarley::Do(), PLFodderLucerne1::Do(), PTHorticulture::Do(), UKPermanentGrass::Do(), UKPotatoes::Do(), DK_Potato::Do(), UKTempGrass::Do(), PTOliveGroveTraditional::Do(), PTPotatoes::Do(), FI_Caraway2::Do(), PTOats::Do(), DK_OSeedGrassRye_Spring::Do(), NLGrassGrazed2::Do(), NLPermanentGrassGrazed::Do(), NLGrassGrazed1Spring::Do(), WinterWheatStriglingCulm::Do(), NLGrassGrazedLast::Do(), WinterWheatStrigling::Do(), WinterWheatStriglingSingle::Do(), PTMaize::Do(), PTMaize_Hort::Do(), PTWinterRye::Do(), PTWinterWheat::Do(), PTWinterBarley::Do(), PTFodderMix::Do(), PTCloverGrassGrazed2::Do(), PTTriticale::Do(), ITGrassland::Do(), DK_PotatoSeed::Do(), PTYellowLupin::Do(), BEPotatoesSpring::Do(), PTGrassGrazed::Do(), PTSorghum::Do(), WinterBarleyStrigling::Do(), NLGrassGrazed1::Do(), FI_OCaraway1::Do(), DE_BushFruitPerm::Do(), DK_PotatoIndustry::Do(), WinterBarley::Do(), NLPotatoesSpring::Do(), PTRyegrass::Do(), DK_OOrchCherry::Do(), DK_OBushFruit_Perm1::Do(), FI_GrasslandSilageAnnual::Do(), FR_Sorghum::Do(), FR_Maize_Silage::Do(), FR_Maize::Do(), NLPotatoes::Do(), PLSpringBarley::Do(), FI_Caraway1::Do(), PTCloverGrassGrazed1::Do(), SE_SpringBarley::Do(), DE_Carrots::Do(), DK_BushFruit_Perm1::Do(), SE_WinterRape_Seed::Do(), PTPermanentGrassGrazed::Do(), DE_Oats::Do(), DE_Cabbage::Do(), FR_SpringWheat::Do(), DE_SpringRye::Do(), PTVineyards::Do(), DE_GrasslandSilageAnnual::Do(), DK_BushFruit_Perm2::Do(), FR_WinterBarley::Do(), IRSpringBarley::Do(), IRSpringOats::Do(), FR_Grassland::Do(), FR_WinterWheat::Do(), IRSpringWheat::Do(), DE_WinterRape::Do(), DE_Orchard::Do(), DK_SeedGrassFescue_Spring::Do(), WinterWheat::Do(), DK_OrchCherry::Do(), IRGrassland_no_reseed::Do(), DE_OOrchard::Do(), IRGrassland_reseed::Do(), ITOrchard::Do(), DK_OChristmasTrees_Perm::Do(), ITOOrchard::Do(), and DK_ChristmasTrees_Perm::Do().

◆ FP_NPKS()

bool Farm::FP_NPKS ( LE a_field,
double  a_user,
int  a_days 
)
virtual

Apply NPKS fertilizer, on a_field owned by an arable farmer.

631 {
632  FarmToDo treatment = fp_npks;
633  if ( (0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
634  SetFunctionData(a_field, 1.0, 1.0, EL_TRAMLINE_DECAYTIME, treatment);
635  return true;
636  }
637  return false;
638 }

References DO_IT_PROB, EL_TRAMLINE_DECAYTIME, fp_npks, g_weather, and Weather::Raining().

Referenced by WinterRapeStrigling::Do(), DK_CerealLegume_Whole::Do(), DK_CerealLegume::Do(), FI_OPotato_South::Do(), FI_OPotatoIndustry_North::Do(), FI_OPotatoIndustry_South::Do(), FI_OStarchPotato_North::Do(), FI_OStarchPotato_South::Do(), DK_SpringBarley_Green::Do(), FI_OPotato_North::Do(), DK_SpringBarleySilage::Do(), FI_SugarBeet::Do(), FI_Potato_North::Do(), FI_StarchPotato_North::Do(), FI_PotatoIndustry_North::Do(), FI_PotatoIndustry_South::Do(), FI_Potato_South::Do(), FI_StarchPotato_South::Do(), DK_SpringBarleyCloverGrass::Do(), DK_OVegSeeds::Do(), DK_SpringBarley::Do(), DK_SpringBarley_CC::Do(), DK_VegSeeds::Do(), SpringRape::Do(), DK_MixedVeg::Do(), FI_OSpringBarley_Malt::Do(), WinterRape::Do(), FI_OFabaBean::Do(), FR_SpringBarley::Do(), FI_OSpringOats::Do(), FI_OSpringRape::Do(), FI_OSpringWheat::Do(), FI_GrasslandPasturePerennial1::Do(), FI_GrasslandSilagePerennial1::Do(), FI_OTurnipRape::Do(), FR_SpringOats::Do(), FI_OSpringBarley_Fodder::Do(), PLWinterRye::Do(), FI_TurnipRape::Do(), FR_Maize_Silage::Do(), FI_FabaBean::Do(), PLSpringBarley::Do(), FI_SpringRape::Do(), FI_OWinterRye::Do(), FI_SpringBarley_Malt::Do(), PLWinterTriticale::Do(), FI_OWinterWheat::Do(), FI_SprSpringBarley_Fodder::Do(), PLWinterWheat::Do(), FI_SpringWheat::Do(), PLWinterBarley::Do(), PLWinterWheatLate::Do(), PLSpringWheat::Do(), FI_SpringOats::Do(), FI_SpringBarley_Fodder::Do(), PLPotatoes::Do(), PLWinterRape::Do(), FI_WinterWheat::Do(), FI_WinterRye::Do(), IRGrassland_no_reseed::Do(), IRGrassland_reseed::Do(), ITOrchard::Do(), and ITOOrchard::Do().

◆ FP_NS()

bool Farm::FP_NS ( LE a_field,
double  a_user,
int  a_days 
)
virtual

Apply NS fertilizer, on a_field owned by an arable farmer.

741 {
742  if ((0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
743  SetFunctionData(a_field, 1.0, 1.0, EL_TRAMLINE_DECAYTIME, fp_ns);
744  return true;
745  }
746  return false;
747 }

References DO_IT_PROB, EL_TRAMLINE_DECAYTIME, fp_ns, g_weather, and Weather::Raining().

Referenced by SE_SpringBarley::Do(), SE_WinterRape_Seed::Do(), and SE_WinterWheat::Do().

◆ FP_P()

bool Farm::FP_P ( LE a_field,
double  a_user,
int  a_days 
)
virtual

Apply P fertilizer, on a_field owned by an arable farmer.

688 {
689  if ((0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
690  SetFunctionData(a_field, 1.0, 1.0, EL_TRAMLINE_DECAYTIME, fp_p);
691  return true;
692  }
693  return false;
694 }

References DO_IT_PROB, EL_TRAMLINE_DECAYTIME, fp_p, g_weather, and Weather::Raining().

Referenced by FR_Sunflower::Do(), DE_WinterWheatLate::Do(), and FR_WinterRape::Do().

◆ FP_PK()

bool Farm::FP_PK ( LE a_field,
double  a_user,
int  a_days 
)
virtual

Apply PK fertilizer, on a_field owned by an arable farmer.

674 {
675  FarmToDo treatment = fp_pk;
676  if ( (0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
677  SetFunctionData(a_field, 1.0, 1.0, EL_TRAMLINE_DECAYTIME, treatment);
678  return true;
679  }
680  return false;
681 }

References DO_IT_PROB, EL_TRAMLINE_DECAYTIME, fp_pk, g_weather, and Weather::Raining().

Referenced by UKBeans::Do(), SpringBarleySeed::Do(), PLFodderLucerne2::Do(), DK_WinterRye_CC::Do(), DK_WinterRye::Do(), SpringBarleySKManagement::Do(), SpringBarleySilage::Do(), PLCarrots::Do(), SpringBarleySpr::Do(), SpringBarleyStriglingSingle::Do(), SpringBarleyPTreatment::Do(), SpringBarleyStrigling::Do(), SpringBarleyStriglingCulm::Do(), NLWinterWheat::Do(), SpringBarley::Do(), PLFodderLucerne1::Do(), DE_HerbsPerennial_after1year::Do(), DE_HerbsPerennial_1year::Do(), DE_OHerbsPerennial_after1year::Do(), PLBeetSpr::Do(), PLBeans::Do(), DE_OHerbsPerennial_1year::Do(), DE_OAsparagusEstablishedPlantation::Do(), PLWinterRye::Do(), DE_SpringBarley::Do(), DE_AsparagusEstablishedPlantation::Do(), PLMaize::Do(), PLMaizeSilage::Do(), NLTulips::Do(), PLWinterTriticale::Do(), DE_WinterRye::Do(), PLWinterBarley::Do(), PLBeet::Do(), PLWinterWheat::Do(), PLSpringWheat::Do(), PLWinterWheatLate::Do(), DK_BushFruit_Perm1::Do(), PLPotatoes::Do(), DE_WinterBarley::Do(), DE_GrasslandSilageAnnual::Do(), DK_BushFruit_Perm2::Do(), IRWinterOats::Do(), IRWinterBarley::Do(), FR_WinterWheat::Do(), DE_Triticale::Do(), DE_WinterWheat::Do(), IRWinterWheat::Do(), FR_Potatoes::Do(), DE_Orchard::Do(), DE_SugarBeet::Do(), DE_Potatoes::Do(), and DE_PotatoesIndustry::Do().

◆ FP_PKS()

bool Farm::FP_PKS ( LE a_field,
double  a_user,
int  a_days 
)
virtual

Apply PKS fertilizer to a_field owned by an arable farmer.

660 {
661  FarmToDo treatment = fp_pks;
662  if ((0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
663  SetFunctionData(a_field, 1.0, 1.0, EL_TRAMLINE_DECAYTIME, treatment);
664  return true;
665  }
666  return false;
667 }

References DO_IT_PROB, EL_TRAMLINE_DECAYTIME, fp_pks, g_weather, and Weather::Raining().

Referenced by DE_OPeas::Do(), and DE_OLegume::Do().

◆ FP_RSM()

bool Farm::FP_RSM ( LE a_field,
double  a_user,
int  a_days 
)
virtual

RSM (ammonium nitrate solution) applied on a_field owned by an arable farmer.

941 {
942  FarmToDo treatment = fp_rsm;
943  if ((0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
944  SetFunctionData(a_field, 1.0, 1.0, EL_TRAMLINE_DECAYTIME, treatment);
945  return true;
946  }
947  return false;
948 }

References DO_IT_PROB, EL_TRAMLINE_DECAYTIME, fp_rsm, g_weather, and Weather::Raining().

Referenced by PLSpringBarleySpr::Do(), PLWinterRye::Do(), PLMaize::Do(), PLMaizeSilage::Do(), PLSpringBarley::Do(), PLWinterTriticale::Do(), PLWinterWheat::Do(), PLWinterBarley::Do(), PLSpringWheat::Do(), PLWinterWheatLate::Do(), and PLWinterRape::Do().

◆ FP_SK()

bool Farm::FP_SK ( LE a_field,
double  a_user,
int  a_days 
)
virtual

◆ FP_Sludge()

bool Farm::FP_Sludge ( LE a_field,
double  a_user,
int  a_days 
)
virtual

Spread sewege on a_field owned by an arable farmer.

927 {
928  FarmToDo treatment = fp_sludge;
929  if ((0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
930  SetFunctionData(a_field, 1.0, 1.0, EL_TRAMLINE_DECAYTIME, treatment);
931  return true;
932  }
933  return false;
934 }

References DO_IT_PROB, EL_TRAMLINE_DECAYTIME, fp_sludge, g_weather, and Weather::Raining().

Referenced by WinterBarleyStrigling::Do(), and WinterBarley::Do().

◆ FP_Slurry()

bool Farm::FP_Slurry ( LE a_field,
double  a_user,
int  a_days 
)
virtual

Apply slurry to a_field owned by an arable farmer.

824 {
825  FarmToDo treatment = fp_slurry;
826  if ( (0 >= a_days) || ((g_weather->GetTemp()>0)&&
827  !g_weather->Raining() && DoIt(DO_IT_PROB)))
828 {
829  SetFunctionData(a_field, 1.0, 1.0, EL_TRAMLINE_DECAYTIME, treatment);
830  return true;
831  }
832  return false;
833 }

References DO_IT_PROB, EL_TRAMLINE_DECAYTIME, fp_slurry, g_weather, Weather::GetTemp(), and Weather::Raining().

Referenced by UKMaize::Do(), WinterRapeStrigling::Do(), NLCatchCropPea::Do(), BECatchPeaCrop::Do(), OCarrots::Do(), FI_OPotato_North::Do(), FI_OPotato_South::Do(), FI_OPotatoIndustry_North::Do(), OWinterBarleyExt::Do(), FI_OPotatoIndustry_South::Do(), FI_OStarchPotato_North::Do(), FI_OStarchPotato_South::Do(), OWinterBarley::Do(), DK_MaizeSilage::Do(), DK_OSpringBarleyCloverGrass::Do(), OWinterRye::Do(), DK_OWinterRye::Do(), FI_SugarBeet::Do(), DK_SpringOats::Do(), DK_SpringOats_CC::Do(), DE_OMaizeSilage::Do(), DK_OWinterRye_CC::Do(), DE_OMaize::Do(), DK_OSpringBarley_CC::Do(), DK_Maize::Do(), DK_OWinterBarley::Do(), BEMaizeSpring::Do(), DK_SpringWheat::Do(), OSpringBarleyExt::Do(), OSpringBarley::Do(), DK_OSpringBarley::Do(), OPotatoes::Do(), FI_Potato_North::Do(), FI_StarchPotato_North::Do(), OWinterWheat::Do(), OWinterWheatUndersown::Do(), OWinterWheatUndersownExt::Do(), FI_PotatoIndustry_North::Do(), FI_Potato_South::Do(), PTOliveGroveTradOrganic::Do(), FI_PotatoIndustry_South::Do(), FI_StarchPotato_South::Do(), OWinterRape::Do(), DK_OSpringOats::Do(), DK_OSpringWheat::Do(), DE_OCabbages::Do(), DK_SpringBarleyCloverGrass::Do(), NLMaize::Do(), Carrots::Do(), UKSpringBarley::Do(), UKWinterBarley::Do(), DK_WinterFodderGrass::Do(), DK_OSpringOats_CC::Do(), DK_OWinterRape::Do(), DK_SpringBarley::Do(), DK_SpringBarley_CC::Do(), DK_OMaize::Do(), DK_OMaizeSilage::Do(), DE_OPotatoes::Do(), DK_SpringFodderGrass::Do(), NLGrassGrazedExtensive2::Do(), DK_WinterCloverGrassGrazedSown::Do(), NLPermanentGrassGrazedExtensive::Do(), DK_OSpringBarleySilage::Do(), NLGrassGrazedExtensive1Spring::Do(), NLGrassGrazedExtensiveLast::Do(), DK_WinterBarley::Do(), NLCabbage::Do(), NLGrassGrazedExtensive1::Do(), DK_WinterRye::Do(), DK_WinterRye_CC::Do(), UKWinterWheat::Do(), TestCrop::Do(), UKWinterRape::Do(), NLSpringBarley::Do(), NLWinterWheat::Do(), DK_OMixedVeg::Do(), DK_WinterWheat::Do(), DK_WinterWheat_CC::Do(), DE_PermanentGrassGrazed::Do(), PLFodderLucerne1::Do(), UKPermanentGrass::Do(), FR_Grassland_Perm::Do(), UKPotatoes::Do(), UKTempGrass::Do(), SpringRape::Do(), DK_OBushFruit_Perm2::Do(), PTOats::Do(), NLGrassGrazed2::Do(), NLPermanentGrassGrazed::Do(), WinterWheatStrigling::Do(), WinterWheatStriglingCulm::Do(), WinterWheatStriglingSingle::Do(), NLGrassGrazed1Spring::Do(), NLGrassGrazedLast::Do(), PLBeans::Do(), PTWinterBarley::Do(), PTWinterWheat::Do(), PTWinterRye::Do(), DE_OGrasslandSilageAnnual::Do(), PTTriticale::Do(), DK_WinterRape::Do(), PTYellowLupin::Do(), WinterRape::Do(), NLGrassGrazed1::Do(), DE_Maize::Do(), OSpringBarleyPigs::Do(), FI_OSpringRape::Do(), FI_OTurnipRape::Do(), DE_MaizeSilage::Do(), PTRyegrass::Do(), PLWinterRye::Do(), DK_OWinterWheat_CC::Do(), NLPotatoes::Do(), PLMaize::Do(), DK_OWinterWheat::Do(), PLMaizeSilage::Do(), PLSpringBarley::Do(), FI_SpringRape::Do(), FI_OWinterRye::Do(), PTCloverGrassGrazed1::Do(), PLWinterTriticale::Do(), SE_SpringBarley::Do(), FI_OWinterWheat::Do(), PLBeet::Do(), PLWinterBarley::Do(), PLWinterWheat::Do(), PLWinterWheatLate::Do(), PLSpringWheat::Do(), PLPotatoes::Do(), PTPermanentGrassGrazed::Do(), DE_Oats::Do(), SE_WinterWheat::Do(), DE_Cabbage::Do(), DE_SpringRye::Do(), PLWinterRape::Do(), FI_WinterWheat::Do(), DE_GrasslandSilageAnnual::Do(), FR_Grassland::Do(), IRWinterBarley::Do(), IRWinterOats::Do(), IRSpringOats::Do(), IRSpringBarley::Do(), IRSpringWheat::Do(), FI_WinterRye::Do(), FR_WinterRape::Do(), IRWinterWheat::Do(), WinterWheat::Do(), DE_SugarBeet::Do(), IRGrassland_no_reseed::Do(), DE_Potatoes::Do(), DE_PotatoesIndustry::Do(), and IRGrassland_reseed::Do().

◆ FruitHarvest()

bool Farm::FruitHarvest ( LE a_field,
double  a_user,
int  a_days 
)
virtual

FruitHarvest (harvest of the mature fruits, e.g., grapes) applied on a_field.

  • details needs to be added (e.g., impact on biomass, influence/impacts in species code)!
1960 {
1961 
1962  FarmToDo treatment = harvest;
1963  if ((0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
1964  SetFunctionData(a_field, 1.0, 1.0, 0, treatment);
1965  return true;
1966  }
1967  return false;
1968 }

References DO_IT_PROB, g_weather, harvest, and Weather::Raining().

Referenced by DE_OBushFruitPerm::Do(), DK_OMaize::Do(), PTOliveGroveTraditional::Do(), DE_BushFruitPerm::Do(), DK_OOrchCherry::Do(), DK_OOrchPear::Do(), DK_OOrchOther::Do(), DK_OOrchApple::Do(), DK_OOrchardCrop_Perm::Do(), PTVineyards::Do(), DE_Orchard::Do(), DK_OrchCherry::Do(), DK_OrchPear::Do(), DK_OrchApple::Do(), DK_OrchOther::Do(), DK_OrchardCrop_Perm::Do(), DE_OOrchard::Do(), ITOrchard::Do(), and ITOOrchard::Do().

◆ FungicideTreat()

bool Farm::FungicideTreat ( LE a_field,
double  a_user,
int  a_days 
)
virtual

Apply fungicide to a_field.

2102 {
2103  FarmToDo treatment = fungicide_treat;
2104  if (0 >= a_days)
2105  {
2106  if ((!a_field->GetSignal() & LE_SIG_NO_FUNGICIDE))
2107  {
2108  a_field->Trace(treatment);
2109  a_field->SetLastTreatment(treatment);
2112  }
2113  CalculateTreatmentCosts(treatment, a_field);
2114  return true;
2115  }
2116  else if ((g_weather->GetWind() < cfg_pest_max_wind.value()) &&
2117  (!g_weather->Raining()) && DoIt(DO_IT_PROB)) {
2118  if (!(a_field->GetSignal() & LE_SIG_NO_FUNGICIDE)) {
2119  a_field->Trace(treatment);
2120  a_field->SetLastTreatment(treatment);
2123  }
2124  CalculateTreatmentCosts(treatment, a_field);
2125  return true;
2126  }
2127  return false;
2128 }

References cfg_pest_max_wind, Landscape::CheckForPesticideRecord(), DO_IT_PROB, EL_TRAMLINE_DECAYTIME, fungicide, fungicide_treat, g_landscape_ptr, g_weather, Weather::GetWind(), LE_SIG_NO_FUNGICIDE, Weather::Raining(), LE::SetLastTreatment(), LE::SetTramlinesDecay(), and CfgFloat::value().

Referenced by WinterRapeStrigling::Do(), SeedGrass1::Do(), DK_CerealLegume::Do(), DK_CerealLegume_Whole::Do(), DK_SpringBarley_Green::Do(), SeedGrass2::Do(), DK_SpringBarleySilage::Do(), DK_FodderBeet::Do(), DK_MaizeSilage::Do(), FI_SugarBeet::Do(), DK_SpringOats::Do(), DK_SpringOats_CC::Do(), DK_SugarBeet::Do(), DK_Legume_Beans::Do(), UKBeans::Do(), DK_SpringWheat::Do(), DK_Maize::Do(), SpringBarleySeed::Do(), SpringBarleyCloverGrassStrigling::Do(), FieldPeas::Do(), FieldPeasSilage::Do(), FieldPeasStrigling::Do(), FI_Potato_North::Do(), FI_StarchPotato_North::Do(), SpringBarleyCloverGrass::Do(), FI_PotatoIndustry_North::Do(), FI_PotatoIndustry_South::Do(), FI_StarchPotato_South::Do(), Triticale::Do(), UKBeet::Do(), FI_Potato_South::Do(), DK_SpringBarleyCloverGrass::Do(), NLBeetSpring::Do(), UKSpringBarley::Do(), UKWinterBarley::Do(), SpringBarleyPeaCloverGrassStrigling::Do(), DK_SpringBarley_CC::Do(), DK_SpringBarley::Do(), DE_OPotatoes::Do(), NLCarrotsSpring::Do(), NLBeet::Do(), NLCarrots::Do(), NLCabbageSpring::Do(), DK_WinterBarley::Do(), NLSpringBarleySpring::Do(), PotatoesIndustry::Do(), NorwegianPotatoes::Do(), Potatoes::Do(), PTOliveGroveIntensive::Do(), DK_VegSeeds::Do(), SpringBarleySKManagement::Do(), NLCabbage::Do(), DK_Carrots_Spring::Do(), DK_WinterRye::Do(), DK_WinterRye_CC::Do(), SpringBarleySilage::Do(), SpringBarleySpr::Do(), UKWinterWheat::Do(), WinterRyeStrigling::Do(), DK_Carrots::Do(), PLCarrots::Do(), SpringBarleyPTreatment::Do(), SpringBarleyStrigling::Do(), SpringBarleyStriglingCulm::Do(), SpringBarleyStriglingSingle::Do(), DK_Cabbages::Do(), WinterRye::Do(), NLSpringBarley::Do(), UKWinterRape::Do(), PTOliveGroveSuperIntensive::Do(), NLWinterWheat::Do(), PLSpringBarleySpr::Do(), SpringBarley::Do(), DK_WinterWheat::Do(), DK_WinterWheat_CC::Do(), DK_Potato::Do(), UKPotatoes::Do(), PTOliveGroveTraditional::Do(), PTPotatoes::Do(), SpringRape::Do(), FI_Caraway2::Do(), PLBeetSpr::Do(), DK_MixedVeg::Do(), WinterWheatStrigling::Do(), WinterWheatStriglingCulm::Do(), WinterWheatStriglingSingle::Do(), PLBeans::Do(), DK_WinterRape::Do(), DK_PotatoSeed::Do(), WinterBarleyStrigling::Do(), WinterRape::Do(), DE_BushFruitPerm::Do(), DK_PotatoIndustry::Do(), FR_SpringBarley::Do(), FR_SpringOats::Do(), WinterBarley::Do(), NLPotatoesSpring::Do(), DE_SpringBarley::Do(), PLWinterRye::Do(), FI_TurnipRape::Do(), DE_AsparagusEstablishedPlantation::Do(), NLPotatoes::Do(), PLMaizeSilage::Do(), PLMaize::Do(), PLSpringBarley::Do(), FI_FabaBean::Do(), FI_SpringRape::Do(), NLTulips::Do(), FR_WinterTriticale::Do(), DE_Peas::Do(), SE_SpringBarley::Do(), FI_SpringBarley_Malt::Do(), DE_Legumes::Do(), PLWinterTriticale::Do(), FI_Caraway1::Do(), DE_WinterRye::Do(), FI_SpringWheat::Do(), FI_SprSpringBarley_Fodder::Do(), PLWinterBarley::Do(), PLBeet::Do(), PLWinterWheat::Do(), PLSpringWheat::Do(), PLWinterWheatLate::Do(), DE_Carrots::Do(), FI_SpringOats::Do(), FI_SpringBarley_Fodder::Do(), PLPotatoes::Do(), DK_BushFruit_Perm1::Do(), DE_WinterBarley::Do(), DE_Cabbage::Do(), FR_SpringWheat::Do(), SE_WinterWheat::Do(), DE_Oats::Do(), DE_SpringRye::Do(), DK_SeedGrassRye_Spring::Do(), PLWinterRape::Do(), PTVineyards::Do(), FR_WinterBarley::Do(), DK_BushFruit_Perm2::Do(), FI_WinterWheat::Do(), IRSpringBarley::Do(), IRWinterOats::Do(), IRSpringOats::Do(), IRWinterBarley::Do(), IRSpringWheat::Do(), DE_WinterWheat::Do(), DE_Triticale::Do(), FI_WinterRye::Do(), FR_WinterWheat::Do(), DE_WinterWheatLate::Do(), FR_Potatoes::Do(), IRWinterWheat::Do(), FR_WinterRape::Do(), DE_WinterRape::Do(), DE_Orchard::Do(), WinterWheat::Do(), DE_SugarBeet::Do(), DK_OrchCherry::Do(), DE_Potatoes::Do(), DK_OrchPear::Do(), DK_OrchOther::Do(), DK_OrchApple::Do(), DK_OrchardCrop_Perm::Do(), DE_PotatoesIndustry::Do(), ITOrchard::Do(), and ITOOrchard::Do().

◆ GetArea()

int Farm::GetArea ( void  )

Returns the area of arable fields owned by that farm.

1082  {
1083  int area = 0;
1084  for (unsigned int i = 0; i < m_fields.size(); i++) {
1085  if (m_fields[i]->GetElementType() == tole_Field) area += (int)m_fields[i]->GetArea();
1086  }
1087  return area;
1088 }

References tole_Field.

Referenced by AssignPermanentCrop().

◆ GetAreaDouble()

double Farm::GetAreaDouble ( void  )

Returns the area of arable fields owned by that farm.

1101  {
1102  double area = 0;
1103  for ( unsigned int i = 0; i < m_fields.size(); i++ ) {
1104  if (m_fields[i]->GetElementType()==tole_Field) area += m_fields[i]->GetArea();
1105  }
1106  return area;
1107 }

References tole_Field.

◆ GetAreaOpenFields()

int Farm::GetAreaOpenFields ( int  a_openness)

Returns the area of the fields above an openness of a_openness.

Returns the area of fields owned by that farm with an openness above a_openness

1121 {
1122  int area = 0;
1123  for (unsigned int i = 0; i < m_fields.size(); i++) {
1124  if (m_fields[i]->GetOpenness() > a_openness) area += int(m_fields[i]->GetArea());
1125  }
1126  return area;
1127 }

◆ GetCentroids()

APoint Farm::GetCentroids ( )
inline

◆ GetCrop()

TTypesOfVegetation Farm::GetCrop ( int  a_index)
inline
971  {
972  return m_rotation[a_index];
973  }

References m_rotation.

◆ GetFarmer()

Farmer* Farm::GetFarmer ( )
inline

Returns the pointer to this farm's farmer.

817 { return m_OurFarmer; }

References m_OurFarmer.

Referenced by TestCrop::Do().

◆ GetFarmManager()

FarmManager* Farm::GetFarmManager ( )
inline
780 { return m_OurManager; }

References m_OurManager.

◆ GetFarmNumber()

int Farm::GetFarmNumber ( void  )
inline

◆ GetFarmType()

TTypesOfFarm Farm::GetFarmType ( )
inline

Returns the farm type.

791 { return m_FarmType; }

References m_FarmType.

◆ GetFirstCropIndex()

int Farm::GetFirstCropIndex ( TTypesOfLandscapeElement  a_type)
protectedvirtual

Gets the first crop for the farm.

This method also synchronises farm rotations either within or between farms if needed. This is useful to try simple what if scenarios.

1136  {
1137  // If g_farm_fixed_rotation, then determine the first
1138  // crop number in the rotation rotation number.
1140 
1142  // We are running all the farms synchronized, so
1143  // simply set the first crop to run on all farm fields.
1144  return 0;
1145  }
1146 
1147  // Each farm runs its fields sync'ed but independently from
1148  // the other farmers.
1149 
1150  // Determine if this farm has selected its own start index
1151  // and set it if not. m_rotation_sync_index is initialized
1152  // to -1 by the Farm::Farm() constructor.
1153  if ( -1 == m_rotation_sync_index ) {
1155  }
1156  // Return farm localized rotation index.
1157  return m_rotation_sync_index;
1158  }
1159 
1160  // Not synchronised, but we want to follow our rotation sequence, so check
1161  // if we have started this process, if not set the sync value.
1162  // afterwards just increment this.
1163  if ( -1 == m_rotation_sync_index ) {
1164  if (int(m_rotation.size()) > 0) m_rotation_sync_index = g_random_fnc(int(m_rotation.size())); else m_rotation_sync_index = 0;
1165  }
1166  else m_rotation_sync_index = (int) ((m_rotation_sync_index+1) % m_rotation.size());
1167  return m_rotation_sync_index;
1168 }

References g_farm_fixed_rotation_enable, g_farm_fixed_rotation_farms_async, g_random_fnc(), and CfgBool::value().

◆ GetFirstDate()

int Farm::GetFirstDate ( TTypesOfVegetation  a_tov)
protected

Gets the start date for a crop type.

2152  {
2153 
2154  vector<Crop*>* crops_mgt_plans = m_OurManager->GetCropMgtPlans();
2155  for (unsigned int i = 0; i < crops_mgt_plans->size(); i++)
2156  {
2157  if (a_tov2 == (*crops_mgt_plans)[i]->m_tov)
2158  return (*crops_mgt_plans)[i]->GetFirstDate();
2159  }
2160 
2161  return 0;
2162 }

◆ GetForceSpringOK()

int Farm::GetForceSpringOK ( TTypesOfVegetation  a_tov)
protected

Gets the start date for a crop type.

2168  {
2169 
2170  vector<Crop*>* crops_mgt_plans = m_OurManager->GetCropMgtPlans();
2171  for (unsigned int i = 0; i < crops_mgt_plans->size(); i++)
2172  {
2173  if (a_tov == (*crops_mgt_plans)[i]->m_tov)
2174  return (*crops_mgt_plans)[i]->GetForceSpringOK();
2175  }
2176  return 0;
2177 }

◆ GetIntensity()

double Farm::GetIntensity ( void  )
inline
963 { return m_intensity; }

References m_intensity.

Referenced by Landscape::SupplyFarmIntensity().

◆ GetMaxOpenness()

int Farm::GetMaxOpenness ( )
inline

Returns the maximum openness score of the fields.

806  {
807  int op = 0;
808  for (int i = 0; i < m_fields.size(); i++)
809  {
810  int openness = m_fields[i]->GetOpenness();
811  if (openness > op) op = openness;
812  }
813  return op;
814  }

References m_fields.

◆ GetNextCrop()

TTypesOfVegetation Farm::GetNextCrop ( int  a_index)
inline
974  {
975  int ind = a_index + 1;
976  if (ind >= (int)m_rotation.size()) ind = ind - (int)m_rotation.size();
977  return m_rotation[ind];
978  }

References m_rotation.

◆ GetNextCropIndex()

int Farm::GetNextCropIndex ( int  a_rot_index)
protectedvirtual

Returns the next crop in the rotation.

Also provides the possibility of over-riding rotations using configuration settings

1178  {
1180  // Rotation not enabled.
1181  return a_rot_index;
1182  }
1183 
1184  if ( a_rot_index == -1 )
1185  return -1;
1186 
1187  if ( ( unsigned int ) ( ++a_rot_index ) == m_rotation.size() ) //AM comm: the last crop was the last element of the vector - so go back to the element zero; otherwise just add 1 to the index
1188  a_rot_index = 0;
1189 
1190  return a_rot_index;
1191 }

References g_farm_enable_crop_rotation, and CfgBool::value().

◆ GetNextCropStartDate()

int Farm::GetNextCropStartDate ( LE a_field,
TTypesOfVegetation a_curr_veg 
)

Returns the start date of the next crop in the rotation.

920  {
921  TTypesOfVegetation l_tov2;
922 
923  if ( a_field->GetRotIndex() < 0 || g_farm_fixed_crop_enable.value() //|| g_farm_test_crop.value()
924  ) {
925  l_tov2 = a_curr_veg; // don't do it if no rotation
926  } else {
927  l_tov2 = m_rotation[ GetNextCropIndex( a_field->GetRotIndex() ) ];
928  }
929  a_curr_veg = l_tov2;
930  return GetFirstDate( l_tov2 );
931 }

References g_farm_fixed_crop_enable, LE::GetRotIndex(), and CfgBool::value().

Referenced by BroadBeans::Do(), DK_OLegume_Peas_CC::Do(), DK_OLegume_Beans_CC::Do(), DK_SpringOats_CC::Do(), DK_OWinterRye_CC::Do(), DK_OLegume_Whole_CC::Do(), DK_OSpringBarley_CC::Do(), NLMaizeSpring::Do(), NLMaize::Do(), DK_OSpringOats_CC::Do(), DK_SpringBarley_CC::Do(), BEWinterBarleyCC::Do(), BEWinterWheatCC::Do(), DK_WinterRye_CC::Do(), NLWinterWheat::Do(), DK_WinterWheat_CC::Do(), PTCabbage_Hort::Do(), PTMaize_Hort::Do(), and DK_OWinterWheat_CC::Do().

◆ GetNoCrops()

int Farm::GetNoCrops ( )
inline
979  {
980  return (int)m_rotation.size();
981  }

References m_rotation.

◆ GetNoFields()

int Farm::GetNoFields ( )
inline

Returns the number of the fields owned.

797 { return (int)m_fields.size(); }

References m_fields.

◆ GetNoOpenFields()

int Farm::GetNoOpenFields ( int  a_openness)

Returns the number of the fields above an openness of a_openness.

Returns the number of fields owned by that farm with an openness above a_openness

1111 {
1112  int num = 0;
1113  for (unsigned int i = 0; i < m_fields.size(); i++) {
1114  if (m_fields[i]->GetOpenness() > a_openness) num++;
1115  }
1116  return num;
1117 }

◆ GetPreviousTov()

TTypesOfVegetation Farm::GetPreviousTov ( int  a_index)
inline
966  {
967  int ind = a_index - 1;
968  if (ind < 0) ind = (int)m_rotation.size() - 1;
969  return m_rotation[ind];
970  }

References m_rotation.

Referenced by UKMaize::Do(), BEOrchardCrop::Do(), BEMaizeSpring::Do(), UKBeans::Do(), BEBeetSpring::Do(), UKBeet::Do(), BEMaize::Do(), PLFodderLucerne2::Do(), UKSpringBarley::Do(), UKWinterBarley::Do(), BEBeet::Do(), BEWinterBarley::Do(), BEWinterBarleyCC::Do(), BEWinterWheat::Do(), BEWinterWheatCC::Do(), DK_Carrots_Spring::Do(), UKWinterWheat::Do(), PLCarrots::Do(), BEGrassGrazed1Spring::Do(), TestCrop::Do(), UKWinterRape::Do(), BEGrassGrazed2::Do(), BEGrassGrazedLast::Do(), BEGrassGrazed1::Do(), PLFodderLucerne1::Do(), FR_Grassland_Perm::Do(), UKPotatoes::Do(), UKPermanentGrass::Do(), FI_GreenFallow_1year::Do(), UKTempGrass::Do(), FI_NaturalGrassland_Perm::Do(), PLBeetSpr::Do(), FI_GreenFallow_Perm::Do(), PLBeans::Do(), FI_BufferZone_Perm::Do(), FI_BufferZone::Do(), ITGrassland::Do(), FI_NaturalGrassland::Do(), FI_OSpringBarley_Malt::Do(), BEPotatoesSpring::Do(), FI_OCaraway1::Do(), FI_OFabaBean::Do(), FI_OSpringOats::Do(), FI_OSpringRape::Do(), FI_OSpringWheat::Do(), FI_OTurnipRape::Do(), FR_SpringOats::Do(), FI_OSpringBarley_Fodder::Do(), FI_FeedingGround::Do(), PLWinterRye::Do(), FR_Sorghum::Do(), BEPotatoes::Do(), PLMaizeSilage::Do(), PLMaize::Do(), PLSpringBarley::Do(), FI_OWinterRye::Do(), PLWinterTriticale::Do(), SE_SpringBarley::Do(), FI_OWinterWheat::Do(), PLWinterWheat::Do(), PLBeet::Do(), PLWinterBarley::Do(), PLSpringWheat::Do(), PLWinterWheatLate::Do(), SE_WinterRape_Seed::Do(), PLPotatoes::Do(), SE_WinterWheat::Do(), PLWinterRape::Do(), IRWinterBarley::Do(), IRSpringOats::Do(), IRSpringBarley::Do(), IRWinterOats::Do(), IRSpringWheat::Do(), IRWinterWheat::Do(), WinterWheat::Do(), IRGrassland_no_reseed::Do(), IRGrassland_reseed::Do(), ITOrchard::Do(), ITOOrchard::Do(), and Field::GetPreviousTov().

◆ GetRotFilename()

string Farm::GetRotFilename ( void  )
inline
957 { return m_rotfilename; }

References m_rotfilename.

◆ GetTotalArea()

int Farm::GetTotalArea ( void  )

Returns the area of all fields owned by that farm.

1091  {
1092  int area = 0;
1093  for (unsigned int i = 0; i < m_fields.size(); i++)
1094  {
1095  area += (int)m_fields[i]->GetArea();
1096  }
1097  return area;
1098 }

◆ GetType()

TTypesOfFarm Farm::GetType ( void  )
inline
956 { return m_farmtype; }

References m_farmtype.

Referenced by PermanentSetAside::Do(), OrchardCrop::Do(), PermanentGrassTussocky::Do(), UKMaize::Do(), DK_GrassTussocky_Perm::Do(), OSeedGrass1::Do(), OSeedGrass2::Do(), BroadBeans::Do(), PermanentGrassLowYield::Do(), YoungForestCrop::Do(), SeedGrass1::Do(), PermanentGrassGrazed::Do(), FI_OPotatoIndustry_North::Do(), FI_OPotatoIndustry_South::Do(), FI_OPotato_South::Do(), FI_OStarchPotato_North::Do(), FI_OStarchPotato_South::Do(), FI_OPotato_North::Do(), BEOrchardCrop::Do(), SeedGrass2::Do(), FI_SugarBeet::Do(), Maize::Do(), MaizeSilage::Do(), OTriticale::Do(), Oats::Do(), BEMaizeSpring::Do(), UKBeans::Do(), DummyCropPestTesting::Do(), FI_Potato_North::Do(), FieldPeas::Do(), FieldPeasSilage::Do(), FI_StarchPotato_North::Do(), OFodderBeet::Do(), FI_PotatoIndustry_North::Do(), BEBeetSpring::Do(), PLFodderLucerne2::Do(), BEMaize::Do(), Triticale::Do(), UKBeet::Do(), Carrots::Do(), UKSpringBarley::Do(), UKWinterBarley::Do(), BEBeet::Do(), SetAside::Do(), BEWinterBarley::Do(), PotatoesIndustry::Do(), BEWinterBarleyCC::Do(), SugarBeet::Do(), NorwegianPotatoes::Do(), DKOBroadBeans_test::Do(), Potatoes::Do(), FodderBeet::Do(), BEWinterWheat::Do(), BEWinterWheatCC::Do(), DK_Carrots_Spring::Do(), PLCarrots::Do(), SpringBarleySilage::Do(), SpringBarleySpr::Do(), UKWinterWheat::Do(), BEGrassGrazed1Spring::Do(), TestCrop::Do(), UKWinterRape::Do(), WinterRye::Do(), BEGrassGrazed2::Do(), PLSpringBarleySpr::Do(), BEGrassGrazedLast::Do(), BEGrassGrazed1::Do(), SpringBarley::Do(), PLFodderLucerne1::Do(), FR_Grassland_Perm::Do(), UKPotatoes::Do(), UKPermanentGrass::Do(), UKTempGrass::Do(), FI_GreenFallow_1year::Do(), FI_NaturalGrassland_Perm::Do(), SpringRape::Do(), PLBeetSpr::Do(), FI_GreenFallow_Perm::Do(), PLBeans::Do(), FI_BufferZone::Do(), FI_BufferZone_Perm::Do(), ITGrassland::Do(), FI_OSpringBarley_Malt::Do(), FI_NaturalGrassland::Do(), BEPotatoesSpring::Do(), WinterRape::Do(), FI_OCaraway1::Do(), FI_OFabaBean::Do(), FI_OSpringRape::Do(), FI_OSpringWheat::Do(), FI_OSpringOats::Do(), FI_OTurnipRape::Do(), FR_SpringOats::Do(), FI_OSpringBarley_Fodder::Do(), WinterBarley::Do(), PLWinterRye::Do(), FI_FeedingGround::Do(), BEPotatoes::Do(), FR_Sorghum::Do(), PLMaize::Do(), PLSpringBarley::Do(), PLMaizeSilage::Do(), FI_OWinterRye::Do(), PLWinterTriticale::Do(), SE_SpringBarley::Do(), FI_OWinterWheat::Do(), FI_SprSpringBarley_Fodder::Do(), PLWinterWheat::Do(), PLBeet::Do(), PLWinterBarley::Do(), PLSpringWheat::Do(), PLWinterWheatLate::Do(), PLPotatoes::Do(), SE_WinterRape_Seed::Do(), SE_WinterWheat::Do(), PLWinterRape::Do(), IRWinterBarley::Do(), IRSpringOats::Do(), IRWinterOats::Do(), IRSpringBarley::Do(), IRSpringWheat::Do(), IRWinterWheat::Do(), WinterWheat::Do(), IRGrassland_no_reseed::Do(), IRGrassland_reseed::Do(), ITOrchard::Do(), and ITOOrchard::Do().

◆ GetValidCoords()

APoint Farm::GetValidCoords ( )
inline

Returns the valid coordinates of the first field owned by a farm.

803 { APoint pt; pt.m_x = m_fields[0]->GetValidX(); pt.m_y = m_fields[0]->GetValidY(); return pt; }

References m_fields, APoint::m_x, and APoint::m_y.

◆ GreenHarvest()

bool Farm::GreenHarvest ( LE a_field,
double  a_user,
int  a_days 
)
virtual

GreenHarvest (remove of excess production that may affect the desired quality of the fruits, e.g., grapes) applied on a_field.

  • details needs to be added (e.g., impact on biomass, influence/impacts in species code)!
1943 {
1944 
1945  FarmToDo treatment = green_harvest;
1946  if ((0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
1947  SetFunctionData(a_field, 1.0, 1.0, 0, treatment);
1948  return true;
1949  }
1950  return false;
1951 }

References DO_IT_PROB, g_weather, green_harvest, and Weather::Raining().

Referenced by DE_HerbsPerennial_after1year::Do(), DE_HerbsPerennial_1year::Do(), DE_OHerbsPerennial_after1year::Do(), DE_OHerbsPerennial_1year::Do(), and PTVineyards::Do().

◆ GrowthRegulator()

bool Farm::GrowthRegulator ( LE a_field,
double  a_user,
int  a_days 
)
virtual

Apply growth regulator to a_field.

2071 {
2072  FarmToDo treatment = growth_regulator;
2073  if (0 >= a_days)
2074  {
2075 
2076  if ((!g_weather->Raining()) && (g_weather->GetWind() < cfg_pest_max_wind.value()) && (!(a_field->GetSignal() & LE_SIG_NO_GROWTH_REG))) {
2077  a_field->Trace(treatment);
2078  a_field->SetLastTreatment(treatment);
2080  }
2081  CalculateTreatmentCosts(treatment, a_field);
2082  return true;
2083  }
2084  else if ((g_weather->GetWind() < cfg_pest_max_wind.value()) &&
2085  (!g_weather->Raining()) && DoIt(DO_IT_PROB)) {
2086  if (!(a_field->GetSignal() & LE_SIG_NO_GROWTH_REG)) {
2087  a_field->Trace(treatment);
2088  a_field->SetLastTreatment(treatment);
2090  }
2091  CalculateTreatmentCosts(treatment, a_field);
2092  return true;
2093  }
2094  return false;
2095 }

References cfg_pest_max_wind, DO_IT_PROB, EL_TRAMLINE_DECAYTIME, g_weather, Weather::GetWind(), growth_regulator, LE_SIG_NO_GROWTH_REG, Weather::Raining(), LE::SetLastTreatment(), LE::SetTramlinesDecay(), and CfgFloat::value().

Referenced by SeedGrass2::Do(), DK_SpringOats_CC::Do(), DK_SpringOats::Do(), DK_SpringWheat::Do(), SpringBarleySeed::Do(), FieldPeas::Do(), SpringBarleyCloverGrassStrigling::Do(), FieldPeasSilage::Do(), FieldPeasStrigling::Do(), SpringBarleyCloverGrass::Do(), Triticale::Do(), DK_SpringBarleyCloverGrass::Do(), UKSpringBarley::Do(), UKWinterBarley::Do(), SpringBarleyPeaCloverGrassStrigling::Do(), DK_SpringBarley_CC::Do(), DK_SpringBarley::Do(), DK_WinterBarley::Do(), NLSpringBarleySpring::Do(), PotatoesIndustry::Do(), NorwegianPotatoes::Do(), Potatoes::Do(), SpringBarleySKManagement::Do(), DK_WinterRye::Do(), DK_WinterRye_CC::Do(), SpringBarleySilage::Do(), SpringBarleySpr::Do(), UKWinterWheat::Do(), WinterRyeStrigling::Do(), SpringBarleyPTreatment::Do(), SpringBarleyStrigling::Do(), SpringBarleyStriglingCulm::Do(), SpringBarleyStriglingSingle::Do(), UKWinterRape::Do(), WinterRye::Do(), NLSpringBarley::Do(), NLWinterWheat::Do(), DK_WinterWheat::Do(), DK_WinterWheat_CC::Do(), SpringBarley::Do(), WinterWheatStrigling::Do(), WinterWheatStriglingCulm::Do(), WinterWheatStriglingSingle::Do(), DK_WinterRape::Do(), WinterBarleyStrigling::Do(), FR_SpringBarley::Do(), FR_SpringOats::Do(), WinterBarley::Do(), DE_SpringBarley::Do(), PLWinterRye::Do(), FR_WinterTriticale::Do(), PLWinterTriticale::Do(), FI_Caraway1::Do(), FI_SpringBarley_Malt::Do(), DE_WinterRye::Do(), FI_SprSpringBarley_Fodder::Do(), FI_SpringWheat::Do(), PLWinterWheat::Do(), PLWinterBarley::Do(), FI_SpringOats::Do(), PLSpringWheat::Do(), PLWinterWheatLate::Do(), FI_SpringBarley_Fodder::Do(), SE_WinterRape_Seed::Do(), DE_Oats::Do(), SE_WinterWheat::Do(), DE_WinterBarley::Do(), FR_SpringWheat::Do(), DK_SeedGrassRye_Spring::Do(), DE_SpringRye::Do(), FR_WinterBarley::Do(), FI_WinterWheat::Do(), DE_Triticale::Do(), DE_WinterWheat::Do(), FR_WinterWheat::Do(), DE_WinterWheatLate::Do(), FI_WinterRye::Do(), DK_SeedGrassFescue_Spring::Do(), WinterWheat::Do(), DK_OrchCherry::Do(), DK_OrchPear::Do(), DK_OrchardCrop_Perm::Do(), DK_OrchOther::Do(), DK_OrchApple::Do(), ITOrchard::Do(), and ITOOrchard::Do().

◆ HandleEvents()

void Farm::HandleEvents ( void  )
protectedvirtual

If there are events to carry out do this, and perhaps start a new crop.

Call the management plan for the current crop and it this return done=true starts the next management.

Sets the new index to the rotation.

Save the new veg type as the LE vegetation type

Save the crop veg type as the Field vegetation type

938  {
939  if (m_queue.Empty())
940  return;
941 
943  FarmEvent* ev = pair.m_element;
944  while (pair.m_pri <= g_date->Date()) {
945  m_queue.Pop();
947  if (LeSwitch(ev)) {
948  // This crop management plan has terminated.
949 #ifdef __CALCULATE_MANAGEMENT_NORMS
951 #endif
952  // If the farmer is simulated in detail he may need to know how he did relative to norms for this crop, so transfer this information now before its lost.
953  if (cfg_UseSocioEconomicFarm.value()) m_OurFarmer->CheckManagementImpacts(ev);
954 
955  // First check for an infinite loop in the rotation scheme,
956  // ie. a scenario where all crops decide not to run given
957  // the date.
959 
960  // Outdate any remaining events for this field.
961  ev->m_field->BumpRunNum();
962 
963  // Crop treatment done, select and initiate new crop if in rotation.
964  TTypesOfVegetation new_veg = ev->m_field->GetVegType();
965 
966  if (ev->m_field->GetRotIndex() >= 0) {
967  int new_index = GetNextCropIndex(ev->m_field->GetRotIndex());
968  new_veg = m_rotation[new_index];
969  // Running in fixed crop mode?
972  }
973  TTypesOfCrops new_crop = m_OurManager->GetCropTypeFromPlan(new_veg);
975  ev->m_field->SetRotIndex(new_index);
977  ev->m_field->SetVegType(new_veg, tov_Undefined);
978  ev->m_field->SetPollenNectarType(new_veg);
979  if(new_crop == toc_OCloverGrassGrazed1
980  || new_crop == toc_CloverGrassGrazed1
981  || new_crop == toc_GrazingPigs
982  || new_crop == toc_OGrazingPigs
983  || new_crop == toc_OCloverGrassSilage1
984  || new_crop == toc_OSetAside
985  || new_crop == toc_SetAside){ // we need to set it to force growth for first year crops
987  if (ev->m_field->GetUnsprayedMarginPolyRef() != -1){
990  }
991  }
992  else{
993  ev->m_field->SetVegHeight(10);
995  if (ev->m_field->GetUnsprayedMarginPolyRef() != -1){
997  um->SetVegHeight(10);
998  um->ResetDigestibility();
999  }
1000  }
1001  if (ev->m_field->GetUnsprayedMarginPolyRef() != -1)
1002  {
1004  um->SetVegType(new_veg, tov_Undefined);
1005  um->SetPollenNectarType(new_veg);
1006  }
1007  /* Recalculate the attributes */
1008  ev->m_field->GetLandscape()->Set_TOV_Att(ev->m_field);
1010  ev->m_field->SetCropType(m_OurManager->GetCropTypeFromPlan(new_veg));
1011  }
1012  // Reset the event list for this field.
1013  ev->m_field->ResetTrace();
1014  // Reset event timeout counter.
1015  ev->m_field->SetVegStore(0);
1016 
1017  // The next bit simply determines the start date of the next crop in
1018  // the rotation and passes this to the start crop event.
1019  // The crop is responsible for raising an error if the next crop is
1020  // not possible or otherwise handling the problem
1021 
1022  // 19/5-2003: Note: This code was moved out into a dedicated
1023  // method of the Farm class, GetNextCropStartDate(), as precisely
1024  // the same piece of code needs to be run during initialization of
1025  // farm management.
1026  TTypesOfVegetation l_tov = new_veg;
1027  int l_nextcropstartdate = GetNextCropStartDate(ev->m_field, l_tov);
1028  bool forcespringOK = GetForceSpringOK(l_tov);
1029  // Create 'start' event for today and put it on the queue.
1030  AddNewEvent(new_veg, g_date->Date(), ev->m_field, PROG_START, ev->m_field->GetRunNum(), false, l_nextcropstartdate, false, l_tov, fmc_Others, ev->m_forcespring, forcespringOK);
1031  // Set starting date for rotation mgmt loop detection.
1032  ev->m_field->SetMgtLoopDetectDate(g_date->Date());
1033  // Now reset the random slope factor for the field growth
1035  }
1036 
1037  delete ev;
1038 
1039  if (m_queue.Empty())
1040  return;
1041  pair = m_queue.Bottom();
1042  ev = pair.m_element;
1043 
1044  }
1045 }

References cfg_UseSocioEconomicFarm, Calendar::Date(), fmc_Others, LE::ForceGrowthInitialiseForFirstYearCrop(), g_date, g_farm_fixed_crop_enable, g_farm_fixed_crop_type, g_landscape_ptr, g_letype, LE::GetRotIndex(), LE::GetUnsprayedMarginPolyRef(), LowPriPair< ELEMTYPE >::m_element, FarmEvent::m_field, FarmEvent::m_forcespring, LowPriPair< ELEMTYPE >::m_pri, PROG_START, LE::ResetDigestibility(), LE::SetPollenNectarType(), LE::SetRotIndex(), LE::SetVegGrowthScalerRand(), LE::SetVegHeight(), LE::SetVegStore(), LE::SetVegType(), Landscape::SupplyLEPointer(), toc_CloverGrassGrazed1, toc_GrazingPigs, toc_OCloverGrassGrazed1, toc_OCloverGrassSilage1, toc_OGrazingPigs, toc_OSetAside, toc_SetAside, tov_Undefined, LE_TypeClass::TranslateVegTypes(), CfgInt::value(), and CfgBool::value().

◆ Harvest()

bool Farm::Harvest ( LE a_field,
double  a_user,
int  a_days 
)
virtual

Carry out a harvest on a_field.

1365 {
1366  FarmToDo treatment = harvest;
1367  //5 days good weather before
1368  if ((0 >= a_days) || ((g_weather->GetRainPeriod(g_date->Date(), 5) < 0.1) && DoIt(DO_IT_PROB))) {
1369  LE* um = SetFunctionData(a_field, 0.4, 1.0, 0, treatment);
1370  float biomassBefore = a_field->GetVegBiomass();
1371  a_field->SetGrowthPhase(harvest1);
1372  // Here we have to do a little skip to avoid too low insect populations after harvest, but a correct veg biomass
1373  double insects = a_field->GetInsectPop();
1374  a_field->RecalculateBugsNStuff();
1375  float reduc = a_field->GetVegBiomass() / biomassBefore;
1376  if (reduc > 0 && reduc < 1) g_pest->ReducePlantPesticide(a_field->GetMinX(), a_field->GetMaxX(), a_field->GetMinY(), a_field->GetMaxY(), a_field->GetMapIndex(), reduc, true);
1377  //else (cout << "Before: " << biomassBefore << ", after: " << a_field->GetVegBiomass());
1378  a_field->ResetDigestibility();
1379  a_field->SetInsectPop(insects);
1380  a_field->PollenNectarReset();
1381  // Are we a cereal crop? If so we need to have some spilled grain
1382  double someseed = 0.0;
1383  double somemaize = 0.0;
1384  if (dynamic_cast<VegElement*>(a_field)->IsMatureCereal()) {
1385  someseed = m_OurManager->GetSpilledGrain();
1386  a_field->SetStubble(true);
1387  }
1388  else if (dynamic_cast<VegElement*>(a_field)->IsMaize()) {
1389  // Maize in stubble
1390  a_field->SetStubble(true);
1391  somemaize = m_OurManager->GetSpilledMaize();
1392  }
1393  a_field->SetBirdSeed(someseed);
1394  a_field->SetBirdMaize(somemaize);
1395  if (um != nullptr) {
1396  um->SetGrowthPhase(harvest1);
1397  double biomassBefore = um->GetVegBiomass();
1398  um->RecalculateBugsNStuff();
1399  double reduc = um->GetVegBiomass() / biomassBefore;
1400  if (reduc > 0 && reduc < 1) g_pest->ReducePlantPesticide(um->GetMinX(), um->GetMaxX(), um->GetMinY(), um->GetMapIndex(), reduc, true);
1401  um->ResetDigestibility();
1402  um->SetInsectPop(insects);
1403  um->SetBirdSeed(someseed);
1404  um->SetBirdMaize(somemaize);
1405  um->PollenNectarReset();
1406 
1407  if ((somemaize > 0) || (someseed > 0)) um->SetStubble(true);
1408  }
1409  // Calculate economics
1410  if (m_OurManager->GetUseSocioEconomicFarmers()) Harvested(a_field->GetCropType(), a_field->GetVegBiomass() * a_field->GetArea());
1411  return true;
1412  }
1413  return false;
1414 }

References Calendar::Date(), DO_IT_PROB, g_date, g_pest, g_weather, LE::GetArea(), LE::GetInsectPop(), LE::GetMapIndex(), LE::GetMaxX(), LE::GetMaxY(), LE::GetMinX(), LE::GetMinY(), Weather::GetRainPeriod(), LE::GetVegBiomass(), harvest, harvest1, LE::PollenNectarReset(), LE::RecalculateBugsNStuff(), Pesticide::ReducePlantPesticide(), LE::ResetDigestibility(), LE::SetBirdMaize(), LE::SetBirdSeed(), LE::SetGrowthPhase(), LE::SetInsectPop(), and LE::SetStubble().

Referenced by UKMaize::Do(), GenericCatchCrop::Do(), NorwegianOats::Do(), WinterRapeStrigling::Do(), NorwegianSpringBarley::Do(), OSeedGrass1::Do(), BroadBeans::Do(), OSeedGrass2::Do(), OFieldPeas::Do(), OFieldPeasSilage::Do(), OCarrots::Do(), DE_OPeas::Do(), DK_OLegume::Do(), SeedGrass1::Do(), DK_CerealLegume::Do(), DK_CerealLegume_Whole::Do(), OBarleyPeaCloverGrass::Do(), OMaizeSilage::Do(), DE_OLegume::Do(), DK_SpringBarley_Green::Do(), DK_Legume_Peas::Do(), OWinterBarleyExt::Do(), DK_OLegume_Peas_CC::Do(), DK_OLentils::Do(), DK_SpringBarleySilage::Do(), OWinterBarley::Do(), DK_OLegume_Beans::Do(), DK_OLegume_Peas::Do(), SeedGrass2::Do(), DK_OLegume_Beans_CC::Do(), DK_OLupines::Do(), DK_OSpringBarleyCloverGrass::Do(), DK_MaizeSilage::Do(), OWinterRye::Do(), DE_OSpringRye::Do(), DK_OWinterRye::Do(), OOats::Do(), DK_Legume_Beans::Do(), DK_SpringOats::Do(), DK_SpringOats_CC::Do(), DE_OMaizeSilage::Do(), DE_OOats::Do(), DK_OLegume_Whole_CC::Do(), DK_OLegumeCloverGrass_Whole::Do(), DK_OSpringBarley_CC::Do(), Maize::Do(), MaizeSilage::Do(), MaizeStrigling::Do(), DE_OWinterWheat::Do(), DK_OWinterRye_CC::Do(), OTriticale::Do(), DE_OMaize::Do(), DK_OCerealLegume_Whole::Do(), DK_OLegume_Whole::Do(), DK_OWinterBarley::Do(), NLMaizeSpring::Do(), Oats::Do(), OSpringBarleyExt::Do(), DK_SpringWheat::Do(), DK_Maize::Do(), UKBeans::Do(), DK_OSpringBarley::Do(), OSpringBarley::Do(), DK_Legume_Whole::Do(), DK_OCerealLegume::Do(), SpringBarleySeed::Do(), FieldPeas::Do(), FieldPeasSilage::Do(), FieldPeasStrigling::Do(), OPotatoes::Do(), SpringBarleyCloverGrassStrigling::Do(), DE_OWinterRape::Do(), OWinterWheat::Do(), OWinterWheatUndersown::Do(), OWinterWheatUndersownExt::Do(), OFodderBeet::Do(), SpringBarleyCloverGrass::Do(), UKBeet::Do(), DK_OSpringOats::Do(), DK_OSpringWheat::Do(), Triticale::Do(), OWinterRape::Do(), PTOliveGroveTradOrganic::Do(), DE_OCabbages::Do(), DE_OSugarBeet::Do(), DK_OVegSeeds::Do(), NLBeetSpring::Do(), Carrots::Do(), NLMaize::Do(), DK_SpringBarleyCloverGrass::Do(), UKSpringBarley::Do(), UKWinterBarley::Do(), DK_OSpringOats_CC::Do(), DK_WinterFodderGrass::Do(), DK_OMaizeSilage::Do(), DE_OPotatoes::Do(), DK_OWinterRape::Do(), NLCarrotsSpring::Do(), DK_SpringBarley::Do(), DK_SpringBarley_CC::Do(), SpringBarleyPeaCloverGrassStrigling::Do(), DK_OSpringBarleySilage::Do(), NLBeet::Do(), DK_SpringFodderGrass::Do(), DE_OCarrots::Do(), DK_WinterCloverGrassGrazedSown::Do(), DK_OCabbages::Do(), DK_OEnergyCrop_Perm::Do(), NLCarrots::Do(), DK_OCarrots::Do(), NLCabbageSpring::Do(), NLSpringBarleySpring::Do(), DK_WinterBarley::Do(), PotatoesIndustry::Do(), FodderBeet::Do(), NorwegianPotatoes::Do(), DKOBroadBeans_test::Do(), Potatoes::Do(), PTOliveGroveIntensive::Do(), DK_EnergyCrop_Perm::Do(), DK_VegSeeds::Do(), DK_Carrots_Spring::Do(), NLCabbage::Do(), DK_WinterRye::Do(), DK_WinterRye_CC::Do(), SpringBarleySKManagement::Do(), UKWinterWheat::Do(), DK_Carrots::Do(), WinterRyeStrigling::Do(), PLCarrots::Do(), SpringBarleySilage::Do(), SpringBarleySpr::Do(), UKWinterRape::Do(), DK_Cabbages::Do(), NLSpringBarley::Do(), WinterRye::Do(), SpringBarleyPTreatment::Do(), SpringBarleyStrigling::Do(), SpringBarleyStriglingSingle::Do(), SpringBarleyStriglingCulm::Do(), DK_OMixedVeg::Do(), NLWinterWheat::Do(), PLSpringBarleySpr::Do(), PTBeans::Do(), PTOliveGroveSuperIntensive::Do(), PTCabbage::Do(), DK_WinterWheat::Do(), DK_WinterWheat_CC::Do(), PTCabbage_Hort::Do(), FI_OCaraway2::Do(), PTOtherDryBeans::Do(), SpringBarley::Do(), PTHorticulture::Do(), UKPotatoes::Do(), PTPotatoes::Do(), DK_OSeedGrassRye_Spring::Do(), SpringRape::Do(), FI_Caraway2::Do(), PTOats::Do(), DK_MixedVeg::Do(), PLBeetSpr::Do(), DK_CloverGrassGrazed1::Do(), WinterWheatStriglingCulm::Do(), WinterWheatStriglingSingle::Do(), WinterWheatStrigling::Do(), PLBeans::Do(), PTMaize_Hort::Do(), PTWinterWheat::Do(), PTMaize::Do(), PTWinterBarley::Do(), PTWinterRye::Do(), PTFodderMix::Do(), DK_WinterRape::Do(), PTCloverGrassGrazed2::Do(), FI_OSpringBarley_Malt::Do(), PTTriticale::Do(), WinterBarleyStrigling::Do(), WinterRape::Do(), PTGrassGrazed::Do(), PTSorghum::Do(), FI_OFabaBean::Do(), FI_OCaraway1::Do(), DE_Maize::Do(), FI_OSpringOats::Do(), FR_SpringBarley::Do(), DE_MaizeSilage::Do(), OSpringBarleyPigs::Do(), FI_OSpringWheat::Do(), FI_GrasslandSilagePerennial1::Do(), FI_OTurnipRape::Do(), FI_GrasslandPasturePerennial1::Do(), FI_OSpringRape::Do(), FR_SpringOats::Do(), WinterBarley::Do(), PTRyegrass::Do(), FI_OSpringBarley_Fodder::Do(), NLPotatoesSpring::Do(), DE_SpringBarley::Do(), PLWinterRye::Do(), FR_Sorghum::Do(), FI_TurnipRape::Do(), FI_GrasslandSilageAnnual::Do(), FR_Maize::Do(), DK_OWinterWheat_CC::Do(), FR_Maize_Silage::Do(), PLMaizeSilage::Do(), FI_FabaBean::Do(), PLSpringBarley::Do(), NLPotatoes::Do(), PLMaize::Do(), DK_OWinterWheat::Do(), FI_OWinterRye::Do(), FR_WinterTriticale::Do(), FI_SpringRape::Do(), FR_Sunflower::Do(), FI_Caraway1::Do(), DE_Peas::Do(), SE_SpringBarley::Do(), FI_SpringBarley_Malt::Do(), DE_Legumes::Do(), PLWinterTriticale::Do(), PTCloverGrassGrazed1::Do(), DE_WinterRye::Do(), DE_OTriticale::Do(), FI_OWinterWheat::Do(), DE_OWinterRye::Do(), PLWinterBarley::Do(), PLWinterWheat::Do(), FI_SprSpringBarley_Fodder::Do(), DK_CloverGrassGrazed3::Do(), FI_SpringWheat::Do(), PLBeet::Do(), DE_OWinterBarley::Do(), DK_CloverGrassGrazed2::Do(), DE_Carrots::Do(), FI_SpringOats::Do(), PLSpringWheat::Do(), PLWinterWheatLate::Do(), FI_SpringBarley_Fodder::Do(), PLPotatoes::Do(), SE_WinterRape_Seed::Do(), SE_WinterWheat::Do(), DE_WinterBarley::Do(), DE_Cabbage::Do(), DE_Oats::Do(), FR_SpringWheat::Do(), DK_SeedGrassRye_Spring::Do(), DE_SpringRye::Do(), PLWinterRape::Do(), FR_WinterBarley::Do(), FI_WinterWheat::Do(), IRSpringBarley::Do(), IRWinterBarley::Do(), IRSpringOats::Do(), IRWinterOats::Do(), DE_WinterWheatLate::Do(), FR_WinterWheat::Do(), FI_WinterRye::Do(), IRSpringWheat::Do(), DE_Triticale::Do(), DE_WinterWheat::Do(), IRWinterWheat::Do(), FR_Potatoes::Do(), FR_WinterRape::Do(), DE_WinterRape::Do(), DK_SeedGrassFescue_Spring::Do(), WinterWheat::Do(), DE_SugarBeet::Do(), DE_Potatoes::Do(), DE_PotatoesIndustry::Do(), DK_OChristmasTrees_Perm::Do(), and DK_ChristmasTrees_Perm::Do().

◆ HarvestBF_Machine()

bool Farm::HarvestBF_Machine ( LE a_field,
double  a_user,
int  a_days 
)
virtual

Harvest bush fruit on a_field - tramlines since fruits are picked by machine, the bush stays on field with same vegetation height, thus suspects same % insects.

1815 {
1816  FarmToDo treatment = harvest_bushfruit;
1817  if ((0 >= a_days) || ((g_weather->GetRainPeriod(g_date->Date(), 5) < 0.1)
1818  && DoIt(DO_IT_PROB)))
1819  {
1820  LE* um = SetFunctionData(a_field, 1.0, 1.0, EL_TRAMLINE_DECAYTIME, treatment);
1821  a_field->SetGrowthPhase(harvest1);
1822  if (um != nullptr) {
1823  um->SetGrowthPhase(harvest1);
1824  }
1825  return true;
1826  }
1827  return false;
1828 }

References Calendar::Date(), DO_IT_PROB, EL_TRAMLINE_DECAYTIME, g_date, g_weather, Weather::GetRainPeriod(),