diff --git a/GAMS/PricesAndGdp.gdx b/GAMS/PricesAndGdp.gdx deleted file mode 100644 index db056a0ba3207f3419959aabb4df2e8503d6c0e3..0000000000000000000000000000000000000000 Binary files a/GAMS/PricesAndGdp.gdx and /dev/null differ diff --git a/data/DemandParameters.gdx b/data/DemandParameters.gdx deleted file mode 100644 index a99959597817e5d046cac0c0fc4f8ab0f0db03cc..0000000000000000000000000000000000000000 Binary files a/data/DemandParameters.gdx and /dev/null differ diff --git a/data/bioenergy_futures_BAU.csv b/data/bioenergy_futures_BAU.csv index b0eccc3bdbcd3dbb2fe4b6aa5fcc9f2b329958a7..c2caef9d2a6e29b26fbdb3878ac775ff98dd04e9 100644 --- a/data/bioenergy_futures_BAU.csv +++ b/data/bioenergy_futures_BAU.csv @@ -1,24 +1,24 @@ MODEL,SCENARIO,REGION,Variable,Unit,Year,value PLUM,BAU,World,Agricultural Demand|Bioenergy|1st generation,million t DM/yr,2000,20 -PLUM,BAU,World,Agricultural Demand|Bioenergy|1st generation,million t DM/yr,2005,27 -PLUM,BAU,World,Agricultural Demand|Bioenergy|1st generation,million t DM/yr,2010,34 -PLUM,BAU,World,Agricultural Demand|Bioenergy|1st generation,million t DM/yr,2015,41 -PLUM,BAU,World,Agricultural Demand|Bioenergy|1st generation,million t DM/yr,2020,31 -PLUM,BAU,World,Agricultural Demand|Bioenergy|1st generation,million t DM/yr,2025,23 -PLUM,BAU,World,Agricultural Demand|Bioenergy|1st generation,million t DM/yr,2030,33 -PLUM,BAU,World,Agricultural Demand|Bioenergy|1st generation,million t DM/yr,2035,40 -PLUM,BAU,World,Agricultural Demand|Bioenergy|1st generation,million t DM/yr,2040,45 -PLUM,BAU,World,Agricultural Demand|Bioenergy|1st generation,million t DM/yr,2045,40 -PLUM,BAU,World,Agricultural Demand|Bioenergy|1st generation,million t DM/yr,2050,30 -PLUM,BAU,World,Agricultural Demand|Bioenergy|1st generation,million t DM/yr,2055,25 -PLUM,BAU,World,Agricultural Demand|Bioenergy|1st generation,million t DM/yr,2060,24 -PLUM,BAU,World,Agricultural Demand|Bioenergy|1st generation,million t DM/yr,2065,23 -PLUM,BAU,World,Agricultural Demand|Bioenergy|1st generation,million t DM/yr,2070,23 +PLUM,BAU,World,Agricultural Demand|Bioenergy|1st generation,million t DM/yr,2005,23 +PLUM,BAU,World,Agricultural Demand|Bioenergy|1st generation,million t DM/yr,2010,27 +PLUM,BAU,World,Agricultural Demand|Bioenergy|1st generation,million t DM/yr,2015,30 +PLUM,BAU,World,Agricultural Demand|Bioenergy|1st generation,million t DM/yr,2020,34 +PLUM,BAU,World,Agricultural Demand|Bioenergy|1st generation,million t DM/yr,2025,38 +PLUM,BAU,World,Agricultural Demand|Bioenergy|1st generation,million t DM/yr,2030,41 +PLUM,BAU,World,Agricultural Demand|Bioenergy|1st generation,million t DM/yr,2035,43 +PLUM,BAU,World,Agricultural Demand|Bioenergy|1st generation,million t DM/yr,2040,43 +PLUM,BAU,World,Agricultural Demand|Bioenergy|1st generation,million t DM/yr,2045,41 +PLUM,BAU,World,Agricultural Demand|Bioenergy|1st generation,million t DM/yr,2050,38 +PLUM,BAU,World,Agricultural Demand|Bioenergy|1st generation,million t DM/yr,2055,32 +PLUM,BAU,World,Agricultural Demand|Bioenergy|1st generation,million t DM/yr,2060,29 +PLUM,BAU,World,Agricultural Demand|Bioenergy|1st generation,million t DM/yr,2065,26 +PLUM,BAU,World,Agricultural Demand|Bioenergy|1st generation,million t DM/yr,2070,25 PLUM,BAU,World,Agricultural Demand|Bioenergy|1st generation,million t DM/yr,2075,24 PLUM,BAU,World,Agricultural Demand|Bioenergy|1st generation,million t DM/yr,2080,24 -PLUM,BAU,World,Agricultural Demand|Bioenergy|1st generation,million t DM/yr,2085,24 -PLUM,BAU,World,Agricultural Demand|Bioenergy|1st generation,million t DM/yr,2090,24 -PLUM,BAU,World,Agricultural Demand|Bioenergy|1st generation,million t DM/yr,2095,23 +PLUM,BAU,World,Agricultural Demand|Bioenergy|1st generation,million t DM/yr,2085,23 +PLUM,BAU,World,Agricultural Demand|Bioenergy|1st generation,million t DM/yr,2090,23 +PLUM,BAU,World,Agricultural Demand|Bioenergy|1st generation,million t DM/yr,2095,22 PLUM,BAU,World,Agricultural Demand|Bioenergy|1st generation,million t DM/yr,2100,22 PLUM,BAU,World,Agricultural Demand|Bioenergy|2nd generation,million t DM/yr,2000,0 PLUM,BAU,World,Agricultural Demand|Bioenergy|2nd generation,million t DM/yr,2005,0 diff --git a/debug_config.properties b/debug_config.properties index f5d79b5c7f1a8e7515a8ff27512b3d13e4878346..3d59e5b3356b0a541b409cb4c1d08083d745d62b 100644 --- a/debug_config.properties +++ b/debug_config.properties @@ -3,13 +3,13 @@ BASE_DIR=.. YIELD_DIR=/Users/peteralexander/Documents/LURG/LPJ/LPJGPLUM_expt1.1_2006-2100_PLUM6xtra_20180412171654/rcp60 DEBUG_LIMIT_COUNTRIES=true -DEBUG_COUNTRY_NAME=Japan +DEBUG_COUNTRY_NAME=United States of America IS_CALIBRATION_RUN = false GENERATE_NEW_YIELD_CLUSTERS = false NUM_YIELD_CLUSTERS=8000 -END_TIMESTEP=5 +END_TIMESTEP=18 TIMESTEP_SIZE=5 INTERPOLATE_OUTPUT_YEARS = false @@ -19,4 +19,9 @@ CHANGE_YIELD_DATA_YEAR=false ORIG_LEAST_COST_MIN=false DEBUG_JUST_DEMAND_OUTPUT=true -PRICE_ELASTIC_DEMAND=true \ No newline at end of file +PRICE_ELASTIC_DEMAND=false + +GAMS_COUNTRY_TO_SAVE=United States of America +SSP_SCENARIO=SSP2_v9_130325 +MARKET_ADJ_PRICE=false +DONT_REBASE_DEMAND=false \ No newline at end of file diff --git a/src/ac/ed/lurg/ModelConfig.java b/src/ac/ed/lurg/ModelConfig.java index c40421769c0775c0c69b24074b5f5f3ccb2d3c6c..a32e9f3141a418adc003a11cd6a24788153f5d26 100644 --- a/src/ac/ed/lurg/ModelConfig.java +++ b/src/ac/ed/lurg/ModelConfig.java @@ -152,6 +152,7 @@ public class ModelConfig { // Country (non-gridded) data public static final boolean DEMAND_FROM_FILE = getBooleanProperty("DEMAND_FROM_FILE", false); // used in hindcasting public static final boolean PRICE_ELASTIC_DEMAND = getBooleanProperty("PRICE_ELASTIC_DEMAND", false); + public static final boolean DONT_REBASE_DEMAND = getBooleanProperty("DONT_REBASE_DEMAND", false);; public static final String DEMAND_CURVES_FILE = getProperty("DEMAND_CURVES_FILE", DATA_DIR + File.separator + "com_curves.csv"); // either DEMAND_CURVES_FILE or DEMAND_CONSUMPTION_FILE is used, but not both public static final String DEMAND_CONSUMPTION_FILE = getProperty("DEMAND_CONSUMPTION_FILE", DATA_DIR + File.separator + "hist_comsump.csv"); public static final String SSP_FILE = DATA_DIR + File.separator + "ssp.csv"; diff --git a/src/ac/ed/lurg/country/CountryAgent.java b/src/ac/ed/lurg/country/CountryAgent.java index 9a03e6d9f3c92e4d2e0679a72daa228c9a9931d7..587af6b6e4d7813947073a7b6ebc7fe7af60f740 100644 --- a/src/ac/ed/lurg/country/CountryAgent.java +++ b/src/ac/ed/lurg/country/CountryAgent.java @@ -109,6 +109,10 @@ public class CountryAgent extends AbstractCountryAgent { // get projected demand Map<CommodityType, Double> projectedDemand = calculateDemand(timestep); + + if (saveGamsGdxFiles && ModelConfig.PRICE_ELASTIC_DEMAND) + saveGDXFile("demand"); + if (currentTimestep.isInitialTimestep()) { double totalAnimalProductDemand = projectedDemand.get(CommodityType.MONOGASTRICS) + projectedDemand.get(CommodityType.RUMINANTS); animalFeedFromOtherSources = totalAnimalProductDemand * ModelConfig.ANIMAL_FEED_FROM_OTHER_SOURCES_RATE; @@ -138,10 +142,8 @@ public class CountryAgent extends AbstractCountryAgent { updateNetImportsFromProdAndDemand(countryInput.getProjectedDemand(), countryInput.getMinDemandFractions(), result.getCropUsageData()); } - if (saveGamsGdxFiles){ - String ext = "landuse"; - saveGDXFile(ext); - } + if (saveGamsGdxFiles) + saveGDXFile("landuse"); previousGamsRasterOutput = result; return result; @@ -155,7 +157,7 @@ public class CountryAgent extends AbstractCountryAgent { try { Files.copy( FileSystems.getDefault().getPath(ModelConfig.TEMP_DIR + File.separator + "_gams_java_gdb1.gdx"), - FileSystems.getDefault().getPath(ModelConfig.TEMP_DIR + File.separator + ModelConfig.GAMS_COUNTRY_TO_SAVE + currentTimestep.getYear() + ext + ".gdx"), + FileSystems.getDefault().getPath(ModelConfig.TEMP_DIR + File.separator + country.getName().replaceAll("\\s+","") + currentTimestep.getYear() + ext + ".gdx"), StandardCopyOption.REPLACE_EXISTING); } catch (IOException e) { LogWriter.print(e); diff --git a/src/ac/ed/lurg/demand/AbstractSSPDemandManager.java b/src/ac/ed/lurg/demand/AbstractSSPDemandManager.java index 6afe752da2c828d231eaafb16a380f7bbb197f01..b9ae2188f1fc989008d0d21aab4c225ed8109d47 100644 --- a/src/ac/ed/lurg/demand/AbstractSSPDemandManager.java +++ b/src/ac/ed/lurg/demand/AbstractSSPDemandManager.java @@ -57,7 +57,7 @@ public abstract class AbstractSSPDemandManager extends AbstractDemandManager { double gapRatio = Math.exp((gdpPc-baseGdpPc)/baseGdpPc * ModelConfig.DIETARY_CLOSURE_PARAM); if (gapRatio>1) gapRatio = 1; - double adjFactor = baseExpCpc==0 ? 1.0 : (baseCpc*gapRatio+baseExpCpc*(1-gapRatio))/baseExpCpc; // if baseExpCpc is zero no adjustment + double adjFactor = (baseExpCpc==0 || ModelConfig.DONT_REBASE_DEMAND) ? 1.0 : (baseCpc*gapRatio+baseExpCpc*(1-gapRatio))/baseExpCpc; // if baseExpCpc is zero no adjustment double projectedCpc = newExpCpc*adjFactor; return projectedCpc;