fix adding zero deviations

This commit is contained in:
Milos Kozak 2018-06-23 12:27:18 +02:00
parent 9c5e389afb
commit 53ba6d46d5
4 changed files with 14 additions and 10 deletions

View file

@ -105,12 +105,13 @@ public class SensitivityAAPSPlugin extends PluginBase implements SensitivityInte
pastSensitivity += "(SITECHANGE)";
}
double deviation = autosensData.validDeviation ? autosensData.deviation : 0d;
double deviation = autosensData.deviation;
//set positive deviations to zero if bg < 80
if (autosensData.bg < 80 && deviation > 0)
deviation = 0;
if (autosensData.validDeviation)
if (autosensData.time > toTime - hoursForDetection * 60 * 60 * 1000L)
deviationsArray.add(deviation);
if (deviationsArray.size() > hoursForDetection * 60 / 5)

View file

@ -106,12 +106,13 @@ public class SensitivityOref0Plugin extends PluginBase implements SensitivityInt
pastSensitivity += "(SITECHANGE)";
}
double deviation = autosensData.validDeviation ? autosensData.deviation : 0d;
double deviation = autosensData.deviation;
//set positive deviations to zero if bg < 80
if (autosensData.bg < 80 && deviation > 0)
deviation = 0;
if (autosensData.validDeviation)
if (autosensData.time > toTime - hoursForDetection * 60 * 60 * 1000L)
deviationsArray.add(deviation);
if (deviationsArray.size() > hoursForDetection * 60 / 5)

View file

@ -97,12 +97,13 @@ public class SensitivityOref1Plugin extends PluginBase implements SensitivityInt
pastSensitivity += "(SITECHANGE)";
}
double deviation = autosensData.validDeviation ? autosensData.deviation : 0d;
double deviation = autosensData.deviation;
//set positive deviations to zero if bg < 80
if (autosensData.bg < 80 && deviation > 0)
deviation = 0;
if (autosensData.validDeviation)
deviationsArray.add(deviation);
for (int i = 0; i < autosensData.extraDeviation.size(); i++)

View file

@ -111,7 +111,7 @@ public class SensitivityWeightedAveragePlugin extends PluginBase implements Sens
pastSensitivity += "(SITECHANGE)";
}
double deviation = autosensData.validDeviation ? autosensData.deviation : 0d;
double deviation = autosensData.deviation;
//set positive deviations to zero if bg < 80
if (autosensData.bg < 80 && deviation > 0)
@ -119,6 +119,7 @@ public class SensitivityWeightedAveragePlugin extends PluginBase implements Sens
//data.append(autosensData.time);
long reverseWeight = (toTime - autosensData.time) / (5 * 60 * 1000L);
if (autosensData.validDeviation)
data.append(reverseWeight, deviation);
//weights += reverseWeight;
//weightedsum += reverseWeight * (autosensData.validDeviation ? autosensData.deviation : 0d);