Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions lib/determine-basal/determine-basal.js
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ var determine_basal = function determine_basal(glucose_status, currenttemp, iob_
//console.error(meal_data.lastCarbTime, lastCarbAge);

fractionCOBAbsorbed = ( meal_data.carbs - meal_data.mealCOB ) / meal_data.carbs;
remainingCATime = remainingCATimeMin + lastCarbAge/60;
remainingCATime = remainingCATimeMin + 1.5 * lastCarbAge/60;
remainingCATime = round(remainingCATime,1);
//console.error(fractionCOBAbsorbed, remainingCATimeAdjustment, remainingCATime)
console.error("Last carbs",lastCarbAge,"minutes ago; remainingCATime:",remainingCATime,"hours;",round(fractionCOBAbsorbed*100)+"% carbs absorbed");
Expand Down Expand Up @@ -443,15 +443,15 @@ var determine_basal = function determine_basal(glucose_status, currenttemp, iob_
if ( profile.curve == "ultra-rapid" && !profile.useCustomPeakTime ) {
insulinPeakTime = 55;
}
// add 15m to allow for insluin delivery (SMBs or temps)
insulinPeakTime += 15;
// add 30m to allow for insluin delivery (SMBs or temps)
insulinPeakTime += 30;
var insulinPeak5m = (insulinPeakTime/60)*12;
//console.error(insulinPeakTime, insulinPeak5m, profile.insulinPeakTime, profile.curve);

// wait 70-90m before setting minIOBPredBG
// wait 80-100 before setting minIOBPredBG
if ( IOBpredBGs.length > insulinPeak5m && (IOBpredBG < minIOBPredBG) ) { minIOBPredBG = round(IOBpredBG); }
if ( IOBpredBG > maxIOBPredBG ) { maxIOBPredBG = IOBpredBG; }
// wait 70-90m before setting COB and 60m for UAM minPredBGs
// wait 85-105m before setting COB and 60m for UAM minPredBGs
if ( (cid || remainingCIpeak > 0) && COBpredBGs.length > insulinPeak5m && (COBpredBG < minCOBPredBG) ) { minCOBPredBG = round(COBpredBG); }
if ( (cid || remainingCIpeak > 0) && COBpredBG > maxIOBPredBG ) { maxCOBPredBG = COBpredBG; }
if ( enableUAM && UAMpredBGs.length > 12 && (UAMpredBG < minUAMPredBG) ) { minUAMPredBG = round(UAMpredBG); }
Expand Down