function sep(t,in,out)
% Sep: mass-balance separator module
% function sep(t,in,out)
% Simulates the behavior of a separator. It takes one inlet stream
%   and separates it into two outlet streams.
% Argument    Gives
%   t(j)   the fraction of ns(in,j) that goes
%          to the first outlet stream. Can be a vector.
%    in    the index of the inlet stream.
%   out    the indices of the two exit streams.
% The exit streams are ordered.
% For additional help and picture, see PICSEP
% OKB, TYLC
% Example: >> sep([0.2 0.3 0.8 0.5],1,[2 3])
%   Would separate stream 1 (which contains 4 compounds: a,b,c,d)
%          into exit streams 2 and 3
%    Stream 2 is the first outlet stream because it is the
%          the first stream specified in the vector, out (3rd argument
%          of sep)
%          and would get 20% of cmpd a in Stream 1
%                        30% of cmpd b in Stream 1
%                        80% of cmpd c in Stream 1
%                        50% of cmpd d in Stream 1
%    Stream 3 is the other outlet stream and would get the remaining
%          amounts of the cmpds
% NOTE that the sum of the t vector does NOT necessarily equal one!
   
global ns
sc=size(ns);
if length(t)~=sc(2)
   disp('Your vector t does not have one element for each compound.')
   return
end
ns(out(1),:)=(t).*(ns(in,:));
ns(out(2),:)=ns(in,:)-ns(out(1),:);










