You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit e0afef6
Browse filesBrowse the repository at this point in the historyBrowse files
Add graduated Amber headroom target to reduce solar clipping on Amber days (#23)
Amber forecast days previously received no pre-period headroom export, leaving
the battery full when morning solar arrives. Now a configurable AMBER_HEADROOM_FRACTION
(default 0.25) drives a 6 kWh headroom target for Amber periods, sitting between
Red (none) and Green (50% / 12 kWh). All headroom checks in the decision engine,
period handlers, and mid-period safety exports are status-aware.
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: README.md
+18-6Lines changed: 18 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -104,6 +104,7 @@ see exactly what values were used and why each decision was made.
104
104
|`CHEAP_RATE_END_HOUR`|`8`| Hour your cheap-rate electricity ends (local time) |
105
105
|`ESTIMATED_HOME_LOAD_KW`|`0.8`| Your average household draw in kW when solar is low |
106
106
|`HEADROOM_TARGET_KWH`|`BATTERY_KWH * 0.5`| Free battery space to maintain before a Green forecast. The alternative physics formula is `(SOLAR_PV_KW - INVERTER_KW) * 3`; use whichever fits your clipping risk tolerance |
107
+
|`AMBER_HEADROOM_FRACTION`|`0.25`| Fraction of battery capacity to keep free before an Amber forecast (e.g. `0.25` = 25%). Set to `0.0` to disable Amber headroom entirely |
107
108
108
109
All solar trigger thresholds (`MID_PERIOD_SAFETY_SOLAR_TRIGGER_KW`, `LIVE_CLIPPING_RISK_SOLAR_TRIGGER_KW`) and discharge rate estimates (`PRE_CHEAP_RATE_NIGHT_EXPORT_ASSUMED_DISCHARGE_KW`, `EVENING_EXPORT_ASSUMED_DISCHARGE_KW`) are automatically derived from your hardware specs — you do not need to touch them.
109
110
@@ -286,6 +287,7 @@ These settings are **not** derived from hardware and need manual review:
286
287
|`CHEAP_RATE_START_HOUR` / `CHEAP_RATE_END_HOUR`| Varies by energy provider and tariff plan |
287
288
|`ESTIMATED_HOME_LOAD_KW`| Household draw varies; affects the evening battery-bridge rule |
288
289
|`HEADROOM_TARGET_KWH`| Currently `BATTERY_KWH * 0.5`. The physics alternative is `(SOLAR_PV_KW - INVERTER_KW) * 3` (surplus kW × 3 h reserve). For systems with a large battery relative to array surplus, the physics formula is more appropriate |
290
+
|`AMBER_HEADROOM_FRACTION`| Fraction of battery capacity to maintain as free headroom before an Amber period. Default `0.25` (25% of battery). Set to `0.0` to disable Amber pre-period exports entirely |
289
291
|`PRE_SUNRISE_DISCHARGE_MONTHS`| Months where pre-sunrise discharge is useful — adjust for your latitude and climate |
-`QUARTZ_RED_CAPACITY_FRACTION`: lower Quartz status threshold as a fraction of configured array capacity
338
341
-`QUARTZ_GREEN_CAPACITY_FRACTION`: upper Quartz status threshold as a fraction of configured array capacity
339
342
-`FORECAST_SOLAR_POWER_MULTIPLIER`: scalar applied to Forecast.Solar watts before period status/value normalization; use this to correct persistent local bias (for example, historical under-forecasting)
-`HEADROOM_TARGET_KWH`: fixed battery headroom target for Green periods (10.2 kWh = surplus capacity × 3 hours)
344
+
-`AMBER_HEADROOM_FRACTION`: fraction of battery capacity to maintain as free headroom before Amber periods (default `0.25`); `AMBER_HEADROOM_TARGET_KWH` is derived as `BATTERY_KWH * AMBER_HEADROOM_FRACTION`. Set to `0.0` to disable Amber headroom
341
345
-`ENABLE_PRE_CHEAP_RATE_BATTERY_BRIDGE`: when enabled, Evening decisions avoid charge-oriented behavior before cheap-rate starts if battery can bridge the expected load
342
346
-`ESTIMATED_HOME_LOAD_KW`: average household load estimate used to calculate whether current battery energy can cover consumption until cheap-rate begins
343
347
-`BRIDGE_BATTERY_RESERVE_KWH`: safety buffer to keep in battery when evaluating bridge sufficiency
@@ -650,19 +654,27 @@ $$
650
654
651
655
The system exports to grid under these conditions.
652
656
653
-
#### Rule 1: Insufficient headroom before a Green period
657
+
#### Rule 1: Insufficient headroom before a Green or Amber period
654
658
655
-
The target free headroom is derived from hardware surplus capacity multiplied by a 3-hour reserve window:
659
+
The headroom target varies by forecast status:
660
+
661
+
| Forecast | Target | Setting |
662
+
|---|---|---|
663
+
| Green |`BATTERY_KWH × 0.5` (e.g. 12 kWh) |`HEADROOM_TARGET_KWH`|
This fixed target ensures the battery can absorb 3 hours of maximum surplus generation (3.4 kW) without clipping, independent of forecast quality or period.
673
+
The Amber target is a reduced fraction of the battery, reflecting that Amber days carry real but moderate solar risk — enough to warrant partial headroom, but not the full Green reserve. Setting `AMBER_HEADROOM_FRACTION = 0.0` disables Amber headroom entirely.
662
674
663
675
If:
664
676
$$
665
-
ext{headroom} < \text{headroom target}
677
+
\text{headroom} < \text{headroom target}
666
678
$$
667
679
668
680
then the system selects `GRID_EXPORT` to create battery space ahead of the solar period.
0 commit comments