diff --git a/GAMS/IntExtOpt.gms b/GAMS/IntExtOpt.gms index 0c4f76f6e1296c93bd9b20daca65ba12071eccbe..616068c94084dcd38349f5e371be0f7b08c17521 100644 --- a/GAMS/IntExtOpt.gms +++ b/GAMS/IntExtOpt.gms @@ -114,7 +114,7 @@ $gdxin UNIT_ENERGY_EQ(crop, location) .. unitEnergy(crop, location) =E= ( baseCost(crop) + fertiliserUnitCost * fertI(crop, location) + irrigCost(location) * irrigMaxRate(crop, location) * irrigI(crop, location) + - SQR(otherIntensity(crop, location)) * 1 + (otherIntensity(crop, location)) ) ; YIELD_EQ(crop, location) .. yield(crop, location) =E= ( @@ -170,10 +170,10 @@ $gdxin SUM((crop, location), area(crop, location) * unitEnergy(crop, location)) + sum(location, agriLandExpansion(location) + - 0.45 * SQR(cropIncrease(location) + cropDecrease(location)) / (suitableLandArea(location) * 0.01 + sum(crop_less_pasture, previousArea(crop_less_pasture, location))) + - 0.05 * (cropIncrease(location) + cropDecrease(location)) + - 0.45 * SQR(pastureIncrease(location) + pastureDecrease(location)) / (suitableLandArea(location) * 0.01 + previousArea('pasture', location)) + - 0.05 * (pastureIncrease(location) + pastureDecrease(location)) + 0.5 * cropIncrease(location) + + 0.5 * cropDecrease(location) + + 0.5 * pastureIncrease(location) + + 0.5 * pastureDecrease(location) ) * landChangeEnergy + sum(import_crop, importAmount(import_crop) * worldImportPrices(import_crop) - exportAmount(import_crop) * worldExportPrices(import_crop)) ) / 1000000; diff --git a/debug_config.properties b/debug_config.properties index f77f278dadb9d3df2d813a94927c5a88213340ce..952cffaa350fb7f28e883d85d9360d7d4df689b6 100644 --- a/debug_config.properties +++ b/debug_config.properties @@ -4,13 +4,14 @@ CLEANUP_GAMS_DIR=false # Properties for testing CHANGE_YIELD_DATA_YEAR=true -KEEP_DEMAND_FIXED=false +CHANGE_DEMAND_YEAR=true +MAX_IMPORT_CHANGE=0.1 DEBUG_LIMIT_COUNTRIES=false -MAX_IMPORT_CHANGE=0.10 -SEED_AND_WASTE_FRACTION=0.15 -SSP_SCENARIO=SSP4_v9_130325 +SSP_SCENARIO=SSP1_v9_130325 -END_TIMESTEP=1 +MARKET_LAMBA = 0.5 + +END_TIMESTEP=18 TIMESTEP_SIZE=5 POPULATION_AGGREG_LIMIT=60 diff --git a/src/ac/ed/lurg/ModelConfig.java b/src/ac/ed/lurg/ModelConfig.java index a9fca62b1557a668d7fa53a9abaf219404ae8f1d..be6158d00e7a9a7a3ad74b78beb1497b4f14538a 100644 --- a/src/ac/ed/lurg/ModelConfig.java +++ b/src/ac/ed/lurg/ModelConfig.java @@ -134,30 +134,31 @@ public class ModelConfig { public static final double MAX_FERT_AMOUNT = 200; // Other model parameters - public static final boolean KEEP_DEMAND_FIXED = getBooleanProperty("KEEP_DEMAND_FIXED", false); + public static final boolean CHANGE_DEMAND_YEAR = getBooleanProperty("CHANGE_DEMAND_YEAR", true); public static final String SSP_SCENARIO = getProperty("SSP_SCENARIO", "SSP1_v9_130325"); public static final double MAX_IMPORT_CHANGE = getDoubleProperty("MAX_IMPORT_CHANGE", 0.1); - public static final double PASTURE_HARVEST_FRACTION = getDoubleProperty("PASTURE_HARVEST_FRACTION", 0.5); + public static final double PASTURE_HARVEST_FRACTION = getDoubleProperty("PASTURE_HARVEST_FRACTION", 0.3); public static final double MEAT_EFFICIENCY = getDoubleProperty("MEAT_EFFICIENCY", 1.0); public static final double IRRIGIATION_EFFICIENCY = getDoubleProperty("IRRIGIATION_EFFICIENCY", 0.5); public static final double LAND_CHANGE_COST = getDoubleProperty("LAND_CHANGE_COST", 2.0); public static final double MIN_FEED_RATE = getDoubleProperty("MIN_FEED_RATE", 0.15); - public static final double SEED_AND_WASTE_FRACTION = getDoubleProperty("SEED_AND_WASTE_FRACTION", 0.1); // should be around 10%, but also including set aside and forage crops adjustment - + public static final double SEED_AND_WASTE_FRACTION = getDoubleProperty("SEED_AND_WASTE_FRACTION", 0.15); + public static final double MARKET_LAMBA = getDoubleProperty("MARKET_LAMBA", 0.3); // controls international market price adjustment rate public static final double POPULATION_AGGREG_LIMIT = getDoubleProperty("POPULATION_AGGREG_LIMIT", 40.0); // in millions, smaller countries are aggregated on a regional basis - public static final double IRRIG_COST_SCALE_FACTOR = getDoubleProperty("IRRIG_COST_SCALE_FACTOR", 0.05); - public static final double FERTILISER_MAX_COST = getDoubleProperty("FERTILISER_MAX_COST", 2.5); + public static final double IRRIG_COST_SCALE_FACTOR = getDoubleProperty("IRRIG_COST_SCALE_FACTOR", 0.1); + public static final double FERTILISER_COST_PER_T = getDoubleProperty("FERTILISER_COST_PER_T", 5.0); + public static final double FERTILISER_MAX_COST = FERTILISER_COST_PER_T * MAX_FERT_AMOUNT/1000; public static final double TRANSPORT_LOSSES = getDoubleProperty("TRANSPORT_LOSSES", 0.15); // in international trade - public static final double TRADE_BARRIER_FACTOR = getDoubleProperty("TRADE_BARRIER_FACTOR", 1.2); // price factor in international trade, transport cost and real trade barriers + public static final double TRADE_BARRIER_FACTOR = getDoubleProperty("TRADE_BARRIER_FACTOR", 1.5); // price factor in international trade, transport cost and real trade barriers public static final int NUM_CEREAL_CATEGORIES = getIntProperty("NUM_CEREAL_CATEGORIES", 5); public static final int NUM_PASTURE_CATEGORIES = getIntProperty("NUM_PASTURE_CATEGORIES", 1); public static final boolean DEBUG_LIMIT_COUNTRIES = getBooleanProperty("DEBUG_LIMIT_COUNTRIES", false); - public static final double PASTURE_MAX_IRRIGATION_RATE = getDoubleProperty("DEFAULT_MAX_IRRIGATION_RATE", 50.0); // should need this but some areas crops don't have a value, but was causing them to be selected + public static final double PASTURE_MAX_IRRIGATION_RATE = getDoubleProperty("DEFAULT_MAX_IRRIGATION_RATE", 50.0); // shouldn't need this but some areas crops don't have a value, but was causing them to be selected public static int NUM_CALIBRATION_ITERATIONS = 10; } \ No newline at end of file diff --git a/src/ac/ed/lurg/ModelMain.java b/src/ac/ed/lurg/ModelMain.java index d308cfe7d9e459527d09101e11baa99bca96ba7d..79a51abc618a81665024158bb270f1fba38c088e 100644 --- a/src/ac/ed/lurg/ModelMain.java +++ b/src/ac/ed/lurg/ModelMain.java @@ -79,9 +79,7 @@ public class ModelMain { // in first timestep we don't have this info, but ok as constrained to import/export specified amount prevWorldPrices = new HashMap<CropType, GlobalPrice>(); for (CropType c : CropType.getImportedTypes()) - prevWorldPrices.put(c, GlobalPrice.createInitial(0.3)); - - prevWorldPrices.put(CropType.STARCHY_ROOTS, GlobalPrice.createInitial(1.2)); + prevWorldPrices.put(c, GlobalPrice.createInitial(0.5)); } /* run the model */ @@ -221,14 +219,14 @@ public class ModelMain { private void writeGlobalMarketFile(Timestep timestep) { try { - StringBuffer sbHeadings = new StringBuffer("Year, Crop, Imports (Mt), Exports (Mt), New import price, New export price"); + StringBuffer sbHeadings = new StringBuffer("Year,Crop,Imports (Mt),Exports (Mt),New import price,New export price"); BufferedWriter outputFile = getFileWriter(timestep, ModelConfig.PRICES_OUTPUT_FILE, sbHeadings.toString()); for (CropType crop : CropType.getImportedTypes() ) { StringBuffer sbData = new StringBuffer(); - sbData.append(String.format("%d, %s", timestep.getYear(), crop.getGamsName())); - sbData.append(String.format(", %.1f, %.1f", prevWorldPrices.get(crop).getImportAmount(), prevWorldPrices.get(crop).getExportAmount())); - sbData.append(String.format(", %.3f, %.3f", prevWorldPrices.get(crop).getImportPrice(), prevWorldPrices.get(crop).getExportPrice())); + sbData.append(String.format("%d,%s", timestep.getYear(), crop.getGamsName())); + sbData.append(String.format(",%.1f,%.1f", prevWorldPrices.get(crop).getImportAmount(), prevWorldPrices.get(crop).getExportAmount())); + sbData.append(String.format(",%.3f,%.3f", prevWorldPrices.get(crop).getImportPrice(), prevWorldPrices.get(crop).getExportPrice())); outputFile.write(sbData.toString()); @@ -244,7 +242,7 @@ public class ModelMain { private void writeDemandFile(Timestep timestep) { try { - StringBuffer sbHeadings = new StringBuffer("Year, Commodity, Amount (Mt)"); + StringBuffer sbHeadings = new StringBuffer("Year,Commodity,Amount (Mt)"); BufferedWriter outputFile = getFileWriter(timestep, ModelConfig.DEMAND_OUTPUT_FILE, sbHeadings.toString()); for (CommodityType comm : CommodityType.getAllItems() ) { @@ -256,8 +254,8 @@ public class ModelMain { demandAmount += d.doubleValue(); } StringBuffer sbData = new StringBuffer(); - sbData.append(String.format("%d, %s", timestep.getYear(), comm.getGamsName())); - sbData.append(String.format(", %.1f", demandAmount)); + sbData.append(String.format("%d,%s", timestep.getYear(), comm.getGamsName())); + sbData.append(String.format(",%.1f", demandAmount)); outputFile.write(sbData.toString()); outputFile.newLine(); diff --git a/src/ac/ed/lurg/demand/DemandManager.java b/src/ac/ed/lurg/demand/DemandManager.java index 4e6c8316558ec7344c33dc7a476ce0283aa728a7..f3e5d6d058d5de108ee129261fbde7ed6667f24e 100644 --- a/src/ac/ed/lurg/demand/DemandManager.java +++ b/src/ac/ed/lurg/demand/DemandManager.java @@ -34,7 +34,7 @@ public class DemandManager { public Map<CommodityType, Double> getDemand(CompositeCountry cc, int year) { - if (ModelConfig.KEEP_DEMAND_FIXED) + if (!ModelConfig.CHANGE_DEMAND_YEAR) year = ModelConfig.BASE_YEAR; Map<CommodityType, Double> demandMap = new HashMap<CommodityType, Double>();