diff --git a/src/ac/ed/lurg/ModelConfig.java b/src/ac/ed/lurg/ModelConfig.java index 7acc7e5416224e95da4d641365d39a300f06e886..2e49791e78fae35cd13773e3768c80b069118c28 100644 --- a/src/ac/ed/lurg/ModelConfig.java +++ b/src/ac/ed/lurg/ModelConfig.java @@ -153,13 +153,16 @@ public class ModelConfig { public static final double PASTURE_HARVEST_FRACTION = getDoubleProperty("PASTURE_HARVEST_FRACTION", 0.25); public static final double MEAT_EFFICIENCY = getDoubleProperty("MEAT_EFFICIENCY", 1.0); // 'meat' is includes feed conversion ratio already, this is tech. change or similar public static final double IRRIGIATION_EFFICIENCY = getDoubleProperty("IRRIGIATION_EFFICIENCY", 0.5); - public static final double LAND_CHANGE_COST = getDoubleProperty("LAND_CHANGE_COST", 0.5); + public static final double LAND_CHANGE_COST = getDoubleProperty("LAND_CHANGE_COST", 0.8); 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.15); public static final double TECHNOLOGY_CHANGE_ANNUAL_RATE = getDoubleProperty("TECHNOLOGY_CHANGE_ANNUAL_RATE", 0.0); public static final int TECHNOLOGY_CHANGE_START_STEP = getIntProperty("TECHNOLOGY_CHANGE_START_STEP", 0); + public static final double BIOENERGY_CHANGE_ANNUAL_RATE = getDoubleProperty("BIOENERGY_CHANGE_ANNUAL_RATE", 0.0); + public static final int BIOENERGY_CHANGE_START_YEAR = getIntProperty("BIOENERGY_CHANGE_START_YEAR", 2010); + public static final double MARKET_LAMBA = getDoubleProperty("MARKET_LAMBA", 0.5); // 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 @@ -168,12 +171,12 @@ public class ModelConfig { public static final double OTHER_INTENSITY_COST = getDoubleProperty("OTHER_INTENSITY_COST", 0.3); 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.01); + public static final double IRRIG_COST_SCALE_FACTOR = getDoubleProperty("IRRIG_COST_SCALE_FACTOR", 0.02); 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; public static final double DOMESTIC_PRICE_MARKUP = getDoubleProperty("DOMESTIC_PRICE_MARKUP", 1.0); - public static final double TRANSPORT_LOSSES = getDoubleProperty("TRANSPORT_LOSSES", 0.1); // in international trade + public static final double TRANSPORT_LOSSES = getDoubleProperty("TRANSPORT_LOSSES", 0.05); // in international trade public static final double TRADE_BARRIER_FACTOR_DEFAULT = getDoubleProperty("TRADE_BARRIER_FACTOR_DEFAULT", 0.2); // price factor in international trade, transport cost and real trade barriers public static final boolean ACTIVE_TRADE_BARRIERS = getBooleanProperty("ACTIVE_TRADE_BARRIERS", false); // if set to true read in barrier information from file, otherwise use default as above diff --git a/src/ac/ed/lurg/ModelMain.java b/src/ac/ed/lurg/ModelMain.java index bc1e5aea6d417f2062af5a797259cb1d0e828d21..7be0c8ec41e5eaec099a490b62ab07c8f488b02c 100644 --- a/src/ac/ed/lurg/ModelMain.java +++ b/src/ac/ed/lurg/ModelMain.java @@ -228,14 +228,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 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(",%.3f", prevWorldPrices.get(crop).getExportPrice())); outputFile.write(sbData.toString()); diff --git a/src/ac/ed/lurg/country/CountryAgent.java b/src/ac/ed/lurg/country/CountryAgent.java index 898d414f41501af704b85256e20423326ecb394c..206f35cc195f6ef78e6a9c42549ae59450695c28 100644 --- a/src/ac/ed/lurg/country/CountryAgent.java +++ b/src/ac/ed/lurg/country/CountryAgent.java @@ -137,10 +137,9 @@ public class CountryAgent { Map<CropType, CountryPrice> countryPrices = new HashMap <CropType, CountryPrice>(); for (CropType c : CropType.getImportedTypes()) { - GlobalPrice worldPrice = worldPrices.get(c); - CountryPrice prices = new CountryPrice((worldPrice.getImportPrice()+ worldPrice.getImportPrice()*tradeBarriers.get(c).doubleValue()), worldPrice.getExportPrice()); - countryPrices.put(c, prices); - + GlobalPrice worldPrice = worldPrices.get(c); + CountryPrice prices = new CountryPrice(worldPrice.getCountryImportPrice(tradeBarriers.get(c)), worldPrice.getExportPrice()); + countryPrices.put(c, prices); } return countryPrices; diff --git a/src/ac/ed/lurg/country/GlobalPrice.java b/src/ac/ed/lurg/country/GlobalPrice.java index 8171026744eb0249525ff3a012346dea66c7c5b3..1317c014158669e75556a3431525f09f68228ee2 100644 --- a/src/ac/ed/lurg/country/GlobalPrice.java +++ b/src/ac/ed/lurg/country/GlobalPrice.java @@ -3,34 +3,29 @@ package ac.ed.lurg.country; import ac.ed.lurg.ModelConfig; public class GlobalPrice { - double importPrice; double exportPrice; double importAmount; double exportAmount; - public GlobalPrice(double importPrice, double exportPrice, double importAmount, double exportAmount) { - this.importPrice = importPrice; + public GlobalPrice(double exportPrice, double importAmount, double exportAmount) { this.exportPrice = exportPrice; this.importAmount = importAmount; this.exportAmount = exportAmount; } -// public static GlobalPrice createInitial(double exportPrice) { -// return new GlobalPrice(exportPrice, exportPrice * (1-ModelConfig.TRANSPORT_LOSSES) / ModelConfig.TRADE_BARRIER_FACTOR, Double.NaN, Double.NaN); -// } -//removed trade barriers adjustment as this is now done per country public static GlobalPrice createInitial(double exportPrice) { - return new GlobalPrice(exportPrice, exportPrice * (1-ModelConfig.TRANSPORT_LOSSES), Double.NaN, Double.NaN); + return new GlobalPrice(exportPrice, Double.NaN, Double.NaN); } - public double getImportPrice() { - return importPrice; - } - public double getExportPrice() { return exportPrice; } + public double getCountryImportPrice(double countryTradeBarrier) { + double importPrice = exportPrice * (1.0 + countryTradeBarrier) / (1.0 - ModelConfig.TRANSPORT_LOSSES); + return importPrice; + } + public double getImportAmount() { return importAmount; } @@ -49,7 +44,7 @@ public class GlobalPrice { ratio = (imports-exports)/exports; double adjustment = Math.exp(ratio * ModelConfig.MARKET_LAMBA); - return new GlobalPrice(importPrice * adjustment, exportPrice * adjustment, imports, exports); + return new GlobalPrice(exportPrice * adjustment, imports, exports); } else { return this; @@ -58,6 +53,6 @@ public class GlobalPrice { @Override public String toString() { - return String.format("import=%.3f export=%.3f", importPrice, exportPrice); + return String.format("export=%.3f", exportPrice); } } diff --git a/src/ac/ed/lurg/demand/DemandManager.java b/src/ac/ed/lurg/demand/DemandManager.java index f3e5d6d058d5de108ee129261fbde7ed6667f24e..d3c15d30377c40e4853187fecf69fe4f327906ca 100644 --- a/src/ac/ed/lurg/demand/DemandManager.java +++ b/src/ac/ed/lurg/demand/DemandManager.java @@ -75,7 +75,11 @@ public class DemandManager { // could adjust for year somehow, but not doing this yet if (bioenergyBaseDemand != null && bioenergyBaseDemand.containsKey(country)) { Double d = bioenergyBaseDemand.get(country).get(commodity); - return d == null ? 0 : d.doubleValue(); + + int yearsOfChange = year - ModelConfig.BIOENERGY_CHANGE_START_YEAR; + double bioenergyDemandAdj = yearsOfChange > 0 ? (1.0 + yearsOfChange * ModelConfig.BIOENERGY_CHANGE_ANNUAL_RATE) : 1.0 ; + + return d == null ? 0 : d.doubleValue() * bioenergyDemandAdj; } return 0.0; } diff --git a/src/ac/ed/lurg/yield/LPJYieldResponseMapReader.java b/src/ac/ed/lurg/yield/LPJYieldResponseMapReader.java index c2f003babc70f30b7194c9ee790e83ea473a44a3..792daf85c75bcebf36900206514940ed95dc9d9e 100644 --- a/src/ac/ed/lurg/yield/LPJYieldResponseMapReader.java +++ b/src/ac/ed/lurg/yield/LPJYieldResponseMapReader.java @@ -53,7 +53,7 @@ public class LPJYieldResponseMapReader { AbstractTabularRasterReader<YieldResponsesItem> nppReader = new AbstractTabularRasterReader<YieldResponsesItem>("\\s+", 10, yieldRaster) { protected void setData(RasterKey key, YieldResponsesItem item, Map<String, Double> rowValues) { - double adjFactor = 2 * 10 * ModelConfig.PASTURE_HARVEST_FRACTION; // 2 for carbon units, 10 for kg/m2 to t/ha, and 0.5 for half grazed + double adjFactor = 2.2 * 10 * ModelConfig.PASTURE_HARVEST_FRACTION; // 2.2 for carbon units, 10 for kg/m2 to t/ha, and 0.5 for half grazed for (FertiliserRate fert : FertiliserRate.values()) { double pastureYield;