From eb6979789cc3aad3de898782404d76b7b0cc9b98 Mon Sep 17 00:00:00 2001 From: Peter Alexander <peter@blackhillock.co.uk> Date: Sat, 12 Nov 2016 16:29:07 +0000 Subject: [PATCH] Calibration changes --- GAMS/IntExtOpt.gms | 14 +++++++------- debug_config.properties | 5 ++--- src/ac/ed/lurg/ModelConfig.java | 5 ++--- src/ac/ed/lurg/ModelMain.java | 14 ++++++++++++-- src/ac/ed/lurg/landuse/LandUseItem.java | 4 ++++ 5 files changed, 27 insertions(+), 15 deletions(-) diff --git a/GAMS/IntExtOpt.gms b/GAMS/IntExtOpt.gms index 4c55afe0..cb70376a 100644 --- a/GAMS/IntExtOpt.gms +++ b/GAMS/IntExtOpt.gms @@ -115,10 +115,10 @@ $gdxin PASTURE_DECREASE_CONV_CALC(location) COST_EQ total cost objective function; - UNIT_COST_EQ(crop, location) .. unitCost(crop, location) =E= ( baseCost(crop) + + UNIT_COST_EQ(crop, location) .. unitCost(crop, location) =E= ( baseCost(crop) * 0.5 + fertiliserUnitCost * fertI(crop, location) + irrigCost(location) * irrigMaxRate(crop, location) * irrigI(crop, location) + - otherICost * otherIntensity(crop, location) + (baseCost(crop) * 0.5 + otherICost) * otherIntensity(crop, location) ) ; YIELD_EQ(crop, location) .. yield(crop, location) =E= ( @@ -133,7 +133,7 @@ $gdxin (yieldBoth(crop, location) + yieldNone(crop, location) - yieldFertOnly(crop, location) - yieldIrrigOnly(crop, location)) * (1 - exp(-fertParam(crop, location)*fertI(crop, location))) * (1 - exp(-irrigParam(crop, location)*irrigI(crop, location))) - ) * (1 - 0.9 * exp(-otherIntensity(crop, location)*otherIParam)); + ) * (1 - exp(-otherIntensity(crop, location)*otherIParam)); NET_SUPPLY_EQ(crop) .. net_supply(crop) =E= (sum(location, area(crop, location) * yield(crop, location)) - feedAmount(crop)) / cropDM(crop) + importAmount(crop) - exportAmount(crop); @@ -175,10 +175,10 @@ $gdxin SUM(location, 1.0 * agriLandExpansion(location) + - 0.25 * cropIncrease(location) + - 0.25 * cropDecrease(location) + - 0.25 * pastureIncrease(location) + - 0.25 * pastureDecrease(location) + 0.5 * cropIncrease(location) + + 0.5 * cropDecrease(location) + + 0.5 * pastureIncrease(location) + + 0.5 * pastureDecrease(location) ) * landChangeCost ) * domesticPriceMarkup + diff --git a/debug_config.properties b/debug_config.properties index 0e466a7c..841a71cb 100644 --- a/debug_config.properties +++ b/debug_config.properties @@ -17,9 +17,10 @@ CLEANUP_GAMS_DIR=false # Properties for testing CHANGE_YIELD_DATA_YEAR=false -CHANGE_DEMAND_YEAR=true +CHANGE_DEMAND_YEAR=false DEBUG_LIMIT_COUNTRIES=false SSP_SCENARIO=SSP2_v9_130325 +MAX_IMPORT_CHANGE=0 END_TIMESTEP=18 TIMESTEP_SIZE=5 @@ -27,6 +28,4 @@ TIMESTEP_SIZE=5 NUM_CEREAL_CATEGORIES=5 NUM_PASTURE_CATEGORIES=3 -LAND_CHANGE_COST=.8 - INTERPOLATE_OUTPUT_YEARS = false diff --git a/src/ac/ed/lurg/ModelConfig.java b/src/ac/ed/lurg/ModelConfig.java index c70e4443..f7fae185 100644 --- a/src/ac/ed/lurg/ModelConfig.java +++ b/src/ac/ed/lurg/ModelConfig.java @@ -163,9 +163,9 @@ public class ModelConfig { public static final double UNHANDLED_CROP_AREA = getDoubleProperty("UNHANDLED_CROP_AREA", 0.4); // includes fruit veg forage crops set aside and failed crop public static final double OTHER_INTENSITY_COST = getDoubleProperty("OTHER_INTENSITY_COST", 0.3); - public static final double OTHER_INTENSITY_PARAM = getDoubleProperty("OTHER_INTENSITY_PARAM", 5.0); + public static final double OTHER_INTENSITY_PARAM = getDoubleProperty("OTHER_INTENSITY_PARAM", 3.22); - public static final double IRRIG_COST_SCALE_FACTOR = getDoubleProperty("IRRIG_COST_SCALE_FACTOR", 0.02); + public static final double IRRIG_COST_SCALE_FACTOR = getDoubleProperty("IRRIG_COST_SCALE_FACTOR", 0.01); public static final double FERTILISER_COST_PER_T = getDoubleProperty("FERTILISER_COST_PER_T", 0.87 * 1.4 * 2); // £900/t N * 1.4$/£ * 2NPK/N public static final double FERTILISER_MAX_COST = FERTILISER_COST_PER_T * MAX_FERT_AMOUNT/1000; @@ -182,6 +182,5 @@ public class ModelConfig { public static final boolean DEBUG_LIMIT_COUNTRIES = getBooleanProperty("DEBUG_LIMIT_COUNTRIES", false); public static final Object DEBUG_COUNTRY_NAME = getProperty("DEBUG_COUNTRY_NAME", "United States of America"); 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 = getIntProperty("NUM_CALIBRATION_ITERATIONS", 1); } \ No newline at end of file diff --git a/src/ac/ed/lurg/ModelMain.java b/src/ac/ed/lurg/ModelMain.java index ff351892..bc1e5aea 100644 --- a/src/ac/ed/lurg/ModelMain.java +++ b/src/ac/ed/lurg/ModelMain.java @@ -322,7 +322,7 @@ public class ModelMain { if (item == null) return null; - return item.getLandCoverArea(lcType); + return item.getLandCoverFract(lcType); } }.writeOutput(); } @@ -339,8 +339,18 @@ public class ModelMain { Collection<CountryAgent> countryAgents = new HashSet<CountryAgent>(); RasterSet<LandCoverItem> initLC = getInitialLandCover(); - Map<CompositeCountry, Map<CropType, CropUsageData>> cropUsageDataMap = new CropUsageReader(compositeCountryManager).getCommodityData(); + new RasterOutputer<LandCoverItem>(initLC, "InitialCropland") { + @Override + public Double getValue(RasterKey location) { + LandCoverItem item = results.get(location); + if (item == null) + return null; + return item.getLandCoverFract(LandCoverType.CROPLAND); + } + }.writeOutput(); + + Map<CompositeCountry, Map<CropType, CropUsageData>> cropUsageDataMap = new CropUsageReader(compositeCountryManager).getCommodityData(); for (CompositeCountry cc : countryGrouping) { diff --git a/src/ac/ed/lurg/landuse/LandUseItem.java b/src/ac/ed/lurg/landuse/LandUseItem.java index bcf827c2..9b16b040 100644 --- a/src/ac/ed/lurg/landuse/LandUseItem.java +++ b/src/ac/ed/lurg/landuse/LandUseItem.java @@ -184,6 +184,10 @@ public class LandUseItem implements InterpolatingRasterItem<LandUseItem> { return d == null ? 0.0 : d; } + public double getLandCoverFract(LandCoverType c) { + return getLandCoverArea(c) / getTotalLandCoverArea(); + } + public void setLandCoverArea(LandCoverType c, double d) { if (Double.isNaN(d) || Double.isInfinite(d)) throw new RuntimeException("AreasItem for " + c + " is " + d); -- GitLab