Understanding TRV Control Algorithms: A Comprehensive Guide

Background

The Aqara W600 TRV is currently under active development, with the team working to improve temperature control performance. Many users have reported issues such as temperature overshoot, oscillations, and difficulty maintaining stable setpoint temperatures. These discussions have highlighted the critical importance of the control algorithm and its tuning.

This post aims to provide technical background on the different control approaches used in TRVs, explaining why certain behaviors occur and what trade-offs exist between different controller types. Understanding these fundamentals can help users interpret their TRV’s behavior and contribute more effectively to discussions about firmware improvements.


Smart thermostatic radiator valves (TRVs) are sophisticated devices that regulate room temperature by controlling the flow of hot water through radiators. The quality of temperature control depends heavily on the control algorithm used. This post explains the main approaches—from simple bang-bang control to advanced PI control—and discusses their respective advantages and limitations.

Understanding these control strategies can help explain why TRVs behave the way they do, and why some provide better temperature stability than others.

Controller Basics: The Control Loop

All TRV control algorithms operate on the same fundamental principle: the feedback control loop.

This closed-loop system continuously measures temperature and adjusts valve position to minimize the difference between the desired setpoint and actual room temperature.

Basic Control Loop Components

  • Setpoint (theta_set): The desired room temperature selected by the user
  • Measured Temperature (theta_measured): The current room temperature from the sensor
  • Error (e): The difference between setpoint and measured temperature (e = theta_set - theta_measured)
  • Controller: The algorithm that calculates the required valve position based on the error
  • Actuator: The motor that physically opens or closes the valve
  • Plant: The physical heating system (radiator + room) that responds to valve changes

The controller’s job is to determine the optimal valve position at each moment to bring the room temperature to the setpoint as quickly and smoothly as possible, while maintaining that temperature without oscillations or overshoot.

Bang-Bang Controller (On-Off Control)

The bang-bang controller is the simplest control strategy: the valve is either fully open or fully closed, with no intermediate positions.

How It Works

The controller uses a threshold (hysteresis band) to prevent rapid switching:

  • If temperature drops below (theta_set - threshold): Valve opens completely
  • If temperature reaches theta_set: Valve closes completely

Example: For a setpoint of 22°C with a 2K threshold:

  • At 19.5°C (below 20°C): Valve fully opens
  • At 22°C: Valve closes
  • Temperature then drifts between 20°C and 24°C due to thermal inertia

Advantages

  • Extremely simple to implement - minimal computational requirements
  • Very low battery consumption (infrequent valve movements)
  • Robust and reliable - no complex tuning required
  • Works well for slow-responding systems with high thermal inertia

Disadvantages

  • Temperature oscillations: Room temperature swings significantly above and below setpoint
  • Overshoot: Radiator continues releasing heat after valve closes, causing temperature to exceed setpoint
  • Large hysteresis band required to prevent frequent switching (up to 2-3°C), reducing comfort
  • No proportional response: Cannot adapt to partial heating needs or changing conditions
  • Inefficient energy use due to overheating cycles

Bottom line: Bang-bang control is acceptable for applications where some temperature variation is tolerable, but provides poor comfort compared to proportional control methods. You’ll typically find this approach in very simple, low-cost thermostats.

Proportional (P) Controller

The proportional controller represents a significant improvement over bang-bang control. Instead of binary on/off operation, the valve position is continuously adjusted in proportion to the temperature error.

How It Works

The control equation is straightforward:

u = K_P × e

Where:

  • u: valve position (0 = closed, 1 = fully open)
  • K_P: proportional gain (determines how aggressively the system responds)
  • e = (theta_set - theta_measured): temperature error in °C

Example with K_P = 0.5:

  • Error = 2°C below setpoint → valve opens 100% (2 × 0.5 = 1.0, saturated at maximum)
  • Error = 1°C below setpoint → valve opens 50%
  • Error = 0.5°C below setpoint → valve opens 25%
  • At setpoint (error = 0) → valve closes completely

