set positive deviations to zero if bg < 80
This commit is contained in:
parent
c139942981
commit
8a74646b67
7 changed files with 33 additions and 6 deletions
|
@ -56,7 +56,8 @@ public class AutosensData implements DataPointWithLabelInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
public long time = 0L;
|
public long time = 0L;
|
||||||
long chartTime;
|
public double bg = 0; // mgdl
|
||||||
|
private long chartTime;
|
||||||
public String pastSensitivity = "";
|
public String pastSensitivity = "";
|
||||||
public double deviation = 0d;
|
public double deviation = 0d;
|
||||||
public boolean validDeviation = false;
|
public boolean validDeviation = false;
|
||||||
|
|
|
@ -146,6 +146,7 @@ public class IobCobOref1Thread extends Thread {
|
||||||
log.error("! value < 39");
|
log.error("! value < 39");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
autosensData.bg = bg;
|
||||||
delta = (bg - bucketed_data.get(i + 1).value);
|
delta = (bg - bucketed_data.get(i + 1).value);
|
||||||
avgDelta = (bg - bucketed_data.get(i + 3).value) / 3;
|
avgDelta = (bg - bucketed_data.get(i + 3).value) / 3;
|
||||||
|
|
||||||
|
@ -327,7 +328,7 @@ public class IobCobOref1Thread extends Thread {
|
||||||
calendar.setTimeInMillis(bgTime);
|
calendar.setTimeInMillis(bgTime);
|
||||||
int min = calendar.get(MINUTE);
|
int min = calendar.get(MINUTE);
|
||||||
int hours = calendar.get(Calendar.HOUR_OF_DAY);
|
int hours = calendar.get(Calendar.HOUR_OF_DAY);
|
||||||
if (min >= 0 && min < 5 && hours %2 == 0)
|
if (min >= 0 && min < 5 && hours % 2 == 0)
|
||||||
autosensData.extraDeviation.add(0d);
|
autosensData.extraDeviation.add(0d);
|
||||||
|
|
||||||
previous = autosensData;
|
previous = autosensData;
|
||||||
|
|
|
@ -145,6 +145,7 @@ public class IobCobThread extends Thread {
|
||||||
log.error("! value < 39");
|
log.error("! value < 39");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
autosensData.bg = bg;
|
||||||
delta = (bg - bucketed_data.get(i + 1).value);
|
delta = (bg - bucketed_data.get(i + 1).value);
|
||||||
avgDelta = (bg - bucketed_data.get(i + 3).value) / 3;
|
avgDelta = (bg - bucketed_data.get(i + 3).value) / 3;
|
||||||
|
|
||||||
|
|
|
@ -105,8 +105,14 @@ public class SensitivityAAPSPlugin extends PluginBase implements SensitivityInte
|
||||||
pastSensitivity += "(SITECHANGE)";
|
pastSensitivity += "(SITECHANGE)";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double deviation = autosensData.validDeviation ? autosensData.deviation : 0d;
|
||||||
|
|
||||||
|
//set positive deviations to zero if bg < 80
|
||||||
|
if (autosensData.bg < 80 && deviation > 0)
|
||||||
|
deviation = 0;
|
||||||
|
|
||||||
if (autosensData.time > toTime - hoursForDetection * 60 * 60 * 1000L)
|
if (autosensData.time > toTime - hoursForDetection * 60 * 60 * 1000L)
|
||||||
deviationsArray.add(autosensData.validDeviation ? autosensData.deviation : 0d);
|
deviationsArray.add(deviation);
|
||||||
if (deviationsArray.size() > hoursForDetection * 60 / 5)
|
if (deviationsArray.size() > hoursForDetection * 60 / 5)
|
||||||
deviationsArray.remove(0);
|
deviationsArray.remove(0);
|
||||||
|
|
||||||
|
|
|
@ -106,8 +106,14 @@ public class SensitivityOref0Plugin extends PluginBase implements SensitivityInt
|
||||||
pastSensitivity += "(SITECHANGE)";
|
pastSensitivity += "(SITECHANGE)";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double deviation = autosensData.validDeviation ? autosensData.deviation : 0d;
|
||||||
|
|
||||||
|
//set positive deviations to zero if bg < 80
|
||||||
|
if (autosensData.bg < 80 && deviation > 0)
|
||||||
|
deviation = 0;
|
||||||
|
|
||||||
if (autosensData.time > toTime - hoursForDetection * 60 * 60 * 1000L)
|
if (autosensData.time > toTime - hoursForDetection * 60 * 60 * 1000L)
|
||||||
deviationsArray.add(autosensData.validDeviation ? autosensData.deviation : 0d);
|
deviationsArray.add(deviation);
|
||||||
if (deviationsArray.size() > hoursForDetection * 60 / 5)
|
if (deviationsArray.size() > hoursForDetection * 60 / 5)
|
||||||
deviationsArray.remove(0);
|
deviationsArray.remove(0);
|
||||||
|
|
||||||
|
|
|
@ -97,7 +97,13 @@ public class SensitivityOref1Plugin extends PluginBase implements SensitivityInt
|
||||||
pastSensitivity += "(SITECHANGE)";
|
pastSensitivity += "(SITECHANGE)";
|
||||||
}
|
}
|
||||||
|
|
||||||
deviationsArray.add(autosensData.validDeviation ? autosensData.deviation : 0d);
|
double deviation = autosensData.validDeviation ? autosensData.deviation : 0d;
|
||||||
|
|
||||||
|
//set positive deviations to zero if bg < 80
|
||||||
|
if (autosensData.bg < 80 && deviation > 0)
|
||||||
|
deviation = 0;
|
||||||
|
|
||||||
|
deviationsArray.add(deviation);
|
||||||
|
|
||||||
for (int i = 0; i < autosensData.extraDeviation.size(); i++)
|
for (int i = 0; i < autosensData.extraDeviation.size(); i++)
|
||||||
deviationsArray.add(autosensData.extraDeviation.get(i));
|
deviationsArray.add(autosensData.extraDeviation.get(i));
|
||||||
|
|
|
@ -111,9 +111,15 @@ public class SensitivityWeightedAveragePlugin extends PluginBase implements Sens
|
||||||
pastSensitivity += "(SITECHANGE)";
|
pastSensitivity += "(SITECHANGE)";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double deviation = autosensData.validDeviation ? autosensData.deviation : 0d;
|
||||||
|
|
||||||
|
//set positive deviations to zero if bg < 80
|
||||||
|
if (autosensData.bg < 80 && deviation > 0)
|
||||||
|
deviation = 0;
|
||||||
|
|
||||||
//data.append(autosensData.time);
|
//data.append(autosensData.time);
|
||||||
long reverseWeight = (toTime - autosensData.time) / (5 * 60 * 1000L);
|
long reverseWeight = (toTime - autosensData.time) / (5 * 60 * 1000L);
|
||||||
data.append(reverseWeight, autosensData.validDeviation ? autosensData.deviation : 0d);
|
data.append(reverseWeight, deviation);
|
||||||
//weights += reverseWeight;
|
//weights += reverseWeight;
|
||||||
//weightedsum += reverseWeight * (autosensData.validDeviation ? autosensData.deviation : 0d);
|
//weightedsum += reverseWeight * (autosensData.validDeviation ? autosensData.deviation : 0d);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue