I'm trying to calculate the wet bulb temperature from dry bulb temp (dbt
), relative humidity (rh
) and pressure (p
), so that I can monitor an air condition unit with a raspberry pi. I got the equation from a Research paper and it works fine and is fast when calculated in Matchcad Prime. When I try to get Python to solve the equation however, it just sits there without returning anything, while my CPU fan goes crazy until I cancel the terminal.
from sympy import symbols, Eq, solve
Td = 25
rh = 60
p = 1013
Tw = symbols('Tw')
Td = float(Td)
rh = float(rh)
p = float(p)
e = float(2.71828182845905)
eq1 = Eq(((6.112 * e**((17.502 * Tw) / (240.97 + Tw)) - 0.00066 * (1 + 0.00115 * Tw) * p * (Td - Tw)) / (6.112 * e**((17.502 * Td) / (240.97 + Td)))) * 100 - rh, 0)
result = solve(eq1, Tw)
temp_wet = round(result[Tw], 2)
print(f'Wet bulb temperature = {temp_wet}')
I have also tried nsolve
, but it didn't help, and after 9 hours I now give up and politely ask if anyone here can offer a possible solution.