Maximum Demand Electrical Exclusive Page
// POST /api/max_demand/config
For kVA demand (common for utilities), measure voltage and current, then:
# Store in circular buffer self.buffer[self.index] = delta_kwh self.index = (self.index + 1) % self.num_blocks maximum demand electrical
# Calculate total kWh in complete window total_kwh = sum(self.buffer) demand_kw = total_kwh / (self.window_size / 60.0)
| Priority | Load Type | Action at demand > limit | |----------|-----------|--------------------------| | 1 (low) | Water heater | Shed first | | 2 | HVAC – stage 2 | Shed second | | 3 (high) | Lighting, critical | Never shed | | Signal | Source | Use | |--------|--------|-----| | Energy pulses (kWh) | Utility meter / CT + energy IC | Calculate delta per sub‑interval | | Voltage, Current | Power quality meter | Compute kVA if PF varies | | Relay outputs | PLC / MCU | Load shedding control | | Real‑time clock | RTC / NTP | Timestamp peaks | // POST /api/max_demand/config For kVA demand (common for
Demand = (kWh_last_15min) / 0.25 To avoid storing raw energy every second, break window into N sub‑intervals.
"limit_kw": 160.0, "warning_threshold_pct": 85, "window_minutes": 15, "auto_reset_peak_on": "monthly" measure voltage and current
Demand (kW) = (Energy consumed over window T) / (T in hours) Example for 15‑min window (0.25 hours):