*Carnegie Mellon University, January 2009, Elvis Ahmetovic
*General model for water network superstructure including water-using and water treatment operations
*The superstructure consists of two process and two treatment units
$OFFSYMXREF
$OFFSYMLIST
Set p Process units /p1,p2/;
Set t Treatment units /t1,t2/;
Set j Contaminants /A,B/
Alias (p,pp)
Alias (t,tt);
Parameter FPUin(p) 'Flowrate of water at process units inlets [ton/h]'
/p1 40
p2 50/;
Table xPUin_max(p,j) 'Max. contaminant concentrations at PU inlet [ppm]'
A B
p1 0 0
p2 50 50;
Parameter xout_max(j) 'Max contaminant concentration in discharge stream into environment [ppm]'
/A 10, B 10/ ;
Table LPU(p,j) 'Discharge load of contaminants A and B in the process units [kg/h]'
A B
p1 1 1.5
p2 1 1 ;
Table Removalratio(t,j) 'Removal ratio of contaminant j in treatment unit T [%]'
A B
t1 95 0
t2 0 95 ;
Parameter IC(t) 'Investment cost coeff. for treatment units' /t1 16800,
t2 12600 /;
Parameter OC(t) 'Operating cost coeff. for treatment units' /t1 1,
t2 0.0067 /;
Parameter exp(t)'Cost function exponent for treatment units' /t1 0.7,
t2 0.7 /;
Parameter hours 'Hours of operation of plant per annum (h)' /8000/
CFW 'Cost of fresh water [$/t]' /1/
AR 'Annualized factor for investment on TU' /0.1/;
Variable z Total amount freshwater and waste water from treatment units;
Positive variables
Ftot total flowrate of freshwater at initial splitter inlet
FIP(p) water streams from initial spliter going to mixer MPU
FIT(t) water streams from initial spliter going to treatment units
FPUout(p) water streams at inlet into process unit
FP(pp,p) water streams from SPU going to MPU
FP(p,pp) water streams from SPU going to MPU
FTP(t,p) water streams from STU going to MPU
FPT(p,t) water streams from SPU going to MTU
FPO(p) water streams from SPU going to MF
FTUin(t) water streams at inlet into treatment unit
FTUout(t) water streams at outlet from treatment unit
FT(tt,t) water streams from STU going to MTU
FT(t,tt) water streams from STU going to MTU
FTO(t) water streams from STU going to MF
Fout water stream from final mixer
xPUin(p,j) concentration of contaminants in inlet streams in PU
xPUout(p,j) concentration of contaminants in outlet stream from PU
xIP(p,j) concentration of contaminants in water streams going from IS to MPU
xTUin(t,j) concentration of contaminants in water streams at TU inlet
xTUout(t,j) concentration of contaminants in water streams going from IS to MTU
xSPUout(p,j) concentration of contaminants in water streams at SPU outlet
xIT(t,j) concentration of contaminants in water streams going from IS to MTU
xSTUout(t,j) concentration of contaminants in water streams at STU outlet
xIF(j) concentration of contaminants in water streams going from IS to MF
xout concentration of contaminants in water streams MF outlet
betaTU(t,j) 'coefficient = 1-(removalratio/100)'
xtot(j) concentration of contaminants in freshwater inlet in IS ;
Equations
obj sum of freshwater intake into system and and total flow of wastewater treated in treatment units (t*h-1)
eq1IS overal material balance of initial spliter (IS)
eq2MPU (p) mass balances of mixers in front of process units (MPU)
eq3MPU (p,j) mass balances of contaminants for mixers in front of process units (MPU)
eq4PU (p) mass balances of proces units (PU)
eq5PU (p,j) mass balances of contaminants for process units (PU)
eq6SPU(p) mass balances of spliters behind process units (SPU)
eq7SPU(p,j) equality of contaminants concentrations at outlet PU i SPU
eq8MTU(t) mass balances of mixers in front of treatment units (MTU)
eq9MTU(t,j) mass balances of contaminants for mixers in front of treatment units (TU)
eq10TU(t) mass balances of treatment units (TU)
eq11TU(t,j) coefficient necessary for calculation concentrations at treatment units outlets
eq12TU(t,j) dependence between treatment units inlet and outlet concentrations
eq13STU(t) mass balances of splitters behind treatment units (TU)
eq14STU(t,j) equality concentrations at treatment units inlets and outlets
eq15MF mass balances of final mixer
eq16MF(j) mass balances of contaminants for final mixer
eq17RedEqu(j) contaminant flow balances for the overal system;
* eq18Discharge(j) constraints for network feasibility;
eq1IS.. Ftot=e=sum(p,FIP(p))+sum(t,FIT(t));
*if recycle around process unit is allowed then equations will be
eq2MPU(p).. FPUin(p)=e=FIP(p)+sum(pp,FP(pp,p))+sum(t,FTP(t,p));
eq3MPU(p,j)..FPUin(p)*xPUin(p,j)=e=FIP(p)*xIP(p,j)+sum(pp,FP(pp,p)*xPUout(pp,j))+sum(t,FTP(t,p)*xTUout(t,j));
*if recycle around process unit is not allowed then equations will be
*eq2MPU(p).. FPUin(p)=e=FIP(p)+sum(pp$(ord(pp)<>ord(p)),FP(pp,p))+sum(t,FTP(t,p));
*eq3MPU(p,j)..FPUin(p)*xPUin(p,j)=e=FIP(p)*xIP(p,j)+sum(pp$(ord(pp)<>ord(p)),FP(pp,p)*xPUout(pp,j))+sum(t,FTP(t,p)*xTUout(t,j));
eq4PU(p)..FPUin(p)=e=FPUout(p) ;
eq5PU(p,j)..FPUin(p)*xPUin(p,j)+LPU(p,j)*1e03=e=FPUout(p)*xPUout(p,j);
*if recycle around process unit is allowed then equations will be
eq6SPU(p)..FPUout(p)=e=FPO(p)+sum(t,FPT(p,t))+sum(pp,FP(p,pp));
eq7SPU(p,j)..xSPUout(p,j)=e=xPUout(p,j);
*if recycle around process unit is not allowed then equation will be
*eq6SPU(p)..FPUout(p)=e=FPO(p)+sum(t,FPT(p,t))+sum(pp$(ord(pp)<>ord(p)),FP(p,pp));
*if recycle around process unit is allowed then equations will be
eq8MTU(t)..FTUin(t)=e=FIT(t)+sum(tt,FT(tt,t))+sum(p,FPT(p,t));
eq9MTU(t,j)..FTUin(t)*xTUin(t,j)=e=FIT(t)*xIT(t,j)+sum(tt,FT(tt,t)*xSTUout(tt,j))+sum(p,FPT(p,t)*xSPUout(p,j));
*if recycle around treatment unit is not allowed then equation will be
*eq8MTU(t).. FTUin(t)=e=FIT(t)+sum(tt$(ord(tt)<>ord(t)),FT(tt,t))+sum(p,FPT(p,t));
*eq9MTU(t,j)..FTUin(t)*xTUin(t,j)=e=FIT(t)*xIT(t,j)+sum(tt$(ord(tt)<>ord(t)),FT(tt,t)*xSTUout(tt,j))+sum(p,FPT(p,t)*xSPUout(p,j));
eq10TU(t)..FTUin(t)=e=FTUout(t);
eq11TU(t,j)..betaTU(t,j)=e=(1-(removalratio(t,j)/100));
eq12TU(t,j)..xTUout(t,j)=e=betaTU(t,j)*xTUin(t,j);
*if recycle around process unit is allowed then equations will be
eq13STU(t)..FTUout(t)=e=FTO(t)+sum(p,FTP(t,p))+sum(tt,FT(t,tt));
*if recycle around treatment unit is not allowed then equation will be
*eq13STU(t)..FTUout(t)=e=FTO(t)+sum(p,FTP(t,p))+sum(tt$(ord(tt)<>ord(t)),FT(t,tt));
eq14STU(t,j)..xSTUout(t,j)=e=xTUout(t,j);
eq15MF..Fout=e=sum(p,FPO(p))+sum(t,FTO(t));
eq16MF(j)..Fout*xout(j)=e=sum(p,FPO(p)*xSPUout(p,j))+sum(t,FTO(t)*xSTUout(t,j));
eq17RedEqu(j)..Ftot*xtot(j)+sum(p, LPU(p,j)*1e03)=e=sum(t,(1-betaTU(t,j))*(FTUin(t)*xTUin(t,j)))+Fout*xout(j);
*eq18Discharge(j)..prod(t,betaTU(t,j))*sum(p,LPU(p,j)*1e03)/(sum(p,FPUin(p)))=l=xout(j);
*Variable bounds
********************************************************
*bounds for fresh water stream at inlet in initial mixer
Ftot.lo = FPUin('p1');
Ftot.up = FPUin('p1')+FPUin('p2');
*bounds for outlet streams from MPU to PU
FIP.fx('p1') = FPUin('p1');
FIP.up('p2') = FPUin('p2');
*bounds for outlet stream from final mixer
Fout.lo=FPUin('p1');
Fout.up = FPUin('p1')+FPUin('p2');
xout.up(j) = xout_max(j);
*bounds for maximum concentration of contaminants in streams at inlet of process units
xPUin.fx('p1',j) = xPUin_max('p1',j);
xPUin.up('p2',j) = xPUin_max('p2',j);
*bounds for maximum concentration of contaminants in streams at outlet of PU
xPUout.fx('p1','A') = 1000/40;
xPUout.fx('p1','B') = 1500/40;
*bounds for fresh flowrate streams from initial splitter to treatment units
FIT.fx(t) = 0;
* bounds on concentrations for initial splitter
xIP.fx(p,j)=0;
xIT.fx(t,j)=0;
xIF.fx(j)=0;
xtot.fx(j)=0;
********************************************************
FP.up('p1','p2') = 40;
FTP.up('t2','p2') = 50;
FTP.up('t1','p2') = 50;
FP.fx('p2','p1') = 0;
FTP.fx('t1','p1') = 0;
FTP.fx('t2','p1') = 0;
FPT.up('p1','t2') = 40;
FPT.up('p1','t1') = 40;
FPT.up('p2','t1') = 50;
FPT.up('p2','t2') = 50;
FTUin.up('t1')=90;
FTUin.up('t2')=90;
FTUout.up('t1')=90;
FTUout.up('t2')=90;
FT.up('t1','t2')=90;
FT.up('t2','t1')=90;
FTO.up('t1')=90;
FTO.up('t2')=90;
xPUout.up('p2',j) = 3500/50;
xSPUout.fx('p1','A') = 1000/40;
xSPUout.fx('p1','B') = 1500/40;
FPO.up('p1') = 40;
xSPUout.fx('p1','A') = 1000/40;
xSPUout.fx('p1','B') = 1500/40;
FPO.up('p2') = 90;
xSPUout.up('p2','A') = 3500/50;
xSPUout.up('p2','B') = 3500/50;
xTUin.up(t,j) = 3500/50;
xTUin.lo('t1','A')=0;
xTUin.lo('t1','B')=0;
xTUout.lo('t2','A')=0;
xTUout.lo('t2','B')=0;
xTUout.up('t1','A')=175/50;
xTUout.up('t1','B')=3500/50;
xTUout.up('t2','A')=3500/50;
xTUout.up('t2','B')=175/50;
xSTUout.up('t1','A')= 175/50;
xSTUout.up('t1','B')= 3500/50;
xSTUout.up('t2','A')=3500/50;
xSTUout.up('t2','B')=175/50;
xPUin.lo('p2',j) = 0;
xPUout.lo('p2',j) = 1000/50;
xSPUout.lo('p2',j) = 1000/50;
betaTU.lo(t,j)=0;
betaTU.up(t,j)=1;
obj.. z=e=Ftot+sum(t,FTUout(t));
*OBJ..z =E= CFW*hours*Ftot + AR*sum(t,IC(t)*FTUout(t)**exp(t)) + hours*sum(t,OC(t)*FTUout(t));
OPTION LIMROW=0;
OPTION LIMCOL=0;
option NLP =BARON;
OPTION optcr = 0.01;
Model GenNetwork /all/;
Solve GenNetwork using NLP minimizing z;
Display FTUout.l,Ftot.l,z.l;