PV Self-Consumption KNX Logic: Surplus Calculation and Multi-Load Priority Control
Maximising self-consumption ratio requires KNX logic that continuously monitors solar generation and grid import/export, then activates flexible loads in priority order when surplus is available. This guide covers the complete implementation — from input GA layout and surplus calculation to load priority tables, hysteresis, dynamic EV current control, and grid zero-injection for feed-in penalty avoidance.
Self-consumption objective and input requirements
The self-consumption ratio (SCR) is the fraction of PV generation consumed directly on-site rather than exported to the grid. A higher SCR means lower electricity bills when the feed-in tariff is below the retail import rate — which is the case in most European countries since 2022. KNX self-consumption logic improves SCR by automatically activating controllable loads when surplus solar power is available.
Two inputs are required for effective KNX self-consumption logic. PV generation power from the inverter via Modbus to KNX is optional — the grid power reading from a smart meter is sufficient by itself, as it directly shows the import/export balance. Using grid power as the primary input avoids calibration errors from inverter self-consumption.
Input GA layout for self-consumption logic
GA '6/0/1': PV Generation Power (W)
Source: inverter Modbus → KNX Modbus gateway
DPT: 9.001 (2-byte float, kW) or 13.010 (4-byte, W)
Update: every 10 seconds
Note: optional — grid power GA is sufficient for control
GA '6/0/2': Grid Power (W), signed
Source: Eastron SDM630 Modbus, or SOCOMEC Countis E14,
or inverter internal meter via Modbus
DPT: 9.001 (kW, signed: positive = import, negative = export)
Update: every 10 seconds
This is the PRIMARY control input
Surplus calculation:
When GA '6/0/2' < 0: abs(value) = export power = surplus
When GA '6/0/2' > 0: building is importing = no surplus
Smart meter options:
Eastron SDM630: Modbus TCP via RS485 converter
Register 53 (total import/export W, float32, FC4)
SOCOMEC Countis E14: Modbus TCP port 502
Register 0x0034 (active power signed, int32)
Huawei SUN2000 internal meter: register 32261 (grid power)Load priority table and activation thresholds
Controllable loads are activated in priority order as surplus increases. The priority table below represents a typical residential installation with a water heater, EV charger, and battery storage. Adjust thresholds for your specific load sizes and desired activation sequence.
| Priority | Load | Activate Threshold | KNX Action |
|---|---|---|---|
| 1 (lowest) | Water heater immersion 3 kW | 1500W surplus for 120s | GA '6/1/1' = ON (relay) |
| 2 | EV charger current boost | 250W additional per 1A above 6A base | GA '6/1/2' = current value (A) |
| 3 | Battery forced charge | Any surplus after P1+P2 saturated | GA '6/1/3' = ON (Modbus write) |
| 4 (highest) | Dishwasher or washing machine | 2000W surplus for 300s | GA '6/1/4' = ON (smart socket) |
Priority 1 activates first with the lowest surplus threshold — a 3 kW water heater immersion element provides excellent load absorption. EV charging at minimum 6A (1.38 kW single-phase) requires at least 1.5 kW surplus to start, then scales up current as surplus increases. Forced battery charge acts as a catch-all for remaining surplus after other loads are saturated.
KNX ETS6 logic implementation with MDT Logic Controller
The MDT Logic Controller SCN-LCRM.01 executes EibScript logic directly in the KNX device without a separate PC or server. For simpler installations, the Enertex EibPC is an alternative that runs EibScript in a dedicated Linux appliance. Both support arithmetic on KNX GA values, timers, and conditional group telegram sending.
MDT Logic Controller EibScript — self-consumption logic
// EibScript runs on MDT SCN-LCRM.01
// GA '6/0/2' = grid power (kW, signed float, DPT 9.001)
// Negative = export (surplus available)
ON CHANGE OF GA("6/0/2"):
grid_kw = READ GA("6/0/2")
surplus_w = grid_kw * -1000 // convert to positive W if exporting
// Priority 1: water heater (3 kW, threshold 1.5 kW surplus)
IF surplus_w > 1500 AND TIMER_ELAPSED("wh_timer", 120) THEN
SEND GA("6/1/1") = TRUE // water heater relay ON
TIMER_RESET("wh_timer")
ELSE IF surplus_w < 1000 AND TIMER_ELAPSED("wh_off", 60) THEN
SEND GA("6/1/1") = FALSE // deactivate with hysteresis
TIMER_RESET("wh_off")
END IF
// Priority 2: EV charger current
IF surplus_w > 1500 THEN
ev_amps = MAX(6, MIN(32, surplus_w / 230)) // single-phase
SEND GA("6/1/2") = ev_amps // DPT 5.010 unsigned byte (amps)
ELSE IF surplus_w < 1000 THEN
SEND GA("6/1/2") = 0 // stop EV chargerThree-phase EV charger current calculation
// Three-phase EV charger (e.g. Alfen Eve, ABB Terra AC)
// Three-phase power: P = V * I * sqrt(3) ≈ I * 690W per amp
ev_amps_3ph = MAX(6, MIN(32, surplus_w / 690))
SEND GA("6/1/2") = ev_amps_3ph
// GA '6/1/2' → KNX Modbus gateway write:
// Alfen Eve register 316: max charge current (A, uint16)
// EVBox Elvi register 111: current limit (A, uint16)
// Weinzierl 5010 write task: GA '6/1/2' triggers Modbus FC6
// Update every 30 seconds — smooth out cloud-induced fluctuations
// Single-phase minimum: 6A = 1.38 kW
// Three-phase minimum: 6A = 4.14 kW (higher surplus required)Hysteresis to prevent relay chatter
Without hysteresis, a KNX relay controlling a water heater or EV charger can switch on and off repeatedly within minutes as clouds cause solar generation to fluctuate around the activation threshold. This reduces relay lifespan and causes audible clicking in the distribution panel. Two-threshold hysteresis solves this problem.
Hysteresis implementation — activate and deactivate thresholds
Two-threshold hysteresis example (water heater):
Activate threshold: surplus > 1500W for 120 seconds
Deactivate threshold: surplus < 1000W for 60 seconds
This means:
- Load only activates if surplus stays above 1500W for 2 minutes
- Load only deactivates if surplus drops below 1000W for 60s
- 500W hysteresis band prevents rapid cycling
EibScript timer-based implementation:
// On each GA '6/0/2' update:
IF surplus_w > 1500 THEN
TIMER_START("wh_on_timer", 120) // 120s countdown
ELSE
TIMER_RESET("wh_on_timer") // reset if drops below threshold
END IF
IF TIMER_FIRED("wh_on_timer") THEN
SEND GA("6/1/1") = TRUE
END IF
// Mirror logic for deactivation with 1000W threshold and 60s timer
Real-world effect: a passing cloud lasting 90 seconds
does not cycle the water heater relay
Solar must be consistently low for 60s before deactivationGrid zero-injection control
In some countries — including Spain (since 2019 Royal Decree 244/2019 modification) and some Italian DSO areas — residential grid export is penalised, capped at zero, or requires a separate permit. KNX grid-zero logic immediately reduces flexible load power when export is detected, maintaining near-zero injection without wasting generated energy.
Grid zero injection — KNX logic
Grid zero mode: GA '6/2/0' = TRUE (enabled by time schedule
or manually from touchpanel)
ON CHANGE OF GA("6/0/2") WHEN READ GA("6/2/0") = TRUE:
grid_w = READ GA("6/0/2") * 1000 // convert kW to W
IF grid_w < -100 THEN // exporting > 100W
// Step 1: reduce EV charger current by 1A
ev_curr = READ GA("6/1/2")
IF ev_curr > 6 THEN
SEND GA("6/1/2") = ev_curr - 1
ELSE IF ev_curr <= 6 THEN
// Step 2: switch off water heater
SEND GA("6/1/1") = FALSE
END IF
ELSE IF grid_w > 200 THEN // importing — can increase
// Re-enable water heater if surplus appeared
SEND GA("6/1/1") = TRUE
// Increase EV charger current
ev_curr = READ GA("6/1/2")
IF ev_curr < 32 THEN
SEND GA("6/1/2") = ev_curr + 1
END IF
END IF
Response time: under 15 seconds (one Modbus poll cycle)
Suitable for compliance with zero-export regulationsCommissioning test procedure
Commissioning the self-consumption logic requires simulating PV surplus conditions without waiting for sunny weather. The inverter active power limit register allows the output to be throttled to zero in software, creating a controlled test environment.
Self-consumption logic commissioning test
Preparation:
Disconnect EV charger and water heater from load circuit
(or use test resistive loads that can tolerate cycling)
Simulate surplus — inverter active power limit:
Fronius GEN24: Modbus write reg 40233 = 0 (limit to 0W)
Activation: write reg 40236 = 1 (enable limit function)
SolarEdge: app → Advanced → Active Power Limit (installer only)
Huawei SUN2000: Modbus write reg 40119 = power limit %
With inverter output limited to 0W: building imports from grid
Grid power GA '6/0/2' shows positive value (import)
No surplus → loads should be OFF — verify GA '6/1/1' = OFF
Re-enable inverter output:
Fronius: write reg 40233 = 100 (100% = no limit)
Grid power GA '6/0/2' goes negative (export) = surplus
Verify load activation sequence:
At 1500W surplus for 120s: GA '6/1/1' should go TRUE
At 3000W surplus: GA '6/1/2' should show amps value
ETS6 Group Monitor confirms GA changes in real time
Re-enable inverter fully when test complete:
Write active power limit back to 100% or disable limit functionSelf-consumption ratio target
A well-configured KNX self-consumption system with water heater, EV charger, and battery storage typically achieves 70-85% SCR for a family home in Central Europe. Without flexible load control, SCR is typically 30-40% — the same hardware but without the KNX logic layer. Log GA '6/0/1' and '6/0/2' to InfluxDB for monthly SCR calculation.
EibPC as alternative to MDT
The Enertex EibPC runs the same EibScript language as the MDT Logic Controller but on a dedicated Linux appliance with network connectivity for InfluxDB logging and web dashboard. Preferred for installations requiring logging and visualisation alongside self-consumption control. Supports MQTT for inverter data without a separate Modbus gateway.
Need a solar panel with KNX self-consumption logic built to spec?
We design and build LV panels with MDT Logic Controller self-consumption programs, Modbus TCP gateways for grid meters and inverters, EV charger current control, and full commissioning documentation delivered tested to your site.
Request a quote →