File failed to load: https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/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
FarmFuncs.cpp File Reference

Farmfuncs.cpp This file contains the source for implementing the farm events
More...

#include "ls.h"
#include "../BatchALMaSS/PopulationManager.h"
#include "../People/Farmers/Farmer.h"

Macros

#define UNREFERENCED_PARAMETER(P)   (P)
 
#define DO_IT_PROB   (l_farm_event_do_it_prob.value())
 
#define DO_IT_PROB_LONG   (l_farm_event_do_it_prob_long.value())
 

Variables

Landscapeg_landscape_ptr
 
CfgArray_Double cfg_pest_product_amounts
 Amount of pesticide applied in grams of active substance per hectare for each of the 10 pesticides. More...
 
CfgInt l_pest_productapplic_startdate
 
CfgInt l_pest_productapplic_enddate
 
CfgInt l_pest_productapplic_period
 
CfgBool cfg_OptimiseBedriftsmodelCrops
 If set to true, the original farm optimisation model's crop set is used in the farmer decision making model In this mode the optimisation is carried out only once; it is used for the comparioson of the optimisaiton results with the original model. More...
 
CfgInt cfg_productapplicstartyear
 
CfgInt cfg_productapplicendyear
 
CfgBool cfg_UseSocioEconomicFarm
 Used to socio-economic calculations for farms. More...
 
static CfgInt l_farm_event_do_it_prob ("FARM_EVENT_DO_IT_PROB", CFG_PRIVATE, 50)
 
static CfgInt l_farm_event_do_it_prob_long ("FARM_EVENT_DO_IT_PROB_LONG", CFG_PRIVATE, 5)
 
static CfgFloat l_farm_cattle_veg_reduce ("FARM_CATTLE_VEG_REDUCE", CFG_CUSTOM, 1.5)
 
static CfgFloat l_farm_cattle_veg_reduce2 ("FARM_CATTLE_VEG_REDUCE_LOW", CFG_CUSTOM, 0.50)
 
CfgInt cfg_farm_cattle_grass_low ("FARM_CATTLE_GRASS_LOW", CFG_CUSTOM, 4)
 
CfgInt cfg_farm_cattle_grass_high ("FARM_CATTLE_GRASS_HIGH", CFG_CUSTOM, 15)
 
CfgInt cfg_farm_cattle_grazing_lvl_rot ("FARM_CATTLE_GRAZING_LVL_ROT", CFG_CUSTOM, 4)
 
CfgInt cfg_farm_cattle_grazing_lvl_pasture ("FARM_CATTLE_GRAZING_LVL_PASTURE", CFG_CUSTOM, 3)
 
CfgInt cfg_farm_cattle_grazing_lvl_lowyield ("FARM_CATTLE_GRAZING_LVL_LOWYIELD", CFG_CUSTOM, 2)
 
CfgInt cfg_farm_cattle_grazing_lvl_tussocky ("FARM_CATTLE_GRAZING_LVL_TUSSOCKY", CFG_CUSTOM, 1)
 
CfgArray_Double cfg_farm_cattle_reduce_height ("FARM_CATTLE_REDUCE_HEIGHT", CFG_CUSTOM, 4, vector< double > {0.2, 0.3, 1.0, 8.0})
 
static CfgFloat l_farm_pig_veg_reduce ("FARM_PIG_VEG_REDUCE", CFG_CUSTOM, 0.98)
 
static CfgFloat cfg_CustomInsecticidesSurvProp ("CUSTOMINSECTIVIDESURVPROP", CFG_CUSTOM, 0.5, 0, 1.0)
 
static CfgBool l_farm_insecticide_kills ("FARM_INSECTICIDE_KILLS", CFG_CUSTOM, true)
 
static CfgBool l_farm_herbicide_kills ("FARM_PESTICIDE_KILLS", CFG_CUSTOM, true)
 
CfgFloat cfg_pest_max_wind ("PEST_MAX_WIND", CFG_CUSTOM, 4.5)
 Maximum allowed average wind speed for applying pesticides. More...
 
CfgInt cfg_WW_InsecticideDay ("PEST_WWINSECTONEDAY", CFG_CUSTOM, 1)
 Provided to allow configuration control of the first insecticide spray in winter wheat - this changes the day in the month. More...
 
CfgInt cfg_WW_InsecticideMonth ("PEST_WWINSECTONEMONTH", CFG_CUSTOM, 5)
 Provided to allow configuration control of the first insecticide spray in winter wheat - this changes the month. More...
 