The key insight is that as temperature approaches the setpoint, the valve gradually closes, preventing overshoot. This “anticipatory” behavior is fundamentally different from bang-bang control.

Advantages

  • Smooth, gradual control: Eliminates the temperature oscillations characteristic of bang-bang control
  • No overshoot: Valve begins closing before setpoint is reached, preventing temperature from exceeding target
  • Stable steady-state behavior: Temperature settles to a consistent value with minimal fluctuation
  • Simple to tune: Only one parameter (K_P) needs adjustment
  • Predictable behavior: Response is proportional and easy to understand

Disadvantages

  • Steady-state offset: Cannot achieve zero error - room will typically settle 0.5-1°C below setpoint

The steady-state offset occurs because at equilibrium, the heating power must exactly balance heat loss to the environment. Since P control only provides heating proportional to error, a small persistent error is required to maintain the necessary valve opening.

Example: Room settles at 21°C when setpoint is 22°C. With K_P = 0.5, the 1°C error produces u = 0.5 (50% valve opening), which provides just enough heat to balance the room’s heat loss at 21°C.

Bottom line: P control offers excellent stability and smooth operation with minimal complexity. The small steady-state offset is often acceptable for comfort heating applications and is far preferable to the temperature swings of bang-bang control. Many users find the predictable, stable behavior more comfortable than perfect setpoint accuracy with occasional overshoot.

Proportional-Integral (PI) Controller

The PI controller adds an integral term to proportional control, eliminating the steady-state offset while maintaining smooth control. This is the most sophisticated controller type commonly used in modern smart TRVs.

How It Works

The PI control equation combines two terms:

u = K_P × e + K_I × ∫e dt

Where:

  • e = (theta_set - theta_measured) = current temperature error
  • K_P = proportional gain (provides immediate response to error)
  • K_I = integral gain (eliminates steady-state error by accumulating past errors)

The proportional term K_P × e provides immediate response based on current error, while the integral term K_I × ∫e dt accumulates error over time. If a small steady-state error persists, the integral grows until it provides enough additional valve opening to eliminate the error completely.

Advantages

  • Zero steady-state error: Room temperature converges exactly to the setpoint
  • Smooth control: When properly tuned, provides gradual, stable temperature regulation
  • Better load rejection: Integral action helps compensate for changing conditions (outdoor temperature, sun, occupancy)
  • Optimal for applications requiring precise temperature control

Disadvantages

  • More complex to tune: Requires finding appropriate values for both K_P and K_I
  • Can oscillate if parameters are too aggressive
  • Higher computational requirements than P control
  • Vulnerable to integral windup (see next section)

The Critical Problem: Integral Windup

Integral windup is the most significant challenge with PI control and can cause severe performance degradation if not properly addressed. It occurs when the actuator (valve) reaches saturation limits while the integral term continues accumulating error.

What Is Integral Windup?

Consider a cold start scenario: Room is at 5°C, setpoint is 24°C.

  • Initial error: 19°C (very large)
  • Controller immediately opens valve to 100% (saturated at maximum)
  • Integral term continues growing: Even though valve can’t open further, the integral keeps accumulating the large error
  • Room heats up: After several minutes, temperature reaches 23°C
  • Problem: The integral term has accumulated to a huge value during saturation
  • Result: Even though error is now small (1°C), the massive integral keeps valve fully open
  • Consequence: Room temperature overshoots significantly to 31-32°C before valve finally begins to close

This is why some users experience their TRVs “shooting past” the setpoint temperature during heating from cold, especially on very cold days when the initial temperature error is large.

Why Aggressive Parameters Make It Worse

When K_I is too large (aggressive integral action), the windup problem becomes severe:

  • Faster accumulation: The integral term grows rapidly during saturation
  • Larger overshoot: More accumulated integral = longer period with valve stuck open
  • Oscillations: After overshooting, the integral must “unwind” through negative errors, causing the system to oscillate
  • Long settling time: Multiple oscillations before system stabilizes

Users might notice this as the room temperature “hunting” around the setpoint - going too high, then too low, then too high again - before finally settling down after 30-60 minutes.

