***************************************************************** *** Chapter 6 *** Test Problem 2 *** *** n-Butyl-Acetate and Water -- Tangent plane distance minimization(NRTL) ***************************************************************** SETS i components /1*2/ alias(i,j); ********************************************************************* * P = pressure (atm) * T = temperature (K) * feed(i) = mole fraction of component i in candidate phase (feed) * chempot(i) = chemical potential of component i in candidate phase * alpha(i,j) = binary interaction parameter (symmetric) * tau(i,j) = binary interaction parameter (nonsymmetric) * g(i,j) = binary interaction parameter (calculated) PARAMETERS P, T, feed(i), chempot(i), alpha(i,j), tau(i,j), g(i,j); P = 1.0; T = 298; feed('1') = 0.5; feed('2') = 0.5; chempot('1') = -0.06391; chempot('2') = 0.02875; alpha('1','1') = 0.0; alpha('1','2') = 0.391965; alpha('2','1') = 0.391965; alpha('2','2') = 0.0; tau('1','1') = 0.0; tau('1','2') = 3.00498; tau('2','1') = 4.69071; tau('2','2') = 0.0; g(i,j) = EXP(-alpha(i,j)*tau(i,j)); ******************************************************************* * dist = tangent plane distance function * x(i) = mole fraction of component i * psi(i) = substitution variable VARIABLES dist, x(i), psi(i); ******************************************************************* * obj = objective function * trans(i) = transformation constraint * molesum = mole fractions sum to 1 EQUATIONS obj trans(i) molesum; obj.. dist =e= SUM(i, x(i)*(LOG(x(i)) - chempot(i))) +SUM(i, x(i)*SUM(j, g(i,j)*tau(i,j)*psi(j))); trans(i).. psi(i)*SUM(j, g(j,i)*x(j)) - x(i) =e= 0.0; molesum.. SUM(i, x(i)) =e= 1.0; MODEL tpd / all /; x.lo(i) = 0.000001; x.up(i) = 1.0; x.l('1') = 0.00421; x.l('2') = 0.99579; psi.lo(i) = 0.0; psi.l(i) = x.l(i)/SUM(j, g(j,i)*x.l(j)); SOLVE tpd USING nlp MINIMIZING dist;