CfgFloat cfg_WW_conv_tillage_prop1 ("TILLAGE_WWCONVONEPROP", CFG_CUSTOM, 1.0)
 Provided to allow configuration control of the proportion of farmers doing first conventional tillage in winter wheat - this changes between 0 and 1. More...
 
CfgFloat cfg_WW_conv_tillage_prop2 ("TILLAGE_WWCONVTWOPROP", CFG_CUSTOM, 1.0)
 Provided to allow configuration control of the proportion of farmers doing second conventional tillage in winter wheat - this changes between 0 and 1. More...
 
CfgFloat cfg_WW_NINV_tillage_prop1 ("TILLAGE_WWNINVONEPROP", CFG_CUSTOM, 1.0)
 Provided to allow configuration control of the proportion of farmers doing first non-inversion tillage in winter wheat - this changes between 0 and 1. More...
 
CfgFloat cfg_WW_NINV_tillage_prop2 ("TILLAGE_WWNINVTWOPROP", CFG_CUSTOM, 1.0)
 Provided to allow configuration control of the proportion of farmers doing second non-inversion tillage in winter wheat - this changes between 0 and 1. More...
 
CfgFloat cfg_WW_isecticide_prop1 ("PEST_WWINSECTONEPROP", CFG_CUSTOM, 1.0)
 Provided to allow configuration control of the proportion of farmers doing first insecticide spray in winter wheat - this changes between 0 and 1. More...
 
CfgFloat cfg_WW_isecticide_prop2 ("PEST_WWINSECTTWOPROP", CFG_CUSTOM, 1.0)
 Provided to allow configuration control of the proportion of farmers doing second insecticide spray in winter wheat - this changes between 0 and 1. More...
 
CfgFloat cfg_WW_isecticide_prop3 ("PEST_WWINSECTTHREEPROP", CFG_CUSTOM, 1.0)
 Provided to allow configuration control of the proportion of farmers doing third insecticide spray in winter wheat - this changes between 0 and 1. More...
 
CfgInt cfg_SB_InsecticideDay ("PEST_SBINSECTONEDAY", CFG_CUSTOM, 15)
 Provided to allow configuration control of the first insecticide spray in spring barley crops - this changes the day in the month. More...
 
CfgInt cfg_SB_InsecticideMonth ("PEST_SBINSECTONEMONTH", CFG_CUSTOM, 5)
 Provided to allow configuration control of the first insecticide spray in spring barley crops - this changes the month. More...
 
CfgInt cfg_OSR_InsecticideDay ("PEST_OSRINSECTONEDAY", CFG_CUSTOM, 30)
 Provided to allow configuration control of the first insecticide spray in OSR - this changes the day in the month. More...
 
CfgInt cfg_OSR_InsecticideMonth ("PEST_OSRINSECTONEMONTH", CFG_CUSTOM, 4)
 Provided to allow configuration control of the first insecticide spray in OSR - this changes the month. More...
 
CfgInt cfg_CAB_InsecticideDay ("PEST_CABINSECTONEDAY", CFG_CUSTOM, 15)
 Provided to allow configuration control of the first insecticide spray in cabbage crops - this changes the day in the month. More...
 
CfgInt cfg_CAB_InsecticideMonth ("PEST_CABINSECTONEMONTH", CFG_CUSTOM, 5)
 Provided to allow configuration control of the first insecticide spray in cabbage crops - this changes the month. More...
 
CfgInt cfg_TU_InsecticideDay ("PEST_TUINSECTONEDAY", CFG_CUSTOM, 15)
 Provided to allow configuration control of the first insecticide spray in tulip crops - this changes the day in the month. More...
 
CfgInt cfg_TU_InsecticideMonth ("PEST_TUINSECTONEMONTH", CFG_CUSTOM, 5)
 Provided to allow configuration control of the first insecticide spray in tulip crops - this changes the month. More...
 
CfgInt cfg_POT_InsecticideDay ("PEST_POTINSECTONEDAY", CFG_CUSTOM, 15)
 Provided to allow configuration control of the first insecticide spray in potatoes crops - this changes the day in the month. More...
 
CfgInt cfg_POT_InsecticideMonth ("PEST_POTINSECTONEMONTH", CFG_CUSTOM, 5)
 Provided to allow configuration control of the first insecticide spray in potatoes crops - this changes the month. More...
 
CfgInt cfg_BE_InsecticideDay ("PEST_BEINSECTONEDAY", CFG_CUSTOM, 15)
 Provided to allow configuration control of the first insecticide spray in beet crops - this changes the day in the month. More...
 
