Skip to content
Snippets Groups Projects
Commit 7c83396e authored by Peter Alexander's avatar Peter Alexander
Browse files

no message

parent 663510a6
No related branches found
Tags v12.3.0
No related merge requests found
......@@ -31,7 +31,7 @@
SCALAR fitToPreviousAreas controlling parameter 0 means dont fit and 1 is to calibrate the cropAdj in the calibration year
*$gdxin "/Users/peteralexander/Documents/R_Workspace/temp/GamsTest/_gams_java_gdb1.gdx"
*$gdxin "/Users/peteralexander/Documents/R_Workspace/temp/GamsTest/_gams_java_1091455539.gdx"
$gdxin %gdxincname%
$load location, suitableLandArea, previousArea, demand, landChangeEnergy
$load yieldNone, yieldFertOnly, yieldIrrigOnly, yieldBoth
......@@ -63,8 +63,11 @@ $gdxin
starchyRoots 4.0
pasture 0.1 / ;
SCALAR fertiliserUnitCost / 1.5 /
SCALAR fertiliserUnitCost / 1.5 /
PARAMETER previousCropTotalAreas(location);
previousCropTotalAreas(location) = sum(crop_less_pasture, previousArea(crop_less_pasture, location));
VARIABLES
area(crop, location) total area for each crop - Mha
fertI(crop, location) fertilizer intensity for each crop - factor between 0 and 1
......@@ -110,7 +113,7 @@ $gdxin
PASTURE_DECREASE_CONV_CALC(location)
ENERGY_EQ total energy objective function;
UNIT_ENERGY_EQ(crop, location) .. unitEnergy(crop, location) =E= ( baseCost(crop) +
UNIT_ENERGY_EQ(crop, location) .. unitEnergy(crop, location) =E= ( baseCost(crop) * power(cropAdj(crop), 1) +
(fertiliserUnitCost * fertI(crop, location)) +
(irrigCost(location) * irrigI(crop, location)) ) ;
......@@ -124,7 +127,7 @@ $gdxin
NET_SUPPLY_EQ(crop) .. net_supply(crop) =E= sum(location, area(crop, location) * yield(crop, location)) - feedAmount(crop) + netImportAmount(crop);
NON_CEREAL_DEMAND_CONSTRAINT(non_cereal_crop) .. net_supply(non_cereal_crop) =G= demand(non_cereal_crop);
NON_CEREAL_DEMAND_CONSTRAINT(non_cereal_crop) .. net_supply(non_cereal_crop) =G= demand(non_cereal_crop) ;
CEREAL_DEMAND_CONSTRAINT(cereal_crop) .. net_supply(cereal_crop) =G= demand('cereals') * minDemandPerCereal;
......@@ -150,12 +153,12 @@ $gdxin
CROP_INCREASE_CALC(location) .. cropIncrease(location) =G= sum(crop_less_pasture, area(crop_less_pasture, location) - previousArea(crop_less_pasture, location));
CROP_DECREASE_CALC(location) .. cropDecrease(location) =G= -sum(crop_less_pasture, area(crop_less_pasture, location) - previousArea(crop_less_pasture, location));
PASTURE_INCREASE_CONV_CALC(location) .. pastureIncrease(location) =G= area('pasture', location) - previousArea('pasture', location);
PASTURE_DECREASE_CONV_CALC(location) .. pastureDecrease(location) =G= -area('pasture', location) - previousArea('pasture', location);
PASTURE_DECREASE_CONV_CALC(location) .. pastureDecrease(location) =G= -(area('pasture', location) - previousArea('pasture', location));
ENERGY_EQ .. energy =E= (SUM((crop, location), area(crop, location) * unitEnergy(crop, location))
+ (sum(location, agriLandExpansion(location)) * landChangeEnergy)
+ (sum(location, (((cropIncrease(location) + cropDecrease(location))/sum(crop_less_pasture, previousArea(crop_less_pasture, location)))) * landChangeEnergy/5 * sum(crop_less_pasture, previousArea(crop_less_pasture, location))) )
+ (sum(location, (((pastureIncrease(location) + pastureDecrease(location))/previousArea('pasture', location))) * landChangeEnergy/5 *previousArea('pasture', location)) )
+ (sum(location, ((cropIncrease(location) + cropDecrease(location))/previousCropTotalAreas(location)) * landChangeEnergy/10 * previousCropTotalAreas(location)) )
+ (sum(location, ((pastureIncrease(location) + pastureDecrease(location))/previousArea('pasture', location)) * landChangeEnergy/10 *previousArea('pasture', location)) )
+ sum(import_crop, (netImportAmount(import_crop)) * worldInputEnergy(import_crop))) / 1000000;
MODEL LAND_USE /ALL/ ;
......@@ -167,7 +170,7 @@ $gdxin
scalar newPasture / 0 /;
scalar newCropland / 0 /;
parameter temp(location);
parameter temp(location);
* if fitToPreviousAreas is zero then we just optimise
if (fitToPreviousAreas eq 0,
......@@ -180,23 +183,19 @@ $gdxin
basePasture = sum(location, previousArea("pasture", location));
baseCropland = sum((location, crop_less_pasture), previousArea(crop_less_pasture, location));
while((count le 1 and not (abs(basePasture-newPasture) le 0.1 and abs(baseCropland-newCropland) le 0.1)),
while((count le 10 and not (abs(basePasture-newPasture) le 0.1 and abs(baseCropland-newCropland) le 0.1)),
SOLVE LAND_USE USING NLP MINIMIZING energy;
display pastureIncrease.l, pastureDecrease.l, cropDecrease.l, cropIncrease.l;
temp(location) = SQRT(SQR(cropIncrease.l(location)/sum(crop_less_pasture, previousArea(crop_less_pasture, location)))) * landChangeEnergy/5 * sum(crop_less_pasture, previousArea(crop_less_pasture, location))
display temp;
newPasture = sum(location, area.l("pasture", location));
newCropland = sum((location, crop_less_pasture), area.l(crop_less_pasture, location));
cropAdj(crop_less_pasture) = cropAdj(crop_less_pasture) * (newCropland / baseCropland);
cropAdj("pasture") = cropAdj("pasture") * (newPasture / basePasture);
cropAdj(crop_less_pasture) = cropAdj(crop_less_pasture) * newCropland / baseCropland;
cropAdj("pasture") = cropAdj("pasture") * newPasture / basePasture;
* cropAdj(crop) = max(cropAdj(crop), 0.2);
* cropAdj(crop) = min(cropAdj(crop), 5);
cropAdj(crop) = max(cropAdj(crop), 0.2);
cropAdj(crop) = min(cropAdj(crop), 5);
display area.l, count, basePasture, baseCropland, newPasture, newCropland, cropAdj;
count = count+1 ;
......
......@@ -241,11 +241,11 @@ public class ModelMain {
// DEBUG code
if (!(country.getCountryName().equals("United States of AmericaXX") || country.getCountryName().equals("China"))) { //|| country.getCountryName().equals("China")
if (!(country.getCountryName().equals("United States of Americaxx") || country.getCountryName().equals("Russian Federation"))) { //|| country.getCountryName().equals("China")
continue;
}
if (demandManager.getPopulation(country, 2010) < 5 || countryExclusionList.contains(country.getCountryName())) {
if (demandManager.getPopulation(country, 2010) < 10 || countryExclusionList.contains(country.getCountryName())) {
LogWriter.printlnError("Skipping " + country);
continue;
}
......
......@@ -97,7 +97,7 @@ public class GamsCountryInput {
// }
public double getMeatEfficiency() {
return 0.6; // this is already handled by the feed conversion efficiency for each animal product
return 0.5; // this is already handled by the feed conversion efficiency for each animal product
}
public double getLandChangeEnergy() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment