Merge pull request #1390 from tim2000s/dev

Dynamic ISF
This commit is contained in:
Milos Kozak 2022-02-27 21:49:59 +01:00 committed by GitHub
commit f095b73b9e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -286,7 +286,7 @@ var determine_basal = function determine_basal(glucose_status, currenttemp, iob_
} }
console.error(" "); console.error(" ");
console.error("++++++++++++++++++++++++++++++++++++++++++++++++++++++"); console.error("++++++++++++++++++++++++++++++++++++++++++++++++++++++");
console.error("++ Dynamic ISF Beta 1.3 - Based on rolling 24 hours ++"); console.error("++ Dynamic ISF Beta 1.4 - Linear Extrapolation/TDD7 ++");
console.error("++++++++++++++++++++++++++++++++++++++++++++++++++++++"); console.error("++++++++++++++++++++++++++++++++++++++++++++++++++++++");
console.error(" "); console.error(" ");
@ -306,25 +306,29 @@ var determine_basal = function determine_basal(glucose_status, currenttemp, iob_
var tdd_24 = (( basal * 24 ) * 2.8); var tdd_24 = (( basal * 24 ) * 2.8);
} }
var TDD = (tdd7 * 0.3) + (tdd_24 * 0.7); if (meal_data.TDDPUMP){
var tdd_pump = ( (meal_data.TDDPUMP / now ) * 24);
}
else {
var tdd_pump = (( basal * 24 ) * 2.8);
}
var TDD = (tdd7 * 0.4) + (tdd_pump * 0.6);
console.error("Rolling 24 hour TDD = "+tdd_24+"; "); console.error("Pump extrapolated TDD = "+tdd_pump+"; ");
console.error(" ");
console.error("Weighted Average TDD = "+TDD+"; ");
console.error(" ");
//if (tdd7 > 0){ //if (tdd7 > 0){
/*if ( tdd_pump > tdd7 && now < 5 || now < 7 && TDD < ( 0.8 * tdd7 ) ){ if ( tdd_pump > tdd7 && now < 5 || now < 7 && TDD < ( 0.8 * tdd7 ) ){
TDD = ( 0.8 * tdd7 ); TDD = ( 0.8 * tdd7 );
console.log("Excess or too low insulin from pump so TDD set to "+TDD+" based on 75% of TDD7; "); console.log("Excess or too low insulin from pump so TDD set to "+TDD+" based on 75% of TDD7; ");
rT.reason += "TDD: " +TDD+ " due to low or high tdd from pump; "; rT.reason += "TDD: " +TDD+ " due to low or high tdd from pump; ";
} }
else if (tdd_pump > (1.75 * tdd7)) { else if (tdd_pump > (1.75 * tdd7)){
TDD = tdd7; TDD = tdd7;
console.error("TDD set to TDD7 due to high pump usage reported. TDD = "+TDD+"; "); console.error("TDD set to TDD7 due to high pump usage reported. TDD = "+TDD+"; ");
rT.reason += "TDD set to TDD7 due to high pump usage reported. TDD = "+TDD+"; "; rT.reason += "TDD set to TDD7 due to high pump usage reported. TDD = "+TDD+"; ";
} }
else if (tdd_pump < (0.33 * tdd7)){ else if (tdd_pump < (0.33 * tdd7)){
TDD = (tdd7 * 0.25) + (tdd_pump * 0.75); TDD = (tdd7 * 0.25) + (tdd_pump * 0.75);
console.error("TDD weighted to pump due to low insulin usage. TDD = "+TDD+"; "); console.error("TDD weighted to pump due to low insulin usage. TDD = "+TDD+"; ");
@ -332,9 +336,11 @@ var determine_basal = function determine_basal(glucose_status, currenttemp, iob_
} }
else { else {
console.log("TDD 7 ="+tdd7+", TDD Pump ="+tdd_pump+" and TDD = "+TDD+";"); console.log("TDD = " +TDD+ " based on standard pump 60/tdd7 40 split; ");
rT.reason += "TDD: " +TDD+ " based on standard pump 60/tdd7 40 split; "; rT.reason += "TDD: " +TDD+ " based on standard pump 60/tdd7 40 split; ";
}*/ }
console.error(" ");
var variable_sens = (277700 / (TDD * bg)); var variable_sens = (277700 / (TDD * bg));