I've just set a solar thermal array for research for my thesis. I would like to simulate different usage patterns to see how the system performs. I'm doing this using a Arduino with temperature sensors at the top hot the tank and on the cold supply which will then control a motorised valve which will dump hot water based on the usage patterns I set. I'm struggling to work out how to calculate this. So for example if I want to dump 50l at 45°C and the hot water store is a 60°C and the coldwater supply is at 10°C. I need to work out the volume of hot and cold water required. (and tell the motorised valve to open for a time based on the volume calculated) I've been playing around with Q=mcΔT for a couple of day, and think I need to rearrange the equation to give me a ratio of the hot/cold water then calculate the actual volume based on how much I want to dump. Can anyone point me in the right direction?