From 15cfaf0c78169b8625fc02693f79b63111b7cd9f Mon Sep 17 00:00:00 2001 From: R0slyn <roslyn.henry.08@aberdeen.ac.uk> Date: Fri, 16 Nov 2018 13:45:00 +0000 Subject: [PATCH] different implementation of fix --- src/ac/ed/lurg/country/CountryAgent.java | 7 ++++--- src/ac/ed/lurg/landuse/CropUsageData.java | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/ac/ed/lurg/country/CountryAgent.java b/src/ac/ed/lurg/country/CountryAgent.java index 878ef55d..60787f6a 100644 --- a/src/ac/ed/lurg/country/CountryAgent.java +++ b/src/ac/ed/lurg/country/CountryAgent.java @@ -162,7 +162,7 @@ public class CountryAgent { for (CropType crop : commodity.getCropTypes()) { CropUsageData cropUsage = cropUsages.get(crop); - double prod = cropUsage.getNetProduction(crop.getSeedAndWasteRate()); + double prod = cropUsage.getProduction() *(1-crop.getSeedAndWasteRate()) - cropUsage.getMonogastricFeed() - cropUsage.getRuminantFeed(); totalProd += prod; double minFract = minCerealFracts.containsKey(crop) ? minCerealFracts.get(crop) : 0.0; double netImportsFromMinDemand = minFract * demand - prod; @@ -202,7 +202,8 @@ public class CountryAgent { // simple 1-1 commodity to cereal mappings for (CropType crop : commodity.getCropTypes()) { CropUsageData cropUsage = cropUsages.get(crop); - double netImports = demand - cropUsage.getNetProduction(crop.getSeedAndWasteRate()); + double prod = cropUsage.getProduction() *(1-crop.getSeedAndWasteRate()) - cropUsage.getMonogastricFeed() - cropUsage.getRuminantFeed(); + double netImports = demand - prod; LogWriter.println("Updating net imports single commodity/crop" + commodity + "/" + crop + " to " + netImports); cropUsage.updateNetImports(netImports); } @@ -233,7 +234,7 @@ public class CountryAgent { for (Map.Entry<CropType, CropUsageData> entry : previousGamsRasterOutput.getCropUsageData().entrySet()) { CropUsageData cropUsage = entry.getValue(); CropType crop = entry.getKey(); - double baseTradeOrProd = (ModelConfig.ORIG_LEAST_COST_MIN) ? cropUsage.getNetImports() : cropUsage.getNetProduction(crop.getSeedAndWasteRate()); + double baseTradeOrProd = (ModelConfig.ORIG_LEAST_COST_MIN) ? cropUsage.getNetImports() : cropUsage.getNetProduction(); double changeUp = 0.0; double changeDown = 0.0; diff --git a/src/ac/ed/lurg/landuse/CropUsageData.java b/src/ac/ed/lurg/landuse/CropUsageData.java index c30ec8ba..35e151ce 100644 --- a/src/ac/ed/lurg/landuse/CropUsageData.java +++ b/src/ac/ed/lurg/landuse/CropUsageData.java @@ -42,8 +42,8 @@ public class CropUsageData { } /** return production available after accounting for feed use and seed and waste losses */ - public double getNetProduction(double seedAndWasteRate) { - return prod *(1-seedAndWasteRate) - ruminantFeed - monogastricFeed; + public double getNetProduction() { + return prod - ruminantFeed - monogastricFeed; } public double getProdCost() { -- GitLab