这两天累死了. 先是一个Modelling的作业,要用HYSIS来完成,然后是Optimisation的作业,用GAMS来进行HEN的MINLP优化. 不眠不休的折腾了3天,终于弄完了.
stream name | Tsupply | Ttarget | FCp | h |
h1 | 200 | 35 | 3.8 | 0.2 |
h2 | 200 | 20 | 2 | 0.2 |
c1 | 30 | 180 | 4 | 0.2 |
c2 | 50 | 51 | 532 | 0.2 |
c3 | 10 | 180 | 2.2 | 0.2 |
hot oil | 230 | 200 | | 0.2 |
cool water | 1 | 15 | | 0.2 |
Exchange capital cost 2000+84*Area
Unit cost of hot oil $60/kw*year
Unit cost of cool $6/kw*year
Plant life time 5 year
Tmin 10
--------------------------------------------------
1. Vertical heat transfer
Sets
i hot stream / h1, h2, ho/
j cool stream / c1, c2, c3, cw /
k block /b1, b2, b3 /;
variables
cost total cost
cpi(i) fcp of hot steam
cpj(j) fcp of cool stream;
cpi.fx('h1')=3.8;
cpi.fx('h2')=2;
cpj.fx('c1')=4;
cpj.fx('c2')=532;
cpj.fx('c3')=2.2;
binary variable z(i,j,k);
positive variables
q(i,j,k) hot duty of exchagers
area(i,j,k) heat transfer area
slh(i,k) hot slack
slc(j,k) cool slack;
Parameters
A exchanger capital cost a /2000/
B exchanger capital cost b /84/
costc cost of cooling water /6/
costh cost of hot oil /60/
year plant life time /5/
U heat transfer co /0.1/
dt delta T min /10/
MaxT upper bound /1000/
MaxQ upper bound /10000/
slW penalty /1000/
DT1(i,j,k) entering temperature difference
DT2(i,j,k) leaving temperature difference
DTLM(i,j,k) log mean temperature difference
;
Table T1i(i,k) entering temperatures of hot steam i in block k(constants)
b1 b2 b3
h1 200 61.37931 40
h2 200 61.37931 40
ho 230
Table T1j(j,k) entering temperatures of cool steam j in block k(constants)
b1 b2 b3
c1 180 50
c2 51
c3 180 50 30
cw 15
Table T2i(i,k) leaving temperatures of hot steam i in block k(constants)
b1 b2 b3
h1 61.37931 40 35
h2 61.37931 40 20
ho 200
;
Table T2j(j,k) leaving temperatures of cool steam j in block k(constants)
b1 b2 b3
c1 50 30
c2 50
c3 50 30 10
cw 1
;
DT1(i,j,k)=T1i(i,k)-T1j(j,k);
DT2(i,j,k)=T2i(i,k)-T2j(j,k);
dtlm(i,j,k) = 2/3*sqrt(dt1(i,j,k)*dt2(i,j,k))+1/3*(dt1(i,j,k)+dt2(i,j,k))/2+0.000001;
Equations
eqArea define objective function
eqqi equation (2)
eqqj equation (3)
eqdt1 delta T1 equation (4)
eqdt2 delta T2 equation (5)
eqz contraints of z
eqa
;
eqqi(i,k) .. (T1i(i,k)-T2i(i,k))*cpi(i) =e= sum(j,q(i,j,k))+slh(i,k);
eqqj(j,k) .. (T1j(j,k)-T2j(j,k))*cpj(j) =e= sum(i,q(i,j,k))+slc(j,k);
eqdt1(i,j,k) .. (T1i(i,k)-T1j(j,k))+ MaxT*(1-z(i,j,k)) =g= dt;
eqdt2(i,j,k) .. (T2i(i,k)-T2j(j,k))+ MaxT*(1-z(i,j,k)) =g= dt;
eqz(i,j,k) .. q(i,j,k)-MaxQ*z(i,j,k) =l= 0;
eqa(i,j,k) .. area(i,j,k)=e=q(i,j,k)/(u*dtlm(i,j,k));
eqArea .. cost =e= 1/year*sum(i,sum(j,sum(k,a*z(i,j,k)+b*q(i,j,k)/(U*dtlm(i,j,k)))))+(cpi('ho')*costh*(230-200)+cpj('cw')*costc*(15-1))+slW*sum(i,sum(j,sum(k,(slh(i,k)+slc(j,k)))));
Model HEN /all/ ;
Solve HEN using mip minimizing cost ;
Display z.l, q.l,slh.l,slc.l,area.l;
----------------------------------------------------
2. Criss-cross heat transfer
Sets
i hot stream / h1, h2, ho/
j cool stream / c1, c2, c3, cw /
k block /b1, b2, b3 /
l block /l1, l2, l3 /;
variables
cost total cost
cpi(i) fcp of hot steam
cpj(j) fcp of cool stream;
cpi.fx('h1')=3.8;
cpi.fx('h2')=2;
cpj.fx('c1')=4;
cpj.fx('c2')=532;
cpj.fx('c3')=2.2;
binary variable z(i,j,k,l);
positive variables
q(i,j,k,l) hot duty of exchagers
*area(i,j,k,l) heat transfer area
slh(i,k) hot slack
slc(j,l) cool slack;
Parameters
A exchanger capital cost a /2000/
B exchanger capital cost b /84/
costc cost of cooling water /6/
costh cost of hot oil /60/
year plant life time /5/
U heat transfer co /0.1/
dt delta T min /10/
MaxT upper bound /1000/
MaxQ upper bound /10000/
slW penalty /10000/
DT1(i,j,k,l) entering temperature difference
DT2(i,j,k,l) leaving temperature difference
DTLM(i,j,k,l) log mean temperature difference
;
Table T1i(i,k) entering temperatures of hot steam i in block k(constants)
b1 b2 b3
h1 200 61.37931 40
h2 200 61.37931 40
ho 230
Table T1j(j,l) entering temperatures of cool steam j in block k(constants)
l1 l2 l3
c1 180 50
c2 51
c3 180 50 30
cw 15
Table T2i(i,k) leaving temperatures of hot steam i in block k(constants)
b1 b2 b3
h1 61.37931 40 35
h2 61.37931 40 20
ho 200
;
Table T2j(j,l) leaving temperatures of cool steam j in block k(constants)
l1 l2 l3
c1 50 30
c2 50
c3 50 30 10
cw 1
;
DT1(i,j,k,l)=T1i(i,k)-T1j(j,l);
DT2(i,j,k,l)=T2i(i,k)-T2j(j,l);
dtlm(i,j,k,l) = 2/3*sqrt(abs(dt1(i,j,k,l)*dt2(i,j,k,l)))+1/3*(dt1(i,j,k,l)+dt2(i,j,k,l))/2+0.00001;
Equations
eqArea define objective function
eqqi equation (2)
eqqj equation (3)
eqdt1 delta T1 equation (4)
eqdt2 delta T2 equation (5)
eqz contraints of z
*eqa
eqlm
;
eqqi(i,k) .. (T1i(i,k)-T2i(i,k))*cpi(i) =e= sum((j,l),q(i,j,k,l))+slh(i,k);
eqqj(j,l) .. (T1j(j,l)-T2j(j,l))*cpj(j) =e= sum((i,k),q(i,j,k,l))+slc(j,l);
eqdt1(i,j,k,l) .. (T1i(i,k)-T1j(j,l))+ MaxT*(1-z(i,j,k,l)) =g= dt;
eqdt2(i,j,k,l) .. (T2i(i,k)-T2j(j,l))+ MaxT*(1-z(i,j,k,l)) =g= dt;
eqz(i,j,k,l) .. q(i,j,k,l)-MaxQ*z(i,j,k,l) =l= 0;
eqlm(i,j,k,l)$(ord(k)>ord(l)) .. z(i,j,k,l)=e=0;
*eqa(i,j,k,l) .. area(i,j,k,l)=e=q(i,j,k,l)/(u*dtlm(i,j,k,l));
eqArea .. cost =e= 1/year*sum((i,j,k,l),z(i,j,k,l)*a+b*q(i,j,k,l)/(U*dtlm(i,j,k,l)))+(cpi('ho')*costh*(230-200)+cpj('cw')*costc*(15-1))+slW*sum((i,j,k,l),(slh(i,k)+slc(j,l)));
Model HEN /all/ ;
option iterlim = 1000000;
Solve HEN using minlp minimizing cost ;
Display z.l, q.l,slh.l,slc.l;
Trackback: http://tb.donews.net/TrackBack.aspx?PostId=199591