This commit is contained in:
Milos Kozak 2022-06-17 11:38:00 +02:00
parent 2d6de1970b
commit 8f36b4a0dc

View file

@ -270,11 +270,13 @@ var determine_basal = function determine_basal(glucose_status, currenttemp, iob_
//console.log("Initial insulin value for ISF: "+ins_val+"; "); //console.log("Initial insulin value for ISF: "+ins_val+"; ");
//console.log("Current value for insulin: "+insulin+"; "); //console.log("Current value for insulin: "+insulin+"; ");
var ins_val = 75; // Lyumjev peak: 75 var ins_val;
if (profile.insulinPeak > 65) { // lyumjev peak: 45 if (profile.insulinPeak > 65) { // lyumjev peak: 45
ins_val = 55; ins_val = 55;
} else if (profile.insulinPeak > 50 ){ // ultra rapid peak: 55 } else if (profile.insulinPeak > 50 ){ // ultra rapid peak: 55
ins_val = 65; ins_val = 65;
} else {
ins_val = 75; // rapid peak: 75
} }
console.log("For "+profile.insulinType+" (insulin peak: "+profile.insulinPeak+") divisor is: "+ins_val+"; "); console.log("For "+profile.insulinType+" (insulin peak: "+profile.insulinPeak+") divisor is: "+ins_val+"; ");
@ -824,25 +826,25 @@ var determine_basal = function determine_basal(glucose_status, currenttemp, iob_
if (bg > target_bg && glucose_status.delta < 3 && glucose_status.delta > -3 && glucose_status.short_avgdelta > -3 && glucose_status.short_avgdelta < 3 && eventualBG > target_bg && eventualBG < bg ) { if (bg > target_bg && glucose_status.delta < 3 && glucose_status.delta > -3 && glucose_status.short_avgdelta > -3 && glucose_status.short_avgdelta < 3 && eventualBG > target_bg && eventualBG < bg ) {
var future_sens = ( 1800 / (Math.log((((eventualBG * 0.5) + (bg * 0.5))/ins_val)+1)*TDD)); var future_sens = ( 1800 / (Math.log((((eventualBG * 0.5) + (bg * 0.5))/ins_val)+1)*TDD));
var future_sens_old = ( 277700 / (TDD * ((bg * 0.5) + (eventualBG * 0.5 )))); //var future_sens_old = ( 277700 / (TDD * ((bg * 0.5) + (eventualBG * 0.5 ))));
console.log("Future state sensitivity is " +future_sens+" based on eventual and current bg due to flat glucose level above target"); console.log("Future state sensitivity is " +future_sens+" based on eventual and current bg due to flat glucose level above target");
rT.reason += "Dosing sensitivity: " +future_sens+" using eventual BG;"; rT.reason += "Dosing sensitivity: " +future_sens+" using eventual BG;";
} }
else if( glucose_status.delta > 0 && eventualBG > target_bg ) { else if( glucose_status.delta > 0 && eventualBG > target_bg ) {
var future_sens = ( 1800 / (Math.log((bg/ins_val)+1)*TDD)); var future_sens = ( 1800 / (Math.log((bg/ins_val)+1)*TDD));
var future_sens_old = ( 277700 / (TDD * bg)); //var future_sens_old = ( 277700 / (TDD * bg));
console.log("Future state sensitivity is " +future_sens+" using current bg due to small delta or variation"); console.log("Future state sensitivity is " +future_sens+" using current bg due to small delta or variation");
rT.reason += "Dosing sensitivity: " +future_sens+" using current BG;"; rT.reason += "Dosing sensitivity: " +future_sens+" using current BG;";
} }
else { else {
var future_sens = ( 1800 / (Math.log((eventualBG/ins_val)+1)*TDD)); var future_sens = ( 1800 / (Math.log((eventualBG/ins_val)+1)*TDD));
var future_sens_old = ( 277700 / (TDD * eventualBG)); //var future_sens_old = ( 277700 / (TDD * eventualBG));
console.log("Future state sensitivity is " +future_sens+" based on eventual bg due to -ve delta"); console.log("Future state sensitivity is " +future_sens+" based on eventual bg due to -ve delta");
rT.reason += "Dosing sensitivity: " +future_sens+" using eventual BG;"; rT.reason += "Dosing sensitivity: " +future_sens+" using eventual BG;";
} }
var future_sens = round(future_sens,1); future_sens = round(future_sens,1);