فهرست منبع

Update eventualBG from CoB and UAM forecasts

Sam King 9 ماه پیش
والد
کامیت
92b92226c5

+ 7 - 11
Trio/Sources/APS/OpenAPSSwift/Forecasts/ForecastGenerator.swift

@@ -117,25 +117,21 @@ enum ForecastGenerator {
             currentGlucose: glucose
         )
 
-        // FIXME: Revisit this after I get predBG working
-        /*
-         var eventualGlucose = eventualGlucose
-         if let finalCOBGlucose = cobForecast.last {
-             eventualGlucose = max(eventualGlucose, finalCOBGlucose)
-         }
-         if let finalUAMGlucose = uamForecast.last {
-             eventualGlucose = max(eventualGlucose, finalUAMGlucose)
-         }
-          */
-
+        var eventualGlucose = eventualGlucose
         var finalCobForecast: [Decimal]?
         if mealData.mealCOB > 0, carbImpact > 0 || carbImpactParams.remainingCarbImpactPeak > 0 {
             finalCobForecast = cobForecast
+            if let lastCobGlucose = cobForecast.last {
+                eventualGlucose = max(eventualGlucose, lastCobGlucose)
+            }
         }
 
         var finalUamForecast: [Decimal]?
         if profile.enableUAM, carbImpact > 0 || carbImpactParams.remainingCarbImpactPeak > 0 {
             finalUamForecast = uamForecast
+            if let lastUamGlucose = uamForecast.last {
+                eventualGlucose = max(eventualGlucose, lastUamGlucose)
+            }
         }
 
         return ForecastResult(

+ 2 - 3
Trio/Sources/APS/OpenAPSSwift/Logging/OrefFunction.swift

@@ -72,9 +72,7 @@ enum OrefFunction: String, Codable {
                 // in Swift but not in JS
                 "timestamp",
                 "minGuardBG",
-                "minPredBG",
-                // In both but not ready to test yet
-                "eventualBG"
+                "minPredBG"
             ])
         }
     }
@@ -117,6 +115,7 @@ enum OrefFunction: String, Codable {
             return [
                 "sensitivityRatio": 0.011,
                 "expectedDelta": 0.11,
+                "eventualBG": 1.1,
                 "IOB": 1.1,
                 "ZT": 1.1,
                 "UAM": 1.1,