Measuring heat flux in and out of a hot water cylinder

The heat input into a solar hot water cylinder is usually measured using a flow meter and two temperature sensors. Flow meters are quite expensive and require plumbing work to install. At OpenEnergyMonitor we're all for non-invasive monitoring methods! So..

Can the heat flux in and out of a hot water cylinder (a fixed volume of water) be approximately calculated by measuring the average temperature change in the cylinder in kelvin per second and then multiplying by the volume of the cylinder and the specific heat of water?

This method may only require two temperature sensors so will be considerably easier and more affordable than installing a flow meter.

I've used an emonTx with two DS18B20 temperature sensors one positioned in the temperature sensor sleeve that is in the bottom half of the cylinder and the other positioned in the temperature sensor sleeve in the top half of the cylinder. The emontx is also monitoring the solar hot water collector temperature, controlling the solar hot water system and monitoring house electric consumption and solar pv electricity generation :)

Calculating heat flux
Heat Flux (Watts J/s) = Specific heat of Water (4186 J/kg/K) x Volume of cylinder (Litres) 
x temperature change per second (K/s)
The result
The heat flux is the blue plot and average cylinder temperature is the red plot. I have selected a period of time where the electric immersion heater is on. Feel free to explore the data by using the zoom and pan buttons.

I'm surprised by how good the initial results seem to be. I know that the electric immersion heater consumes about 3400W from my electricity monitoring and the heat flow input calculated via the above method gives pretty much the same power input plus or minus a few hundred watts or so.

Questions for further development
What is the minimum number of temperature sensors needed and what are their optimum positions to give best results? What is the effect of stratification?

Download the source code: hotwatercylinder.zip

To engage in discussion regarding this post, please post on our Community Forum.