BACKUP_PEAK_SHAVING
Combined mode: peak shaving in normal operation, switching to backup when the grid fails.
| Mode string | BACKUP_PEAK_SHAVING |
| Dispatcher | control_step_backup via mode_involves_backup (no dedicated elif branch) |
| Config block | functions.Backup_Peak_Shaving |
| Status | Composition stub — not fully implemented |
Purpose
Intended to run peak shaving while the grid is healthy and fall back to backup operation when the grid is lost.
What actually runs today
ems_main.py matches this mode with mode_involves_backup() and calls
control_logic_updated.control_step_backup before the dispatch chain. That is all that happens:
- ✅ The PQ ↔ VF grid-mode governor runs (subject to
functions.Backup.grid_mode_switch.enabled). - ❌ No peak-shaving power dispatch is performed for this mode — there is no
elif mode == "BACKUP_PEAK_SHAVING"branch, so it falls through to"[EMS] ... not implemented in ems_main.py yet". - ❌ The
peak_shaving_refindirection is never dereferenced.
Configuration
functions.Backup_Peak_Shaving
| Key | Live value | Meaning |
|---|---|---|
enabled |
false |
Documented master switch; not read by any code path. |
priority_rule |
backup_over_peak_shaving |
Documented precedence. |
peak_shaving_ref |
Peak_Shaving |
Names the config block to delegate peak shaving to. Not resolved. |
Safety
Effectively governed by functions.Backup.grid_mode_switch.enabled, which is false by default — so
selecting this mode currently produces no actuation at all.
TODO to complete this mode
- Add a dispatch branch that resolves
peak_shaving_refand runscontrol_step_peak_shavingwhile the grid is present. - Switch to the backup power behaviour on grid loss (itself unimplemented — see backup.md).
- Honour the
enabledflag andpriority_rule.
Blocker: the referenced block
peak_shaving_ref: "Peak_Shaving"is fine, but BACKUP_FREQUENCY_REGULATION points its own reference atPeak_Shavingas well, which looks like a copy-paste error.