How much "Useable" hot water do I have and how best to represent it?

Hi All,

I’m trying to think about how best to represent the amount of hot water I have in my tank and over time use that information to decide if I should adapt the settings I use for DHW. I’m using Home Assistant to collect and visualise the data. I was wondering if others on this forum had done something similar or had different approaches to this? I’m assuming this is better suited to a post here but could also post on the HA forums if people feel that would be a better place for this question.

My idea is to use the information on https://energy-stats.uk/hot-water-cylinder-sizing-and-mixing/ to calculate the amount of “useable hot water” available. To quote from the original blog post by @Zarch for ease of reference:

(MixTemp – ColdTemp) / (HotTemp – ColdTemp)
e.g. if ColdTemp = 10, HotTemp = 60, MixTemp = 41
(41 – 10) / (60 – 10) = 0.62 [i.e. 62%]
Finally cylinder size x 1.62
So 150L x 1.62 = 207L of usable water at mixed temp

I’ve created a template sensor in HA to calculate my “Useable Hot Water” (I used two number input templates to define the ColdTemp and MixTemp so I can change them if I can work out what the appropriate values are for my home, but for now I stuck with 10°C / 41°C). In my case I’ve got a 300L tank and I’ve just hardcoded that figure in the calc. I wasn’t sure which HotTemp would be best. I have a “Hot Water Top” (top of tank sensor) and “Hot Water Charging” (mid tank sensor) so I’ve conservatively used the “Hot Water Charging” value.

The calculation gives me a value in litres but I think the next step would be to convert this into a more “meaningful” unit for my family. I was thinking of creating an artificial “showers” unit and then (once I figure out the average flow rate - tips for this on the blog - and average length of time the showers in my home) I could convert the “Useable Hot Water” value into say “5 showers”. I’d understand this to mean I had enough water for 5 average length showers, which could also mean 3 “normal” showers and 1 of my wife’s “I’m washing my hair” showers. I’d show this on a gauge with RAG colours showing what we have left in the tank. In time I was also thinking of adding a button which when pressed would override the blocking schedule and top up the tank temperature. This would give us the ability to request extra water heating only when we need it (e.g. after an evening gym session) rather than on a predefined schedule.

Thanks in advance for any tips and guidance. I’ve been amazed at how active these forums are and how helpful and knowledgeable folks are on here!

Samir

2 Likes

I realised this isn’t quite right when my usable hot water was going up rather than down during the day without any heat being added. Believe the formula should be as follows. The IF condition is needed to make the useable water be zero if the hot water temp is below the mix temp.

`tank size + (tank size * [1 - (Mix – Cold) / (Hot – Cold)]) * IF(Hot >= Mix, 1, 0)

= 150 + (150 * (1 - [(41 - 10) / (60 - 10)])) * IF (60 >= 41, 1, 0)
= 150 + (150 * (1 - 0.62)) * 1
= 150 x 1.38
= 207
`

I think I also still need to determine which hot water temperature sensor to use. I think using the hot water charging temp might be too conservative.

Based on the following parameters:
Tank Size = 300L
Mix = 41°C
Cold = 10°C

And the following Hot water temps, I have two very different results:

Hot Water Top = 46.8°C ==> 347L of Useable Hot Water
Hot Water Charging = 17.5°C ==> 0L of Useable Hot Water

I’m guessing the “real” answer lies somewhere in between (or maybe towards the upper end of this). If I take an average of the two sensors (32.5°C) then I’d still calculate no useable hot water whilst I am pretty certain I can still get hot water if I turn on the shower right now. So the question is, what is the “Hot” temp to use in the calculation when I have a 300L tank where the top is at 46.8°C and the charging (I think this is in the middle) is at 17.5°C?

The temp of all the water inside the cylinder I have found to be a really tough problem to solve because of the stratification of different temps through the height of the cylinder.

On my cylinder I have three temp sensors:

Top: At the outlet (strapped to the pipe)
Middle: In the temp sensor pocket
Bottom: At the inlet (strapped to the pipe)

I heat water with immersion heater powered by solar PV. The immersion heater is a few inches above the Middle sensor.

Unless I run out of hot water completely (e.g. turned off when on holiday) Top sensor stays pretty stable at the set temp.

Bottom sensor stays pretty stable at the ambient temp, drops suddenly when new water is drawn into the cylinder.

Middle sensor is the one that responds to introduction of heat via immersion heater but still lags the temp at the immersion heater by hours. I know this because the immersion heater reaches its set temp and cuts out before the temp is reached at the middle sensor. The middle sensor temp will drop suddenly if enough how water is used so as to bring cold water up to the mid level.

