Help needed with an equation


Hi,
I'm currently gearing up to go AG and am expanding my own brewing software that I have written in VBA with MSAccess. I have discovered that I need an equation/algorithm to calculate the required temperature (either farenheit or celsuis) of a set volume of hot liquor (say 20 litres) to a mash that is currently at 60 degrees celsuis and contains 30 litres HL and 24KG of grain. I have Palmers equations to calculate the volume of water to add of a
given temperature, but, what I am looking for is an algorithm to calculate what temperature a set volume of water is required to be to reach a desired target temperature.
I have Palmer's equation to calculate the amount of hot liquor given the temperature of it, which is as follows:
Initial Infusion Temp equation
Strike Water Temp TW = (0.2/r)(T2  T1) + T2
Mash Infusion Temp equation
WA = (T2  T1)(.2G + Wm)/(Tw  T2)
where
r = The ratio of water to grain
WA = The amount of water to add
Wm = The total amount of water in the mash
T1 = Teh initial temp of the mash
T2 = The target temp of the mash
Tw = The actual temp of the infusion water (Hot Liquor)
G = The amount of grain in the mash
What I need is an equation/algorithm to calculate the temperature what the temperature of a set volume of Hot Liquor
needs to be to reach a desired rest temperature.
