{Comments are surrounded by quotes or brackets.}
FUNCTION tk(T) "converts from C to K"
tk:=T+273.15
END
$INCLUDE /eesw/userlib/REFPROP.TXT
{Calculating what the mdot ratio is from the end point data.}
{m_ratio = m_w / m_m}
m_ratio=(h_end_mix-h_start_mix)/(h_end_h20-h_start_h20)
{The components and compositions listed below vary for each}
{refrigerant mixture.}
CALL REFPROP(3,R32,R125,R134a,TQX,TK(29)+Pinch,0,0.3811,0.1796:
T_hi,P_hi,v_hi,h_hi,s_hi)
CALL REFPROP(3,R32,R125,R134a,PQX,P_hi,0,0.3811,0.1796:T_1m,
P_1m,v_1m,h_start_mix,s_1m)
CALL REFPROP(3,R32,R125,R134a,PQX,P_hi,1,0.3811,0.1796:T_Nm,
P_Nm,v_Nm,h_end_mix,s_Nm)
h_start_h20=enthalpy(WATER,T=TK(29),P=P_hi)
h_end_h20=enthalpy(WATER,T=TK(34),P=P_hi)
T1w=temperature(WATER,h=h_start_h20,P=P_hi)
T2w=temperature(WATER,h=h_end_h20,P=P_hi)
{Entered Values}
EndPtQ=h_end_mix-h_start_mix "The total heat transferred in the heat exchanger"
h_m=Qtot+h_start_mix
h_w=(Qtot/m_ratio)+h_start_h20
T_w=temperature(WATER,h=h_w,P=P_hi)
CALL REFPROP(3,R32,R125,R134a,PHX,P_hi,h_m,0.3811,0.1796:T_m,
Pm,vm,hom,sm)
DELTAT_mw=T_m-T_w
Delta_T_1=T_1m-T1w "Calculation of the LMTD and U0A0 using"
Delta_T_2=T_Nm-T2w "the traditional method"
LMTD=(Delta_T_2-Delta_T_1)/(ln(Delta_T_2/Delta_T_1))
U0A0_LMTD=(h_end_mix-h_start_mix)/LMTD
{Integration to find the actual U0A0}
U0A0_act=integral(1/DELTAT_mw,Qtot,0,EndPtQ)
{Calculation of the error using two error scales}
LER=-log10(U0A0_LMTD/U0A0_act)
SE=(abs(U0A0_act-U0A0_LMTD)/U0A0_act)*100