oref0 icon indicating copy to clipboard operation
oref0 copied to clipboard

Algorithm idea: always ZT w/ SMB

Open scottleibrand opened this issue 6 years ago • 1 comments

Building on #985, it appears that we could more quickly dose the correct amount of insulin, while ensuring hypo safety, by always zero-temping when SMB is active, and dosing the foregone basal insulin up front if BG is projected to be above target when that insulin would be peaking, or waiting to dose it later if BG is predicted to be below target at that point.

The implementation would look something like this:

  • If insulinReq is positive and no boluses have been given with 15m, set a high temp to cover insulinReq, and try to SMB. Once an SMB is successful, we can ZT again.
  • Otherwise, make sure a zero temp is running, with at least 20m left.
  • Calculate the predBG 30m + insulinPeakTime from now (so 85m for Fiasp, 105m for rapid-acting). If that predBG is below target, leave insulinReq unchanged. If that predBG is > target, then add 30m of basal to insulinReq.

As a result, when BG is projected to be above target in ~1.5h and SMB is enabled, oref0 will SMB slightly more aggressively to get BG down to target, by delivering basal insulin as bolus approximately 15-20m earlier than it would otherwise be delivered via basal. If BG is projected to be below target in ~1.5h, then it will zero-temp slightly more aggressively (and later SMB as needed) to get BG to target faster and subsequently try to keep it closer to target.

Another effect of this change would be that, if SMB is enabled and working, a zero temp will always be set (except for very brief periods >15m after a bolus), reducing confusion over "why is SMB zero temping" and refocusing the thinking/discussion onto total insulin delivery via microboluses.

scottleibrand avatar May 17 '18 23:05 scottleibrand

Speaking of zero-temp basal visualization causing frustration/concern, I think in concert we should work on a netIOB (or some other) visualization of insulin activity for NS display.

danamlewis avatar May 17 '18 23:05 danamlewis