function dt_x = DEW_T(A,B,C,P,y)
% [T x] = DEW_T(A,B,C,P,y)
% Dew Temperature and Composition of Liquid
% Input: Antoine Constants (A,B,C), Total Pressure, y
% Output: Dew Temperature & Composition of Liquid

% Done on 09-Sep-2001, M.Subramanian
% msubbu@svce.ac.in

n = size(A,2); % No of components
T_init = sum(y.*sat_temp_antoine(A,B,C,P));
p_sat = sat_pr_antoine(A,B,C,T_init);
alpha = p_sat./p_sat(n);
p_sat(n) = P*sum(y./alpha);
T = sat_temp_antoine(A(n),B(n),C(n),p_sat(n));
while abs(T-T_init) > 0.001
   T_init = T;
   p_sat = sat_pr_antoine(A,B,C,T_init);
   alpha = p_sat./p_sat(n);
	p_sat(n) = P*sum(y./alpha);
	T = sat_temp_antoine(A(n),B(n),C(n),p_sat(n));
end
p_sat = sat_pr_antoine(A,B,C,T);
x = (y./p_sat)*P;
dt_x = [T x];
%end
