%%HP: T(3)A(R)F(.);
@ Psychrometric equation solved in RPL - Version 1.1
@ Pushes the vapour mixing ratio in kg/kg in the stack.
@ Only tested on a HP 50g.
\<<
"Psychrometric equation"
{ {}
{ "Dry bulb temperature:" "Dry bulb temperature in \^oC" 0.}
{ "Wet bulb temperature:" "Wet bulb temperature in \^oC" 0.}
{ " Pressure:" "Pressure in hPa" 0.}}
{1 0} {NOVAL NOVAL 1000.} DUP
INFORM
\<<
OBJ\-> DROP
\<< @ Local procedure to calculate saturated vapour mixing ratio
@ from the temperature on stack position 1 and pressure on 2
DUP 17.67 * SWAP 243.5 + / EXP 6.112 * @ Now contains e_s(T)
DUP 3 ROLL
SWAP - 1.61 * /
\>> \-> Td Tw P0 TtoR
\<<
@ c_pd + c_pv r_vs(Tw):
P0 Tw TtoR EVAL DUP 1859.0 * 1004.0 +
@ L(Td) = L(0)-Td (c_pl-c_pv):
2.501E06 Td 4218.0 1859.0 - * -
@ Psychrometric equation:
/ Tw Td - * + "r" \->TAG DUP DUP 1000.0 * -2 RND
SWAP P0 Td TtoR EVAL / 100 * 0 RND R\->I
2 \->LIST
\>>
"Psychrometric equation"
{ {}
{ "Specific humidity:" "Specific humidity (g/kg)" 0}
{ "Relative humidity:" "Relative humidity (%)" 10} }
{1 0} 4 ROLL DUP
INFORM
\<< DROP\>> IFT
\>> IFT
\>>