     public override init?(dailyItems: [RepeatingScheduleValue], timeZone: NSTimeZone? = nil) {
         super.init(dailyItems: dailyItems, timeZone: timeZone)
     }
-}
+
+    /**
+     Calculates the total basal delivery for a day
+
+     - returns: The total basal delivery
+     */
+    public func total() -> Double {
+        var total: Double = 0
+
+        for (index, item) in items.enumerate() {
+            var endTime = maxTimeInterval
+
+            if index < items.endIndex - 1 {
+                endTime = items[index + 1].startTime
+            }
+
+            total += (endTime - item.startTime) / NSTimeInterval(hours: 1) * item.value
+        }
+
+        return total
+    }
+}

        }

        referenceTimeInterval = firstItem.startTime
    }

    private var maxTimeInterval: NSTimeInterval {

        self.unit = unit

        super.init(dailyItems: dailyItems, timeZone: timeZone)
    }

    public required convenience init?(rawValue: RawValue) {
        guard let
            rawUnit = rawValue["unit"] as? String,
            timeZoneName = rawValue["timeZone"] as? String,
            rawItems = rawValue["items"] as? [RepeatingScheduleValue.RawValue] else
        {
            return nil
        }

        self.init(unit: HKUnit(fromString: rawUnit), dailyItems: rawItems.flatMap { RepeatingScheduleValue(rawValue: $0) }, timeZone: NSTimeZone(name: timeZoneName))
    }

    public func at(time: NSDate) -> HKQuantity {
