function hdif=sepe(stop,sbot,ttop,tbot,in,out,t)
% sepe - separator module with energy balances
%
% function hdif=sepe(stop,sbot,ttop,tbot,in,out,t)
% Arguments:
%     stop     state of the top stream: 'v', 'l', or 's'.
%     sbot     state of the bottom stream.
%     ttop     the temperature of the top stream in Tdeg.
%     tbot     the temperature of the bottom stream in Tdeg.
%     in       the index of feed, 
%     out      the indices of the top and bottom streams
%              in that order.
%     t        the fraction of each compound in the feed
%              that goes to the top stream.
%
% sepe returns the sum of the enthalpies of the exit 
%    streams minus the enthalpy of the feed stream.
%
% Example:
%    >> sepe('v','l',120,150,2,[3 5],[.9 .35])
%    
%    might simulate a fractionator with stream 2 as the
%    feed, 3 as the top product and 5 as the bottom.
%    The top comes off as a vapor at 120 Tdeg and gets
%    90% of the first component and 35% of the second.
%
% OKB, TYLC; help revised by MAH
global ne
sne=size(ne);
NS=ne(in,4:sne(2));
NST=NS.*t;
jt=find(NST);
NSB=NS-NST;
jb=find(NSB);
setne(stop,out(1),ttop,NST(jt),jt)
setne(sbot,out(2),tbot,NSB(jb),jb)
hdif=sum(ne(out,3))-ne(in,3);
