123f7dea by Nathan Lighthart

Fix depletion level irrigation

- Fix logic for determining if irrigation should occur for depletion level storage
1 parent e2fae694
......@@ -54,7 +54,15 @@ public class ProcessIrrigation {
case 4:
// depletion level needs to check soil water content
double root_swc = computeRootSWC();
return root_swc > depletionTriggerLevel && root_swc < depletionRefillLevel;
if (doIrrigate) {
// already irrigating thus irrigation was triggered
// continue irrigating until refill level is met
return root_swc < depletionRefillLevel;
} else {
// not currently irrigating
// start irrigating if below trigger level
return root_swc < depletionTriggerLevel;
}
default:
// unknown types cannot irrigate
return false;
......
......@@ -83,8 +83,9 @@ public class ProcessIrrigationAdapter extends AnnotatedAdapter {
@Optional
@Input public double soilSat;
@Optional
@Description("flag whether irrigation was run today")
@Output public boolean doIrrigate;
@Input @Output public boolean doIrrigate;
@Description("Current irrigation amount in liter for the whole hru")
@Output public double irrigation_amount;
......@@ -101,6 +102,7 @@ public class ProcessIrrigationAdapter extends AnnotatedAdapter {
component.surfacetemp = surfacetemp;
component.irri_depth = irrigation.getDepth();
component.area = hru.area;
component.doIrrigate = doIrrigate;
if (irrigation instanceof FixedCropDateIrrigation) {
FixedCropDateIrrigation irri = (FixedCropDateIrrigation) irrigation;
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!