If I come back from holiday and start with a cold cylinder, it takes 10 hours before the top sensor reaches set temp and we have hot water even though the immersion heater cut out after a few hours (as it reached its set temp at that level in the cylinder).

My conclusion is that the spread of heat around the cylinder takes a long time. I would expect that given enough time there is an even gradient from top to bottom but in a moving system with water coming in and out I don’t think temp sensors alone allow one to know exactly what blocks of what temps are in the cylinder and therefore how much heat energy is in the cylinder. There could for example be only a few litres of hot water at the top and a few litres of hot water around the immersion heater which hasn’t yet made it up to the top - the temp readings for that look the same as a completely hot cylinder.

If you manage to solve the challenge I would be very interested in the solution!

After a couple of days of googling I’ve come to this same conclusion. I didn’t think it would be this tricky but it seems the question is beyond the A-level physics I did many moons ago.

However, I don’t think I need a precise physics equation here, I think a basic heuristic which tells me how many “showers” remain if the tank sensor reports a given temperature would be sufficient. I suppose I could conduct an experiment where I have a full tank at a known temperature x°C and then stand under the shower for y minutes, but that does seem very wasteful and also won’t directly tell me how y varies as a function of x. I also naively assumed the manufacturers of these tanks would have some pretty graphs showing these curves but that doesn’t seem to be the case or at least isn’t publicly available.

Back to the drawing board…maybe learning about stratification would help if that would tell me how many litres of “top sensor temp” water there is in a 300L tank that would be more relevant to the “how many showers” conundrum!

Thanks for sharing your thoughts and findings.
I’ve just started adding some automation to our HWC: 350litre, twin 3kW element (top one about 30% from top, bottom at about 30% from bottom), sensor pocket tube near top (outlet), sensor pocket tube near bottom (inlet), solar hw loop at bottom and around 25% of the way up. We have a iammeter wifi power controller attached to the top element so this can be throttled, the bottom element is controlled via a relay/contactor.
I have installed 5x DS18B20 sensors and a Shelly Plus Uni, so now can read the approx temps from bottom to top. I used the two existing sensor pocket tubes, then drilled through the outer metal casing to attach the other 3 sensors - removing the PU foam- and glued the sensors to the inner stainless pressure tank.
We’re in winter currently so the amount of solar heating is relatively low. My use case is how much overnight electrical heating do I need to supply so we have sufficient hot water for intended activities. Currently the automation is done by me :slight_smile: so I’m looking to write a rule in openHAB to figure out the current temp at the top 3 sensors to give capacity, look at the solar forecast for the next day and then either heat the top to around 50 degrees if a good solar day is forecast or run it up to 65 degrees if the next day is cloudy. With a weekly cycle to control legionella etc.
My first hurdle is the integration of the Shelly into openHAB seems out of date, so I need to switch to a generic MQTT control.

Thanks for taking the time to respond @fastbike. Your use case sounds very closely linked to mine (I think I just phrased mine as the inverse). If you can determine the temperature you need to achieve to have sufficient water and use that in automations that would be brilliant. I’m not sure my Nibe heat pump would be easy to automate in the same way you describe, hence I was initially just looking to get an approximation for “what’s left in the tank” so I could manually top up, but your idea would be one step further down the path. Would love to hear how you get on!

Thanks,
Samir

1 Like

Hi Samir,

I agree. In general, this is a difficult problem to solve - because there are so many variables - but you don’t need to cater for all the variables because you only need to model your specific installation. It sounds like you also have a reasonable degree of consistency in how your water gets consumed (e.g. in terms of shower temperature and duration).

A few thoughts from me:

  1. There will be convection within the DHW tank while it’s actively being heated, which will tend to mix all the water above the bottom of the heating coil / element.

    • At the point the heat pump stops heating (because the ‘hot water charging’ sensor in (roughly) the middle of the tank says it’s reached the target temperature) you should have a consistent volume of stored hot water every time - though it won’t be the full 300 litres.
    • Stratification then takes over while the tank isn’t being heated, as cold water fills from the bottom to replace the hot water drawn off from the top
  2. Would adding a ‘hot water meter’ help, so you know how much hot water has been used since the DHW tank was last heated up - rather than trying to infer that from a couple of temperature sensors?

    • I have sub-meters for the incoming cold mains water and the cold fill into the DHW tank, which are read by the same M-Bus (Meter-Bus) reader that handles my Heat Meter - with the readings going into Home Assistant
    • One thing those tell me is that hot water consumption is lower in Summer than in Winter - because the incoming cold mains water is warmer in Summer, so it needs mixing with less hot water for a given showering temperature
  3. Did your searching turn up this PDF document from the Home Energy Model folks Modelling hot water storage tanks within the Home Energy Model ? They have their corresponding Python code published in a Git repo at: water_heat_demand

    • From a quick look, they’re not trying to a full theoretical engineering / physics representation of the problem, so their approach looks a bit less daunting than some other research papers

David

Hi David

This is a reasonable assumption (although to be honest I have no idea what the shower temperature is so I should probably get around to checking that to lock down this parameter).

I was going to say I probably don’t need to worry about the short periods when the tank is actually being heated but upon rereading your response I see what you are getting at. This should give me a “known starting point” every time (for a given ‘hot water charging temp’).

Ok so this is where my previously described method unravels because when someone actually takes a shower the ‘hot water charging’ temp can drop significantly even though due to stratification I’ve actually got some usable water left. Is there some way to approximate:

  1. number and temperature of each layer (can we simply assume there are three - top (temp from top sensor) middle (temp from charging) and bottom (temp from mains inlet)?
  2. volume of water in each layer (does the position of the sensor give us a way to estimate if we also have the tank diameter, given it’s cylindrical)

Quite probably, but I was hoping not to have to retrofit anything if that can be avoided.

No I hadn’t but this looks like a great resource. Thank you. I’ll spend some time reading through this and report back. I’m sure this will be useful to others even if it’s just a rough estimate of “showers left” using some basic parameters and a simplified model.

Thanks
Samir

I’ve had a quick flick through and this looks like its exactly what I’m looking for and it answers some of the questions I’ve posed above. I’ll need a bit more time to digest it fully and then to think about how best to implement it but I feel like this is a good rabbit hole to go down! Thanks again @dMb, what were your search terms to dig this up? Or did you already know roughly where to look?

I’m pleased to hear that Home Energy Model report (and its associated code base) looks like it might be promising.

Looking at my browser history, that result came back from a Google search for “hot water tank stratification model”. I expected to find the more theoretical university research papers but the GOV.UK link caught my eye because some other GOV.UK papers have proved to be useful, easy-to-read summaries of heatpump-related research.

A couple of minor observations on the HEM model that @dMb references:

  1. The model appears to assume that water heating is permanently enabled, i.e. once the water temperature at the relevant sensor falls below setpoint (due to demand or heat loss), the water will be reheated immediately. Not all users choose to operate in this way - some (like me :upside_down_face:) only heat DHW prior to anticipated demand, and leave the tank unheated for the rest of the time (we schedule the main demands - showers and washing machine - such as to minimise water heating frequency).
  2. The model appears to neglect the effects of the tank wall (the energy required to heat it, and the conduction between water layers that it facilitates - convection isn’t the only heat transfer mechanism).

That said, anything that helps simplify the calculations for what is a very complex process has to be useful.

1 Like

You won’t be able to determine anything meaningful with only 2 or 3 sensors on your hot water tank. All you’ll know is the stratification is somewhere between your sensors.

This is an HA forum post that discusses 6 sensors and how to calculate the amount of usable hot water in the tank.

I myself use 8 sensors on my tank and this produces temperature graphs as shown -

The sensors are DS18B20 sensors connected to an ESPHOME device I built.

I use the following yaml template sensor in HA to calculate the remaining available hot water. This is based on code found on the post I referred to.

  - sensor:
    - name: "Main Tank Hot Water Remaining"
      unique_id: "main_tank_hot_water_remaining"
      unit_of_measurement: "l"
#      availability: "{{is_state('sensor.esp_main_airing_cupboard_1_temperature')}}"
      state: "
      {%- set traw = [
                float(states('sensor.esp_main_airing_cupboard_1_temperature'),20.0), 
                float(states('sensor.esp_main_airing_cupboard_3_temperature'),20.0), 
                float(states('sensor.esp_main_airing_cupboard_4_temperature'),20.0), 
                float(states('sensor.esp_main_airing_cupboard_5_temperature'),20.0), 
                float(states('sensor.esp_main_airing_cupboard_6_temperature'),20.0), 
                float(states('sensor.esp_main_airing_cupboard_7_temperature'),20.0),        
                float(states('sensor.esp_main_airing_cupboard_8_temperature'),20.0), 
                float(states('sensor.esp_main_airing_cupboard_9_temperature'),20.0)
                ] -%}
      {%- set vlist = [
                12.37, 
                23.84, 
                23.84, 
                23.84, 
                23.84, 
                23.84, 
                12.37
                ] -%}
        {#
        Ref: https://community.home-assistant.io/t/six-temperature-sensors-on-a-hot-tank/453661/11
        tt    = Target Temperature
        tc    = Temperature of cold water feed
        traw  = Actual tank temperature measurements
        vlist = Volume list of tank sections
        tlist = Average temperature in that tank section
        vt    = Virtual tank in litres of target temp water
        #} 
               {%- set tt = float(states('input_number.desired_tank_temperature'),40.0) -%}
                {%- set tc = float(states('sensor.esp_main_airing_cupboard_10_temperature'),20.0) -%}
                {%- set tlist = [
                (traw[0]+traw[1])/2, 
                (traw[1]+traw[2])/2, 
                (traw[2]+traw[3])/2, 
                (traw[3]+traw[4])/2, 
                (traw[4]+traw[5])/2, 
                (traw[5]+traw[6])/2,
                (traw[6]+traw[7])/2] -%}

        {% set ns = namespace(vt=0, centigrade=tt) %}

        {%- for i in range(0, tlist | count ) -%}
          {%- if tlist[i] > tt -%}
            {%- set v=(tlist[i]*vlist[i]-tt*vlist[i])/(tt-tc) + vlist[i] -%}
            {%- set ns.vt=(ns.vt+v) | round(1) -%}
          {%- endif -%}
        {%- endfor %}
        
        {% if ns.vt == 0 %}
          {%- for tt in range(tt | int, 30, -1) if ns.vt==0 -%}
            {%- for i in range(0, tlist | count ) -%}
              {%- if tlist[i] > tt -%}
                {%- set v=(tlist[i]*vlist[i]-tt*vlist[i])/(tt-tc) + vlist[i] -%}
                {%- set ns.vt=(ns.vt+v) -%}
                {%- set ns.centigrade=tt if ns.vt != '0' %}
              {%- endif -%}
            {%- endfor %}
          {%- endfor -%}
        {% endif %}

        {{ ns.vt | round(1) }}"
      attributes:
          target_temp: "{{ float(states('input_number.desired_tank_temperature'),40.0) }}"

~Brian

1 Like

Thanks @beaj - this is exactly what I was looking for and the HA thread looks an interesting read. Having said that, it sounds like the only way to achieve it is to install additional sensors (if that involves drilling holes into the outer skin of the tank that’s probably already well past my comfort zone!)

If extra sensors is the only way to accurately determine the useable water its a shame the manufacturers haven’t included the necessary sensors in the first place.

I don’t think you mentioned what type of tank you have. If its a foam insulated vented tank it’s not too difficult to attach the sensors.

I used a garden parasol where the pole was split into 2 and screwed together. The bottom half makes an ideal ‘cookie cutter’ to cut the ~1" of insulated foam so the sensors can be pressed against the tank at an angle.

The more sensors you attached the greater the resolution you’ll achieve on calculating the amount of hot water. Mine is split into ~12 litre top of tank dome and 6 22 litre cylindrical sections and a botton 12 litre dome.

Ok, now I see what you mean and it sounds more doable in your scenario. Looks like you’ve done a superb job of it too, well done! Mine is a 300L NIBE metal cylinder (believe it’s called a ‘megacoil’). I’d not want to ruin any warranty and quite honestly wouldn’t trust myself to do it even if I did have the appropriate tools!

Yeah, I would maybe have not been so willing to mod my hot water tank if I’d bought a posh one like that. :grinning_face_with_smiling_eyes:

I have a 150L cylinder with 3 heating means, a bottom mounted solar coil with a PT1000 temp probe in pocket immediately above this, at a “20L level”, a (oil fired) heating coil above with another PT1000 probe at a “72L level” ( ~ 30% above the coil outlet) and a top mounted electric immersion that heats 30L with another probe immediately just below the cylinder top.

If I start off with a stone cold cylinder with the 3 probes reading exactly the same and use the solar heating only then the temperature rise in all 3 probes is exactly the same.
If I again start off with a cold cylinder I have tested with the top 30L heated and indicating 65C, (immersion off), the oil fired coil having heating until the middle probe reaches 50C and then the bottom 20L probe reading say 15C (mains temp)
and then start heating the whole cylinder with solar only then I find that the middle probe stays almost exactly at 50C until the 20L probe also reads 50C, (top probe remains at exactly 65C), both temperatures will then start rising at exactly the same rate until they reach 65C, at which point all 3 start rising uniformly up to ~ 80C, the max temp my solar flat plate panels can achieve, ( I have a TMV set to 60C on the cyl HW outlet). Hot water obviously rises but it only heats the layers above it until they all reach the same temperature as the next highest one, then “both” rise together until the next level.
There is also a sensor pocket just below (~ “5L”) the bottom of the immersion element, if I just heat the top 30L with the immersion then this resistance temperature measured temp will take a very long time to even start indicating a temperature rise.