CfgInt cfg_BE_InsecticideMonth ("PEST_BEINSECTONEMONTH", CFG_CUSTOM, 5)
 Provided to allow configuration control of the first insecticide spray in beet crops - this changes the month. More...
 
CfgInt cfg_ORCH_InsecticideDay ("PEST_ORCHINSECTONEDAY", CFG_CUSTOM, 15)
 Provided to allow configuration control of the first insecticide spray in orchard crops - this changes the day in the month. More...
 
CfgInt cfg_ORCH_InsecticideMonth ("PEST_ORCHINSECTONEMONTH", CFG_CUSTOM, 4)
 Provided to allow configuration control of the first insecticide spray in orchard crops - this changes the month. More...
 
CfgFloat cfg_biocide_reduction_val ("REDUCE_BIOCIDE_EFFECT", CFG_CUSTOM, 0.0)
 
CfgFloat l_el_o_cut_height
 
CfgFloat l_el_o_cut_green
 
CfgFloat l_el_o_cut_total
 

Detailed Description

Farmfuncs.cpp This file contains the source for implementing the farm events

by Frank Nikolaisen & Chris J. Topping
Initial version of June 2003, but under continual change.
All rights reserved.

Doxygen formatted comments in July 2008

Macro Definition Documentation

◆ DO_IT_PROB

#define DO_IT_PROB   (l_farm_event_do_it_prob.value())

◆ DO_IT_PROB_LONG

#define DO_IT_PROB_LONG   (l_farm_event_do_it_prob_long.value())

◆ UNREFERENCED_PARAMETER

#define UNREFERENCED_PARAMETER (   P)    (P)

Variable Documentation

◆ cfg_BE_InsecticideDay

CfgInt cfg_BE_InsecticideDay("PEST_BEINSECTONEDAY", CFG_CUSTOM, 15)

Provided to allow configuration control of the first insecticide spray in beet crops - this changes the day in the month.

◆ cfg_BE_InsecticideMonth

CfgInt cfg_BE_InsecticideMonth("PEST_BEINSECTONEMONTH", CFG_CUSTOM, 5)

Provided to allow configuration control of the first insecticide spray in beet crops - this changes the month.

◆ cfg_biocide_reduction_val

◆ cfg_CAB_InsecticideDay

CfgInt cfg_CAB_InsecticideDay("PEST_CABINSECTONEDAY", CFG_CUSTOM, 15)

Provided to allow configuration control of the first insecticide spray in cabbage crops - this changes the day in the month.

◆ cfg_CAB_InsecticideMonth

CfgInt cfg_CAB_InsecticideMonth("PEST_CABINSECTONEMONTH", CFG_CUSTOM, 5)

Provided to allow configuration control of the first insecticide spray in cabbage crops - this changes the month.

◆ cfg_CustomInsecticidesSurvProp

CfgFloat cfg_CustomInsecticidesSurvProp("CUSTOMINSECTIVIDESURVPROP", CFG_CUSTOM, 0.5, 0, 1.0)
static

◆ cfg_farm_cattle_grass_high

◆ cfg_farm_cattle_grass_low

◆ cfg_farm_cattle_grazing_lvl_lowyield

CfgInt cfg_farm_cattle_grazing_lvl_lowyield("FARM_CATTLE_GRAZING_LVL_LOWYIELD", CFG_CUSTOM, 2)

◆ cfg_farm_cattle_grazing_lvl_pasture

CfgInt cfg_farm_cattle_grazing_lvl_pasture("FARM_CATTLE_GRAZING_LVL_PASTURE", CFG_CUSTOM, 3)

◆ cfg_farm_cattle_grazing_lvl_rot

CfgInt cfg_farm_cattle_grazing_lvl_rot("FARM_CATTLE_GRAZING_LVL_ROT", CFG_CUSTOM, 4)

Referenced by VegElement::SetCropType().

◆ cfg_farm_cattle_grazing_lvl_tussocky

CfgInt cfg_farm_cattle_grazing_lvl_tussocky("FARM_CATTLE_GRAZING_LVL_TUSSOCKY", CFG_CUSTOM, 1)

◆ cfg_farm_cattle_reduce_height

CfgArray_Double cfg_farm_cattle_reduce_height("FARM_CATTLE_REDUCE_HEIGHT", CFG_CUSTOM, 4, vector< double > {0.2, 0.3, 1.0, 8.0})

◆ cfg_OptimiseBedriftsmodelCrops

CfgBool cfg_OptimiseBedriftsmodelCrops

If set to true, the original farm optimisation model's crop set is used in the farmer decision making model In this mode the optimisation is carried out only once; it is used for the comparioson of the optimisaiton results with the original model.

◆ cfg_ORCH_InsecticideDay

CfgInt cfg_ORCH_InsecticideDay("PEST_ORCHINSECTONEDAY", CFG_CUSTOM, 15)

Provided to allow configuration control of the first insecticide spray in orchard crops - this changes the day in the month.

◆ cfg_ORCH_InsecticideMonth

CfgInt cfg_ORCH_InsecticideMonth("PEST_ORCHINSECTONEMONTH", CFG_CUSTOM, 4)

Provided to allow configuration control of the first insecticide spray in orchard crops - this changes the month.

◆ cfg_OSR_InsecticideDay

CfgInt cfg_OSR_InsecticideDay("PEST_OSRINSECTONEDAY", CFG_CUSTOM, 30)

Provided to allow configuration control of the first insecticide spray in OSR - this changes the day in the month.

Referenced by WinterRape::Do().

◆ cfg_OSR_InsecticideMonth

CfgInt cfg_OSR_InsecticideMonth("PEST_OSRINSECTONEMONTH", CFG_CUSTOM, 4)

Provided to allow configuration control of the first insecticide spray in OSR - this changes the month.

Referenced by WinterRape::Do().

◆ cfg_pest_max_wind

CfgFloat cfg_pest_max_wind("PEST_MAX_WIND", CFG_CUSTOM, 4.5)

◆ cfg_pest_product_amounts

CfgArray_Double cfg_pest_product_amounts

Amount of pesticide applied in grams of active substance per hectare for each of the 10 pesticides.

Referenced by Osmia_Population_Manager::Osmia_Population_Manager().

◆ cfg_POT_InsecticideDay

CfgInt cfg_POT_InsecticideDay("PEST_POTINSECTONEDAY", CFG_CUSTOM, 15)

Provided to allow configuration control of the first insecticide spray in potatoes crops - this changes the day in the month.

◆ cfg_POT_InsecticideMonth

CfgInt cfg_POT_InsecticideMonth("PEST_POTINSECTONEMONTH", CFG_CUSTOM, 5)

Provided to allow configuration control of the first insecticide spray in potatoes crops - this changes the month.

◆ cfg_productapplicendyear

CfgInt cfg_productapplicendyear

◆ cfg_productapplicstartyear

CfgInt cfg_productapplicstartyear

◆ cfg_SB_InsecticideDay

CfgInt cfg_SB_InsecticideDay

Provided to allow configuration control of the first insecticide spray in spring barley crops - this changes the day in the month.

Referenced by SpringBarleyCloverGrass::Do(), SpringBarleySilage::Do(), and SpringBarley::Do().

◆ cfg_SB_InsecticideMonth

CfgInt cfg_SB_InsecticideMonth

Provided to allow configuration control of the first insecticide spray in spring barley crops - this changes the month.

Referenced by SpringBarleyCloverGrass::Do(), SpringBarleySilage::Do(), and SpringBarley::Do().

◆ cfg_TU_InsecticideDay

CfgInt cfg_TU_InsecticideDay("PEST_TUINSECTONEDAY", CFG_CUSTOM, 15)

Provided to allow configuration control of the first insecticide spray in tulip crops - this changes the day in the month.

◆ cfg_TU_InsecticideMonth

CfgInt cfg_TU_InsecticideMonth("PEST_TUINSECTONEMONTH", CFG_CUSTOM, 5)

Provided to allow configuration control of the first insecticide spray in tulip crops - this changes the month.

◆ cfg_UseSocioEconomicFarm

CfgBool cfg_UseSocioEconomicFarm

Used to socio-economic calculations for farms.

Referenced by Farm::CalculateTreatmentCosts(), FarmManager::FarmManager(), and Farm::HandleEvents().

◆ cfg_WW_conv_tillage_prop1

CfgFloat cfg_WW_conv_tillage_prop1("TILLAGE_WWCONVONEPROP", CFG_CUSTOM, 1.0)

Provided to allow configuration control of the proportion of farmers doing first conventional tillage in winter wheat - this changes between 0 and 1.

Referenced by TestCrop::Do(), and PLWinterWheat::Do().

◆ cfg_WW_conv_tillage_prop2

CfgFloat cfg_WW_conv_tillage_prop2("TILLAGE_WWCONVTWOPROP", CFG_CUSTOM, 1.0)

