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

Setting ASCMAT value only once per day

parent 1742c1c4
No related branches found
No related tags found
No related merge requests found
......@@ -100,7 +100,7 @@ public class AppleScabModel extends I18nImpl implements Model{
{
Result result = new ResultImpl();
result.setResultValidTime(timeStamp);
result.setValue(AppleScabCalculations.ASCOSPORE_MATURITY, String.valueOf(this.calculations.getParamDoubleValueForDate(timeStamp, AppleScabCalculations.ASCOSPORE_MATURITY)));
result.setValue(AppleScabCalculations.ASCOSPORE_MATURITY, this.calculations.getParamDoubleValueForDate(timeStamp, AppleScabCalculations.ASCOSPORE_MATURITY) != null ? String.valueOf(this.calculations.getParamDoubleValueForDate(timeStamp, AppleScabCalculations.ASCOSPORE_MATURITY)) : "");
result.setValue(AppleScabCalculations.ACCUMULATED_MILLS, String.valueOf(this.calculations.getParamDoubleValueForDate(timeStamp, AppleScabCalculations.ACCUMULATED_MILLS)));
result.setValue(AppleScabCalculations.TM, String.valueOf(this.calculations.getParamDoubleValueForDate(timeStamp, AppleScabCalculations.TM)));
result.setValue(AppleScabCalculations.BT, String.valueOf(this.calculations.getParamDoubleValueForDate(timeStamp, AppleScabCalculations.BT)));
......@@ -134,7 +134,7 @@ public class AppleScabModel extends I18nImpl implements Model{
{
return Result.WARNING_STATUS_NO_WARNING;
}
else if(this.calculations.getParamDoubleValueForDate(timeStamp, AppleScabCalculations.ASCOSPORE_MATURITY) == 100d)
else if(this.calculations.getParamDoubleValueForDate(this.weatherUtil.normalizeToExactDate(timeStamp, this.timeZone), AppleScabCalculations.ASCOSPORE_MATURITY) == 100d)
{
return Result.WARNING_STATUS_NO_WARNING;
}
......@@ -347,8 +347,12 @@ public class AppleScabModel extends I18nImpl implements Model{
{
currentAppleScabStadium = APPLE_SCAB_STADIUM_CONIDIA;
}
ascosporeMaturity = ascosporeMaturityTable.getAscosporeMaturity(this.getAccumulatedTemperature(currentTimeStamp));
this.calculations.setParamDoubleValueForDate(currentTimeStamp, AppleScabCalculations.ASCOSPORE_MATURITY, ascosporeMaturity);
// We update and store the ascospore maturity only at midnight, when we have an updated accumulated temperature
if(currentTimeStamp.equals(this.weatherUtil.normalizeToExactDate(currentTimeStamp, this.timeZone)))
{
ascosporeMaturity = ascosporeMaturityTable.getAscosporeMaturity(this.getAccumulatedTemperature(currentTimeStamp));
this.calculations.setParamDoubleValueForDate(currentTimeStamp, AppleScabCalculations.ASCOSPORE_MATURITY, ascosporeMaturity);
}
// We accumulate Mills only when there are humid conditions
if(this.getLeafWetness(currentTimeStamp) < LEAF_WETNESS_THRESHOLD)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment