From f227da9b114ad6e9e88791d69f784489ed344503 Mon Sep 17 00:00:00 2001
From: Bart Arendarczyk <s1924442@ed.ac.uk>
Date: Fri, 12 May 2023 11:53:53 +0100
Subject: [PATCH] Initial trade set at the start rather than 2nd timestep.

---
 src/ac/ed/lurg/ModelMain.java           | 4 ++++
 src/ac/ed/lurg/country/GlobalPrice.java | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/ac/ed/lurg/ModelMain.java b/src/ac/ed/lurg/ModelMain.java
index a3050e74..bd97461b 100644
--- a/src/ac/ed/lurg/ModelMain.java
+++ b/src/ac/ed/lurg/ModelMain.java
@@ -99,6 +99,10 @@ public class ModelMain {
 	private void doTimestep(Timestep timestep) {
 		LogWriter.println("Timestep: " + timestep.toString());
 
+		if (ModelConfig.IS_CALIBRATION_RUN && timestep.isInitialTimestep()) { // initialize trade and production
+			internationalMarket.determineInternationalTrade(countryAgents.getAll(), timestep);
+		}
+
 		yieldSurfaces = getYieldSurfaces(timestep); // this will wait for the marker file from LPJ if configured to do so
 		getUpdateIrrigationData(timestep); // updating currentIrrigationData
 
diff --git a/src/ac/ed/lurg/country/GlobalPrice.java b/src/ac/ed/lurg/country/GlobalPrice.java
index 7263e879..e08cfa84 100644
--- a/src/ac/ed/lurg/country/GlobalPrice.java
+++ b/src/ac/ed/lurg/country/GlobalPrice.java
@@ -39,7 +39,7 @@ public class GlobalPrice implements Serializable {
 	
 	public static GlobalPrice createInitial(double exportPrice, double intitalStock) {
 		return new GlobalPrice(new Timestep(ModelConfig.START_TIMESTEP-1), exportPrice, intitalStock, Double.NaN,
-				Double.NaN, Double.NaN, Double.NaN, Double.NaN, 0.0, intitalStock / 0.1);
+				Double.NaN, Double.NaN, Double.NaN, Double.NaN, 0.0, Double.NaN);
 	}
 	
 	public double getExportPrice(){
-- 
GitLab