fix cob calculation for history records
This commit is contained in:
parent
8a45422135
commit
801182eccd
4 changed files with 12 additions and 8 deletions
|
@ -568,7 +568,8 @@ public class IobCobCalculatorPlugin implements PluginBase {
|
||||||
//log.debug("Locking onNewHistoryData");
|
//log.debug("Locking onNewHistoryData");
|
||||||
stopCalculation("onEventNewHistoryData");
|
stopCalculation("onEventNewHistoryData");
|
||||||
synchronized (dataLock) {
|
synchronized (dataLock) {
|
||||||
long time = ev.time;
|
// clear up 5 min back for proper COB calculation
|
||||||
|
long time = ev.time - 5 * 60 * 1000L;
|
||||||
log.debug("Invalidating cached data to: " + new Date(time).toLocaleString());
|
log.debug("Invalidating cached data to: " + new Date(time).toLocaleString());
|
||||||
for (int index = iobTable.size() - 1; index >= 0; index--) {
|
for (int index = iobTable.size() - 1; index >= 0; index--) {
|
||||||
if (iobTable.keyAt(index) > time) {
|
if (iobTable.keyAt(index) > time) {
|
||||||
|
|
|
@ -11,6 +11,7 @@ import java.util.Arrays;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import info.nightscout.androidaps.Config;
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
import info.nightscout.androidaps.data.Profile;
|
import info.nightscout.androidaps.data.Profile;
|
||||||
|
@ -191,8 +192,10 @@ public class SensitivityAAPSPlugin implements PluginBase, SensitivityInterface{
|
||||||
log.debug(ratioLimit);
|
log.debug(ratioLimit);
|
||||||
}
|
}
|
||||||
|
|
||||||
log.debug("Sensitivity to: " + new Date(toTime).toLocaleString() + " percentile: " + percentile + " ratio: " + ratio);
|
if (Config.logAutosensData) {
|
||||||
|
log.debug("Sensitivity to: " + new Date(toTime).toLocaleString() + " percentile: " + percentile + " ratio: " + ratio + " mealCOB: " + current.cob);
|
||||||
log.debug("Sensitivity to: deviations " + Arrays.toString(deviations));
|
log.debug("Sensitivity to: deviations " + Arrays.toString(deviations));
|
||||||
|
}
|
||||||
|
|
||||||
AutosensResult output = new AutosensResult();
|
AutosensResult output = new AutosensResult();
|
||||||
output.ratio = Round.roundTo(ratio, 0.01);
|
output.ratio = Round.roundTo(ratio, 0.01);
|
||||||
|
|
|
@ -7,8 +7,10 @@ import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import info.nightscout.androidaps.Config;
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
import info.nightscout.androidaps.data.Profile;
|
import info.nightscout.androidaps.data.Profile;
|
||||||
|
@ -199,10 +201,8 @@ public class SensitivityOref0Plugin implements PluginBase, SensitivityInterface
|
||||||
log.debug(ratioLimit);
|
log.debug(ratioLimit);
|
||||||
}
|
}
|
||||||
|
|
||||||
double newisf = Math.round(Profile.toMgdl(sens, profile.getUnits()) / ratio);
|
if (Config.logAutosensData)
|
||||||
if (ratio != 1) {
|
log.debug("Sensitivity to: " + new Date(toTime).toLocaleString() + " ratio: " + ratio + " mealCOB: " + current.cob);
|
||||||
log.debug("ISF adjusted from " + Profile.toMgdl(sens, profile.getUnits()) + " to " + newisf);
|
|
||||||
}
|
|
||||||
|
|
||||||
AutosensResult output = new AutosensResult();
|
AutosensResult output = new AutosensResult();
|
||||||
output.ratio = Round.roundTo(ratio, 0.01);
|
output.ratio = Round.roundTo(ratio, 0.01);
|
||||||
|
|
|
@ -217,7 +217,7 @@ public class SensitivityWeightedAveragePlugin implements PluginBase, Sensitivity
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.logAutosensData)
|
if (Config.logAutosensData)
|
||||||
log.debug("Sensitivity to: " + new Date(toTime).toLocaleString() + " weightedaverage: " + average + " ratio: " + ratio);
|
log.debug("Sensitivity to: " + new Date(toTime).toLocaleString() + " weightedaverage: " + average + " ratio: " + ratio + " mealCOB: " + current.cob);
|
||||||
|
|
||||||
AutosensResult output = new AutosensResult();
|
AutosensResult output = new AutosensResult();
|
||||||
output.ratio = Round.roundTo(ratio, 0.01);
|
output.ratio = Round.roundTo(ratio, 0.01);
|
||||||
|
|
Loading…
Reference in a new issue