use min5min impact actually used for SMB

This commit is contained in:
AdrianLxM 2018-04-19 13:31:34 +02:00
parent f4dea97f36
commit 09cc8c01b6
7 changed files with 18 additions and 6 deletions

View file

@ -11,4 +11,5 @@ public class MealData {
public double slopeFromMinDeviation = 999;
public long lastBolusTime;
public long lastCarbTime = 0L;
public double usedMinCarbsImpact = 0d;
}

View file

@ -65,6 +65,8 @@ public class AutosensData {
public double autosensRatio = 1d;
public double slopeFromMaxDeviation = 0;
public double slopeFromMinDeviation = 999;
public double usedMinCarbsImpact = -0;
@Override
public String toString() {

View file

@ -222,6 +222,7 @@ public class IobCobThread extends Thread {
// and add that to the running total carbsAbsorbed
autosensData.cob = Math.max(previous.cob - autosensData.absorbed, 0d);
autosensData.substractAbosorbedCarbs();
autosensData.usedMinCarbsImpact = totalMinCarbsImpact;
}
autosensData.removeOldCarbs(bgTime);
autosensData.cob += autosensData.carbsFromBolus;

View file

@ -213,8 +213,12 @@ public class DetermineBasalAdapterAMAJS {
mProfile.put("current_basal", basalrate);
mProfile.put("temptargetSet", tempTargetSet);
mProfile.put("autosens_adjust_targets", SP.getBoolean("openapsama_autosens_adjusttargets", true));
//TODO: align with max-absorption model in AMA sensitivity
mProfile.put("min_5m_carbimpact", SP.getDouble("openapsama_min_5m_carbimpact", SMBDefaults.min_5m_carbimpact));
//align with max-absorption model in AMA sensitivity
if(mealData.usedMinCarbsImpact >0){
mProfile.put("min_5m_carbimpact", mealData.usedMinCarbsImpact);
} else {
mProfile.put("min_5m_carbimpact", SP.getDouble("openapsama_min_5m_carbimpact", SMBDefaults.min_5m_carbimpact));
}
if (units.equals(Constants.MMOL)) {
mProfile.put("out_units", "mmol/L");

View file

@ -243,9 +243,12 @@ public class DetermineBasalAdapterSMBJS {
mProfile.put("half_basal_exercise_target", SMBDefaults.half_basal_exercise_target);
mProfile.put("maxCOB", SMBDefaults.maxCOB);
mProfile.put("skip_neutral_temps", SMBDefaults.skip_neutral_temps);
//TODO: align with max-absorption model in AMA sensitivity
mProfile.put("min_5m_carbimpact", SP.getDouble("openapsama_min_5m_carbimpact", SMBDefaults.min_5m_carbimpact));
;
//align with max-absorption model in AMA sensitivity
if(mealData.usedMinCarbsImpact >0){
mProfile.put("min_5m_carbimpact", mealData.usedMinCarbsImpact);
} else {
mProfile.put("min_5m_carbimpact", SP.getDouble("openapsama_min_5m_carbimpact", SMBDefaults.min_5m_carbimpact));
}
mProfile.put("remainingCarbsCap", SMBDefaults.remainingCarbsCap);
mProfile.put("enableUAM", SP.getBoolean(R.string.key_use_uam, false));
mProfile.put("A52_risk_enable", SMBDefaults.A52_risk_enable);

View file

@ -29,6 +29,6 @@ public class SourceXdripPlugin extends PluginBase implements BgSourceInterface {
@Override
public boolean advancedFilteringSupported() {
return false;
return true;
}
}

View file

@ -235,6 +235,7 @@ public class TreatmentsPlugin extends PluginBase implements TreatmentsInterface
result.mealCOB = autosensData.cob;
result.slopeFromMinDeviation = autosensData.slopeFromMinDeviation;
result.slopeFromMaxDeviation = autosensData.slopeFromMaxDeviation;
result.usedMinCarbsImpact = autosensData.usedMinCarbsImpact;
}
result.lastBolusTime = getLastBolusTime();
return result;