Goose Management Model ODdox
1.02
|
The Farm Manager class. More...
#include <farm.h>
Classes | |
struct | PesticideData |
Struct used for storing data on pesticide usage throughout the whole simulation (one instance, m_crops_summary_BIs). More... | |
Public Member Functions | |
void | ActualProfit () |
Calls OptimisingFarm::ActualProfit for all optimising farms. More... | |
void | Add_to_cropTotals (int i, double value) |
void | AddField (int a_OwnerIndex, LE *a_newland, int a_Owner) |
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. More... | |
void | CalcCentroids () |
calculate all farm centroids More... | |
bool | CheckOpenness (int a_openness, int a_ref) |
Check if a farm has at least one field with openness above a_openness. More... | |
void | ChooseDecisionMode_for_farms () |
Calls OptimisingFarm::ChooseDecisionMode for all optimising farms. More... | |
int | ConnectFarm (int a_owner) |
void | DumpFarmAreas () |
void | DumpFarmrefs () |
dumps the farmrefs file to a standard named file More... | |
void | FarmManagement () |
Runs the daily farm management for each farm, but also calculates annual spilled grain and maize. More... | |
FarmManager () | |
Farm manager constructor. More... | |
int | FindClosestFarm (HunterInfo a_hinfo, vector< int > *a_farmlist) |
Finds the closest farm to this co-ordinate. More... | |
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. More... | |
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 distribtution for acceptance based on closeness. More... | |
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 distribtution for acceptance based on closeness and another based on farm size. More... | |
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 distribtution for acceptance based on closeness and another based on farm size. More... | |
int | FindFarmWithOpenness (vector< int > *a_farmlist, int a_openness) |
Finds a farm openness more than a value not on the list. More... | |
int | FindFarmWithRandom (vector< int > *a_farmlist) |
Finds a farm openness more than a value not on the list. More... | |
void | FindNeighbours () |
Finds all OptimisingFarms' neighbours and saves them in the farm's OptimisingFarm::m_neighbours vector. More... | |
int | FindOpennessFarm (int a_openness) |
Finds a random farm with at least one field with openness above a_openness. More... | |
TTypesOfVegetation | Get_crops_summary_BIs_tov (int i) |
double | Get_cropTotals (int i) |
int | Get_cropTotals_size () |
int | Get_lookup_table (int index) |
double | GetDD (void) |
Returnes day degrees for the period March 1st - November 1st. Used for determining yields of crops that are not harvested. More... | |
int | GetFarmArableSize (int a_farmref) |
Returns the arable area from the farm ref num. More... | |
int | GetFarmAreaOpenFields (int a_farmref, int a_openness) |
Returns the area of fields with openness more than a_openness. More... | |
APoint | GetFarmCentroid (int a_farmref) |
Gets the farm centroid as an APoint. More... | |
int | GetFarmNoFields (int a_farmref) |
Returns the number of fields owned by a from the farm ref num. More... | |
int | GetFarmNoLookup (int a_ref) |
Get a farm reference from the lookup table. More... | |
int | GetFarmNoOpenFields (int a_farmref, int a_openness) |
Returns the number of fields with openness more than a_openness. More... | |
Farm * | GetFarmPtr (int a_owner) |
Returns the pointer to a farm with a specific number. More... | |
Farm * | GetFarmPtrIndex (int a_index) |
Returns the pointer to a farm with a specific index. More... | |
int | GetFarmTotalSize (int a_farmref) |
Returns the total farm area from the farm ref num. More... | |
TTypesOfFarm | GetFarmType (int a_farmref) |
Returns the farm type from the farm ref num. More... | |
int | GetFarmTypeLookup (int a_ref) |
Get a farm type from the lookup table. More... | |
APoint | GetFarmValidCoords (int a_farmref) |
Returns the number of fields owned by a from the farm ref num. More... | |
bool | GetIsRenumbered () |
Returns the flag for renumbering. More... | |
int | GetNoFarms () |
int | GetRandomFarmRefnum () |
Returns a random farm reference number. More... | |
int | GetRenumberedFarmRef (int a_farmref) |
Returns the farm ref index for a farmref. More... | |
double | GetSpilledGrain () |
Returns the average amount of spilled grain in KJ/m2 this year. More... | |
double | GetSpilledMaize () |
Returns the average amount of spilled maize in KJ/m2 this year. More... | |
bool | InIllegalList (int a_farm_ref, vector< int > *a_farmlist) |
Checks a list to see if a farm matches the illegal list of references. More... | |
void | InitFarms () |
Calls OptimisingFarm::Init for all optimising farms. More... | |
void | InitiateManagement (void) |
bool | IsDuplicateRef (int a_ref, HunterInfo *a_hinfo) |
Checks if we already have this ref. More... | |
void | PrintDecModes_counts () |
For each OptimizingFarm it prints the number of times each of the decision modes was used within a single simulation. See also OptimisingFarm::m_decision_mode_counters. More... | |
void | PrintFinalResults () |
At the end of a simulation it prints results on crop distribution, pesticide and fertilizer usage. More... | |
void | RemoveField (int a_OwnerIndex, LE *a_field) |
void | Save_diff_farm_types_areas () |
Calculates and saves total areas of all optimising farms and specific farm types. More... | |
void | Save_last_years_crops_for_farms () |
Calls OptimisingFarm::Save_last_years_crops for all optimising farms. More... | |
void | Set_crops_fertilizer (int i, double fert) |
void | Set_crops_fertilizer_trade (int i, double fert_trade) |
void | Set_crops_summary_BIs (int i, double BI) |
void | Set_crops_summary_BIs_fi (int i, double BIfi) |
void | Set_crops_summary_BIs_herb (int i, double BIherb) |
void | Set_cropTotals (int i, double value) |
void | Set_cropTotals_cattle_sum (int i, double crop_area) |
void | Set_cropTotals_other_sum (int i, double crop_area) |
void | Set_cropTotals_pig_sum (int i, double crop_area) |
void | Set_cropTotals_plant_sum (int i, double crop_area) |
void | Set_cropTotals_sum (int i, double crop_area) |
void | SetDD (double a_dd) |
void | SetSpilledGrain (bool a_spilledgrain) |
Set m_SpilledGrain which is the flag for either 2013 (true) or 2014 (false) spilled grain distributions. More... | |
void | Switch_rotation () |
Switches OptimisingFarms Farm::m_rotation to the list of all possible rotational crops. More... | |
TTypesOfAnimals | TranslateAnimalsCodes (string &str) |
TTypesOfVegetation | TranslateCropCodes (std::string &str) |
TTypesOfCrops | TranslateCropsCodes (string &str) |
TTypesOfCropVariables | TranslateCropVariablesCodes (string &str) |
TTypesOfOptFarms | TranslateFarmCodes (string &str) |
TTypesOfFarmSize | TranslateFarmSizeCodes (string &str) |
TTypesOfLivestockParameters | TranslateLivestockParametersCodes (string &str) |
TTypesOfParameters | TranslateParametersCodes (string &str) |
TTypesOfSoils | TranslateSoilCodes (string &str) |
~FarmManager () | |
Farm manager destructor. More... | |
Public Attributes | |
DataForOptimisation * | pm_data |
Pointer to the DataForOptimisation. More... | |
ofstream * | pm_output_file |
Protected Member Functions | |
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 by farms (OptimisingFarm) to print the farm level results of optimisation. Includes results of the initial farm otpimisation. More... | |
void | CreateFarms (const char *a_farmfile) |
void | CropDistribution () |
Calculates total crop areas (at the landscape level). Includes results of the initial farm otpimisation. More... | |
void | DistributeFarmerTypes () |
Randomly assigns farmer types to farms (OptimisingFarm) in proportions specified in an input file. More... | |
void | OptimisationOutput () |
Creates output files for all crop level variables and for landscape level crop distribution. Includes results of the initial farm otpimisation. More... | |
void | PrintNeighbours () |
Creates an output file with a list of neighbours of each OptimisingFarm. More... | |
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 OptimisingFarm. Includes results of the initial farm otpimisation. More... | |
void | ReadCropsData () |
Reads the data on crops' parameters that do not vary with farm variables and saves them in a vector DataForOptimisation::m_cropParameters. More... | |
void | ReadCropsData_almass () |
Reads the data on crops' parameters that do not vary with farm variables and saves them in a vector DataForOptimisation::m_cropParameters. ALMaSS crop mode. More... | |
void | ReadCropsData_perFarm_and_Soil () |
Reads the data on crops' parameters that vary with a farm and soil type (sellingPrice) and saves them in a vector DataForOptimisation::m_sellingPrice. More... | |
void | ReadCropsData_perFarm_and_Soil_almass () |
Reads the data on crops' parameters that vary with a farm and soil type (sellingPrice) and saves them in a vector DataForOptimisation:m_sellingPrice. ALMaSS crop mode. More... | |
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, rotationMin) and saves them in vectors of the DataForOptimisation class. More... | |
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, rotationMin) and saves them in vectors of the DataForOptimisation class. ALMaSS crop mode. More... | |
void | ReadCropsData_perFarmType () |
Reads the data on crops' parameters that vary with a farm type (fixed, fodder, FUKey) and saves them in vectors of the DataForOptimisation class. More... | |
void | ReadCropsData_perFarmType_almass () |
Reads the data on crops' parameters that vary with a farm type (fixed, fodder, FUKey) and saves them in vectors of the DataForOptimisation class. ALMaSS crop mode. More... | |
void | ReadCropsData_perSoilType () |
Reads the data on crops' parameters that vary with a soil type (alfa, beta1, beta2, Nnorm) and saves them in vectors of the DataForOptimisation class. More... | |
void | ReadCropsData_perSoilType_almass () |
Reads the data on crops' parameters that vary with a soil type (alfa, beta1, beta2, Nnorm) and saves them in vectors of the DataForOptimisation class. ALMaSS crop mode. More... | |
void | ReadEnergyMaizePrice () |
void | ReadFarmsData () |
Reads farm level parameters and saves them in a vector DataForOptimisation::m_farm_data. More... | |
void | ReadFarmsData_perFarmType () |
Reads the data on farms' parameters that vary with a farm type and saves them in a vector of a DataForOptimisation class. More... | |
void | ReadInitialCropAreas () |
Reads the data on farms' initial crop distributions and saves them in a vector DataForOptimisation::m_cropAreas. More... | |
void | ReadInitialCropAreas_almass () |
Reads the data on farms' initial crop distributions and saves them in a vector of a DataForOptimisation class. ALMaSS crop mode. More... | |
void | ReadLivestockData () |
Reads the data on livestock parameters (do not vary with farm variables) and saves them in a vector DataForOptimisation::m_livestockParameters. More... | |
void | ReadLivestockNumbers () |
Reads the data on livestock numbers and saves them in a vector DataForOptimisation::m_livestockNumbers. More... | |
void | ReadLookupTable () |
Reads the lookup table with allowed/forbidden crop order from a text file and saves it into a vector m_crop_lookup_table. More... | |
Protected Attributes | |
double | daydegrees |
Daydegress for period March 1st - November 1st. Used to determine yield of crops that are not harvested (and thus do not have values of biomass at harvest). More... | |
vector< double > | m_crop_areas_stages |
Stores information on crop areas calculated in different stages of model development: for comparison in sensitivity analysis. More... | |
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). More... | |
vector< double > | m_crops_fertilizer |
Stores information on aggregate (all farms) fertilizer usage for each crop. More... | |
vector< double > | m_crops_fertilizer_trade |
Stores information on aggregate (all farms) fertilizer trade (Nt) usage for each crop. More... | |
vector< PesticideData > | m_crops_summary_BIs |
Stores information on aggregate (all farms)pesticide usage for each crop. More... | |
vector< double > | m_cropTotals |
Stores crops areas at the landscape level per year. More... | |
vector< double > | m_cropTotals_cattle_sum |
Stores the sums of crops areas on cattle farms within one simulation at the landscape level. More... | |
vector< double > | m_cropTotals_other_sum |
Stores the sums of crops areas on other farms within one simulation at the landscape level. More... | |
vector< double > | m_cropTotals_pig_sum |
Stores the sums of crops areas on pig farms within one simulation at the landscape level. More... | |
vector< double > | m_cropTotals_plant_sum |
Stores the sums of crops areas on plant farms within one simulation at the landscape level. More... | |
vector< double > | m_cropTotals_sum |
Stores the sums of crops areas within one simulation at the landscape level. More... | |
int * | m_farmmapping_lookup |
Used for a dynamic array of lookups converting farm references to internal renumbering. More... | |
vector< Farm * > | m_farms |
Population_Manager * | m_population_manager |
bool | m_renumbered |
A flag to show whether renumbering was already done. More... | |
bool | m_SpilledGrain |
Is it 2013 (true) or 2014 (false) as far as grain goes. More... | |
double | totalOptFarmsArea |
double | totalOptFarmsArea_cattle |
double | totalOptFarmsArea_other |
double | totalOptFarmsArea_pig |
double | totalOptFarmsArea_plant |
FarmManager::FarmManager | ( | ) |
Farm manager constructor.
Definition at line 2626 of file farm.cpp.
References cfg_MaizeEnergy, cfg_OptimiseBedriftsmodelCrops, cfg_OptimisingFarms, CreateFarms(), g_farmmanager, DataForOptimisation::Get_cropTypes_almass(), DataForOptimisation::Get_noCrops(), l_map_farmref_file, l_map_read_farmfile, m_crop_areas_stages, m_crops_fertilizer, m_crops_fertilizer_trade, m_crops_summary_BIs, m_cropTotals_cattle_sum, m_cropTotals_other_sum, m_cropTotals_pig_sum, m_cropTotals_plant_sum, m_cropTotals_sum, pm_data, ReadCropsData(), ReadCropsData_almass(), ReadCropsData_perFarm_and_Soil(), ReadCropsData_perFarm_and_Soil_almass(), ReadCropsData_perFarm_and_Soil_and_Size(), ReadCropsData_perFarm_and_Soil_and_Size_almass(), ReadCropsData_perFarmType(), ReadCropsData_perFarmType_almass(), ReadCropsData_perSoilType(), ReadCropsData_perSoilType_almass(), ReadEnergyMaizePrice(), ReadFarmsData(), ReadFarmsData_perFarmType(), ReadInitialCropAreas(), ReadInitialCropAreas_almass(), ReadLivestockData(), ReadLivestockNumbers(), ReadLookupTable(), CfgBool::value(), and CfgStr::value().
FarmManager::~FarmManager | ( | ) |
Farm manager destructor.
Definition at line 2699 of file farm.cpp.
References cfg_OptimisingFarms, m_farms, pm_data, and CfgBool::value().
void FarmManager::ActualProfit | ( | ) |
Calls OptimisingFarm::ActualProfit for all optimising farms.
Definition at line 3433 of file farm.cpp.
References OptimisingFarm::ActualProfit(), m_farms, and tof_OptimisingFarm.
|
inline |
Definition at line 1838 of file farm.h.
References m_cropTotals.
Referenced by OptimisingFarm::ActualProfit().
void FarmManager::AddField | ( | int | a_OwnerIndex, |
LE * | a_newland, | ||
int | a_Owner | ||
) |
void FarmManager::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.
a_farmlist is a pointer to a list of integers with illegal farm ref numbers.
Definition at line 3099 of file farm.cpp.
Referenced by Hunter_Population_Manager::CheckDensity(), and FindFarmWithOpenness().
|
inline |
bool FarmManager::CheckOpenness | ( | int | a_openness, |
int | a_ref | ||
) |
void FarmManager::ChooseDecisionMode_for_farms | ( | ) |
Calls OptimisingFarm::ChooseDecisionMode for all optimising farms.
Definition at line 3444 of file farm.cpp.
References OptimisingFarm::ChooseDecisionMode(), m_farms, and tof_OptimisingFarm.
int FarmManager::ConnectFarm | ( | int | a_owner | ) |
|
protected |
Creates an output file. Prints the crop variables in the first row of the file. The file is used then by farms (OptimisingFarm) to print the farm level results of optimisation. Includes results of the initial farm otpimisation.
Definition at line 4609 of file farm.cpp.
References pm_output_file.
Referenced by InitFarms().
|
protected |
Definition at line 2772 of file farm.cpp.
References cfg_OptimisingFarms, DistributeFarmerTypes(), g_farm_fixed_rotation_enable, g_farm_fixed_rotation_farmtype, g_msg, DataForOptimisation::Get_farmType(), GetFarmNoLookup(), m_farmmapping_lookup, m_farms, m_renumbered, pm_data, toof_Cattle, toof_Other, toof_Pig, toof_Plant, CfgInt::value(), CfgBool::value(), MapErrorMsg::Warn(), and WARN_FILE.
Referenced by FarmManager().
|
protected |
Calculates total crop areas (at the landscape level). Includes results of the initial farm otpimisation.
Definition at line 4588 of file farm.cpp.
References cfg_OptimiseBedriftsmodelCrops, OptimisingFarm::Get_crop(), OptimisingFarm::Get_cropsSize(), DataForOptimisation::Get_noCrops(), CropOptimised::m_area_ha, m_cropTotals, m_farms, pm_data, toc_Foobar, tof_OptimisingFarm, and CfgBool::value().
Referenced by OptimisationOutput().
|
protected |
Randomly assigns farmer types to farms (OptimisingFarm) in proportions specified in an input file.
Definition at line 4965 of file farm.cpp.
References cfg_Environmentalist_proportion, cfg_Profit_max_proportion, cfg_Yield_max_proportion, m_farms, tof_OptimisingFarm, tofg_environment, tofg_profit, tofg_yield, and CfgFloat::value().
Referenced by CreateFarms().
void FarmManager::DumpFarmAreas | ( | ) |
Definition at line 1964 of file farm.cpp.
References OptimisingFarm::Get_almass_no(), Farm::GetArea(), and tof_OptimisingFarm.
void FarmManager::DumpFarmrefs | ( | ) |
dumps the farmrefs file to a standard named file
Definition at line 2997 of file farm.cpp.
References g_msg, m_farmmapping_lookup, m_farms, MapErrorMsg::Warn(), and WARN_FILE.
void FarmManager::FarmManagement | ( | ) |
Runs the daily farm management for each farm, but also calculates annual spilled grain and maize.
Definition at line 2707 of file farm.cpp.
References cfg_Animals_number_test_day, cfg_AnimalsThreshold, cfg_LifeStage, g_landscape_p, OptimisingFarm::Get_main_goal(), Farm::GetFarmNumber(), m_farms, OptimisingFarm::Set_animals_no(), Landscape::SupplyDayInYear(), Landscape::SupplyFarmAnimalCensus(), Landscape::SupplyYearNumber(), tof_OptimisingFarm, tofg_environment, CfgInt::value(), and CfgFloat::value().
int FarmManager::FindClosestFarm | ( | HunterInfo | a_hinfo, |
vector< int > * | a_farmlist | ||
) |
Finds the closest farm to this co-ordinate.
Centroid calculation on farms must be called before calling this method for the first time.
a_farmlist is a pointer to a list of integers with illegal farm ref numbers. The first entry lists the number of illegal numbers.
Definition at line 3126 of file farm.cpp.
References g_msg, HunterInfo::homeX, HunterInfo::homeY, InIllegalList(), IsDuplicateRef(), m_farms, and MapErrorMsg::Warn().
Referenced by Hunter_Population_Manager::DistributeHuntersByRules().
int FarmManager::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.
Finds the closest farm to this co-ordinate with openness more than a value
Definition at line 3155 of file farm.cpp.
References g_msg, HunterInfo::homeX, HunterInfo::homeY, InIllegalList(), IsDuplicateRef(), m_farms, and MapErrorMsg::Warn().
Referenced by Hunter_Population_Manager::DistributeHuntersByRules().
int FarmManager::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 distribtution for acceptance based on closeness.
Centroid calculation on farms must be called before calling this method for the first time.
a_farmlist is a pointer to a list of integers with illegal farm ref numbers. The first entry lists the number of illegal numbers. The chance of acceptance is probability based, taking the nearest farm first then testing the next etc.. The probability is based on y = 1*EXP(-x*cfg) with cfg being a fitting parameter in cfg_ClosestFarmProbParam1
We use typedef here to create our own name for APoint - but it is just two unsigned ints. We will use 'x' for the farm num and 'y' for the distance.
We use a vector of AFarmDists to be able to sort it easily
Struct redefining operator < - used for sorting distances from smallest to largest.
Definition at line 3182 of file farm.cpp.
References cfg_ClosestFarmProbParam1, cfg_ClosestFarmProbParam2, g_msg, g_rand_uni, HunterInfo::homeX, HunterInfo::homeY, InIllegalList(), IsDuplicateRef(), m_farms, CfgFloat::value(), and MapErrorMsg::Warn().
Referenced by Hunter_Population_Manager::DistributeHuntersByRules(), and Hunter_Population_Manager::RuleSet10Based().
int FarmManager::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 distribtution for acceptance based on closeness and another based on farm size.
Centroid calculation on farms must be called before calling this method for the first time.
a_farmlist is a pointer to a list of integers with illegal farm ref numbers. The first entry lists the number of illegal numbers. The chance of acceptance is probability based, taking the nearest farm first then testing the next etc.. The probability is based on y = 1*EXP(-x*cfg) with cfg being a fitting parameter in cfg_ClosestFarmProbParam1
We use typedef here to create our own name for APoint - but it is just two unsigned ints. We will use 'x' for the farm num and 'y' for the distance.
We use a vector of AFarmDists to be able to sort it easily
Struct redefining operator < - used for sorting distances from smallest to largest.
Definition at line 3289 of file farm.cpp.
References cfg_ClosestFarmProbParam1, cfg_ClosestFarmProbParam2, cfg_RoostDistProbParam1, g_msg, g_rand_uni, HunterInfo::homeX, HunterInfo::homeY, InIllegalList(), IsDuplicateRef(), m_farms, CfgFloat::value(), and MapErrorMsg::Warn().
Referenced by Hunter_Population_Manager::RuleSet10Based().
int FarmManager::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 distribtution for acceptance based on closeness and another based on farm size.
Centroid calculation on farms must be called before calling this method for the first time.
a_farmlist is a pointer to a list of integers with illegal farm ref numbers. The first entry lists the number of illegal numbers. The chance of acceptance is probability based, taking the nearest farm first then testing the next etc.. The probability is based on y = 1*EXP(-x*cfg) with cfg being a fitting parameter in cfg_ClosestFarmProbParam1
We use typedef here to create our own name for APoint - but it is just two unsigned ints. We will use 'x' for the farm num and 'y' for the distance.
We use a vector of AFarmDists to be able to sort it easily
Struct redefining operator < - used for sorting distances from smallest to largest.
Definition at line 3233 of file farm.cpp.
References cfg_ClosestFarmProbParam1, cfg_ClosestFarmProbParam2, cfg_FarmSizeProbParam1, g_msg, g_rand_uni, HunterInfo::homeX, HunterInfo::homeY, InIllegalList(), IsDuplicateRef(), m_farms, CfgFloat::value(), and MapErrorMsg::Warn().
Referenced by Hunter_Population_Manager::RuleSet10Based().
int FarmManager::FindFarmWithOpenness | ( | vector< int > * | a_farmlist, |
int | a_openness | ||
) |
Finds a farm openness more than a value not on the list.
Definition at line 3370 of file farm.cpp.
References AddToIllegalList(), g_msg, InIllegalList(), m_farms, and MapErrorMsg::Warn().
Referenced by Hunter_Population_Manager::DistributeHuntersByRules().
int FarmManager::FindFarmWithRandom | ( | vector< int > * | a_farmlist | ) |
Finds a farm openness more than a value not on the list.
Definition at line 3353 of file farm.cpp.
References g_msg, InIllegalList(), m_farms, and MapErrorMsg::Warn().
Referenced by Hunter_Population_Manager::DistributeHuntersByRules().
void FarmManager::FindNeighbours | ( | ) |
Finds all OptimisingFarms' neighbours and saves them in the farm's OptimisingFarm::m_neighbours vector.
Definition at line 4657 of file farm.cpp.
References Farm::Centroids(), cfg_Neighbor_dist, OptimisingFarm::Get_almass_no(), OptimisingFarm::GetFarmCentroidX(), OptimisingFarm::GetFarmCentroidY(), m_farms, PrintNeighbours(), OptimisingFarm::Set_Neighbour(), tof_OptimisingFarm, and CfgFloat::value().
int FarmManager::FindOpennessFarm | ( | int | a_openness | ) |
Finds a random farm with at least one field with openness above a_openness.
Definition at line 3387 of file farm.cpp.
References m_farms.
Referenced by Hunter_Population_Manager::DistributeHuntersByRules().
|
inline |
Definition at line 1853 of file farm.h.
References m_crops_summary_BIs.
Referenced by OptimisingFarm::ActualProfit().
|
inline |
|
inline |
|
inline |
Definition at line 1879 of file farm.h.
References m_crop_lookup_table.
Referenced by OptimisingFarm::Make_rotations(), and OptimisingFarm::Match_crop_to_field().
|
inline |
Returnes day degrees for the period March 1st - November 1st. Used for determining yields of crops that are not harvested.
Definition at line 1835 of file farm.h.
References daydegrees.
Referenced by OptimisingFarm::ActualProfit().
|
inline |
Returns the arable area from the farm ref num.
Definition at line 1733 of file farm.h.
References GetFarmPtr().
Referenced by Hunter_Population_Manager::SaveFarmHunters().
|
inline |
Returns the area of fields with openness more than a_openness.
Definition at line 1760 of file farm.h.
References GetFarmPtr().
Referenced by Hunter_Population_Manager::CheckDensity(), and Hunter_Population_Manager::SaveFarmHunters().
|
inline |
Gets the farm centroid as an APoint.
Definition at line 1809 of file farm.h.
References g_msg, m_farms, and MapErrorMsg::Warn().
Referenced by Hunter_Population_Manager::SaveFarmHunters().
|
inline |
Returns the number of fields owned by a from the farm ref num.
Definition at line 1743 of file farm.h.
References GetFarmPtr().
Referenced by Hunter_Population_Manager::SaveFarmHunters().
|
inline |
Get a farm reference from the lookup table.
Definition at line 1882 of file farm.h.
References m_farmmapping_lookup.
Referenced by CreateFarms().
|
inline |
Returns the number of fields with openness more than a_openness.
Definition at line 1754 of file farm.h.
References GetFarmPtr().
Referenced by Hunter_Population_Manager::SaveFarmHunters().
|
inline |
Returns the pointer to a farm with a specific number.
Definition at line 1766 of file farm.h.
References g_msg, m_farms, and MapErrorMsg::Warn().
Referenced by GetFarmArableSize(), GetFarmAreaOpenFields(), GetFarmNoFields(), GetFarmNoOpenFields(), GetFarmTotalSize(), GetFarmType(), GetFarmValidCoords(), and Landscape::SupplyFarmPtr().
|
inline |
Returns the pointer to a farm with a specific index.
Definition at line 1777 of file farm.h.
References m_farms.
Referenced by Hunter_Population_Manager::SaveFarmHunters().
|
inline |
Returns the total farm area from the farm ref num.
Definition at line 1728 of file farm.h.
References GetFarmPtr().
Referenced by Hunter_Population_Manager::DistributeHuntersByRules(), and Hunter_Population_Manager::SaveFarmHunters().
|
inline |
Returns the farm type from the farm ref num.
Definition at line 1738 of file farm.h.
References GetFarmPtr().
Referenced by Hunter_Population_Manager::SaveFarmHunters().
|
inline |
Get a farm type from the lookup table.
Definition at line 1884 of file farm.h.
References m_farmmapping_lookup.
|
inline |
Returns the number of fields owned by a from the farm ref num.
Definition at line 1748 of file farm.h.
References GetFarmPtr().
Referenced by Hunter_Population_Manager::SaveFarmHunters().
|
inline |
|
inline |
Definition at line 1900 of file farm.h.
References m_farms.
Referenced by Hunter_Population_Manager::DistributeHuntersByRules(), Hunter_Population_Manager::RuleSet10Based(), Hunter_Population_Manager::SaveFarmHunters(), and Landscape::SupplyNumberOfFarms().
|
inline |
|
inline |
Returns the farm ref index for a farmref.
Definition at line 1888 of file farm.h.
References g_msg, m_farmmapping_lookup, m_farms, and MapErrorMsg::Warn().
double FarmManager::GetSpilledGrain | ( | ) |
Returns the average amount of spilled grain in KJ/m2 this year.
Definition at line 3033 of file farm.cpp.
References cfg_grain_distribution, g_rand_uni, m_SpilledGrain, and CfgInt::value().
double FarmManager::GetSpilledMaize | ( | ) |
Returns the average amount of spilled maize in KJ/m2 this year.
Definition at line 3064 of file farm.cpp.
References g_rand_uni.
bool FarmManager::InIllegalList | ( | int | a_farm_ref, |
vector< int > * | a_farmlist | ||
) |
Checks a list to see if a farm matches the illegal list of references.
a_farmlist is a pointer to a list of integers with illegal farm ref numbers. The first entry lists the number of illegal numbers.
Definition at line 3088 of file farm.cpp.
Referenced by FindClosestFarm(), FindClosestFarmOpenness(), FindClosestFarmOpennessProb(), FindClosestFarmOpennessProbNearRoostIsBest(), FindClosestFarmOpennessProbSmallIsBest(), FindFarmWithOpenness(), and FindFarmWithRandom().
void FarmManager::InitFarms | ( | ) |
Calls OptimisingFarm::Init for all optimising farms.
Definition at line 3014 of file farm.cpp.
References cfg_OptimisingFarms, Create_Output_file_for_farms(), OptimisingFarm::Init(), m_farms, OptimisationOutput(), pm_output_file, tof_OptimisingFarm, and CfgBool::value().
void FarmManager::InitiateManagement | ( | void | ) |
bool FarmManager::IsDuplicateRef | ( | int | a_ref, |
HunterInfo * | a_hinfo | ||
) |
Checks if we already have this ref.
Definition at line 3116 of file farm.cpp.
References HunterInfo::FarmHuntRef.
Referenced by Hunter_Population_Manager::DistributeHuntersByRules(), FindClosestFarm(), FindClosestFarmOpenness(), FindClosestFarmOpennessProb(), FindClosestFarmOpennessProbNearRoostIsBest(), and FindClosestFarmOpennessProbSmallIsBest().
|
protected |
Creates output files for all crop level variables and for landscape level crop distribution. Includes results of the initial farm otpimisation.
Definition at line 4451 of file farm.cpp.
References cfg_OptimiseBedriftsmodelCrops, CropDistribution(), DataForOptimisation::Get_cropTypes_almass_str(), DataForOptimisation::Get_cropTypes_str(), DataForOptimisation::Get_noCrops(), m_cropTotals, pm_data, PrintOutput(), toc_Foobar, tocv_AreaHa, tocv_AreaPercent, tocv_BI, tocv_BIFi, tocv_BIHerb, tocv_Costs, tocv_GM, tocv_Grooming, tocv_Hoeing, tocv_Income, tocv_N, tocv_Nt, tocv_Response, tocv_Savings, tocv_TotalLoss, tocv_Weeding, and CfgBool::value().
Referenced by InitFarms().
void FarmManager::PrintDecModes_counts | ( | ) |
For each OptimizingFarm it prints the number of times each of the decision modes was used within a single simulation. See also OptimisingFarm::m_decision_mode_counters.
Definition at line 4720 of file farm.cpp.
References OptimisingFarm::Get_almass_no(), OptimisingFarm::Get_decision_mode_counters(), m_farms, and tof_OptimisingFarm.
Referenced by PrintFinalResults().
void FarmManager::PrintFinalResults | ( | ) |
At the end of a simulation it prints results on crop distribution, pesticide and fertilizer usage.
Definition at line 4741 of file farm.cpp.
References g_date, DataForOptimisation::Get_cropTypes_almass_str(), DataForOptimisation::Get_noCrops(), Calendar::GetYearNumber(), m_crop_areas_stages, m_crops_fertilizer, m_crops_fertilizer_trade, m_crops_summary_BIs, m_cropTotals_cattle_sum, m_cropTotals_other_sum, m_cropTotals_pig_sum, m_cropTotals_plant_sum, m_cropTotals_sum, pm_data, PrintDecModes_counts(), totalOptFarmsArea, totalOptFarmsArea_cattle, totalOptFarmsArea_other, totalOptFarmsArea_pig, and totalOptFarmsArea_plant.
|
protected |
Creates an output file with a list of neighbours of each OptimisingFarm.
Definition at line 4701 of file farm.cpp.
References OptimisingFarm::Get_almass_no(), OptimisingFarm::Get_Neighbour(), OptimisingFarm::Get_NeighboursSize(), m_farms, and tof_OptimisingFarm.
Referenced by FindNeighbours().
|
protected |
Makes an output file for one crop variable and prints its values for each crop and each OptimisingFarm. Includes results of the initial farm otpimisation.
Definition at line 4504 of file farm.cpp.
References cfg_OptimiseBedriftsmodelCrops, g_msg, OptimisingFarm::Get_almass_no(), OptimisingFarm::Get_crop(), OptimisingFarm::Get_cropsSize(), DataForOptimisation::Get_cropTypes_almass_str(), DataForOptimisation::Get_cropTypes_str(), DataForOptimisation::Get_noCrops(), CropOptimised::m_area_ha, CropOptimised::m_areaPercent, CropOptimised::m_BI, CropOptimised::m_BIFi, CropOptimised::m_BIHerb, CropOptimised::m_costs_ha, m_farms, CropOptimised::m_GM, CropOptimised::m_grooming, CropOptimised::m_hoeing, CropOptimised::m_income_ha, CropOptimised::m_n, CropOptimised::m_nt, CropOptimised::m_resp, CropOptimised::m_savings, CropOptimised::m_totalLoss, CropOptimised::m_weeding, pm_data, toc_Foobar, tocv_AreaHa, tocv_AreaPercent, tocv_BI, tocv_BIFi, tocv_BIHerb, tocv_Costs, tocv_GM, tocv_Grooming, tocv_Hoeing, tocv_Income, tocv_N, tocv_Nt, tocv_Response, tocv_Savings, tocv_TotalLoss, tocv_Weeding, tof_OptimisingFarm, CfgBool::value(), MapErrorMsg::Warn(), and WARN_BUG.
Referenced by OptimisationOutput().
|
protected |
Reads the data on crops' parameters that do not vary with farm variables and saves them in a vector DataForOptimisation::m_cropParameters.
Definition at line 3656 of file farm.cpp.
References pm_data, DataForOptimisation::Set_cropParameter(), toc_Foobar, and top_Foobar.
Referenced by FarmManager().
|
protected |
Reads the data on crops' parameters that do not vary with farm variables and saves them in a vector DataForOptimisation::m_cropParameters. ALMaSS crop mode.
Definition at line 3688 of file farm.cpp.
References DataForOptimisation::Get_cropTypes_almass(), pm_data, DataForOptimisation::Set_cropParameter(), and top_Foobar.
Referenced by FarmManager().
|
protected |
Reads the data on crops' parameters that vary with a farm and soil type (sellingPrice) and saves them in a vector DataForOptimisation::m_sellingPrice.
Definition at line 4003 of file farm.cpp.
References pm_data, DataForOptimisation::Set_sellingPrice(), toc_Foobar, toof_Foobar, and tos_Foobar.
Referenced by FarmManager().
|
protected |
Reads the data on crops' parameters that vary with a farm and soil type (sellingPrice) and saves them in a vector DataForOptimisation:m_sellingPrice. ALMaSS crop mode.
Definition at line 4036 of file farm.cpp.
References DataForOptimisation::Get_cropTypes_almass(), pm_data, DataForOptimisation::Set_sellingPrice(), toof_Foobar, tos_Foobar, and tov_Undefined.
Referenced by FarmManager().
|
protected |
Reads the data on crops' parameters that vary with a farm type, soil type and farm size (rotationMax, rotationMin) and saves them in vectors of the DataForOptimisation class.
Definition at line 4074 of file farm.cpp.
References pm_data, DataForOptimisation::Set_rotationMax(), DataForOptimisation::Set_rotationMin(), toc_Foobar, tofs_Foobar, toof_Foobar, and tos_Foobar.
Referenced by FarmManager().
|
protected |
Reads the data on crops' parameters that vary with a farm type, soil type and farm size (rotationMax, rotationMin) and saves them in vectors of the DataForOptimisation class. ALMaSS crop mode.
Definition at line 4117 of file farm.cpp.
References cfg_Areas_Based_on_Distribution, g_msg, DataForOptimisation::Get_cropTypes_almass(), pm_data, DataForOptimisation::Set_rotationMax(), DataForOptimisation::Set_rotationMin(), tofs_Foobar, toof_Foobar, tos_Foobar, tov_Undefined, CfgBool::value(), MapErrorMsg::Warn(), and WARN_FILE.
Referenced by FarmManager().
|
protected |
Reads the data on crops' parameters that vary with a farm type (fixed, fodder, FUKey) and saves them in vectors of the DataForOptimisation class.
Definition at line 3881 of file farm.cpp.
References pm_data, DataForOptimisation::Set_fixed(), DataForOptimisation::Set_fodder(), DataForOptimisation::Set_FUKey(), toc_Foobar, and toof_Foobar.
Referenced by FarmManager().
|
protected |
Reads the data on crops' parameters that vary with a farm type (fixed, fodder, FUKey) and saves them in vectors of the DataForOptimisation class. ALMaSS crop mode.
Definition at line 3937 of file farm.cpp.
References g_msg, DataForOptimisation::Get_cropTypes_almass(), pm_data, DataForOptimisation::Set_fixed(), DataForOptimisation::Set_fodder(), DataForOptimisation::Set_FUKey(), toof_Foobar, tov_Undefined, MapErrorMsg::Warn(), and WARN_FILE.
Referenced by FarmManager().
|
protected |
Reads the data on crops' parameters that vary with a soil type (alfa, beta1, beta2, Nnorm) and saves them in vectors of the DataForOptimisation class.
Definition at line 3724 of file farm.cpp.
References pm_data, DataForOptimisation::Set_alfa(), DataForOptimisation::Set_beta1(), DataForOptimisation::Set_beta2(), DataForOptimisation::Set_Nnorm(), toc_Foobar, and tos_Foobar.
Referenced by FarmManager().
|
protected |
Reads the data on crops' parameters that vary with a soil type (alfa, beta1, beta2, Nnorm) and saves them in vectors of the DataForOptimisation class. ALMaSS crop mode.
Definition at line 3790 of file farm.cpp.
References g_msg, DataForOptimisation::Get_cropTypes_almass(), pm_data, DataForOptimisation::Set_alfa(), DataForOptimisation::Set_beta1(), DataForOptimisation::Set_beta2(), DataForOptimisation::Set_biomass_factor(), DataForOptimisation::Set_Nnorm(), tos_Foobar, tov_Undefined, MapErrorMsg::Warn(), and WARN_FILE.
Referenced by FarmManager().
|
protected |
Definition at line 4244 of file farm.cpp.
References l_emaize_price_file, pm_data, DataForOptimisation::Set_emaize_price(), and CfgStr::value().
Referenced by FarmManager().
|
protected |
Reads farm level parameters and saves them in a vector DataForOptimisation::m_farm_data.
Definition at line 3484 of file farm.cpp.
References DataForOptimisation::m_farm_data, DataForOptimisation::FarmData::md_almass_no, DataForOptimisation::FarmData::md_farmRealID, DataForOptimisation::FarmData::md_farmSize, DataForOptimisation::FarmData::md_farmType, DataForOptimisation::FarmData::md_soilSubType, DataForOptimisation::FarmData::md_soilType, pm_data, TranslateFarmCodes(), TranslateFarmSizeCodes(), and TranslateSoilCodes().
Referenced by FarmManager().
|
protected |
Reads the data on farms' parameters that vary with a farm type and saves them in a vector of a DataForOptimisation class.
Definition at line 4184 of file farm.cpp.
References pm_data, DataForOptimisation::Set_winterMax(), and toof_Foobar.
Referenced by FarmManager().
|
protected |
Reads the data on farms' initial crop distributions and saves them in a vector DataForOptimisation::m_cropAreas.
Definition at line 3571 of file farm.cpp.
References pm_data, DataForOptimisation::Set_cropArea(), DataForOptimisation::Set_cropTypes(), DataForOptimisation::Set_cropTypes_str(), toc_Foobar, and TranslateCropsCodes().
Referenced by FarmManager().
|
protected |
Reads the data on farms' initial crop distributions and saves them in a vector of a DataForOptimisation class. ALMaSS crop mode.
Definition at line 3612 of file farm.cpp.
References pm_data, DataForOptimisation::Set_cropArea(), DataForOptimisation::Set_cropTypes_almass(), DataForOptimisation::Set_cropTypes_almass_str(), DataForOptimisation::Set_noCrops(), and TranslateCropCodes().
Referenced by FarmManager().
|
protected |
Reads the data on livestock parameters (do not vary with farm variables) and saves them in a vector DataForOptimisation::m_livestockParameters.
Definition at line 4212 of file farm.cpp.
References pm_data, DataForOptimisation::Set_livestockParameter(), toa_Foobar, and tolp_Foobar.
Referenced by FarmManager().
|
protected |
Reads the data on livestock numbers and saves them in a vector DataForOptimisation::m_livestockNumbers.
Definition at line 3530 of file farm.cpp.
References pm_data, DataForOptimisation::Set_livestockNumber(), DataForOptimisation::Set_livestockTypes(), toa_Foobar, and TranslateAnimalsCodes().
Referenced by FarmManager().
|
protected |
Reads the lookup table with allowed/forbidden crop order from a text file and saves it into a vector m_crop_lookup_table.
Definition at line 4625 of file farm.cpp.
References m_crop_lookup_table, and tov_Undefined.
Referenced by FarmManager().
void FarmManager::RemoveField | ( | int | a_OwnerIndex, |
LE * | a_field | ||
) |
void FarmManager::Save_diff_farm_types_areas | ( | ) |
Calculates and saves total areas of all optimising farms and specific farm types.
Definition at line 3404 of file farm.cpp.
References OptimisingFarm::Get_farmType(), Farm::GetAreaDouble(), m_farms, tof_OptimisingFarm, toof_Cattle, toof_Other, toof_Pig, toof_Plant, totalOptFarmsArea, totalOptFarmsArea_cattle, totalOptFarmsArea_other, totalOptFarmsArea_pig, and totalOptFarmsArea_plant.
void FarmManager::Save_last_years_crops_for_farms | ( | ) |
Calls OptimisingFarm::Save_last_years_crops for all optimising farms.
Definition at line 3456 of file farm.cpp.
References m_farms, OptimisingFarm::Save_last_years_crops(), and tof_OptimisingFarm.
|
inline |
Definition at line 1863 of file farm.h.
References m_crops_fertilizer.
Referenced by OptimisingFarm::ActualProfit().
|
inline |
Definition at line 1864 of file farm.h.
References m_crops_fertilizer_trade.
Referenced by OptimisingFarm::ActualProfit().
|
inline |
Definition at line 1856 of file farm.h.
References m_crops_summary_BIs.
Referenced by OptimisingFarm::ActualProfit().
|
inline |
Definition at line 1855 of file farm.h.
References m_crops_summary_BIs.
Referenced by OptimisingFarm::ActualProfit().
|
inline |
Definition at line 1854 of file farm.h.
References m_crops_summary_BIs.
Referenced by OptimisingFarm::ActualProfit().
|
inline |
|
inline |
Definition at line 1860 of file farm.h.
References m_cropTotals_cattle_sum.
Referenced by OptimisingFarm::ActualProfit().
|
inline |
Definition at line 1861 of file farm.h.
References m_cropTotals_other_sum.
Referenced by OptimisingFarm::ActualProfit().
|
inline |
Definition at line 1859 of file farm.h.
References m_cropTotals_pig_sum.
Referenced by OptimisingFarm::ActualProfit().
|
inline |
Definition at line 1858 of file farm.h.
References m_cropTotals_plant_sum.
Referenced by OptimisingFarm::ActualProfit().
|
inline |
Definition at line 1857 of file farm.h.
References m_cropTotals_sum.
Referenced by OptimisingFarm::ActualProfit().
|
inline |
|
inline |
Set m_SpilledGrain which is the flag for either 2013 (true) or 2014 (false) spilled grain distributions.
Definition at line 1828 of file farm.h.
References m_SpilledGrain.
void FarmManager::Switch_rotation | ( | ) |
Switches OptimisingFarms Farm::m_rotation to the list of all possible rotational crops.
Definition at line 4942 of file farm.cpp.
References Farm::Assign_rotation(), DataForOptimisation::Get_cropTypes_almass(), DataForOptimisation::Get_cropTypes_almass_size(), m_farms, pm_data, tof_OptimisingFarm, tov_OrchardCrop, tov_PermanentGrassGrazed, tov_PermanentGrassLowYield, tov_PermanentGrassTussocky, tov_PermanentSetaside, and tov_YoungForest.
TTypesOfAnimals FarmManager::TranslateAnimalsCodes | ( | string & | str | ) |
Definition at line 4309 of file farm.cpp.
References g_msg, toa_DCalf, toa_DCow, toa_Deer, toa_Duck, toa_EHen, toa_Finisher, toa_Goat, toa_Goose, toa_Horse, toa_MCalf, toa_MCattle, toa_MDuck, toa_MHen, toa_Mink, toa_Ostrich, toa_Piglet, toa_Sheep, toa_So, toa_Suckler, toa_Turkey, MapErrorMsg::Warn(), and WARN_FILE.
Referenced by ReadLivestockNumbers().
TTypesOfVegetation FarmManager::TranslateCropCodes | ( | std::string & | str | ) |
Definition at line 1818 of file farm.cpp.
References g_msg, tov_AgroChemIndustryCereal, tov_BroadBeans, tov_Carrots, tov_CloverGrassGrazed1, tov_CloverGrassGrazed2, tov_DummyCropPestTesting, tov_FieldPeas, tov_FieldPeasSilage, tov_FieldPeasStrigling, tov_FodderBeet, tov_FodderGrass, tov_Maize, tov_MaizeSilage, tov_MaizeStrigling, tov_NLBeet, tov_NLBeetSpring, tov_NLCabbage, tov_NLCabbageSpring, tov_NLCarrots, tov_NLCarrotsSpring, tov_NLCatchPeaCrop, tov_NLGrassGrazed1, tov_NLGrassGrazed1Spring, tov_NLGrassGrazed2, tov_NLGrassGrazedLast, tov_NLMaize, tov_NLMaizeSpring, tov_NLPermanentGrassGrazed, tov_NLPotatoes, tov_NLPotatoesSpring, tov_NLSpringBarley, tov_NLSpringBarleySpring, tov_NLTulips, tov_NLWinterWheat, tov_NorwegianOats, tov_NorwegianPotatoes, tov_NorwegianSpringBarley, tov_Oats, tov_OBarleyPeaCloverGrass, tov_OCarrots, tov_OCloverGrassGrazed1, tov_OCloverGrassGrazed2, tov_OCloverGrassSilage1, tov_OFieldPeas, tov_OFieldPeasSilage, tov_OFodderBeet, tov_OGrazingPigs, tov_OMaizeSilage, tov_OOats, tov_OPermanentGrassGrazed, tov_OPotatoes, tov_OrchardCrop, tov_OSBarleySilage, tov_OSeedGrass1, tov_OSeedGrass2, tov_OSpringBarley, tov_OSpringBarleyClover, tov_OSpringBarleyExt, tov_OSpringBarleyGrass, tov_OSpringBarleyPigs, tov_OTriticale, tov_OWinterBarley, tov_OWinterBarleyExt, tov_OWinterRape, tov_OWinterRye, tov_OWinterWheat, tov_OWinterWheatUndersown, tov_OWinterWheatUndersownExt, tov_PermanentGrassGrazed, tov_PermanentGrassLowYield, tov_PermanentGrassTussocky, tov_PermanentSetaside, tov_PlantNursery, tov_PLBeans, tov_PLBeet, tov_PLBeetSpr, tov_PLCarrots, tov_PLFodderLucerne1, tov_PLFodderLucerne2, tov_PLMaize, tov_PLMaizeSilage, tov_PLPotatoes, tov_PLSpringBarley, tov_PLSpringBarleySpr, tov_PLSpringWheat, tov_PLWinterBarley, tov_PLWinterRape, tov_PLWinterRye, tov_PLWinterTriticale, tov_PLWinterWheat, tov_PLWinterWheatLate, tov_Potatoes, tov_PotatoesIndustry, tov_SeedGrass1, tov_SeedGrass2, tov_Setaside, tov_SpringBarley, tov_SpringBarleyCloverGrass, tov_SpringBarleyCloverGrassStrigling, tov_SpringBarleyGrass, tov_SpringBarleyPeaCloverGrassStrigling, tov_SpringBarleyPTreatment, tov_SpringBarleySeed, tov_SpringBarleySilage, tov_SpringBarleySpr, tov_SpringBarleyStrigling, tov_SpringBarleyStriglingCulm, tov_SpringBarleyStriglingSingle, tov_SpringRape, tov_SpringWheat, tov_SugarBeet, tov_Triticale, tov_WinterBarley, tov_WinterBarleyStrigling, tov_WinterRape, tov_WinterRapeStrigling, tov_WinterRye, tov_WinterRyeStrigling, tov_WinterWheat, tov_WinterWheatShort, tov_WinterWheatStrigling, tov_WinterWheatStriglingCulm, tov_WinterWheatStriglingSingle, tov_WWheatPControl, tov_WWheatPToxicControl, tov_WWheatPTreatment, tov_YoungForest, MapErrorMsg::Warn(), and WARN_FILE.
Referenced by OptimisingFarm::findCropByName_almass(), ReadInitialCropAreas_almass(), Farm::ReadRotation(), and UserDefinedFarm::UserDefinedFarm().
TTypesOfCrops FarmManager::TranslateCropsCodes | ( | string & | str | ) |
Definition at line 4338 of file farm.cpp.
References g_msg, toc_ChrisTree, toc_CloverGrz, toc_EnergyFor, toc_Fruit, toc_FruitTree, toc_GrassClover, toc_GrassEnv1, toc_GrassEnv2, toc_GrassRot, toc_GrassSeed, toc_MaizeSil, toc_Oats, toc_OFodderBeet, toc_OLSeed, toc_OLSeedCut, toc_OOilseed, toc_OSCrops, toc_OSpecCrops, toc_Other, toc_OUncult, toc_Peas, toc_PeasSil, toc_PerGrassLow, toc_PerGrassNorm, toc_Potato, toc_PotatoFood, toc_SBarley, toc_SCerealG, toc_SCerealSil, toc_Setaside, toc_SRape, toc_SugarBeet, toc_Triticale, toc_Uncult, toc_Veg, toc_WBarley, toc_WCerealSil, toc_WRape, toc_WRye, toc_WWheat, MapErrorMsg::Warn(), and WARN_FILE.
Referenced by OptimisingFarm::findCropByName(), and ReadInitialCropAreas().
TTypesOfCropVariables FarmManager::TranslateCropVariablesCodes | ( | string & | str | ) |
Definition at line 4426 of file farm.cpp.
References g_msg, tocv_AreaHa, tocv_AreaPercent, tocv_BI, tocv_BIFi, tocv_BIHerb, tocv_Costs, tocv_GM, tocv_Grooming, tocv_Hoeing, tocv_Income, tocv_N, tocv_Nt, tocv_Response, tocv_Savings, tocv_TotalLoss, tocv_Weeding, MapErrorMsg::Warn(), and WARN_FILE.
TTypesOfOptFarms FarmManager::TranslateFarmCodes | ( | string & | str | ) |
Definition at line 4273 of file farm.cpp.
References g_msg, toof_Cattle, toof_Other, toof_Pig, toof_Plant, MapErrorMsg::Warn(), and WARN_FILE.
Referenced by ReadFarmsData().
TTypesOfFarmSize FarmManager::TranslateFarmSizeCodes | ( | string & | str | ) |
Definition at line 4298 of file farm.cpp.
References g_msg, tofs_Business, tofs_Private, MapErrorMsg::Warn(), and WARN_FILE.
Referenced by ReadFarmsData().
TTypesOfLivestockParameters FarmManager::TranslateLivestockParametersCodes | ( | string & | str | ) |
Definition at line 4414 of file farm.cpp.
References g_msg, tolp_AUKey, tolp_FUuKey, tolp_Nusable, MapErrorMsg::Warn(), and WARN_FILE.
Referenced by OptimisingFarm::findFodderDemand(), and OptimisingFarm::findTotalNanim().
TTypesOfParameters FarmManager::TranslateParametersCodes | ( | string & | str | ) |
Definition at line 4387 of file farm.cpp.
References g_msg, top_AlfaFi, top_AlfaG, top_AlfaH, top_AlfaHerb, top_AlfaW, top_BetaFi, top_BetaG, top_BetaH, top_BetaHerb, top_BetaW, top_PriceFi, top_PriceG, top_PriceH, top_PriceHerb, top_PriceLM, top_PriceW, top_Subsidy, MapErrorMsg::Warn(), and WARN_FILE.
Referenced by OptimisingFarm::crop_parameter().
TTypesOfSoils FarmManager::TranslateSoilCodes | ( | string & | str | ) |
|
protected |
|
protected |
Stores information on crop areas calculated in different stages of model development: for comparison in sensitivity analysis.
Definition at line 1957 of file farm.h.
Referenced by FarmManager(), and PrintFinalResults().
|
protected |
Specifies which crop order is allowed in a rotation (i.e. if a given crop can follow another crop).
Definition at line 1939 of file farm.h.
Referenced by Get_lookup_table(), and ReadLookupTable().
|
protected |
Stores information on aggregate (all farms) fertilizer usage for each crop.
Definition at line 1953 of file farm.h.
Referenced by FarmManager(), PrintFinalResults(), and Set_crops_fertilizer().
|
protected |
Stores information on aggregate (all farms) fertilizer trade (Nt) usage for each crop.
Definition at line 1955 of file farm.h.
Referenced by FarmManager(), PrintFinalResults(), and Set_crops_fertilizer_trade().
|
protected |
Stores information on aggregate (all farms)pesticide usage for each crop.
Definition at line 1951 of file farm.h.
Referenced by FarmManager(), Get_crops_summary_BIs_tov(), PrintFinalResults(), Set_crops_summary_BIs(), Set_crops_summary_BIs_fi(), and Set_crops_summary_BIs_herb().
|
protected |
Stores crops areas at the landscape level per year.
Definition at line 1937 of file farm.h.
Referenced by Add_to_cropTotals(), CropDistribution(), Get_cropTotals(), Get_cropTotals_size(), OptimisationOutput(), and Set_cropTotals().
|
protected |
Stores the sums of crops areas on cattle farms within one simulation at the landscape level.
Definition at line 1947 of file farm.h.
Referenced by FarmManager(), PrintFinalResults(), and Set_cropTotals_cattle_sum().
|
protected |
Stores the sums of crops areas on other farms within one simulation at the landscape level.
Definition at line 1949 of file farm.h.
Referenced by FarmManager(), PrintFinalResults(), and Set_cropTotals_other_sum().
|
protected |
Stores the sums of crops areas on pig farms within one simulation at the landscape level.
Definition at line 1945 of file farm.h.
Referenced by FarmManager(), PrintFinalResults(), and Set_cropTotals_pig_sum().
|
protected |
Stores the sums of crops areas on plant farms within one simulation at the landscape level.
Definition at line 1943 of file farm.h.
Referenced by FarmManager(), PrintFinalResults(), and Set_cropTotals_plant_sum().
|
protected |
Stores the sums of crops areas within one simulation at the landscape level.
Definition at line 1941 of file farm.h.
Referenced by FarmManager(), PrintFinalResults(), and Set_cropTotals_sum().
|
protected |
Used for a dynamic array of lookups converting farm references to internal renumbering.
Definition at line 1915 of file farm.h.
Referenced by CreateFarms(), DumpFarmrefs(), GetFarmNoLookup(), GetFarmTypeLookup(), and GetRenumberedFarmRef().
|
protected |
Definition at line 1906 of file farm.h.
Referenced by ActualProfit(), AddField(), CalcCentroids(), CheckOpenness(), ChooseDecisionMode_for_farms(), ConnectFarm(), CreateFarms(), CropDistribution(), DistributeFarmerTypes(), DumpFarmrefs(), FarmManagement(), FindClosestFarm(), FindClosestFarmOpenness(), FindClosestFarmOpennessProb(), FindClosestFarmOpennessProbNearRoostIsBest(), FindClosestFarmOpennessProbSmallIsBest(), FindFarmWithOpenness(), FindFarmWithRandom(), FindNeighbours(), FindOpennessFarm(), GetFarmCentroid(), GetFarmPtr(), GetFarmPtrIndex(), GetNoFarms(), GetRandomFarmRefnum(), GetRenumberedFarmRef(), InitFarms(), InitiateManagement(), PrintDecModes_counts(), PrintNeighbours(), PrintOutput(), RemoveField(), Save_diff_farm_types_areas(), Save_last_years_crops_for_farms(), Switch_rotation(), and ~FarmManager().
|
protected |
|
protected |
A flag to show whether renumbering was already done.
Definition at line 1917 of file farm.h.
Referenced by CreateFarms(), and GetIsRenumbered().
|
protected |
Is it 2013 (true) or 2014 (false) as far as grain goes.
Definition at line 1912 of file farm.h.
Referenced by GetSpilledGrain(), and SetSpilledGrain().
DataForOptimisation* FarmManager::pm_data |
Pointer to the DataForOptimisation.
Definition at line 1876 of file farm.h.
Referenced by OptimisingFarm::ActualProfit(), OptimisingPigFarm::check_WRape_WBarley(), OptimisingCattleFarm::checkCattleRotation(), OptimisingCattleFarm::checkCattleRotation_almass(), AnimalFarm::checkWinterCrops(), NonAnimalFarm::checkWinterCrops(), AnimalFarm::checkWinterRotation1(), AnimalFarm::correctFodderDemand(), CreateFarms(), AnimalFarm::createFodderCrops(), OptimisingFarm::createVariableCrops(), OptimisingFarm::crop_parameter(), CropDistribution(), AnimalFarm::decreaseCrops(), OptimisingFarm::determineAreas(), AnimalFarm::determineFodderAreas(), AnimalFarm::determineMinFodder(), FarmManager(), OptimisingFarm::findFertilizer(), OptimisingFarm::findFodderDemand(), OptimisingFarm::findGrossMargin(), OptimisingFarm::findResponse(), OptimisingFarm::findTotalNanim(), AnimalFarm::increaseCrops(), OptimisingFarm::Initialize(), OptimisationOutput(), OptimisingFarm::optimizeCrops(), PrintFinalResults(), PrintOutput(), ReadCropsData(), ReadCropsData_almass(), ReadCropsData_perFarm_and_Soil(), ReadCropsData_perFarm_and_Soil_almass(), ReadCropsData_perFarm_and_Soil_and_Size(), ReadCropsData_perFarm_and_Soil_and_Size_almass(), ReadCropsData_perFarmType(), ReadCropsData_perFarmType_almass(), ReadCropsData_perSoilType(), ReadCropsData_perSoilType_almass(), ReadEnergyMaizePrice(), ReadFarmsData(), ReadFarmsData_perFarmType(), ReadInitialCropAreas(), ReadInitialCropAreas_almass(), ReadLivestockData(), ReadLivestockNumbers(), OptimisingCattleFarm::setCattleCropsAtMin(), Switch_rotation(), and ~FarmManager().
ofstream* FarmManager::pm_output_file |
Definition at line 1877 of file farm.h.
Referenced by Create_Output_file_for_farms(), and InitFarms().
|
protected |
Definition at line 1930 of file farm.h.
Referenced by PrintFinalResults(), and Save_diff_farm_types_areas().
|
protected |
Definition at line 1933 of file farm.h.
Referenced by PrintFinalResults(), and Save_diff_farm_types_areas().
|
protected |
Definition at line 1934 of file farm.h.
Referenced by PrintFinalResults(), and Save_diff_farm_types_areas().
|
protected |
Definition at line 1932 of file farm.h.
Referenced by PrintFinalResults(), and Save_diff_farm_types_areas().
|
protected |
Definition at line 1931 of file farm.h.
Referenced by PrintFinalResults(), and Save_diff_farm_types_areas().