![]() |
function hdif=splite(t,in,out,s,tmp) % splite: energy-balance splitter module % function hdif=splite(t,in,out,s,tmp) % Argument List % Argument Gives % t the fraction of the inlet stream % that goes to each exit stream. % in the index of the inlet stream. % out the indices of the exit streams. % s the states of the exit streams. % tmp the temperatures of the exit streams. % The last two arguments are optional. Without them this works as a % normal splitter. With them splite can be used as a sort of heat % exchanger on the exit streams. % % Ex: splite([.2 .2 .2 .2 .2],1,2:6) % would split stream 1 into 5 equal parts in streams 2 through 6, % all with the same state and temperature as stream 1. % Ex: splite([.2 .3 .5],1,2:4,'vvl',[400 300 200]) % would split stream 1 into streams 2, 3 and 4. % Stream 2 would get 20% of the flow, as a vapor at 400 Tdeg, % stream 3 would get 30% as vapor at 300 Tdeg, % and stream 4 would get the remaining 50% as liquid at 200 Tdeg. % % Splite returns the enthalpy difference between the inlet and outlet % streams, which should be zero unless the last two arguments % are given. % % For additional help and picture of Ex. #2 , see PICSPLITE %JWD, TYLC % global ne lt=length(t); if length(out)~=lt disp('Your t and out vectors are not the same length in splite') return end if sum(t)~=1.0 disp('The t vector does not sum to 1 in splite') return end if nargin<5 tmp=ne(in,1)*ones(1,lt); if nargin<4 sl='slv'; s=sl((ne(in,2)+1)*ones(1,lt)); end end [nr,nc]=size(ne); j=find(ne(in,4:nc)); for i=1:lt setne(s(i),out(i),tmp(i),t(i)*ne(in,j+3),j) end hdif=sum(ne(out,3))-ne(in,3); return
Also see The Splitter Function: splite. Back to Chapter 5.