Skip to content
Snippets Groups Projects
Commit af467451 authored by Bart Arendarczyk's avatar Bart Arendarczyk
Browse files

Wood demand rebasing bug fix.

parent 3097a553
No related branches found
No related tags found
No related merge requests found
......@@ -194,6 +194,7 @@ public class ElasticDemandManager extends AbstractSSPDemandManager {
Map<WoodCommodityType, Double> woodDemands = new HashMap<>();
SspData baseSspData = sspManager.get(ssp_scenario, baseYearToRebaseConsumption, country);
double baseGdpPc = baseSspData.getGdpPc();
Map<WoodCommodityType, Double> baseExpCpcMap = baseWoodCpcCache.get(country);
if (baseExpCpcMap == null) { // we should only do this in the first year
......@@ -208,9 +209,10 @@ public class ElasticDemandManager extends AbstractSSPDemandManager {
double newExpCpc = entry.getValue();
double baseExpCpc = baseExpCpcMap.get(commodity);
double baseCpc = woodDemandManager.getBaseDemand(country, commodity);
double cpc = rebaseConsumption(baseGdpPc, baseCpc, baseExpCpc, gdpPc, newExpCpc);
cpc = Math.max(cpc, 0); // could be negative due to rebasing so need to max 0
// Rebased consumption
double cpc = baseCpc + (newExpCpc - baseExpCpc);
double d = cpc * population;
woodDemands.put(commodity, d);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment