Loading [MathJax]/extensions/ams.js
ALMaSS  1.2 (after EcoStack, March 2024)
The Animal, Landscape and Man Simulation System
All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
UserDefinedFarm Class Reference

A farm that can have its rotation defined by the user at runtime. More...

#include <Farm.h>

Inheritance diagram for UserDefinedFarm:
Farm

Public Member Functions

 UserDefinedFarm (TTypesOfFarm farm_type, const char *fname, FarmManager *a_manager)
 
- Public Member Functions inherited from Farm
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...
 
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...
 

Protected Member Functions

virtual void InitiateManagement (void)
 Kicks off the farm's management. More...
 
- Protected Member Functions inherited from Farm
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...
 

Additional Inherited Members

- Public Attributes inherited from Farm
string m_rotfilename
 
- Protected Attributes inherited from Farm
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

A farm that can have its rotation defined by the user at runtime.

The rotation is controlled by a file with the format: N
Crop
Crop
Crop...
..........where N is the number of entries and "Crop" is replaced by the crop name for each entry in the rotation. There are 16 Userdefined farm types available numbered 1 to 16, but 2->16 have been excluded from the documentation because they are identical to this class in all but name.

Constructor & Destructor Documentation

◆ UserDefinedFarm()

UserDefinedFarm::UserDefinedFarm ( TTypesOfFarm  farm_type,
const char *  fname,
FarmManager a_manager 
)

User defined farms derived from this class have greater functionality and greater flexibility than those defined from Farm. There are three areas of added functionality:
1) The ability to define whether the farm is arable or stock
2) The ability to define farm intensity
3) The capability of defining permanent crops (e.g. permanent grass or silage maize). This means that whatever field is assigned this crop in the first year will retain it subsequently. Further functionality here is that the ideal crop area can also be specified. If so then the farmer will identify the field closest to that area and assign the crop to that.

3668  : Farm(a_manager) // Base class for the real ones
3669 {
3680 
3681  m_farmtype = farm_type;
3682 
3683 
3684  if ((std::string)cfgRotationFileDir.value()=="."){
3685  m_rotfilename = fname;
3686  }
3687  else{
3688  m_rotfilename = (std::string)cfgRotationFileDir.value()+ (std::string)"/"+(std::string)fname;
3689 
3690 
3691  }
3692  ifstream ifile;
3693  ifile.open(m_rotfilename,ios::in);
3694  if (!ifile.is_open()) {
3695  g_msg->Warn( WARN_FILE, " Unable to open file ", m_rotfilename );
3696  exit( 1 );
3697  }
3698  int input;
3699  double intensity;
3700  // First entry - arable/stock
3701  // Second entry - farm intensity. Zero = default, 1 extensive, 2 very extensive
3702  ifile >> input >> intensity;
3703  if (input==1) m_stockfarmer = true; else m_stockfarmer = false;
3704  SetIntensity(intensity);
3705  // Thrid entry - no permanent crops
3706  int permcrops;
3707  std::string cropref ="";
3708  ifile >> permcrops;
3709  // The problem here is that at the time when we reach this code there are no fields attached to the farm - so we need
3710  // to store this information - hence the vector of the vector of PermCropData
3711  PermCropData pcd;
3712  for (int i=0; i<permcrops; i++) {
3713  int pct;
3714  ifile >> cropref;
3716  ifile >> pct; // 0-100%
3717  pcd.Pct=pct;
3718  pcd.Tov=tov;
3719  m_PermCrops.push_back(pcd);
3720  }
3721  // 4th entry
3722  int nocrops;
3723  ifile >> nocrops;
3724  m_rotation.resize( nocrops );
3725  for ( int i = 0; i < nocrops; i++ ) {
3726  ifile >> cropref;
3728  m_rotation[ i ] = tov;
3729  }
3730  ifile.close();
3731 }

References cfgRotationFileDir, g_farmmanager, g_msg, Farm::m_farmtype, Farm::m_PermCrops, Farm::m_rotation, Farm::m_rotfilename, Farm::m_stockfarmer, PermCropData::Pct, Farm::SetIntensity(), PermCropData::Tov, FarmManager::TranslateVegCodes(), CfgStr::value(), MapErrorMsg::Warn(), and WARN_FILE.

Member Function Documentation

◆ InitiateManagement()

void UserDefinedFarm::InitiateManagement ( void  )
protectedvirtual

Kicks off the farm's management.

Reimplemented from Farm.

1280  {
1281  // First we need to assign the permanent crops if any.
1282  if (m_PermCrops.size()>0) {
1283  // We have something to do
1284  for (int i=0; i<(int)m_PermCrops.size(); i++) {
1286  }
1287  }
1289 }

References Farm::InitiateManagement().


The documentation for this class was generated from the following files:
Farm::AssignPermanentCrop
void AssignPermanentCrop(TTypesOfVegetation tov, int pct)
Used to assign a permanent crop to an otherwise rotational field polygon.
Definition: Farm.cpp:3734
WARN_FILE
Definition: MapErrorMsg.h:37
Farm::SetIntensity
void SetIntensity(double a_intensity)
Definition: Farm.h:964
CfgStr::value
char * value() const
Definition: Configurator.h:182
g_farmmanager
FarmManager * g_farmmanager
Definition: Farm.cpp:638
FarmManager::TranslateVegCodes
TTypesOfVegetation TranslateVegCodes(std::string &str)
Converts strings to tov_
Definition: Farm.cpp:2180
Farm::m_farmtype
TTypesOfFarm m_farmtype
Definition: Farm.h:1003
Farm::m_stockfarmer
bool m_stockfarmer
Definition: Farm.h:1006
PermCropData
Used for storing permanent crop data for the farm rotation.
Definition: Farm.h:357
Farm::m_rotation
vector< TTypesOfVegetation > m_rotation
Definition: Farm.h:1001
MapErrorMsg::Warn
void Warn(MapErrorState a_level, std::string a_msg1, std::string a_msg2)
Definition: MapErrorMsg.cpp:69
Farm::m_PermCrops
vector< PermCropData > m_PermCrops
Definition: Farm.h:1002
PermCropData::Tov
TTypesOfVegetation Tov
Definition: Farm.h:358
PermCropData::Pct
int Pct
Definition: Farm.h:359
g_msg
MapErrorMsg * g_msg
Definition: MapErrorMsg.cpp:41
Farm::Farm
Farm(FarmManager *a_manager)
Farm constructor - creates an instance of each possible crop type.
Definition: Farm.cpp:1051
TTypesOfVegetation
TTypesOfVegetation
Values that represent the types of vegetation that are represented in ALMaSS.
Definition: LandscapeFarmingEnums.h:192
cfgRotationFileDir
CfgStr cfgRotationFileDir("ROT_FILES_DIR", CFG_CUSTOM, ".")
Farm::m_rotfilename
string m_rotfilename
Definition: Farm.h:759
Farm::InitiateManagement
virtual void InitiateManagement(void)
Kicks off the farm's management.
Definition: Farm.cpp:1295