ALMaSS Hare ODDox
1.1
The hare model description following ODdox protocol
|
Go to the documentation of this file.
475 bool a_lock,
int a_start,
bool a_first_year,
551 void SimpleEvent(
long a_date,
int a_todo,
bool a_lock);
557 void SimpleEvent_(
long a_date,
int a_todo,
bool a_lock,
Farm* a_farm, LE* a_field);
635 if(a_value==
"yes" || a_value==
"YES" || a_value==
"Yes" || a_value==
"1"){
m_fixed[i]=
true;}
640 if(a_value==
"yes" || a_value==
"YES" || a_value==
"Yes" || a_value==
"1"){
m_fodder[i]=
true;}
780 virtual ~Farm(
void );
805 for (
int i = 0; i <
m_fields.size(); i++)
807 int openness =
m_fields[i]->GetOpenness();
808 if (openness > op) op = openness;
814 virtual bool SleepAllDay( LE *a_field,
double a_user,
int a_days );
815 virtual bool AutumnPlough( LE *a_field,
double a_user,
int a_days );
816 virtual bool StubblePlough(LE *a_field,
double a_user,
int a_days);
818 virtual bool AutumnHarrow( LE *a_field,
double a_user,
int a_days );
819 virtual bool AutumnRoll( LE *a_field,
double a_user,
int a_days );
822 virtual bool AutumnSow( LE *a_field,
double a_user,
int a_days );
823 virtual bool WinterPlough( LE *a_field,
double a_user,
int a_days );
824 virtual bool DeepPlough( LE *a_field,
double a_user,
int a_days );
825 virtual bool SpringPlough( LE *a_field,
double a_user,
int a_days );
826 virtual bool SpringHarrow( LE *a_field,
double a_user,
int a_days );
827 virtual bool SpringRoll( LE *a_field,
double a_user,
int a_days );
828 virtual bool SpringSow( LE *a_field,
double a_user,
int a_days );
830 virtual bool HerbicideTreat( LE *a_field,
double a_user,
int a_days );
831 virtual bool GrowthRegulator( LE *a_field,
double a_user,
int a_days );
832 virtual bool FungicideTreat( LE *a_field,
double a_user,
int a_days );
836 virtual bool Molluscicide( LE *a_field,
double a_user,
int a_days );
837 virtual bool RowCultivation( LE *a_field,
double a_user,
int a_days );
838 virtual bool Strigling( LE *a_field,
double a_user,
int a_days );
839 virtual bool StriglingSow( LE *a_field,
double a_user,
int a_days );
840 virtual bool StriglingHill(LE *a_field,
double a_user,
int a_days);
841 virtual bool HillingUp( LE *a_field,
double a_user,
int a_days );
842 virtual bool Water( LE *a_field,
double a_user,
int a_days );
843 virtual bool Swathing( LE *a_field,
double a_user,
int a_days );
844 virtual bool Harvest(LE *a_field,
double a_user,
int a_days);
845 virtual bool HarvestLong(LE *a_field,
double a_user,
int a_days);
846 virtual bool CattleOut(LE *a_field,
double a_user,
int a_days);
848 virtual bool CattleIsOut( LE *a_field,
double a_user,
int a_days,
int a_max );
849 virtual bool CattleIsOutLow( LE *a_field,
double a_user,
int a_days,
int a_max );
850 virtual bool PigsOut( LE *a_field,
double a_user,
int a_days );
851 virtual bool PigsAreOut( LE *a_field,
double a_user,
int a_days );
853 virtual bool CutToHay( LE *a_field,
double a_user,
int a_days );
854 virtual bool CutWeeds( LE *a_field,
double a_user,
int a_days );
855 virtual bool CutToSilage( LE *a_field,
double a_user,
int a_days );
856 virtual bool CutOrch( LE *a_field,
double a_user,
int a_days );
857 virtual bool StrawChopping( LE *a_field,
double a_user,
int a_days );
858 virtual bool HayTurning( LE *a_field,
double a_user,
int a_days );
859 virtual bool HayBailing( LE *a_field,
double a_user,
int a_days );
862 virtual bool FP_NPKS( LE *a_field,
double a_user,
int a_days );
863 virtual bool FP_NPK( LE *a_field,
double a_user,
int a_days );
864 virtual bool FP_PK( LE *a_field,
double a_user,
int a_days );
865 virtual bool FP_LiquidNH3( LE *a_field,
double a_user,
int a_days );
866 virtual bool FP_Slurry( LE *a_field,
double a_user,
int a_days );
869 virtual bool FP_Manure( LE *a_field,
double a_user,
int a_days );
870 virtual bool FP_GreenManure( LE *a_field,
double a_user,
int a_days );
871 virtual bool FP_Sludge( LE *a_field,
double a_user,
int a_days );
872 virtual bool FP_RSM(LE *a_field,
double a_user,
int a_days);
873 virtual bool FP_Calcium(LE *a_field,
double a_user,
int a_days);
874 virtual bool FA_NPKS(LE *a_field,
double a_user,
int a_days);
875 virtual bool FA_NPK( LE *a_field,
double a_user,
int a_days );
876 virtual bool FA_PK( LE *a_field,
double a_user,
int a_days );
877 virtual bool FA_Slurry( LE *a_field,
double a_user,
int a_days );
880 virtual bool FA_Manure( LE *a_field,
double a_user,
int a_days );
881 virtual bool FA_GreenManure( LE *a_field,
double a_user,
int a_days );
882 virtual bool FA_Sludge( LE *a_field,
double a_user,
int a_days );
883 virtual bool FA_RSM(LE *a_field,
double a_user,
int a_days);
884 virtual bool FA_Calcium(LE *a_field,
double a_user,
int a_days);
885 virtual bool Biocide(LE *a_field,
double a_user,
int a_days);
886 virtual bool BedForming(LE *a_field,
double a_user,
int a_days);
887 virtual bool ShallowHarrow(LE *a_field,
double a_user,
int a_days);
889 virtual bool FlowerCutting(LE *a_field,
double a_user,
int a_days);
890 virtual bool BulbHarvest(LE *a_field,
double a_user,
int a_days);
891 virtual bool StrawCovering(LE *a_field,
double a_user,
int a_days);
892 virtual bool StrawRemoval(LE *a_field,
double a_user,
int a_days);
896 LE *a_field,
int a_todo,
long a_num,
897 bool a_lock,
int a_start,
899 bool DoIt(
double a_probability);
910 int ind = a_index - 1;
911 if (ind < 0) ind = (int)
m_rotation.size() - 1;
918 int ind = a_index + 1;
1716 void AddField(
int a_OwnerIndex, LE* a_newland,
int a_Owner);
1730 return (
GetFarmPtr(a_farmref)->GetTotalArea());
1745 return (
GetFarmPtr(a_farmref)->GetNoFields());
1750 return (
GetFarmPtr(a_farmref)->GetValidCoords());
1756 return (
GetFarmPtr(a_farmref)->GetNoOpenFields(a_openness));
1762 return (
GetFarmPtr(a_farmref)->GetAreaOpenFields(a_openness));
1767 for (
unsigned int i = 0; i <
m_farms.size( ); i++) {
1768 if (a_owner ==
m_farms[ i ]->GetFarmNumber( )) {
1772 g_msg->Warn(
"FarmManager::GetFarmPtr - missing farm ref", a_owner );
1785 bool InIllegalList(
int a_farm_ref, vector<int> * a_farmlist );
1811 for (
unsigned int i = 0; i <
m_farms.size(); i++)
1813 if (a_farmref ==
m_farms[i]->GetFarmNumber())
1815 return m_farms[i]->GetCentroids();
1818 g_msg->Warn(
"FarmManager::GetFarmCentroid - missing farm ref", a_farmref);
1890 for (
int i = 0; i < (int)
m_farms.size(); i++)
1897 g_msg->Warn(
"FarmManager::GetRenumberedFarmRef(int a_farmref) Farm reference number not found in m_farmmapping_lookup ", a_farmref );
2062 bool Harvest( LE *a_field,
double a_user,
int a_days );
2084 void Init(ofstream * ap_output_file);
2348 void sortCrops(vector<CropSort> &cropsToSort,
string sortingKey);
2352 virtual void increaseCrops(vector<CropSort>cropsToIncrease,
double &howMuchToIncrease);
2354 virtual void decreaseCrops(vector<CropSort>cropsToDecrease,
double &howMuchToDecrease);
2424 virtual void increaseCrops(vector<CropSort>cropsToIncrease,
double &howMuchToIncrease);
2426 virtual void decreaseCrops(vector<CropSort>cropsToDecrease,
double &howMuchToDecrease);
void assignFixed()
Adds areas of fixed crops to the variable m_assigned. For each fixed crop it saves its area under var...
void findTotalArea()
Determines m_totalArea of a farm.
virtual bool FP_Sludge(LE *a_field, double a_user, int a_days)
Spread sewege on a_field owned by an arable farmer.
virtual bool PigsAreOut(LE *a_field, double a_user, int a_days)
Start a pig grazing event on a_field today or soon.
A farm that can have its rotation defined by the user at runtime.
SpringBarley * m_springbarley
PLWinterTriticale * m_plwintertriticale
UserDefinedFarm4(FarmManager *a_manager)
UserDefinedFarm31(const char *fname, FarmManager *a_manager)
UserDefinedFarm3(FarmManager *a_manager)
bool InIllegalList(int a_farm_ref, vector< int > *a_farmlist)
Checks a list to see if a farm matches the illegal list of references.
NoPesticideBaseFarm(FarmManager *a_manager)
void DistributeFarmerTypes()
Randomly assigns farmer types to farms (OptimisingFarm) in proportions specified in an input file.
void determineAreas_ha(vector< CropOptimised * >crops)
Determines areas of crops in ha.
void Set_crops_summary_BIs_herb(int i, double BIherb)
void ReadLivestockData()
Reads the data on livestock parameters (do not vary with farm variables) and saves them in a vector D...
AgroChemIndustryCerealFarm3(FarmManager *a_manager)
virtual bool SpringRoll(LE *a_field, double a_user, int a_days)
Carry out a roll event in the spring on a_field.
OptimisingPigFarm(FarmManager *a_myfarmmanager, int a_No)
TTypesOfOptFarms Get_farmType(void)
void correctFodderDemand(int a_foobar)
Determines how much fodder is produced from fixed crops and min. areas of variable crops.
void ReadInitialCropAreas()
Reads the data on farms' initial crop distributions and saves them in a vector DataForOptimisation::m...
FieldPeasStrigling * m_fieldpeasstrigling
int GetRenumberedFarmRef(int a_farmref)
Returns the farm ref index for a farmref.
void AssignPermanentCrop(TTypesOfVegetation tov, int pct)
Used to assign a permanent crop to an otherwise rotational field polygon.
double Get_cropTotals(int i)
PLFodderLucerne2 * m_plfodderlucerne2
AgroChemIndustryCereal * m_agrochemindustrycereal
void Set_cropArea(double a_area)
virtual bool FA_Slurry(LE *a_field, double a_user, int a_days)
Spready slurry on a_field owned by an stock farmer.
A farm that can have its rotation defined by the user at runtime.
void SetFarmNumber(int a_farm_num)
void Add_to_cropTotals(int i, double value)
virtual bool HerbicideTreat(LE *a_field, double, int a_days)
Carries out herbicide application. Saves information on each application for a given crop.
void Centroids()
Finds farm's centroids - x and y.
int m_soilSubType
Farm's soil subtype. Defined only for cattle farms on sandy soil (0-bad, 1-good, 2-undefined).
int m_number
Number of animals of a given type at a farm.
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 co...
virtual void checkWinterRotation1()
Animal farm version of the OptimisingFarm::checkWinterRotation1() function (accounts for fodder chang...
double m_totalFUdemandBefore
Farm's total demand for fodder. [fodder units]
A farm that can have its rotation defined by the user at runtime.
void ReadCropsData_perSoilType_almass()
Reads the data on crops' parameters that vary with a soil type (alfa, beta1, beta2,...
Struct used for storing data on pesticide usage throughout the whole simulation (one instance,...
TTypesOfFarmSize md_farmSize
virtual bool SpringPlough(LE *a_field, double a_user, int a_days)
Carry out a ploughing event in the spring on a_field.
SpringBarleyStrigling * m_springbarleystrigling
PlantProtectionProducts
A list PPP names for tracking by the Pesticide class.
PesticideTrialControl(FarmManager *a_manager)
virtual bool HerbicideTreat(LE *a_field, double a_user, int a_days)
Apply herbicide to a_field.
UserDefinedFarm30(const char *fname, FarmManager *a_manager)
double m_totalArea_original
Total area of a farm as in bedriftsmodel, i.e. original farm optimization model. [ha].
HunterList m_HuntersList
A list of hunters allocated to this farm.
int GetNoOpenFields(int a_openness)
Returns the number of the fields above an openness of a_openness.
void FindNeighbours()
Finds all OptimisingFarms' neighbours and saves them in the farm's OptimisingFarm::m_neighbours vecto...
virtual bool Strigling(LE *a_field, double a_user, int a_days)
Carry out a mechanical weeding on a_field.
double m_BI
Summary value of BI for herbicides and fung- and insecticides [BI/ha].
WinterWheat * m_winterwheat
A farm that can have its rotation defined by the user at runtime.
int GetFarmNoOpenFields(int a_farmref, int a_openness)
Returns the number of fields with openness more than a_openness.
ConvMarginalJord(FarmManager *a_manager)
double m_totalHoeing
Total hoeing planned at a farm.
bool CheckOpenness(int a_openness, int a_ref)
Check if a farm has at least one field with openness above a_openness.
OrganicPlant(FarmManager *a_manager)
vector< double > m_Nnorm
Maximum amount of fertilizer (N) that can be applied for a given crop [kg N/ha]. Soil specific.
double m_totalArea
Total area of a farm. A sum of initial crop areas (if in bedriftsmodel, i.e. original farm optimizati...
double m_actual_costs
Actual costs at a farm in a given year.
Class for storing data for optimisation.
NLGrassGrazed1Spring class .
virtual bool Harvest(LE *a_field, double a_user, int a_days)
Carry out a harvest on a_field.
bool LeSwitch(FarmEvent *ev)
Call do function for any crop with an outstanding event. Signal if the crop has terminated.
vector< CropOptimised * > m_grownVariableCrops
Vector of pointers to variable crops that are grown on area larger than areaMin (after determineAreas...
void setRotationCropsAtMax()
Increases area of winter rotation crops to their max. allowed area.
A farm that can have its rotation defined by the user at runtime.
virtual int GetFirstCropIndex(TTypesOfLandscapeElement a_type)
Gets the first crop for the farm.
ConventionalPig(FarmManager *a_manager)
virtual bool PreseedingCultivatorSow(LE *a_field, double a_user, int a_days)
Carry out preseeding cultivation together with sow on a_field (tilling and sowing set including culti...
SpringRape * m_springrape
OTriticale * m_otriticale
void Translate_crops_to_almass()
Translates crops from Bedriftsmodel (original farm optimization model) to Almass crops....
void Set_crops_summary_BIs_fi(int i, double BIfi)
double Get_sellingPrice_lastyr(int i)
double totalOptFarmsArea_cattle
PLWinterRape * m_plwinterrape
virtual bool FP_ManganeseSulphate(LE *a_field, double a_user, int a_days)
Apply Manganse Sulphate to a_field owned by an arable farmer.
APoint GetFarmValidCoords(int a_farmref)
Returns the number of fields owned by a from the farm ref num.
TTypesOfSoils Get_soilType(void)
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...
double m_weeding
Value of mechanical weed control for a crop - manual weeding [DKK/ha].
NonAnimalFarm(FarmManager *a_myfarmmanager, int a_No)
virtual bool PigsAreOutForced(LE *a_field, double a_user, int a_days)
Start a pig grazing event on a_field today - no exceptions.
void findGrossMargin(CropOptimised *a_crop, int a_foobar, double benefit)
Determines the gross margin (CropOptimised::m_GM) for a given crop at a farm.
vector< double > m_sellingPrice
Selling price of a crop [DKK/hkg]. Farm type specific and soil type specific.
virtual bool ProductApplication(LE *a_field, double a_user, int a_days, double a_applicationrate, PlantProtectionProducts a_ppp)
Apply test pesticide to a_field.
SpringBarleySeed * m_springbarleyseed
A struct to hold the information required to trigger a farm event.
UserDefinedFarm19(const char *fname, FarmManager *a_manager)
virtual void MakeStockFarmer(void)
void Set_fixed(string a_value, int i)
Rotational set-aside management class .
void Set_cropTypes_almass_str(string crop_type)
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.
A farm that can have its rotation defined by the user at runtime.
double totalOptFarmsArea_other
virtual bool FP_NPK(LE *a_field, double a_user, int a_days)
Apply NPK fertilizer, on a_field owned by an arable farmer.
virtual bool CutToSilage(LE *a_field, double a_user, int a_days)
Cut vegetation for silage on a_field.
OMaizeSilage * m_omaizesilage
CloverGrassGrazed2 * m_CGG2
SpringBarleySpr * m_springbarleyspr
bool Harvest(LE *a_field, double a_user, int a_days)
OptimisingFarm's virtual version of Farm::Harvest(). Saves information on biomass of a crop at harves...
bool DoIt(double a_probability)
Return chance out of 0 to 100.
double Get_sellingPrice(int i)
void ChooseDecisionMode_for_farms()
Calls OptimisingFarm::ChooseDecisionMode for all optimising farms.
vector< unsigned > polylist
void CreateFarms(const char *a_farmfile)
vector< double > m_sellingPrice_lastyr
Selling price of a crop in a previous year [DKK/hkg]. Farm type specific and soil type specific.
Subclass of the AnimalFarm.
OptimisingCattleFarm(FarmManager *a_myfarmmanager, int a_No)
int GetFirstDate(TTypesOfVegetation a_tov)
Gets the start date for a crop type.
virtual bool FungicideTreat(LE *a_field, double, int a_days)
Carries out fungicide application. Saves information on each application for a given crop.
int Get_soilSubType(void)
int m_almass_no
Farm's almass number.
vector< double > m_alfa
Crop parameter for response (growth) function (resp = alfa + beta1*N + beta2*N^2; defines relationshi...
virtual bool Molluscicide(LE *a_field, double a_user, int a_days)
Apply molluscidie to a_field.
TTypesOfVegetation GetCrop(int a_index)
UserDefinedFarm29(const char *fname, FarmManager *a_manager)
UserDefinedFarm5(FarmManager *a_manager)
void ReadCropsData_perFarm_and_Soil_and_Size_almass()
Reads the data on crops' parameters that vary with a farm type, soil type and farm size (rotationMax,...
double m_totalBIFi
Total amount of fung- and insecticides which is planned to be applied at a farm. Expressed as a Treat...
int GetFarmTotalSize(int a_farmref)
Returns the total farm area from the farm ref num.
virtual int GetNextCropIndex(int a_rot_index)
Returns the next crop in the rotation.
double Get_livestockParameter(int i)
virtual bool StrawRemoval(LE *a_field, double a_user, int a_days)
Straw covering applied on 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 (normall...
PLSpringBarleySpr class .
virtual void increaseCrops(vector< CropSort >cropsToIncrease, double &howMuchToIncrease)
Increases area of cropsToIncrease by howMuchToIncrease.
void Set_cropTypes_str(string crop_type)
virtual bool FA_GreenManure(LE *a_field, double a_user, int a_days)
Spread green manure on a_field owned by an stock farmer.
void DumpFarmrefs()
dumps the farmrefs file to a standard named file
double m_totalProfit
Planned total profit (= income - costs) at a farm. In case of animal farms costs of purchased fodder ...
vector< double > m_cropTotals_pig_sum
Stores the sums of crops areas on pig farms within one simulation at the landscape level.
Struct used for sorting crops.
A farm that can have its rotation defined by the user at runtime.
int GetFarmNoLookup(int a_ref)
Get a farm reference from the lookup table.
OGrazingPigs * m_ograzingpigs
bool DoIt_prob(double a_probability)
Return chance out of 0 to 1.
vector< TTypesOfCrops > m_cropTypes
Crop types saved as enumarator types (Bedriftsmodel i.e. original crop optimization model crop mode).
double m_totalCosts
Planned total costs of growing crops at a farm. [DKK].
void ReadCropsData_perFarmType()
Reads the data on crops' parameters that vary with a farm type (fixed, fodder, FUKey) and saves them ...
virtual void determineAreas(int a_foobar)
Determines areas of variable crops.
Used for storing farmers field size vectors.
NLPotatoesSpring * m_nlpotatoesspring
UserDefinedFarm6(FarmManager *a_manager)
NorwegianPotatoes * m_norwegianpotatoes
int FindClosestFarmOpennessProbSmallIsBest(HunterInfo a_hinfo, vector< int > *a_farmlist, int a_openness, vector< int > *a_farmsizelist)
Finds the closest farm to this co-ordinate with openness more than a value but uses a probability dis...
double GetSpilledMaize()
Returns the average amount of spilled maize in KJ/m2 this year.
void RemoveField(int a_OwnerIndex, LE *a_field)
TTypesOfVegetation m_cropType_almass
Type/name of a crop (ALMaSS crops).
TTypesOfCrops Get_cropTypes(int i)
virtual bool BedForming(LE *a_field, double a_user, int a_days)
Do bed forming up on a_field, probably of carrots.
void InitFarms()
Calls OptimisingFarm::Init for all optimising farms.
PLWinterBarley * m_plwinterbarley
NLSpringBarley * m_nlspringbarley
void determineFodderAreas(int a_foobar)
Determines areas of fodder crops and corrects areas of non-fodder crops.
SeedGrass2 * m_seedgrass2
void CropDistribution()
Calculates total crop areas (at the landscape level). Includes results of the initial farm otpimisati...
virtual void checkRestrictions()
Checks if the restrictions are fulfilled and corrects crops' areas if necessary.
OFodderbeet * m_ofodderbeet
double m_costs_ha
Costs of growing 1 ha of a crop. Include costs of labour and machine (constant), pesticides (herbicid...
OWinterWheat * m_owinterwheat
void ReadCropsData_perFarmType_almass()
Reads the data on crops' parameters that vary with a farm type (fixed, fodder, FUKey) and saves them ...
A farm that can have its rotation defined by the user at runtime.
AgroChemIndustryCerealFarm1(FarmManager *a_manager)
virtual bool FA_Manure(LE *a_field, double a_user, int a_days)
Spread manure on a_field owned by an stock farmer.
virtual void checkWinterRotation1()
Checks if the restriction on a winter rotation is fulfilled.
int FindClosestFarmOpenness(HunterInfo a_hinfo, vector< int > *a_farmlist, int a_openness)
Finds the closest farm to this co-ordinate but uses a probability distribtution for acceptance.
void AddToIllegalList(int a_farm_ref, vector< int > *a_farmlist)
Add to a list if a farm is not already among the illegal list of references.
virtual bool Spraying_fungins(TTypesOfVegetation a_tov_type)
Returns true if a farmer decided to treat a given crop with fung- and insecticides.
void Set_cropParameter(double a_value, int i)
NLGrassGrazedLast * m_nlgrassgrazedlast
TTypesOfOptFarms Get_farmType(int a_almass_no)
Used by FarmManager::CreateFarms. Finds a matching almass number and returns farm's type.
void ReadFarmsData()
Reads farm level parameters and saves them in a vector DataForOptimisation::m_farm_data.
void Set_crops_fertilizer_trade(int i, double fert_trade)
UserDefinedFarm12(FarmManager *a_manager)
void Set_livestockTypes(TTypesOfAnimals livestock_type)
void Match_crop_to_field(LE *a_field)
Finds a crop to be grown on a given field next year.
virtual bool FA_Sludge(LE *a_field, double a_user, int a_days)
Spread sewege sludge on a_field owned by an stock farmer.
int GetNextCropStartDate(LE *a_field, TTypesOfVegetation &a_curr_veg)
Returns the start date of the next crop in the rotation.
NLGrassGrazed1 * m_nlgrassgrazed1
A farm that can have its rotation defined by the user at runtime.
virtual bool SpringSowWithFerti(LE *a_field, double a_user, int a_days)
Carry out a sowing event with start fertilizer in the spring on a_field.
TTypesOfVegetation GetNextCrop(int a_index)
void ReadCropsData_perSoilType()
Reads the data on crops' parameters that vary with a soil type (alfa, beta1, beta2,...
virtual bool FA_NPKS(LE *a_field, double a_user, int a_days)
Apply NPKS fertilizer, on a_field owned by a stock farmer.
TTypesOfFarm GetType(void)
CropOptimised * Get_crop(int i)
OptimisingFarm * Get_Neighbour(int i)
NLSpringBarleySpring * m_nlspringbarleyspring
void findYieldLoss(CropOptimised *a_crop)
Determines the yield losses (CropOptimised::m_lossHerb, CropOptimised::m_lossFi, CropOptimised::m_tot...
double m_BIHerb
Value of BI for herbicides [BI/ha].
A farm that can have its rotation defined by the user at runtime.
void Set_sellingPrice(double a_value, int i)
OWinterRape * m_owinterrape
A farm that can have its rotation defined by the user at runtime.
OWinterBarley * m_owinterbarley
void Initialize(FarmManager *a_pfm)
Assigns to each farm its farm type, farm size, farm's real ID number, and soil type....
double m_actual_income
An actual income at a farm in a given year.
virtual bool ProductApplication_DateLimited(LE *a_field, double, int, double a_applicationrate, PlantProtectionProducts a_ppp)
Special pesticide trial functionality.
int GetFarmAreaOpenFields(int a_farmref, int a_openness)
Returns the area of fields with openness more than a_openness.
TTypeOfFarmerGoal Get_main_goal()
virtual bool CutToHay(LE *a_field, double a_user, int a_days)
Carry out hay cutting on a_field.
CloverGrassGrazed1 * m_CGG1
NLCabbageSpring * m_nlcabbagespring
A farm that can have its rotation defined by the user at runtime.
void ReadInitialCropAreas_almass()
Reads the data on farms' initial crop distributions and saves them in a vector of a DataForOptimisati...
SpringBarleyCloverGrassStrigling * m_springbarleyclovergrassstrigling
vector< double > m_previous_costs
Vector of costs from previous years.
A class for storing livestock parameters and variables for optimising farms.
AgroChemIndustryCerealFarm2(FarmManager *a_manager)
virtual bool FA_NPK(LE *a_field, double a_user, int a_days)
Apply NPK fertilizer to a_field owned by an stock farmer.
UserDefinedFarm24(const char *fname, FarmManager *a_manager)
UserDefinedFarm25(const char *fname, FarmManager *a_manager)
virtual bool FungicideTreat(LE *a_field, double a_user, int a_days)
Apply fungicide to a_field.
NLWinterWheat * m_nlwinterwheat
FodderGrass * m_foddergrass
virtual bool HillingUp(LE *a_field, double a_user, int a_days)
Do hilling up on a_field, probably of potatoes.
int Get_NeighboursSize(void)
double m_n
Total amount of fertilizer applied per ha of a crop [kg N/ha].
WinterRape * m_winterrape
A farm that can have its rotation defined by the user at runtime.
double m_amounts[ppp_foobar]
double m_area_scaling_factor
Factor used to scale areas of fixed crops and livestock numbers. Used to adjust these values to the f...
virtual void InitiateManagement(void)
Kicks off the farm's management.
void ReadRotation(std::string fname)
Reads a rotation file into the rotation.
TTypesOfVegetation Get_crops_summary_BIs_tov(int i)
void checkCattleRotation_almass()
Checks if the cattle restriction is fulfilled - in the ALMaSS crops mode.
CropOptimised * m_fakeCrop
Crop used to fill up area of a farm up to 100% in case its non-fodder crops do not sum to 100% in det...
Subclass of the AnimalFarm.
Struct redefining operator < - used for sorting crops.
int FindFarmWithRandom(vector< int > *a_farmlist)
Finds a farm openness more than a value not on the list.
vector< double > m_cropAreas
Vector containing values of initial (i.e. in year the data is taken for) crop areas at farms included...
The base class for all crops.
vector< double > m_energy_maize_price
Vector with energy maize prices for each year of simulation.
void Check_SG_and_CGG()
Modifies areas of SeedGrass1 and SeedGrass2, CloverGrassGrazed1 and CloverGrassGrazed2 to be even....
double m_GM
Value of gross margin for a crop (m_income_ha - m_costs_ha) [DKK/ha].
virtual bool FP_PK(LE *a_field, double a_user, int a_days)
Apply PK fertilizer, on a_field owned by an arable farmer.
NLSpringBarleySpring class .
double m_totalNt
Total amount of fertilizer purchased at a farm. [kg].
double Get_rotationMax(int i)
TTypesOfSoils m_soilType
Farm's soil type (sandy, clay, other).
OptimisingFarm(FarmManager *a_myfarmmanager, int a_No)
The constructor.
A farm that can have its rotation defined by the user at runtime.
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.
WinterRapeStrigling * m_winterrapestrigling
MaizeStrigling * m_maizestrigling
UserDefinedFarm17(FarmManager *a_manager)
Farm * GetFarmPtr(int a_owner)
Returns the pointer to a farm with a specific number.
int GetTotalArea(void)
Returns the area of all fields owned by that farm.
void findTotalNanim()
Determines total animal fertilizer (m_totalNanim) available at a farm.
double m_fodderToProduceBefore
Fodder that has to be produced to fulfill the min. fodder production restriction at the beginning of ...
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)
void SimpleEvent(long a_date, int a_todo, bool a_lock)
Adds an event to this crop management.
OWinterWheatUndersownExt * m_owinterwheatundersownext
UserDefinedFarm33(const char *fname, FarmManager *a_manager)
NorwegianSpringBarley * m_norwegianspringbarley
double m_totalLoss
Summary value of the yield loss due to the limited use of herbicides and fung- and insecticides [%].
string Get_cropTypes_almass_str(int i)
virtual bool CattleOutLowGrazing(LE *a_field, double a_user, int a_days)
Start a extensive grazing event on a_field today.
void Set_FUKey(double a_value, int i)
UserDefinedFarm34(const char *fname, FarmManager *a_manager)
bool force_deliberation
If set to true, a farm must use deliberation as a decision strategy.
int FindFarmWithOpenness(vector< int > *a_farmlist, int a_openness)
Finds a farm openness more than a value not on the list.
OSeedGrass2 * m_oseedgrass2
virtual void increaseCrops(vector< CropSort >cropsToIncrease, double &howMuchToIncrease)
Increases area of crops by a specified number.
int InvIntPartition(vector< tpct > *items, int target)
Finds all possible sums of the integers in the items array.
virtual void checkWinterCrops()
Animal farm version of the checkWinterCrops() function (accounts for fodder changes).
double GetSpilledGrain()
Returns the average amount of spilled grain in KJ/m2 this year.
WinterBarleyStrigling * m_winterbarleystrigling
void Set_rotationMin(double a_value, int i)
virtual bool Spraying_herbicides(TTypesOfVegetation a_tov_type)
Returns true if a farmer decided to treat a given crop with herbicides.
virtual void MakeStockFarmer(void)
virtual bool FP_Manure(LE *a_field, double a_user, int a_days)
Spread manure on a_field owned by an arable farmer.
void findBIs(CropOptimised *a_crop, double benefit)
Determines the optimal Treatment frequency indices (behandling index, BI in Danish) (CropOptimised::m...
void Print_FarmVariables(ofstream *ap_output_file)
Prints farm-level variables to a text file (one file for all farms).
vector< double > m_animals_numbers
Vector for storing numbers of animals at a farm in previous years (3).
void ReadLookupTable()
Reads the lookup table with allowed/forbidden crop order from a text file and saves it into a vector ...
void determineMinFodder(int a_foobar)
Covers the min. required fodder production for animal farms.
vector< int > m_decision_mode_counters
Vector with counters for each decision mode. 0 - imitation, 1 - social comparison,...
PermanentSetAside * m_permanentsetaside
double Get_cropArea(int index)
vector< int > m_winterMax
Maximal area taken by winter crops at a farm. [%].
virtual ~OptimisingPigFarm()
UserDefinedFarm(const char *fname, FarmManager *a_manager)
void Set_winterMax(int a_value, int i)
OptimisingFarm * m_previously_imitated_neighbour
The neighbouring farmer whose crops might be copied in imitation and social comparison decision modes...
Farm * GetFarmPtrIndex(int a_index)
Returns the pointer to a farm with a specific index.
virtual double Prob_multiplier()
Used for storing permanent crop data for the farm rotation.
vector< AlmassCrop > Get_rotational_crops_visible()
virtual bool AutumnSow(LE *a_field, double a_user, int a_days)
Carry out a sowing event in the autumn on a_field.
Used during saving farm/hunter information.
ConventionalPlant(FarmManager *a_manager)
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.
double m_lossFi
Value of the yield loss due to the limited use of fung- and insecticides [%].
A class for storing all parameters and results of crop optimisation.
vector< CropSort > m_cattleCrops_almass
Vector of crops used in checkCattleRotation_almass.
virtual void HandleEvents(void)
If there are events to carry out do this, and perhaps start a new crop.
void findNanim()
Determines amount of animal fertilizer per ha (m_Nanim) at a farm.
WinterWheatStriglingCulm * m_winterwheatstriglingculm
vector< double > m_beta2
Crop parameter for response (growth) function (resp = alfa + beta1*N + beta2*N^2; defines relationshi...
virtual bool Biocide(LE *a_field, double a_user, int a_days)
Biocide applied on a_field.
NLMaizeSpring * m_nlmaizespring
Struct for storing ALMaSS crop type (TTypesOfVegetation) with a corresponding value (mainly crop area...
TTypesOfSoils TranslateSoilCodes(string &str)
double m_totalGrooming
Total grooming planned at a farm.
UserDefinedFarm14(FarmManager *a_manager)
int GetMaxOpenness()
Returns the maximum openness score of the fields.
A farm that can have its rotation defined by the user at runtime.
double m_optimalN
Optimal amount of fertilizer per ha of a crop supposing ferilizer price equals zero [kg N/ha]....
vector< AlmassCrop > Get_rotational_crops()
void findMWeedControl(CropOptimised *a_crop)
Determines the optimal mechanical weed control means (CropOptimised::m_grooming, CropOptimised::m_hoe...
TTypesOfVegetation Get_cropTypes_almass(int i)
TTypesOfCrops TranslateCropsCodes(string &str)
virtual void preventCashCrops()
Prevents small cattle farms from growing cash crops and maize silage.
double crop_parameter(int index, string par_name)
Reads in crop parameters that do NOT vary with any farm level parameters.
double m_hoeing
Value of mechanical weed control for a crop - hoeing [DKK/ha].
void Set_Crop(CropOptimised *p_crop)
vector< bool > m_fixed
Crop Boolean parameter - fixed/variable crop. Farm type specific.
virtual void MakeStockFarmer(void)
vector< double > m_cropTotals
Stores crops areas at the landscape level per year.
A farm that can have its rotation defined by the user at runtime.
virtual void decreaseCrops(vector< CropSort >cropsToDecrease, double &howMuchToDecrease)
Decreases area of a crops by a specified number.
double m_exp_profit
An expected farm's profit for a given year.
void findFertilizer(CropOptimised *a_crop, int a_foobar, double benefit)
Determines the optimal amounts of: total fertilizer (CropOptimised::m_n) and purchased fertilizer (Cr...
void PrintOutput(TTypesOfCropVariables a_var, string a_fileName)
Makes an output file for one crop variable and prints its values for each crop and each OptimisingFar...
NLGrassGrazedLast class .
double m_actual_profit
An actual profit realised at a farm in a given year.
Inbuilt special purpose farm type.
void ReadCropsData_perFarm_and_Soil()
Reads the data on crops' parameters that vary with a farm and soil type (sellingPrice) and saves them...
void ActualProfit()
Calls OptimisingFarm::ActualProfit for all optimising farms.
virtual void InitiateManagement(void)
Kicks off the farm's management.
virtual void checkRestrictions()
Checks if the restrictions are fulfilled and corrects crops' areas if necessary.
A farm that can have its rotation defined by the user at runtime.
double m_totalFUgrown
Fodder grown, i.e. obtained from growing fodder crops. [fodder units].
void Print_rotations(ofstream *ap_output_file)
Prints the content of a farm's m_rotation. Not used in ALMaSS crop mode.
TTypesOfOptFarms md_farmType
vector< double > m_previous_incomes
Vector of incomes from previous years.
virtual void preventCashCrops()
Prevents small cattle farms from growing cash crops and maize silage.
UserDefinedFarm16(FarmManager *a_manager)
Subclass of the NonAnimalFarm.
vector< Hunter * > HunterList
TTypesOfAnimals m_animalType
Type of livestock.
void ReadCropsData_almass()
Reads the data on crops' parameters that do not vary with farm variables and saves them in a vector D...
vector< double > m_previous_aggregated_yields
Vector of aggregated yields from previous years.
SpringBarleyStriglingCulm * m_springbarleystriglingculm
NoPesticideNoPFarm(FarmManager *a_manager)
void ReadCropsData()
Reads the data on crops' parameters that do not vary with farm variables and saves them in a vector D...
virtual void determineAreas(int a_foobar)
Determines areas of variable crops.
vector< int > CheckedFarms
A list of farms that has been tested for duplicates.
virtual bool FP_AmmoniumSulphate(LE *a_field, double a_user, int a_days)
Apply Ammonium Sulphate to a_field owned by an arable farmer.
A farm that can have its rotation defined by the user at runtime.
double m_area_ha
Area of a crop in ha at a farm [ha].
UserDefinedFarm27(const char *fname, FarmManager *a_manager)
virtual bool Spraying_herbicides(TTypesOfVegetation)
UserDefinedFarm23(const char *fname, FarmManager *a_manager)
virtual ~OptimisingOtherFarm()
void FarmLevelCalculation()
Calls functions determining farm level values before the initial optimisation.
void Set_Nnorm(double a_value, int i)
int animals_no
Holds the number of animals in a farm at a particular day in a year (depends on a species).
void createVariableCrops(int a_foobar)
Creates a list of pointers to all variable crops included in the optimisation and a list of pointers ...
void PrintFinalResults()
At the end of a simulation it prints results on crop distribution, pesticide and fertilizer usage.
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)
Adds an event to the event queue for a farm.
virtual bool HayBailing(LE *a_field, double a_user, int a_days)
Carry out hay bailing on a_field.
virtual void checkWinterCrops()
Checks if the restriction on a max. share of winter crops is fulfilled.
double m_fodderToProduce
Fodder that has to be produced to fulfill the min. fodder production restriction at the end of a year...
bool cash_crops_allowed
Sets to true if cash crops are allowed. True by default.
void FarmManagement()
Runs the daily farm management for each farm, but also calculates annual spilled grain and maize.
double Get_biomass_factor(int i)
CropOptimised * findCropByName(string crop_name)
Returns a pointer to a crop whose name is specified as the argument (bedriftsmodel,...
virtual bool FA_Calcium(LE *a_field, double a_user, int a_days)
Calcium applied on a_field owned by a stock farmer.
virtual void findFodderDemand()
Determines farm's total demand for fodder (m_totalFUdemand).
vector< TTypesOfVegetation > m_cropTypes_almass
Crop types saved as enumarator types (ALMaSS crop mode).
vector< TTypesOfVegetation > m_rotation
A farm that can have its rotation defined by the user at runtime.
NLPermanentGrassGrazed * m_nlpermanentgrassgrazed
int m_farm_centroidx
Farm's centroid, value x. Equal to the average of the x centroid values of all farm's fields.
double m_benefit
A value of selling price for non-fodder crops or a value of fodder units obtained from a hkg of a fod...
virtual bool StrawChopping(LE *a_field, double a_user, int a_days)
Carry out straw chopping on a_field.
void Save_last_years_crops_for_farms()
Calls OptimisingFarm::Save_last_years_crops for all optimising farms.
vector< double > m_crops_fertilizer_trade
Stores information on aggregate (all farms) fertilizer trade (Nt) usage for each crop.
UserDefinedFarm9(FarmManager *a_manager)
vector< CropOptimised * > m_crops
Vector of pointers to all crops.
OSeedGrass1 * m_oseedgrass1
double m_nt
Amount of purchased (and applied) fertilizer per ha of a crop [kg N/ha].
NLGrassGrazed1Spring * m_nlgrassgrazed1spring
TTypesOfLivestockParameters
void PrintDecModes_counts()
For each OptimizingFarm it prints the number of times each of the decision modes was used within a si...
double m_Nanim
Amount of animal fertilizer available at a farm per hectar. [kg/ha].
void Set_sellingPrice_lastyr(double a_value, int i)
int GetFarmArableSize(int a_farmref)
Returns the arable area from the farm ref num.
void AddField(int a_OwnerIndex, LE *a_newland, int a_Owner)
A farm that can have its rotation defined by the user at runtime.
NLCarrotsSpring * m_nlcarrotsspring
int GetCropClassification()
double m_BIFi
Value of BI for fung- and insecticides [BI/ha].
virtual bool InsecticideTreat(LE *a_field, double, int a_days)
Carries out insecticide application. Saves information on each application for a given crop.
TTypeOfFarmerGoal m_main_goal
Farmer's main goal (determined by a farmer's type) .
void PrintNeighbours()
Creates an output file with a list of neighbours of each OptimisingFarm.
virtual bool FA_ManganeseSulphate(LE *a_field, double a_user, int a_days)
Apply manganese sulphate to a_field owned by an stock farmer.
double daydegrees
Daydegress for period March 1st - November 1st. Used to determine yield of crops that are not harvest...
TTypesOfCrops m_cropType
Type/name of a crop (original farm optimization model crop types).
double m_totalNanim
Total animal fertilizer at a farm. A sum of Livestock::m_NanimUsable (from all types of livestock)....
double m_income_ha
Value of income per ha of a crop. Includes value of sales and subsidy [DKK/ha].
A data structure to hold hunter information for distribution.
TTypesOfCropVariables TranslateCropVariablesCodes(string &str)
ofstream * pm_output_file
A farm that can have its rotation defined by the user at runtime.
double Get_emaize_price(int i)
PLWinterWheat * m_plwinterwheat
void createFodderCrops(int a_foobar)
Creates a list of pointers to all fodder crops.
A farm that can have its rotation defined by the user at runtime.
PLSpringBarley * m_plspringbarley
SpringBarleySKManagement * m_springbarleyskmanagement
Base class for all population managers.
int Get_lookup_table(int index)
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.
virtual bool FP_Calcium(LE *a_field, double a_user, int a_days)
Calcium applied on a_field owned by an arable farmer.
vector< double > m_beta1
Crop parameter for response (growth) function (resp = alfa + beta1*N + beta2*N^2; defines relationshi...
WinterWheatStriglingSingle * m_winterwheatstriglingsingle
vector< PermCropData > m_PermCrops
bool m_fakeCropTest
Set to true if the fake crop is present after determineAreas function.
int FindClosestFarm(HunterInfo a_hinfo, vector< int > *a_farmlist)
Finds the closest farm to this co-ordinate.
virtual bool FlowerCutting(LE *a_field, double a_user, int a_days)
Flower cutting applied on a_field.
double m_resp
Response - yield of a crop per ha [hkg/ha].
OWinterRye * m_owinterrye
Fodderbeet * m_fodderbeet
Inbuilt special purpose farm type.
void Switch_rotation()
Switches OptimisingFarms Farm::m_rotation to the list of all possible rotational crops.
TTypesOfVegetation m_event
virtual bool Do(Farm *a_farm, LE *a_field, FarmEvent *a_ev)
int FindClosestFarmOpennessProbNearRoostIsBest(HunterInfo a_hinfo, vector< int > *a_farmlist, int a_openness, vector< APoint > *a_farmsizelist)
Finds the closest farm to this co-ordinate with openness more than a value but uses a probability dis...
void Set_animals_no(int a_number)
int m_farm_centroidy
Farm's centroid, value y. Equal to the average of the y centroid values of all farm's fields.
FieldPeasSilage * m_fieldpeassilage
double m_need_satisfaction_level
Farmer's actual satisfaction level.
int GetArea(void)
Returns the area of arable fields owned by that farm.
double m_NanimUsable
Amount of usable animal fertilizer from a given type of livestock. [kg].
vector< double > m_rotationMax
Maximum acreage of a crop at a farm [%]. Farm type, soil type and farm size specific.
NLGrassGrazed2 * m_nlgrassgrazed2
OFieldPeas * m_ofieldpeas
UserDefinedFarm1(FarmManager *a_manager)
int GetNoFields()
Returns the number of the fields owned.
void findFodderCropSavings()
Determines the savings resulting from growing a fodder crop relative to purchasing fodder.
UserDefinedFarm35(const char *fname, FarmManager *a_manager)
UserDefinedFarm20(const char *fname, FarmManager *a_manager)
TTypesOfFarmSize TranslateFarmSizeCodes(string &str)
Subclass of the NonAnimalFarm.
double Get_cropParameter(int i)
void Set_cropTotals_other_sum(int i, double crop_area)
vector< AlmassCrop > m_rotational_crops_visible
Stores a copy of m_rotational_crops from a previous year and is accessible to farmers who want to cop...
void Set_fodder(string a_value, int i)
Inbuilt special purpose farm type.
PesticideTrialToxicControl(FarmManager *a_manager)
TTypesOfVegetation m_next_tov
Livestock(TTypesOfAnimals a_animalType, int a_number)
Constructor.
OBarleyPeaCloverGrass * m_OBarleyPCG
UserDefinedFarm18(const char *fname, FarmManager *a_manager)
AnimalFarm(FarmManager *a_myfarmmanager, int a_No)
FarmEvent(TTypesOfVegetation a_event, LE *a_field, int a_todo, long a_run, bool a_lock, int a_start, bool a_first_year, TTypesOfVegetation a_nextcrop)
double m_totalBI
Total amount of pesticides (sum of m_totalBIHerb and m_totalBIFi) which is planned to be applied at a...
virtual void createCropsLists(int a_foobar)
Creates lists of crops.
PLSpringBarleySpr * m_plspringbarleyspr
void sortCrops(vector< CropSort > &cropsToSort, string sortingKey)
Sorts structs of type CropSort.
vector< string > m_str_cropTypes_almass
Crop types saved in string format (ALMaSS crop mode).
OSpringBarley * m_ospringbarley
vector< double > m_biomass_factors
Factor used to determine actual response (yield per ha) based on crop biomass at a harvest....
A farm that can have its rotation defined by the user at runtime.
PermanentGrassTussocky * m_permgrasstussocky
double m_lossHerb
Value of the yield loss due to the limited use of herbicides [%].
double m_exp_aggregated_yield
Expected aggregated yield at a farm in a given year.
vector< double > m_FUKey
Crop parameter: Fodder unit key, i.e. a number of fodder units obtained from a given crop [FU/hkg]....
double m_actual_aggregated_yield
Actual aggregated yield at a farm in a given year.
A farm that can have its rotation defined by the user at runtime.
void Set_cropTypes(TTypesOfCrops crop_type)
double Get_actual_profit()
double m_totalFUdemand
Farm's total demand for fodder (it is covered by growing fodder crops and/or purchasing fodder and th...
NLBeetSpring * m_nlbeetspring
Population_Manager * m_population_manager
void Create_Output_file_for_farms()
Creates an output file. Prints the crop variables in the first row of the file. The file is used then...
void ReadCropsData_perFarm_and_Soil_and_Size()
Reads the data on crops' parameters that vary with a farm type, soil type and farm size (rotationMax,...
Inbuilt special purpose farm type.
SpringBarleyStriglingSingle * m_springbarleystriglingsingle
void Set_alfa(double a_value, int i)
Inbuilt special purpose farm type.
double m_totalWeeding
Total manual weeding planned at a farm.
vector< AlmassCrop > m_rotational_crops_copy
A copy of m_rotational_crops used when matching crops to fields.
virtual bool InsecticideTreat(LE *a_field, double a_user, int a_days)
Apply insecticide to a_field.
void Set_rotationMax(double a_value, int i)
TTypesOfFarmSize Get_farmSize(void)
A farm that can have its rotation defined by the user at runtime.
void RemoveField(LE *a_field)
Removes a field from a farm.
TTypesOfVegetation TranslateCropCodes(std::string &str)
SeedGrass1 * m_seedgrass1
SpringBarleyPeaCloverGrassStrigling * m_springbarleypeaclovergrassstrigling
PesticideTrialTreatment(FarmManager *a_manager)
UserDefinedFarm2(FarmManager *a_manager)
virtual bool AutumnRoll(LE *a_field, double a_user, int a_days)
Carry out a roll event in the autumn on a_field.
int Get_livestockNumbersSize()
double m_areaPercent
Area of a crop in percent of a farm's total area [%].
void AddHunter(Hunter *a_hunter)
void Set_crops_fertilizer(int i, double fert)
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.
void Set_Livestock(Livestock *p_lvs)
virtual bool FP_Slurry(LE *a_field, double a_user, int a_days)
Apply slurry to a_field owned by an arable farmer.
vector< bool > m_fodder
Crop Boolean parameter - fodder/non-fodder crop. Farm type specific.
virtual bool HarvestLong(LE *a_field, double a_user, int a_days)
Carry out a harvest on a_field.
UserDefinedFarm26(const char *fname, FarmManager *a_manager)
SpringBarleySilage * m_springbarleysilage
void Set_biomass_factor(double a_value, int i)
int ConnectFarm(int a_owner)
vector< CropSort > m_cattleCrops
Vector of crops used in checkCattleRotation.
vector< CropSort > m_winterCrops
Vector of structs containing pointers to winter crops.
OFirstYearDanger * m_ofirstyeardanger
Class storing farm information: farm's number used in ALMaSS system, farm's soil type,...
TTypesOfLivestockParameters TranslateLivestockParametersCodes(string &str)
virtual bool SleepAllDay(LE *a_field, double a_user, int a_days)
Nothing to to today on a_field.
void OptimisationOutput()
Creates output files for all crop level variables and for landscape level crop distribution....
WinterRyeStrigling * m_winterryestrigling
void Set_Neighbour(OptimisingFarm *farm)
BroadBeans * m_broadbeans
virtual void MakeStockFarmer(void)
void sumMinAreas()
Adds minimum required areas of variable crops to the variable m_assigned.
virtual double Prob_multiplier()
Used when determining whether there should be a spraying event (i.e. pesticides application) or not....
A farm that can have its rotation defined by the user at runtime.
vector< double > m_cropTotals_plant_sum
Stores the sums of crops areas on plant farms within one simulation at the landscape level.
SpringBarleyCloverGrass * m_sbarleyclovergrass
vector< CropSort > m_variableCrops2
Vector of structs containing pointers to crops which are not fixed and: in case of the winter rotatio...
virtual bool RowCultivation(LE *a_field, double a_user, int a_days)
Carry out a harrowing between crop rows on a_field.
PLWinterTriticale class .
UserDefinedFarm8(FarmManager *a_manager)
int Get_livestockNumber(int index)
int Get_cropTypes_almass_size()
int FindOpennessFarm(int a_openness)
Finds a random farm with at least one field with openness above a_openness.
void Set_cropTotals_cattle_sum(int i, double crop_area)
TTypesOfOptFarms TranslateFarmCodes(string &str)
vector< FarmData * > m_farm_data
virtual bool Water(LE *a_field, double a_user, int a_days)
Carry out a watering on a_field.
bool IsDuplicateRef(int a_ref, HunterInfo *a_hinfo)
Checks if we already have this ref.
A farm that can have its rotation defined by the user at runtime.
virtual bool AutumnPlough(LE *a_field, double a_user, int a_days)
Carry out a ploughing event in the autumn on a_field.
double GetDD(void)
Returnes day degrees for the period March 1st - November 1st. Used for determining yields of crops th...
UserDefinedFarm22(const char *fname, FarmManager *a_manager)
virtual bool SpringSow(LE *a_field, double a_user, int a_days)
Carry out a sowing event in the spring on a_field.
YoungForestCrop * m_youngforest
Subclass of the OptimisingFarm. Either pig or cattle farm.
double m_rotationMin
Minimum area in percent of farm's arable area for a given crop (depends on a farm size,...
TTypesOfFarm GetFarmType(int a_farmref)
Returns the farm type from the farm ref num.
FarmManager()
Farm manager constructor.
int homeX
Hunter home x-coord.
vector< CropOptimised * > m_fixedCrops
Vector of pointers to fixed crops.
int FindClosestFarmOpennessProb(HunterInfo a_hinfo, vector< int > *a_farmlist, int a_openness)
Finds the closest farm to this co-ordinate with openness more than a value but uses a probability dis...
void Init(ofstream *ap_output_file)
Function carrying out the initial calculations at a farm level (including the initial optimisation).
void Set_cropTotals_sum(int i, double crop_area)
virtual void MakeStockFarmer(void)
int m_noCrops
Number of crops used in the simulation.
LowPriority< FarmEvent * > m_queue
virtual bool AutumnHarrow(LE *a_field, double a_user, int a_days)
Carry out a harrow event in the autumn on a_field.
Farm(FarmManager *a_manager)
Farm constructor - creates an instance of each possible crop type.
void ChooseDecisionMode()
Function determines which decision mode to use. The choice depends on the values of need satisfaction...
Struct used only in Bedriftsmodel crop type mode for creating m_rotation vector. Bool member used for...
Inbuilt special purpose farm type.
virtual bool FA_AmmoniumSulphate(LE *a_field, double a_user, int a_days)
Apply ammonium sulphate to a_field owned by an stock farmer.
A farm that can have its rotation defined by the user at runtime.
int homeY
Hunter home y-coord.
Subclass of the OptimisingFarm. Either plant or other farm.
double m_totalN
Total amount of fertilizer used at a farm. [kg].
bool m_SpilledGrain
Is it 2013 (true) or 2014 (false) as far as grain goes.
WinterBarley * m_winterbarley
WWheatPControl * m_wwheatpcontrol
int m_farmRealID
Farm's real ID number.
virtual void Management(void)
Starts the main management loop for the farm and performs some error checking.
NLPotatoes * m_nlpotatoes
DataForOptimisation()
The constructor.
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.
A farm that can have its rotation defined by the user at runtime.
void Assign_rotation(vector< TTypesOfVegetation >a_new_rotation)
FarmManager * m_OurManager
Pointer to the FarmManager.
virtual bool StriglingSow(LE *a_field, double a_user, int a_days)
Carry out a mechanical weeding followed by sowing on a_field.
double m_GM_Savings
Holds the value of m_GM in case of non-fodder crops and a value of m_savings in case of fodder crops ...
void InitiateManagement(void)
vector< double > m_crops_fertilizer
Stores information on aggregate (all farms) fertilizer usage for each crop.
A farm that can have its rotation defined by the user at runtime.
The base class for all farm types.
vector< Livestock * > m_livestock
Vector of pointers to animals belonging to a farm.
double m_totalBIHerb
Total amount of herbicides which is planned to be applied at a farm. Expressed as a Treatment frequen...
virtual void createCropsLists(int a_foobar)
Creates lists of crops.
OrganicPig(FarmManager *a_manager)
void Set_cropTotals_pig_sum(int i, double crop_area)
vector< double > m_previous_satisfaction_levels
Vector of satisfaction levels in five previous years.
virtual void HandleEvents(void)
If there are events to carry out do this, and perhaps start a new crop.
WWheatPTreatment * m_wwheatptreatment
A farm that can have its rotation defined by the user at runtime.
A farm that can have its rotation defined by the user at runtime.
virtual void findFodderDemand()
Determines farm's total demand for fodder (m_totalFUdemand).
WWheatPToxicControl * m_wwheatptoxiccontrol
OCloverGrassGrazed2 * m_OCGG2
TTypesOfAnimals TranslateAnimalsCodes(string &str)
double m_FUdemand
Amount of fodder needed for a given type of livestock. [fodder units].
OrchardCrop * m_orchardcrop
virtual bool DeepPlough(LE *a_field, double a_user, int a_days)
Carry out a deep ploughing event on a_field.
OSpringBarleyPigs * m_ospringbarleypigs
virtual bool StrawCovering(LE *a_field, double a_user, int a_days)
Straw covering applied on a_field.
NLCatchPeaCrop * m_nlcatchpeacrop
void Set_beta2(double a_value, int i)
vector< AlmassCrop > m_crops_almass
Vector of structs with almass type crops with positive areas in % (result of optimisation).
Inbuilt special purpose farm type.
UserDefinedFarm11(FarmManager *a_manager)
vector< double > m_livestockParameters
Vector storing parameters of all livestock types.
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.
PLSpringWheat * m_plspringwheat
vector< int > m_crop_lookup_table
Specifies which crop order is allowed in a rotation (i.e. if a given crop can follow another crop).
vector< CropSort > m_variableCrops
Vector of structs containing pointers to crops which are not fixed.
vector< double > m_crop_areas_stages
Stores information on crop areas calculated in different stages of model development: for comparison ...
bool m_renumbered
A flag to show whether renumbering was already done.
virtual void checkRestrictions()
Checks if the restrictions are fulfilled and corrects crops' areas if necessary.
virtual bool WinterPlough(LE *a_field, double a_user, int a_days)
Carry out a ploughing event in the winter on a_field.
void randomizeCropList(vector< CropSort > &listToRandomize, string key)
Swaps randomly elements of the list holding same values of the key (according to which the list was p...
virtual ~OptimisingFarm()
APoint GetFarmCentroid(int a_farmref)
Gets the farm centroid as an APoint.
PLMaizeSilage * m_plmaizesilage
OptimisingOtherFarm(FarmManager *a_myfarmmanager, int a_No)
void Set_livestockNumber(int a_number)
double m_totalFodderToProduce
Fodder that has to be produced by a farm to fulfill the min. fodder production restriction....
vector< int > m_livestockNumbers
Vector containing numbers of all livestock types at farms included in the simulation.
void AddField(LE *a_newfield)
Adds a field to a farm.
void Make_rotational_crops()
Creates a vector m_rotational_crops using the results of optimisation.
double m_area_rot
Area assigned to rotational crops. [ha].
virtual void checkWinterRotation1()
Checks if the restriction on a winter rotation is fulfilled.
OSBarleySilage * m_osbarleysilage
TTypesOfParameters TranslateParametersCodes(string &str)
APoint GetValidCoords()
Returns the valid coordinates of the first field owned by a farm.
void check_WRape_WBarley()
Checks if the restriction on winter rape and winter barley attachment is fulfilled and corrects crops...
void Set_livestockParameter(double a_value, int i)
int GetRandomFarmRefnum()
Returns a random farm reference number.
void Set_main_goal(TTypeOfFarmerGoal a_goal)
double m_savings
Value of savings resulting from growing a fodder crop and not purchasing amount of fodder correspondi...
virtual bool BulbHarvest(LE *a_field, double a_user, int a_days)
Carry out a bulb harvest on a_field.
void Save_diff_farm_types_areas()
Calculates and saves total areas of all optimising farms and specific farm types.
bool GetIsRenumbered()
Returns the flag for renumbering.
vector< double > m_cropParameters
Vector storing parameters of all crop types.
vector< string > m_str_cropTypes
Crop types saved in string format (Bedriftsmodel i.e. original crop optimization model crop mode).
OrganicCattle(FarmManager *a_manager)
OPermanentGrassGrazed * m_opermgrassgrazed
vector< double > m_rotationMin
Minimum acreage of a crop at a farm [%]. Farm type, soil type and farm size specific.
OFieldPeasSilage * m_ofieldpeassilage
SpringBarleyPTreatment * m_springbarleyptreatment
vector< CropSort > m_rotationCrops
Vector of structs containing pointers to (winter) rotation crops.
virtual bool FP_GreenManure(LE *a_field, double a_user, int a_days)
Spread green manure on a_field owned by an arable farmer.
vector< PesticideData > m_crops_summary_BIs
Stores information on aggregate (all farms)pesticide usage for each crop.
virtual bool GrowthRegulator(LE *a_field, double a_user, int a_days)
Apply growth regulator to a_field.
A farm that can have its rotation defined by the user at runtime.
vector< AlmassCrop > m_rotational_crops
Vector of structs with almass type crops with positive areas in % (result of optimisation): includes ...
virtual void MakeStockFarmer(void)
DataForOptimisation * pm_data
Pointer to the DataForOptimisation.
TTypesOfOptFarms m_farmType
Farm's type (cattle, pig, plant, other).
PLWinterWheatLate class .
A farm that carries out crop, pesticide and fertilizer planning using simplified optimisation or othe...
int GetFarmNoFields(int a_farmref)
Returns the number of fields owned by a from the farm ref num.
PLWinterWheatLate * m_plwinterwheatlate
vector< CropSort > m_fodderCrops
List of pointers to variable (non-fixed) fodder crops.
double m_assigned
Variable holding a value of area already reserved for certain crops at a farm. [0-100%].
void fixBI()
Sets values of Treatment frequency indices (BI) for crops with fixed amount of pesticides (CropOptimi...
int * m_farmmapping_lookup
Used for a dynamic array of lookups converting farm references to internal renumbering.
UserDefinedFarm32(const char *fname, FarmManager *a_manager)
PermanentGrassGrazed * m_permgrassgrazed
PLFodderLucerne1 * m_plfodderlucerne1
double GetAreaDouble(void)
Returns the area of arable fields owned by that farm.
virtual ~OptimisingPlantFarm()
A farm that can have its rotation defined by the user at runtime.
void SetCropClassification(int a_classification)
void findResponse(CropOptimised *a_crop, int a_foobar)
Determines the response (CropOptimised::m_resp) of a crop at a farm.
void Set_emaize_price(double a_value)
double m_grooming
Value of mechanical weed control for a crop - grooming [DKK/ha].
OptimisingFarm * Find_neighbour_to_imitate()
Picks randomly a farmer to imitate/compare with. It chooses among neighbouring farmers with similar f...
double m_initialArea
Initial area of a crop on a farm [ha].
~FarmManager()
Farm manager destructor.
void SetSpilledGrain(bool a_spilledgrain)
Set m_SpilledGrain which is the flag for either 2013 (true) or 2014 (false) spilled grain distributio...
double totalOptFarmsArea_plant
double m_certainty_level
Farmer's certainty level.
void checkCattleRotation()
Checks if the cattle restriction is fulfilled - in the Bedriftsmodel (original farm optimization mode...
vector< TTypesOfAnimals > m_livestockTypes
Livestock types saved as enumarator types.
DummyCropPestTesting * m_dummycroppesttesting
void RemoveHunter(Hunter *a_hunter)
vector< double > m_previous_profits
Vector of profits from previous years.
NLPermanentGrassGrazed class .
int GetFarmTypeLookup(int a_ref)
Get a farm type from the lookup table.
TTypesOfVegetation GetPreviousCrop(int a_index)
Inbuilt special purpose farm type.
NorwegianOats * m_norwegianoats
polylist * ListOpenFields(int a_openness)
Returns a list of fields with openness above a_openness.
WinterWheatStrigling * m_winterwheatstrigling
A farm that can have its rotation defined by the user at runtime.
int GetAreaOpenFields(int a_openness)
Returns the area of the fields above an openness of a_openness.
MaizeSilage * m_maizesilage
OSpringBarleyExt * m_ospringbarleyext
void ReadLivestockNumbers()
Reads the data on livestock numbers and saves them in a vector DataForOptimisation::m_livestockNumber...
void ReadFarmsData_perFarmType()
Reads the data on farms' parameters that vary with a farm type and saves them in a vector of a DataFo...
double m_exp_costs
Expected costs at a farm in a given year.
virtual ~Farm(void)
Farm destructor - deletes all crop instances and empties event queues.
void Save_last_years_crops()
It saves the OptimisingFarm::m_rotational_crops in a vector m_rotational_crops_visible which is acces...
virtual bool FA_PK(LE *a_field, double a_user, int a_days)
Apply PK fertilizer to a_field owned by an stock farmer.
virtual ~OptimisingCattleFarm()
int Get_cropTotals_size()
CropOptimised * findCropByName_almass(string crop_name)
Returns a pointer to almass crop whose name is specified as the argument (ALMaSS crops mode).
UserDefinedFarm28(const char *fname, FarmManager *a_manager)
void CalcCentroids()
calculate all farm centroids
void Set_beta1(double a_value, int i)
virtual bool BurnStrawStubble(LE *a_field, double a_user, int a_days)
Burn stubble on a_field.
OWinterBarleyExt * m_owinterbarleyext
void ReadEnergyMaizePrice()
void Check_if_area_100()
Checks if the sum of crops' areaPercent is 100%.
double m_exp_income
An expected farm's income at a farm in a given year.
virtual bool Swathing(LE *a_field, double a_user, int a_days)
Cut the crop on a_field and leave it lying (probably rape)
UserDefinedFarm7(FarmManager *a_manager)
void InitializeVector(vector< double > &vector)
Initializes vector with -1 values.
double m_areaVariable
Area of a crop that can be changed when checking for restrictions (=m_areaPercent - m_rotationMin) [%...
vector< double > m_cropTotals_cattle_sum
Stores the sums of crops areas on cattle farms within one simulation at the landscape level.
Inbuilt special purpose farm type.
double Get_rotationMin(int i)
vector< double > m_cropTotals_other_sum
Stores the sums of crops areas on other farms within one simulation at the landscape level.
virtual void checkWinterCrops()
Checks if the restriction on a max. share of winter crops is fulfilled.
UserDefinedFarm10(FarmManager *a_manager)
void ReadCropsData_perFarm_and_Soil_almass()
Reads the data on crops' parameters that vary with a farm and soil type (sellingPrice) and saves them...
TTypesOfFarmSize m_farmSize
Scale of the farm - business (size above 10 ha) or private (size below 10 ha).
PLPotatoes * m_plpotatoes
OCloverGrassGrazed1 * m_OCGG1
void CheckRotationManagementLoop(FarmEvent *ev)
void ChooseNextCrop(int a_no_dates)
Chooses the next crop to grow in a field.
vector< OptimisingFarm * > m_neighbours
Vector of pointers to the farms considered neighbours (fulfilling the neighbourship condition) of a g...
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.
OptimisingPlantFarm(FarmManager *a_myfarmmanager, int a_No)
virtual bool HayTurning(LE *a_field, double a_user, int a_days)
Carry out hay turning on a_field.
double Get_actual_aggregated_yield()
void Make_rotations()
Creates m_rotation. Not used in ALMaSS crop mode.
virtual bool CattleOut(LE *a_field, double a_user, int a_days)
Start a grazing event on a_field today.
UserDefinedFarm21(const char *fname, FarmManager *a_manager)
void optimizeCrops(int a_foobar)
Carries out crop optimisation at a farm.
bool operator()(CropSort a, CropSort b)
void Set_cropTotals_plant_sum(int i, double crop_area)
OWinterWheatUndersown * m_owinterwheatundersown
double m_rotationMax
Maximum area in percent of farm's arable area for a given crop (depends on a farm size,...
TTypesOfSoils md_soilType
void Set_cropTypes_almass(TTypesOfVegetation crop_type)
A farm that can have its rotation defined by the user at runtime.
int refID
Unique reference number.
PotatoesIndustry * m_potatoesindustry
double m_totalFUt
Fodder from trade (has to be purchased). [fodder units].
UserDefinedFarm15(FarmManager *a_manager)
void setCattleCropsAtMin()
Decreases area of cattle crops to their min. required area.
void Set_cropTotals(int i, double value)
PLWinterRye * m_plwinterrye
void ActualProfit()
Function that determines actual crop yields and profit in a given year.
PermanentGrassLowYield * m_permgrasslowyield
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 b...
double totalOptFarmsArea_pig
UserDefinedFarm13(FarmManager *a_manager)
void Make_almass_crops_vector()
Creates a vector storing crops with positive area. Used in ALMaSS crop mode.
A farm that can have its rotation defined by the user at runtime.
int m_rotation_sync_index
double m_totalIncome
Planned total income from growing crops at a farm. [DKK].
int Get_decision_mode_counters(int index)
double total(TTypesOfCropVariables variable_name)
Function for determining total values per farm after initial optimisation.
OCloverGrassSilage1 * m_OCGS1
virtual bool Spraying_fungins(TTypesOfVegetation)
string Get_cropTypes_str(int i)
virtual bool StubbleHarrowing(LE *a_field, double a_user, int a_days)
Carry out stubble harrowing on a_field.
virtual bool SpringHarrow(LE *a_field, double a_user, int a_days)
Carry out a harrow event in the spring on a_field.
virtual void InitiateManagement(void)
Kicks off the farm's management.
virtual void decreaseCrops(vector< CropSort >cropsToDecrease, double &howMuchToDecrease)
Decreases area of cropsToDecrease by howMuchToDecrease.
virtual bool FP_NPKS(LE *a_field, double a_user, int a_days)
Apply NPKS fertilizer, on a_field owned by an arable farmer.
void OptimiseFarm(int a_foobar)
Carries out the whole farm optimisation.
A farm that can have its rotation defined by the user at runtime.
vector< int > FarmHuntRef
The hunter's is the farm reference number to where he hunts.
ConventionalCattle(FarmManager *a_manager)
void SimpleEvent_(long a_date, int a_todo, bool a_lock, Farm *a_farm, LE *a_field)
Adds an event to this crop management without relying on member variables.
virtual bool CutWeeds(LE *a_field, double a_user, int a_days)
Carry out weed topping on a_field.
TTypesOfAnimals Get_livestockTypes(int i)
vector< double > m_cropTotals_sum
Stores the sums of crops areas within one simulation at the landscape level.
void Set_crops_summary_BIs(int i, double BI)