Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

per #1401 set highest sensitivity on low TT and halfBasal #1403

Merged
merged 1 commit into from
Dec 18, 2021
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: 9 additions & 1 deletion lib/determine-basal/determine-basal.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,15 @@ var determine_basal = function determine_basal(glucose_status, currenttemp, iob_
// e.g.: Sensitivity ratio set to 0.8 based on temp target of 120; Adjusting basal from 1.65 to 1.35; ISF from 58.9 to 73.6
//sensitivityRatio = 2/(2+(target_bg-normalTarget)/40);
var c = halfBasalTarget - normalTarget;
sensitivityRatio = c/(c+target_bg-normalTarget);
// getting multiplication less or equal to 0 means that we have a really low target with a really low halfBasalTarget
// with low TT and lowTTlowersSensitivity we need autosens_max as a value
// we use multiplication instead of the division to avoid "division by zero error"
if (c * (c + target_bg-normalTarget) <= 0.0) {
sensitivityRatio = profile.autosens_max;
}
else {
sensitivityRatio = c/(c+target_bg-normalTarget);
}
// limit sensitivityRatio to profile.autosens_max (1.2x by default)
sensitivityRatio = Math.min(sensitivityRatio, profile.autosens_max);
sensitivityRatio = round(sensitivityRatio,2);
Expand Down