Hi All. I an new here.
Can somebody please help me convert this formula so that the Arduino can use it.
It is to work out the wet bulb temperature if you have the dry bulb and relative humidity %
Tw = 20 atan[0.151 977 (50 + 8.313 659) to the power 1/2] + atan(20 + 50) - atan(50 - 1.676 331) + 0.003 918 38(50) to the power 3/2 atan(0.023 101 * 50) - 4.686 035
answer should be
13.7
either it is .00391838 * 50 or .00391838 +/- 50 in the least significant digits.
tinkerboy, your notation is all screwed up mixing brackets and parens and multiplications. Also this:
atan(50 - 1.676 331) + 0.003 918 38(50) to the power 3/2 atan(0.023 101 * 50) - 4.686 035
is completely ambiguous.
Do us, and you a favor by doing the following:
Does atan return degrees or radians?
write constants without spaces as separators.
write each term on one line:
atan(0.151777...)
atan(20+50)
...
It is a value. Sorry I see the copy paste made spaces in the value.
But I don't see any input, so why not use 13,7 then?
void setup(void)
{
Serial.begin(9600);
while(!Serial);
// 13.6993418
float RH = 50;
float Tp = 20;
float Tw = Tp * atan(0.151977*sqrt(RH + 8.313659))
+ atan(Tp+RH) - atan(RH - 1.676331)
+ 0.00391838 * pow( RH,3./2.)*atan(0.023101 * RH)
- 4.686035;
Serial.println(Tw,7);
}
void loop(void)
{
}
Prints 13.6993418
It really helps to have a reference to the original equation (which I found before OP posted it)
[+edit] Changed a hardcoded "20" to Tp.
Pete
Found it
ARctan is in radians.
double TW = T * arctan(.151955 * sqrt(RH+8.313659))+atan(T+RH) - atan(RH-1.676331)+
pow(.00391838*RH,1.5)atan(.023101 RH) -4.68035;
With T = temperature and RH = relative humidity
I tried it on the calculator and got 12.6, so check for typos.
But keep in mind, arctan (or other trigonometric functions) are not very easy for an Arduino Uno.
Thank you very much. I am controlling a PC with my phone via Teamviewer making the posts so things end up at wrong places.
Thank you very much for the help !!!!
septillion:
But keep in mind, arctan (or other trigonometric functions) are not very easy for an Arduino Uno.
I have never had one complain.
I did Not the Arduino but the user who thought he could do 100 trigonometric calculations a second...
jurs
June 1, 2017, 5:16pm
12
tinkerboy:
Hi All. I an new here.
Can somebody please help me convert this formula so that the Arduino can use it.
It is to work out the wet bulb temperature if you have the dry bulb and relative humidity %
What is it? I never heard the term "wet bulb temperature"
I know the terms saturation temperature" and "dew point"
Is it all the same?
system
June 1, 2017, 5:17pm
13
I never heard the term "wet bulb temperature"
Well, it's similar to a "dim bulb" temperature... 8)
"Wet bulb" is the temperature that you measure with a wet bulb thermometer. A small sock fits over the bulb and dangles into water.
It's the way we used to measure humidity before electronic humidity sensors were created.
Another cool one: "Whirling Psychrometer" (I hope I've spelled that correctly.)
It's a type of hygrometer where you spin 2 thermometers around or otherwise provide airflow. One bulb is dry and the other is wet and from the temp difference you can get humidity.
MorganS:
It's the way we used to measure humidity before electronic humidity sensors were created.
There were the meters based on hair:
These devices use a human or animal hair under some tension. The hair is hygroscopic (tending toward retaining moisture); its length changes with humidity, and the length change may be magnified by a mechanism and indicated on a dial or scale. In the late 17th century, such devices were called by some scientists hygroscopes; that word is no longer in use, but hygroscopic and hygroscopy, which derive from it, still are. The traditional folk art device known as a weather house works on this princip...
Thank so much. The code works 100%. I just had to add one more variable where there was a hard coded 20. I created a function and it works like a charm. Math formulas are not my strong point LOL.
Oh right. I've corrected my message #5 .
Pete
septillion:
But keep in mind, arctan (or other trigonometric functions) are not very easy for an Arduino Uno.
This is why I used an approximation routine for atan()
Inverse kinematics use a lot of trig.