Skip to content
Snippets Groups Projects
Commit 2fd678b5 authored by Tor-Einar Skog's avatar Tor-Einar Skog
Browse files

Added input parameter harvestWidth

parent 65f5305c
No related branches found
No related tags found
No related merge requests found
...@@ -65,6 +65,7 @@ public class GrassDryingModel extends I18nImpl implements Model{ ...@@ -65,6 +65,7 @@ public class GrassDryingModel extends I18nImpl implements Model{
// 1 = weak, 2 = strong, 3 = crushed // 1 = weak, 2 = strong, 3 = crushed
private Integer conditioning; private Integer conditioning;
private Double stringWidth; private Double stringWidth;
private Double harvestWidth;
public GrassDryingModel() public GrassDryingModel()
{ {
...@@ -165,6 +166,7 @@ public class GrassDryingModel extends I18nImpl implements Model{ ...@@ -165,6 +166,7 @@ public class GrassDryingModel extends I18nImpl implements Model{
"\t\t\"yield\":750.0,\n" + "\t\t\"yield\":750.0,\n" +
"\t\t\"conditioning\":2,\n" + "\t\t\"conditioning\":2,\n" +
"\t\t\"stringWidth\":3.0,\n" + "\t\t\"stringWidth\":3.0,\n" +
"\t\t\"harvestWidth\":3.0,\n" +
"\t\t\"observations\":[\n" + "\t\t\"observations\":[\n" +
"\t\t{\n" + "\t\t{\n" +
"\t\t\t\t\"timeMeasured\": \"2014-06-25T00:00:00+02:00\",\n" + "\t\t\t\t\"timeMeasured\": \"2014-06-25T00:00:00+02:00\",\n" +
...@@ -217,6 +219,7 @@ public class GrassDryingModel extends I18nImpl implements Model{ ...@@ -217,6 +219,7 @@ public class GrassDryingModel extends I18nImpl implements Model{
throw new ConfigValidationException("Conditioning may only have values [1,2,3], not " + this.conditioning); throw new ConfigValidationException("Conditioning may only have values [1,2,3], not " + this.conditioning);
} }
this.stringWidth = (Double) config.getConfigParameter("stringWidth"); this.stringWidth = (Double) config.getConfigParameter("stringWidth");
this.harvestWidth = (Double) config.getConfigParameter("harvestWidth");
// private Double yield; // Kgs? Tons?? Per hectar? // private Double yield; // Kgs? Tons?? Per hectar?
...@@ -380,7 +383,11 @@ public class GrassDryingModel extends I18nImpl implements Model{ ...@@ -380,7 +383,11 @@ public class GrassDryingModel extends I18nImpl implements Model{
Double dryingRateCoefficient = Double dryingRateCoefficient =
this.conditioning == 1 ? 0.095 : this.conditioning == 1 ? 0.095 :
this.conditioning == 2 ? 0.11 : 0.19; this.conditioning == 2 ? 0.11 : 0.19;
Double correctionFactor = 44.939 * Math.pow(this.yield, -0.537);
// Adjustment of yield into model
Double yieldAdjusted = this.yield * (this.harvestWidth / this.stringWidth);
Double correctionFactor = 44.939 * Math.pow(yieldAdjusted, -0.537);
return dryingRateCoefficient * correctionFactor; return dryingRateCoefficient * correctionFactor;
} }
......
...@@ -90,6 +90,8 @@ public class GrassDryingModelTest { ...@@ -90,6 +90,8 @@ public class GrassDryingModelTest {
config.setConfigParameter("yield", 750.0); config.setConfigParameter("yield", 750.0);
config.setConfigParameter("conditioning", 2); config.setConfigParameter("conditioning", 2);
config.setConfigParameter("stringWidth", 3.0); config.setConfigParameter("stringWidth", 3.0);
config.setConfigParameter("harvestWidth", 3.0);
instance.setConfiguration(config); instance.setConfiguration(config);
List<Result> results = instance.getResult(); List<Result> results = instance.getResult();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment