@@ -22,6 +22,24 @@ private func signalHandler(signal: Int32) {
2222 exit ( signal)
2323}
2424
25+ #if os(Linux) || os(Windows)
26+ // Non-Apple platforms use raw Double
27+ public typealias AlgorithmValue = Double
28+ #else
29+ // Apple platforms use LoopQuantity
30+ public typealias AlgorithmValue = LoopQuantity
31+ #endif
32+
33+ extension AbsoluteScheduleValue where T == AlgorithmValue {
34+ static func universal( startDate: Date , endDate: Date , value: Double , unit: String ) -> AbsoluteScheduleValue < AlgorithmValue > {
35+ #if os(Linux) || os(Windows)
36+ return AbsoluteScheduleValue ( startDate: startDate, endDate: endDate, value: value)
37+ #else
38+ return AbsoluteScheduleValue ( startDate: startDate, endDate: endDate, value: LoopQuantity ( unit: LoopUnit ( from: unit) , doubleValue: value) )
39+ #endif
40+ }
41+ }
42+
2543@_cdecl ( " initializeExceptionHandler " )
2644public func initializeExceptionHandler( ) {
2745 #if os(macOS) || os(iOS)
@@ -91,7 +109,7 @@ public func generatePrediction(jsonData: UnsafePointer<Int8>?) -> UnsafeMutableP
91109 carbRatio: input. carbRatio,
92110 algorithmEffectsOptions: . all, // Here we can adjust which predictive factor to output
93111 useIntegralRetrospectiveCorrection: input. useIntegralRetrospectiveCorrection,
94- includingPositiveVelocityAndRC: input. includePositiveVelocityAndRC,
112+ includingPositiveVelocityAndRC: input. includePositiveVelocityAndRC
95113 )
96114
97115
@@ -421,7 +439,7 @@ public func getDynamicCarbsOnBoard(jsonData: UnsafePointer<Int8>?) -> Double {
421439 let carbRatio = [ AbsoluteScheduleValue (
422440 startDate: startDate,
423441 endDate: endDate,
424- value: input. carbRatio
442+ value: LoopQuantity ( unit : LoopUnit ( from : " g/U " ) , doubleValue : input. carbRatio)
425443 ) ]
426444 let isf = [ AbsoluteScheduleValue (
427445 startDate: startDate,
0 commit comments