Anti-Windup Protection: Essential for Good PI Control

To prevent integral windup, well-designed PI controllers implement anti-windup protection. The most common method is conditional integration (clamping):

  • Monitor actuator saturation: Detect when valve is at 0% or 100%
  • Stop integration when saturated: If valve is fully open and error is positive (would make saturation worse), stop adding to the integral
  • Resume integration when unsaturated: Once valve moves away from limits, normal integration continues

This protection mechanism prevents the integral from growing to unreasonable values during saturation, dramatically reducing overshoot and improving control quality.

What this means for users: If your TRV overshoots significantly or oscillates after setpoint changes, it may be using PI control without proper anti-windup protection, or the parameters may be tuned too aggressively. Firmware updates can improve control algorithm behavior significantly.

Comparison: What You Might Experience

Bang-Bang Control

What you’ll notice: Temperature varies noticeably (±1-2°C), especially when radiator first turns on. You might hear the valve clicking fully open and closed. Room feels alternately slightly cool and slightly warm.

Best for: Basic comfort needs where small temperature variations don’t matter.

Proportional (P) Control

What you’ll notice: Very stable temperature with minimal variation. Room might settle about 0.5-1°C below your setpoint (e.g., 21°C when you set 22°C), but stays there consistently. No overshoot, no oscillations.

Best for: Users who prioritize stability and predictability over hitting the exact setpoint. The small offset is usually imperceptible in terms of comfort.

Proportional-Integral (PI) Control

What you’ll notice:

  • When well-tuned: Room reaches exactly the setpoint and stays there. Best of both worlds.
  • When poorly tuned: May overshoot (28°C when you want 22°C), oscillate around setpoint, or take a very long time to settle. Cold starts can be particularly problematic.

Best for: Users who want precise temperature control and have a TRV with well-implemented PI control including anti-windup protection.

Conclusion

The choice of control algorithm significantly impacts TRV performance and user experience:

  • Bang-bang control is the simplest but provides the least comfortable experience with noticeable temperature swings
  • P control provides excellent stability and comfort with minimal complexity, trading a small steady-state offset for predictable, oscillation-free operation
  • PI control can provide the best performance when properly implemented, but requires careful tuning and anti-windup protection to avoid overshoot and oscillations

If you’re experiencing temperature control issues with your TRV (overshoot, oscillations, slow response), understanding these control concepts can help you identify whether the issue is fundamental to the control algorithm being used, or whether it might be addressable through better tuning or firmware updates.

Explore the Simulations Yourself

If you’d like to experiment with these control algorithms and see how different parameters affect performance, I’ve uploaded the complete Simulink simulation files to GitHub. You can modify controller gains, test different scenarios (cold starts, setpoint changes, disturbances), and visualize the results yourself. This is a great way to develop intuition for how these controllers behave and why proper tuning is so important.

Feel free to play around with the simulations and share your findings!


Questions, comments, and feedback are welcome!

4 Likes

This takes me back to university days (if my lecture notes were generated by chatgippitty). But why is this relevant to the forum? It’s just kind of AI slop, no?

Very usefull and comprehensive Thanks

It’s what I was asked to do here: 🛑 Regulation Problem: New Aqara Radiator Thermostat W600 – Unstable Heating (ON/OFF) - #17 by gafich10

I admit that the text was mostly written by AI (Claude not ChatGPT :wink:), but the simulation model and graphics are my own work. If there is a policy not to use AI on the forum, I’ll rewrite the post, of course.

My goal was to provide an overview of existing solutions, without pointing people to lecture notes or books, which would be far to detailed in most cases. AI is very helpful here for two reasons:

  1. The current LLMs are excellent in presenting existing information in a readable manner.
  2. English is not my mother tongue and AI makes it a lot easier for me to write about technical topics like this.

I double checked all of the information provided to my best knowledge. If you find any mistake, please let me know and I’ll be happy to fix it.

