psychrometrics / psychrolib

📚 Library of psychrometric functions to calculate 🌡️ thermodynamic properties of air for Python, C, C#, Fortran, R, JavaScript and VBA/Excel
MIT License
223 stars 62 forks source link

I want to calculate HumRatio from Enthalpy, Relative Humidity, and Pressure #93

Open spinxsunyi opened 2 years ago

spinxsunyi commented 2 years ago

I am working on research to make an automated fogging cooling system by sensing current humidity and set the target humidity.

I want to calculate Absolute Humidity from Enthalpy, Relative Humidity, and Pressure.

There is an exisiting function to find HumidityRatio in this library: psychrolib.GetHumRatioFromRelHum(TDryBulb, RelHum, Pressure)

The problem is that function also needs TDryBulb. In my case, I don't have the TDryBulb, but I have the enthalpy, relative humidity and pressure. Conventionally I use the psychrometric chart to find the answer. But for this case, I need to use python to calculate this value.

Is there any existing function that can help me with this case? I still cannot find the roundabout. Maybe I have to find the TDryBulb first by using enthalpy and RelHum, then put the value to existing formula and get the HumRatio. But there is also not exist in this library.

I've found someone create a polynomial function to find enthalpy from TDryBulb and Relhum, but I cannot make it working otherwise to find the TDryBulb from enthalpy and Relhum. Here is the reference. https://www.mrexcel.com/board/threads/excel-formula-for-calculating-airs-enthalpy-from-dry-bulb-temperature-and-relative-humidity.871843/

I hope there will be new feature to include function: GetHumRatioFromRelHumAndEnthalphy(Enthalphy, RelHum, Pressure) or GetTdrybulbFromEnthalphy(Enthalphy, Relhum, Pressure)

Or is there anyone can help to drop the formula? I really appreciate that.

didierthevenard commented 2 years ago

Apologies for the delayed response. When PsychroLib was originally designed, one assumption was that dry bulb temperature was always one of the known quantities, and the various functions that we implemented were basically converting various water contents quantities into each other. Since then there have been a few requests to calculate dry bulb temperature from two moist air properties, and this led in particular to the implementation of GetTDryBulbFromEnthalpyAndHumRatio. Your use case falls into that same category since you want to calculate dry bulb temperature from enthalpy, relative humidity and pressure. I had a look into it and I don't think there is a simple way to implement this. Your best bet is to start with a guess of dry bulb temperature, then calculate the humidity ratio using GetHumRatioFromRelHum, then use GetTDryBulbFromEnthalpyAndHumRatio to calculate dry bulb temperature, and iterate until you get convergence. I would use bisection but I don't know which values to use as the lower and upper bounds of the bisection, that's still something to investigate. I hope this helps!

aldejager commented 2 years ago

I am facing a similar issue where I have enthalpy and want to know the dry bulb temperature at saturation (effectively the above but only at 100% relative humidity)... Since this doesn't exist yet I have curve fitted the dry bulb temperature at saturation for any given enthalpy between 10 and 90 kJ/kg.

The following equation will give you TDryBulb (in deg Celsius) at saturation as a function of enthalpy (in kJ/kg!); assuming sea level pressure. Accuracy is +/- 0.015:

TDryBulb = 0,0000141544*enthalpy^3 - 0,0042910764*enthalpy^2 + 0,6458382852*enthalpy - 5,6038515116

Any point on the same enthalpy curve can be interpolated to give a reasonable estimate for non-saturated cases.