From 57cbb035f40e1997fbb3fc1e31aa465909bc1eec Mon Sep 17 00:00:00 2001
From: Bart Arendarczyk <s1924442@ed.ac.uk>
Date: Wed, 31 May 2023 15:06:35 +0100
Subject: [PATCH] Minor fixes and parameter updates.

---
 src/ac/ed/lurg/ModelConfig.java         | 22 +++++++++++-----------
 src/ac/ed/lurg/Timestep.java            |  2 +-
 src/ac/ed/lurg/country/GlobalPrice.java |  3 +++
 3 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/src/ac/ed/lurg/ModelConfig.java b/src/ac/ed/lurg/ModelConfig.java
index cf5ced4c..3b1a7379 100755
--- a/src/ac/ed/lurg/ModelConfig.java
+++ b/src/ac/ed/lurg/ModelConfig.java
@@ -160,7 +160,7 @@ public class ModelConfig {
 			e.printStackTrace();
 		}
 
-		if (IS_CALIBRATION_RUN) {
+		if (IS_CALIBRATION_RUN | ModelConfig.CALIB_TRANSITION_TIME == 0) {
 			return endParam;
 		} else {
 			double startParam;
@@ -256,17 +256,17 @@ public class ModelConfig {
 	public static final String YIELD_FILENAME = getProperty("YIELD_FILENAME", "yield.out");
 	public static final boolean PASTURE_FERT_RESPONSE_FROM_LPJ = getBooleanProperty("PASTURE_FERT_RESPONSE_FROM_LPJ", false);;
 
-	public static final double CALIB_FACTOR_CEREAL_C3 = getDoubleProperty("CALIB_FACTOR_CEREAL_C3", 0.972);
-	public static final double CALIB_FACTOR_CEREAL_C4 = getDoubleProperty("CALIB_FACTOR_CEREAL_C4", 0.806);
+	public static final double CALIB_FACTOR_CEREAL_C3 = getDoubleProperty("CALIB_FACTOR_CEREAL_C3", 0.992);
+	public static final double CALIB_FACTOR_CEREAL_C4 = getDoubleProperty("CALIB_FACTOR_CEREAL_C4", 0.813);
 	public static final double CALIB_FACTOR_MISCANTHUS = getDoubleProperty("CALIB_FACTOR_MISCANTHUS", 2.047);
-	public static final double CALIB_FACTOR_RICE = getDoubleProperty("CALIB_FACTOR_RICE", 1.300);
-	public static final double CALIB_FACTOR_OILCROPS_NFIX = getDoubleProperty("CALIB_FACTOR_OILCROPS_NFIX", 0.791);
-	public static final double CALIB_FACTOR_OILCROPS_OTHER = getDoubleProperty("CALIB_FACTOR_OILCROPS_OTHER", 0.601);
-	public static final double CALIB_FACTOR_PULSES = getDoubleProperty("CALIB_FACTOR_PULSES", 0.511);
-	public static final double CALIB_FACTOR_STARCHY_ROOTS = getDoubleProperty("CALIB_FACTOR_STARCHY_ROOTS",5.81);
-	public static final double CALIB_FACTOR_FRUITVEG = getDoubleProperty("CALIB_FACTOR_FRUITVEG",4.805);
-	public static final double CALIB_FACTOR_SUGAR_BEET = getDoubleProperty("CALIB_FACTOR_SUGAR_BEET", 10.377);
-	public static final double CALIB_FACTOR_SUGAR_CANE = getDoubleProperty("CALIB_FACTOR_SUGAR_CANE", 9.641);
+	public static final double CALIB_FACTOR_RICE = getDoubleProperty("CALIB_FACTOR_RICE", 1.521);
+	public static final double CALIB_FACTOR_OILCROPS_NFIX = getDoubleProperty("CALIB_FACTOR_OILCROPS_NFIX", 0.793);
+	public static final double CALIB_FACTOR_OILCROPS_OTHER = getDoubleProperty("CALIB_FACTOR_OILCROPS_OTHER", 0.584);
+	public static final double CALIB_FACTOR_PULSES = getDoubleProperty("CALIB_FACTOR_PULSES", 0.549);
+	public static final double CALIB_FACTOR_STARCHY_ROOTS = getDoubleProperty("CALIB_FACTOR_STARCHY_ROOTS",5.742);
+	public static final double CALIB_FACTOR_FRUITVEG = getDoubleProperty("CALIB_FACTOR_FRUITVEG",4.765);
+	public static final double CALIB_FACTOR_SUGAR_BEET = getDoubleProperty("CALIB_FACTOR_SUGAR_BEET", 10.308);
+	public static final double CALIB_FACTOR_SUGAR_CANE = getDoubleProperty("CALIB_FACTOR_SUGAR_CANE", 9.602);
 	public static final double CALIB_FACTOR_PASTURE = getDoubleProperty("CALIB_FACTOR_PASTURE", 1.0);
 
 	public static final String C3_CEREALS_COLUMN = getProperty("C3_CEREALS_COLUMN", "CerealsC3");
diff --git a/src/ac/ed/lurg/Timestep.java b/src/ac/ed/lurg/Timestep.java
index f50550ac..327e9170 100644
--- a/src/ac/ed/lurg/Timestep.java
+++ b/src/ac/ed/lurg/Timestep.java
@@ -95,7 +95,7 @@ public class Timestep implements Serializable {
 	}
 	
 	public String getYearSubDir(String rootDir) {
-		int targetYear = ModelConfig.CHANGE_YIELD_DATA_YEAR ? targetYear = getYieldYear() : ModelConfig.BASE_YEAR;
+		int targetYear = ModelConfig.CHANGE_YIELD_DATA_YEAR ? getYieldYear() : ModelConfig.BASE_YEAR;
 		
 		int endYear = (targetYear/ModelConfig.LPJG_TIMESTEP_SIZE) * ModelConfig.LPJG_TIMESTEP_SIZE;  // truncation in division as int
 		
diff --git a/src/ac/ed/lurg/country/GlobalPrice.java b/src/ac/ed/lurg/country/GlobalPrice.java
index f250f571..94b83d63 100644
--- a/src/ac/ed/lurg/country/GlobalPrice.java
+++ b/src/ac/ed/lurg/country/GlobalPrice.java
@@ -206,6 +206,9 @@ public class GlobalPrice implements Serializable {
 	}
 
 	public double getTradeChangeDown(double maxOfProdOrSupply, double targetStockUseRatio) {
+		if (ModelConfig.DEBUG_LIMIT_COUNTRIES) {
+			return maxOfProdOrSupply * ModelConfig.MAX_IMPORT_CHANGE;
+		}
 		maxOfProdOrSupply += 0.05 * production / CountryManager.getInstance().getCountryCount();
 		double supplyFraction = maxOfProdOrSupply / (production * 1.05);
 		double stockShortfall = Math.max(0, production * targetStockUseRatio - stockLevel); // allow additional exports to replenish stocks
-- 
GitLab