Hello, @Solmath thank you for the open topic, I could not reply promptly. I think based on this data we will begin to analyze the work of W600 at the physical level of problems. Together with you, W600 users, we will try to thoroughly convey to the manufacturers of Aqara the problems that arise with us.

Hello, @nzjrs, glad to hear from you.
You are our main antagonist of the forum, and therefore every opposition (your post) causes the opposite effect in Aqara specialists, to eliminate or improve according to your remarks. I appreciate your position and say, your remarks are eliminated as a PID regulator regulates temperature, this improvement (of your proposals) takes place with an integral algorithm, not always understandable but with the ultimate goal of improving Aqara products.
I am writing to you as a former university student, and thank you again, and I ask that we work constructively for the benefit of Aqara.

Hi, @Tech-savvy, if you can tell me what algorithm the W600 is controlled by. We want to clarify in this topic possible problems and methods for eliminating them when using the W600. I want to involve as many W600 users as possible in this topic with their problems in maintaining the temperature in the room.
Thank you.

1 Like

It’s not our job to fix the poor regulation of the W600. I guarantee that Aqara has qualified electrical/control systems engineers and PID and similar algorithms are not challenging.

Aqara can go two ways in my opinion, they can make better products (they fix the W600) or they can make more extensible products in the Aqara ecosystem by exposing much more internal state and control options for their products.

For example, I have requested that they expose a way to set the valves to a percentage open. If they do this, we could (in home assistant) make our own true continuous controller, pick your algorithm.

But again, they have not done that. I want to be able to do that in native aqara application, I write enough software for my jobs and I’m not interested in wasting time with home assistant etc. I find automation 2.0 very disappointing.

Maybe their new automation solution will be better and all it takes is for me to buy another hub.

1 Like

And if I had to predict, from one control engineer to another, I would bet that the control loop is not the problem in the W600. Or rather, there are probably tradeoffs in the device that are different to the E1 and this broke their algorithm. I expect there is a some predictive control going on concerning when to wake up the device and sample and adjust. There’s probably also some inferred model of valve openness or flow vs turns that it has to learn. Maybe the motor feedback is worse this version so they can’t learn that model, maybe the temperature sensor is worse and they don’t have a local correction for it. Who knows, but however interesting learning about PID is, it’s not really going to help them fix the W600.

1 Like

I agree.

Interesting idea, but wouldn’t that defeat the purpose of a TRV to some degree? A “dumb” actuator valve would be sufficient.

I understood from another thread that they are using a whole new algorithm and I appreciate their effort to improve existing solutions. However, I’m a bit disappointed that they released the W600 in its current state.

I also agree, that the control loop will not be the only problem, but it’s certainly one of the points that need to be improved.

About the other points you mentioned:

That would totally make sense with respect to energy efficiency. The controller in my Simulink model works well up to a sample time of 120s without adjustments. I guess the sample time could even be increased dynamically, if we are close to the set temperature and the valve position is small.

Another approach to conserve energy could be to only actuate the valve if the relative movement is above a certain threshold.

Valve openness vs turns should be clear after calibration. Not sure whether the device is aware of the actual flow through the valve. tado° has just released Hydronic Balancing as a new feature. I don’t know if Aqara TRVs offer a similar functionality.

1 Like

That’s interesting to hear that Tado explicitly has a hydronic balancing feature. I had an argument with an aqara engineer on here when I requested to have the ability to control valve open by percentages for similar reasons - but he never got my point and was fixated on hydronic balancing per se.

Basically my point was that if one has an under powered heating system, and one sets TRVs to unachievable target temperatures, their individual control systems all fight with one another and cooler rooms take all heat away from other rooms rather than having a proportional distribution of heat throughout the house. I basically just time-multiplex my TRVs (bang bang full off or full on) across my rooms to achieve they hydronic balance I need.

1 Like

Hello, I also work according to your principle. Although I can say that after the new firmware W600 started working stably (I tested in a non-critical room). The disadvantage of the work is in the range of 1°C, I think this is normal in centralized heating systems (where hot water constantly circulates), the temperature is maintained around +/- the set temperature (the radiator is half heated).

1 Like