Documentation
¶
Overview ¶
Package predict estimates the next unplug time from the recorded history. It is a faithful port of the awk model of the bash policy this binary replaces.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Next ¶
Next returns the minute of day the charger is expected to come out, and whether a prediction could be made at all.
Only strictly future times count: once the usual unplug minute has passed, the manager holds the base thresholds overnight instead of chasing a stale prediction. Times from the same weekday are preferred; every weekday fills in until enough same-day samples exist. With fewer than minSamples usable records there is no prediction.
func NextChange ¶
NextChange returns the first minute later on the same day at which TopUp flips, and false when it holds until midnight.
Next is constant between consecutive recorded unplug minutes, since a record only drops out of the pool once its minute is reached. Within each such stretch TopUp can only turn on, exactly when the window opens; it can only turn off where the prediction itself jumps. So the recorded minutes and one window opening per stretch are the only candidates, instead of every minute of the day.
Types ¶
This section is empty.