Provided to allow configuration control of the proportion of farmers doing second conventional tillage in winter wheat - this changes between 0 and 1.

Referenced by TestCrop::Do(), and PLWinterWheat::Do().

◆ cfg_WW_InsecticideDay

CfgInt cfg_WW_InsecticideDay("PEST_WWINSECTONEDAY", CFG_CUSTOM, 1)

Provided to allow configuration control of the first insecticide spray in winter wheat - this changes the day in the month.

Referenced by WinterWheat::Do().

◆ cfg_WW_InsecticideMonth

CfgInt cfg_WW_InsecticideMonth("PEST_WWINSECTONEMONTH", CFG_CUSTOM, 5)

Provided to allow configuration control of the first insecticide spray in winter wheat - this changes the month.

Referenced by WinterWheat::Do().

◆ cfg_WW_isecticide_prop1

CfgFloat cfg_WW_isecticide_prop1("PEST_WWINSECTONEPROP", CFG_CUSTOM, 1.0)

Provided to allow configuration control of the proportion of farmers doing first insecticide spray in winter wheat - this changes between 0 and 1.

Referenced by PLWinterWheat::Do().

◆ cfg_WW_isecticide_prop2

CfgFloat cfg_WW_isecticide_prop2("PEST_WWINSECTTWOPROP", CFG_CUSTOM, 1.0)

Provided to allow configuration control of the proportion of farmers doing second insecticide spray in winter wheat - this changes between 0 and 1.

Referenced by PLWinterWheat::Do().

◆ cfg_WW_isecticide_prop3

CfgFloat cfg_WW_isecticide_prop3("PEST_WWINSECTTHREEPROP", CFG_CUSTOM, 1.0)

Provided to allow configuration control of the proportion of farmers doing third insecticide spray in winter wheat - this changes between 0 and 1.

Referenced by PLWinterWheat::Do().

◆ cfg_WW_NINV_tillage_prop1

CfgFloat cfg_WW_NINV_tillage_prop1("TILLAGE_WWNINVONEPROP", CFG_CUSTOM, 1.0)

Provided to allow configuration control of the proportion of farmers doing first non-inversion tillage in winter wheat - this changes between 0 and 1.

Referenced by TestCrop::Do(), and PLWinterWheat::Do().

◆ cfg_WW_NINV_tillage_prop2

CfgFloat cfg_WW_NINV_tillage_prop2("TILLAGE_WWNINVTWOPROP", CFG_CUSTOM, 1.0)

Provided to allow configuration control of the proportion of farmers doing second non-inversion tillage in winter wheat - this changes between 0 and 1.

Referenced by TestCrop::Do(), and PLWinterWheat::Do().

◆ g_landscape_ptr

◆ l_el_o_cut_green

◆ l_el_o_cut_height

CfgFloat l_el_o_cut_height

◆ l_el_o_cut_total

◆ l_farm_cattle_veg_reduce

CfgFloat l_farm_cattle_veg_reduce("FARM_CATTLE_VEG_REDUCE", CFG_CUSTOM, 1.5)
static

◆ l_farm_cattle_veg_reduce2

CfgFloat l_farm_cattle_veg_reduce2("FARM_CATTLE_VEG_REDUCE_LOW", CFG_CUSTOM, 0.50)
static

◆ l_farm_event_do_it_prob

CfgInt l_farm_event_do_it_prob("FARM_EVENT_DO_IT_PROB", CFG_PRIVATE, 50)
static

◆ l_farm_event_do_it_prob_long

CfgInt l_farm_event_do_it_prob_long("FARM_EVENT_DO_IT_PROB_LONG", CFG_PRIVATE, 5)
static

◆ l_farm_herbicide_kills

CfgBool l_farm_herbicide_kills("FARM_PESTICIDE_KILLS", CFG_CUSTOM, true)
static

Referenced by Farm::HerbicideTreat().

◆ l_farm_insecticide_kills

CfgBool l_farm_insecticide_kills("FARM_INSECTICIDE_KILLS", CFG_CUSTOM, true)
static

◆ l_farm_pig_veg_reduce

CfgFloat l_farm_pig_veg_reduce("FARM_PIG_VEG_REDUCE", CFG_CUSTOM, 0.98)
static

◆ l_pest_productapplic_enddate

CfgInt l_pest_productapplic_enddate

◆ l_pest_productapplic_period

CfgInt l_pest_productapplic_period

◆ l_pest_productapplic_startdate

CfgInt l_pest_productapplic_startdate