{Comments are surrounded by quotes or brackets.}
FUNCTION tk(T) "converts from C to K"
tk:=T+273.15
END
Conc=0.95 "Concentration of the Ammonia-Water Mixture"
Pinch=10 "Pinch Point"
{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)
CALL NH3H2O(138,TK(29)+Pinch,Conc,0:T_hi,P_hi,x_hi,h_hi,s_hi,
u_hi,v_hi,Qu_hi)
CALL NH3H2O(238,P_hi,Conc,0:T_1m,P_1m,x_1m,h_start_mix,s_1m,
u_1m,v_1m,Qu_1m)
CALL NH3H2O(238,P_hi,Conc,1:T_Nm,P_Nm,x_Nm,h_end_mix,s_Nm,
u_Nm,v_Nm,Qu_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 NH3H2O(234,P_hi,Conc,h_m:T_m,Pm,xm,hom,sm,um,vm,Qum)
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