# Virtual hydraulic balancing

> How Better Thermostat's 0–100 % valve-opening algorithms and Valve Max Opening cap distribute heat evenly across rooms—and how they differ from mechanical radiator balancing.

Source: https://better-thermostat.org/deep-explanations/hydraulic-balance/

In heating engineering, **mechanical hydraulic balancing** means a plumber sets a presetting dial inside each radiator's valve body so rooms closest to the boiler pump cannot steal all the hot water from distant bedrooms.

Better Thermostat adds a complementary **software-driven virtual balancing layer** in all **5 valve-computing algorithms**:

- **`(AI) Time Based (Default)`**
- **`TPI Controller`**
- **`(AI) MPC v2 (QP + Kalman, experimental)`**
- **`PID Controller`**
- **`MPC Predictive (Beta)`**

*(The remaining 3 modes—`Aggressive`, `External Sensor Offset Only`, and `No Calibration`—do not compute a `0–100 %` valve opening.)*

---

## How `0–100 %` demand reaches your radiator

Every control cycle, the active algorithm computes a desired valve opening between **`0 %` (closed)** and **`100 %` (full flow)** for each room based on how far the room is from target and how fast it warms or loses heat.

Better Thermostat then applies that percentage through your TRV's configured **[`Calibration type`](https://better-thermostat.org/calibration_algorithms/)**:

1. **`Direct Valve Based` *(True motor positioning)*:**
   - Scales the requested `0–100 %` opening onto each valve entity's own `min`, `max`, and `step` attributes (so the written position may be quantized to the entity's supported increments; on Sonoff `TRVZB` where a closing-degree entity exists, it sets closing degree to `100 − opening` as well).
   - **Capping an oversized radiator (`Valve Max Opening`):** Every direct-valve TRV gets its own `number.<trv>_valve_max_opening` slider (default `100 %`). Lowering a fast guest-bathroom radiator to **`60 %`** restricts its peak water flow so slower rooms down the hall receive hot water faster and the small room stops overshooting!
   - **Per-TRV cold-corner boost in multi-radiator rooms (`Split the valve opening by each TRV's own temperature`):** When a single room has two or more TRVs running `MPC Predictive` or `MPC v2` and you enable **`Split the valve opening by each TRV's own temperature`** on Screen 1 ([All settings reference](https://better-thermostat.org/configuration/#first-step)), any eligible TRV whose own radiator sensor reads colder than the warmest TRV in the room receives an extra **`+8 %` per `°C`** (`4.4 %` per `°F`) of valve opening (still capped by its individual `Valve Max Opening`).
2. **`Offset Based` & `Target Temperature Based` *(Mapped proportional setpoint)*:**
   - Even when a TRV has no direct valve entity, Better Thermostat maps `0–100 %` (for `TPI`, `PID`, and the MPC modes, and for `(AI) Time Based` on `Target Temperature Based`) between the **TRV's current internal reading (`0 %` = close valve)** and the **TRV's maximum setpoint (`100 %` = open wide)**, then rounds the resulting offset or setpoint onto the device's supported step grid.
   - Example: If the TRV currently reads `23.0 °C` and its maximum setpoint is `30.0 °C`, a **`50 %` demand** places the effective TRV target midway (~`26.5 °C`, rounded to the TRV's supported step) rather than slamming it to `30.0 °C`; the TRV's own controller then decides how far its valve actually opens.
   - `(AI) Time Based` on `Offset Based` does not use this mapping. It computes the new offset with its legacy formula instead: the current offset minus `(TRV minimum local calibration + TRV reading) × valve fraction`.

---

## What virtual balancing solves—and where mechanical balancing still matters

| What virtual balancing helps with | Where mechanical lockshield/presetting still matters |
|---|---|
| Throttles fast rooms down early as they approach `21.0 °C`, freeing pump pressure for slower rooms still at `19.5 °C`. | Cannot fix shrill water-flow whistling caused by excessive pump differential pressure across a tiny valve gap. |
| Lets you fine-tune an overpowered radiator from the sofa via `Valve Max Opening` (`Direct Valve Based`). | On cold mornings when *every* room demands `100 %` simultaneously, mechanical valve presetting still governs initial water split. |
| Reduces room overshoot and boiler return-water temperatures (helping condensing boilers & heat pumps run efficiently). | Relies on well-placed room sensors and responsive TRV integrations ([Recommended settings](https://better-thermostat.org/optimal-settings/recommended-settings/)). |
