Professional Documents
Culture Documents
Modelalamiento Examen Final Nuevo PDF
Modelalamiento Examen Final Nuevo PDF
Page 1
1 GAMS 28.2.0 r750fa45 Released Aug 19, 2019 WEX-WEI x86 64bit/MS Windows 12/»
07/19 17:30:00 Page 1
2 Optimal Design of a Gas Transmission Network (GASNET,SEQ=223)
3 C o m p i l a t i o n
4
5
6 2
7 A gas pipeline is to be designed to transport a fixed amount of gas fro»
m
8 one point to two others. Both, the initial and final stages of the gas
9 are known. We need to determine:
10
11 Number of compressor stations
12 Length of the pipeline segments
13 Diameter of pipeline segments
14 Suction and discharge pressures at each stations
15
16
17 Edgar, T F, Himmelblau, D M, and Lasdon, L S, Optimization of
18 Chemical Processes. McGraw Hill, Boston, 2001.
19
20 Keywords: mixed integer nonlinear programming, pipeline designment, eng»
ine
21 ering
22 19
23 21
24 22 Set
25 23 ii 'all pipe segments' / s0*s11 /
26 24 i(ii) 'pipe segments' / s1*s11 /
27 25 i1(i) 'segments one' / s1*s3 /
28 26 i2(i) 'segments two' / s4*s7 /
29 27 i3(i) 'segments three' / s8*s11 /
30 28 j 'compressors' / c1*c10 /
31 29 jii(j,ii,i) 'connections'
32 30 / c1.s0.s1, c2.s1.s2, c3.s2.s3, c4.s3.s4, c5.s4.s5
33 31 c6.s5.s6, c7.s6.s7, c8.s8.(s9,s10), c9.s9.s10, c10.s10»
.s1
34 1 /
35 32 qi(ii,i) 'pipeline flow mapping'
36 33 cj(j,ii) 'compressor inflow mapping'
37 34 ji(j,ii) 'compressor pipeline flow mapping'
38 35 is(ii) 'all segments less terminal segments';
39 36
40 37 cj(j,ii) = sum(i, jii(j,ii,i));
41 38 qi(ii,i) = sum(j, jii(j,ii,i));
42 39 ji(j,i) = sum(ii, jii(j,ii,i));
43 40 is(ii) = sum(j, cj (j,ii));
44 41
45 42 Parameter
46 43 k 'suction condition' / 1.26 »
/
47 44 z 'compressibility factor' / 0.88 »
/
48 45 t 'suction temperature' / 520 »
/
49 46 cvar 'compressor annual capital variable cost ($ per hp)' / 70 »
/
50 47 cfix 'compressor annual fixed cost ($)' / 1e4 »
/
51 48 pcost 'pipe capital cost ($ per inch per mile)' / 870 »
/
D:\Users\Asp\Documents\gamsdir\projdir\Tuberias.lst sábado, 07 de Diciembre de 2019 05:30:22 p.m.
Page 2
109 103
110 104 obj.. cost =e= cl + cc + oc;
111 105
112 106 Model gasnet / all /;
113 107
114 108 * simple bounds
115 109 pd.lo(i) = 1800;
116 110 pd.up(i) = 2000;
117 111 ps.lo(i) = 2100;
118 112 ps.up(i) = 2300;
119 113 L.lo(i) = 70;
120 114 L.up(i) = 110;
121 115 D.lo(i) = 10;
122 116 D.up(i1) = 36;
123 117 D.up(i2) = 24;
124 118 D.up(i3) = 24;
125 119 cr.lo(j) = 1;
126 120 cr.up(j) = 2;
127 121 q.lo(i) = 500;
128 122 q.up(i) = 700;
129 123
130 124 ps.fx('s0') = 500; // fix starting pressure at line one
131 125 ps.fx('s7') = 750; // fix end pressure at line two
132 126 ps.fx('s11') = 750; // fix end pressure at line three
133 127 q.fx('s0') = 600; // fix inflow at line one
134 128
135 129 l.l(i) = 40;
136 130 d.l(i) = 30;
137 131
138 132 solve gasnet minimizing cost using minlp;
139 133
140 134 Parameter
141 135 prep 'pipe report'
142 136 crep 'compressor report';
143 137
144 138 prep(i,'Discharge') = pd.l(i);
145 139 prep(i,'Suction') = ps.l(i);
146 140 prep(i,'Diameter') = d.l(i);
147 141 prep(i,'Length') = l.l(i);
148 142 prep(i,'Flow') = q.l(i);
149 143
150 144 crep(j,'Ratio')$b.l(j) = cr.l(j);
151 145 crep(j,'Work' )$b.l(j) = w.l(j);
152 146
153 147 display prep, crep;
1 54
1 55
156 COMPILATION TIME = 0.000 SECONDS 3 MB 28.2.0 r750fa45 WEX-WE»
I
157 GAMS 28.2.0 r750fa45 Released Aug 19, 2019 WEX-WEI x86 64bit/MS Windows 12/»
07/19 17:30:00 Page 2
158 Optimal Design of a Gas Transmission Network (GASNET,SEQ=223)
159 Equation Listing SOLVE gasnet Using MINLP From line 132
1 60
1 61
162 ---- pdrop =G= pressure drop in lines
1 63
164 pdrop(s1).. Pd(s1) - Ps(s1) =G= 0 ; (LHS = -300, INFES = 300 ****)
1 65
166 pdrop(s2).. Pd(s2) - Ps(s2) =G= 0 ; (LHS = -300, INFES = 300 ****)
1 67
D:\Users\Asp\Documents\gamsdir\projdir\Tuberias.lst sábado, 07 de Diciembre de 2019 05:30:22 p.m.
Page 4
2 28
2 29 REMAINING 8 ENTRIES SKIPPED
2 30
2 31
2 32 ---- crdef =E= compression definition
2 33
2 34 crdef(c1,s0,s1).. - Pd(s1) + (1)*Ps(s0) + (500)*CR(c1) =E= 0 ;
2 35
2 36 (LHS = -1300, INFES = 1300 ****)
2 37
2 38 crdef(c2,s1,s2).. - Pd(s2) + (1)*Ps(s1) + (2100)*CR(c2) =E= 0 ;
2 39
2 40 (LHS = 300, INFES = 300 ****)
2 41
2 42 crdef(c3,s2,s3).. - Pd(s3) + (1)*Ps(s2) + (2100)*CR(c3) =E= 0 ;
2 43
2 44 (LHS = 300, INFES = 300 ****)
2 45
2 46 REMAINING 8 ENTRIES SKIPPED
2 47
2 48
2 49 ---- cdef =L=
2 50
2 51 cdef(c1).. CR(c1) - b(c1) =L= 1 ; (LHS = 1)
2 52
2 53 cdef(c2).. CR(c2) - b(c2) =L= 1 ; (LHS = 1)
2 54
2 55 cdef(c3).. CR(c3) - b(c3) =L= 1 ; (LHS = 1)
2 56
2 57 REMAINING 7 ENTRIES SKIPPED
2 58
2 59
2 60 ---- cldef =E= cost of pipes
2 61
2 62 cldef.. - (26100)*l(s1) - (26100)*l(s2) - (26100)*l(s3) - (20880)*l(s4)
2 63
2 64 - (20880)*l(s5) - (20880)*l(s6) - (20880)*l(s7) - (20880)*l(s8)
2 65
2 66 - (20880)*l(s9) - (20880)*l(s10) - (20880)*l(s11) - (60900)*D(s1)
2 67
2 68 - (60900)*D(s2) - (60900)*D(s3) - (60900)*D(s4) - (60900)*D(s5)
2 69
2 70 - (60900)*D(s6) - (60900)*D(s7) - (60900)*D(s8) - (60900)*D(s9)
2 71
2 72 - (60900)*D(s10) - (60900)*D(s11) + cl =E= 0 ;
2 73
2 74 (LHS = -17173800, INFES = 17173800 ****)
2 75
2 76
2 77 ---- ccdef =E= cost of compressors
2 78
2 79 ccdef.. - 70*W(c1) - 70*W(c2) - 70*W(c3) - 70*W(c4) - 70*W(c5) - 70*W(c6)
2 80
2 81 - 70*W(c7) - 70*W(c8) - 70*W(c9) - 70*W(c10) - 10000*b(c1) - 10000*b(c2»
)
2 82
2 83 - 10000*b(c3) - 10000*b(c4) - 10000*b(c5) - 10000*b(c6) - 10000*b(c7)
2 84
2 85 - 10000*b(c8) - 10000*b(c9) - 10000*b(c10) + cc =E= 0 ; (LHS = 0)
2 86
2 87
D:\Users\Asp\Documents\gamsdir\projdir\Tuberias.lst sábado, 07 de Diciembre de 2019 05:30:22 p.m.
Page 6
3 47
3 48 Pd(s3)
3 49 (.LO, .L, .UP, .M = 1800, 1800, 2000, 0)
3 50 1 pdrop(s3)
3 51 (-0.8249) qdef(s3)
3 52 -1 crdef(c3,s2,s3)
3 53 0 (OLD LEVEL ****)
3 54
3 55 REMAINING 8 ENTRIES SKIPPED
3 56
3 57 ---- Ps suction pressure (psi)
3 58
3 59 Ps(s0)
3 60 (.LO, .L, .UP, .M = 500, 500, 500, 0)
3 61 (1) crdef(c1,s0,s1)
3 62
3 63 Ps(s1)
3 64 (.LO, .L, .UP, .M = 2100, 2100, 2300, 0)
3 65 -1 pdrop(s1)
3 66 (0.9623) qdef(s1)
3 67 (1) crdef(c2,s1,s2)
3 68 0 (OLD LEVEL ****)
3 69
3 70 Ps(s2)
3 71 (.LO, .L, .UP, .M = 2100, 2100, 2300, 0)
3 72 -1 pdrop(s2)
3 73 (0.9623) qdef(s2)
3 74 (1) crdef(c3,s2,s3)
3 75 0 (OLD LEVEL ****)
3 76
3 77 REMAINING 9 ENTRIES SKIPPED
3 78
3 79 ---- D diameter (inches)
3 80
3 81 D(s1)
3 82 (.LO, .L, .UP, .M = 10, 30, 36, 0)
3 83 (47.6584) qdef(s1)
3 84 (-60900) cldef
3 85
3 86 D(s2)
3 87 (.LO, .L, .UP, .M = 10, 30, 36, 0)
3 88 (47.6584) qdef(s2)
3 89 (-60900) cldef
3 90
3 91 D(s3)
3 92 (.LO, .L, .UP, .M = 10, 30, 36, 0)
3 93 (47.6584) qdef(s3)
3 94 (-60900) cldef
3 95
3 96 REMAINING 8 ENTRIES SKIPPED
3 97
3 98 ---- Q flow (MMCFD)
3 99
4 00 Q(s0)
4 01 (.LO, .L, .UP, .M = 600, 600, 600, 0)
4 02 (1) qbal(s0)
4 03
4 04 Q(s1)
4 05 (.LO, .L, .UP, .M = 500, 500, 700, 0)
4 06 (-1.0723) qdef(s1)
4 07 -1 qbal(s0)
D:\Users\Asp\Documents\gamsdir\projdir\Tuberias.lst sábado, 07 de Diciembre de 2019 05:30:22 p.m.
Page 8
4 08 (1) qbal(s1)
4 09 (0) wdef(c1,s1)
4 10 0 (OLD LEVEL ****)
4 11
4 12 Q(s2)
4 13 (.LO, .L, .UP, .M = 500, 500, 700, 0)
4 14 (-1.0723) qdef(s2)
4 15 -1 qbal(s1)
4 16 (1) qbal(s2)
4 17 (0) wdef(c2,s2)
4 18 0 (OLD LEVEL ****)
4 19
4 20 REMAINING 9 ENTRIES SKIPPED
4 21
4 22 ---- CR compression ratio
4 23
4 24 CR(c1)
4 25 (.LO, .L, .UP, .M = 1, 1, 2, 0)
4 26 (-19518.928) wdef(c1,s1)
4 27 (500) crdef(c1,s0,s1)
4 28 1 cdef(c1)
4 29 0 (OLD LEVEL ****)
4 30
4 31 CR(c2)
4 32 (.LO, .L, .UP, .M = 1, 1, 2, 0)
4 33 (-19518.928) wdef(c2,s2)
4 34 (2100) crdef(c2,s1,s2)
4 35 1 cdef(c2)
4 36 0 (OLD LEVEL ****)
4 37
4 38 CR(c3)
4 39 (.LO, .L, .UP, .M = 1, 1, 2, 0)
4 40 (-19518.928) wdef(c3,s3)
4 41 (2100) crdef(c3,s2,s3)
4 42 1 cdef(c3)
4 43 0 (OLD LEVEL ****)
4 44
4 45 REMAINING 7 ENTRIES SKIPPED
4 46
4 47 ---- W work (hp)
4 48
4 49 W(c1)
4 50 (.LO, .L, .UP, .M = 0, 0, +INF, 0)
4 51 1 wdef(c1,s1)
4 52 -70 ccdef
4 53 -8 ocdef
4 54
4 55 W(c2)
4 56 (.LO, .L, .UP, .M = 0, 0, +INF, 0)
4 57 1 wdef(c2,s2)
4 58 -70 ccdef
4 59 -8 ocdef
4 60
4 61 W(c3)
4 62 (.LO, .L, .UP, .M = 0, 0, +INF, 0)
4 63 1 wdef(c3,s3)
4 64 -70 ccdef
4 65 -8 ocdef
4 66
4 67 REMAINING 7 ENTRIES SKIPPED
4 68
D:\Users\Asp\Documents\gamsdir\projdir\Tuberias.lst sábado, 07 de Diciembre de 2019 05:30:22 p.m.
Page 9
8 25 c1 . 17214.880 +INF .
8 26 c2 . . +INF .
8 27 c3 . . +INF .
8 28 c4 . . +INF .
8 29 c5 . . +INF .
8 30 c6 . . +INF .
8 31 c7 . . +INF .
8 32 c8 . . +INF .
8 33 c9 . . +INF .
8 34 c10 . . +INF .
8 35
8 36 ---- VAR b compressor decision
8 37
8 38 LOWER LEVEL UPPER MARGINAL
8 39
8 40 c1 . 1.000 1.000 -0.488
8 41 c2 . . 1.000 6.9773E-5
8 42 c3 . . 1.000 4.0395E-5
8 43 c4 . . 1.000 1.1017E-5
8 44 c5 . . 1.000 7.3445E-6
8 45 c6 . . 1.000 3.6723E-6
8 46 c7 . . 1.000 EPS
8 47 c8 . . 1.000 0.014
8 48 c9 . . 1.000 EPS
8 49 c10 . . 1.000 0.010
8 50
8 51 LOWER LEVEL UPPER MARGINAL
8 52
8 53 ---- VAR cl -INF 7.8817E+6 +INF .
8 54 ---- VAR cc -INF 1.2150E+6 +INF .
8 55 ---- VAR oc -INF 1.3772E+5 +INF .
8 56 ---- VAR cost -INF 9.2345E+6 +INF .
8 57
8 58 cl pipe capital cost
8 59 cc compressor capital cost
8 60 oc operating cost
8 61
8 62
8 63 **** REPORT SUMMARY : 0 NONOPT
8 64 32 INFEASIBLE (INFES)
8 65 SUM 4662.150
8 66 MAX 800.000
8 67 MEAN 145.692
8 68 0 UNBOUNDED
8 69 0 ERRORS
8 70 GAMS 28.2.0 r750fa45 Released Aug 19, 2019 WEX-WEI x86 64bit/MS Windows 12/»
07/19 17:30:00 Page 6
871 Optimal Design of a Gas Transmission Network (GASNET,SEQ=223)
8 72 E x e c u t i o n
8 73
8 74
875 ---- 147 PARAMETER prep pipe report
8 76
8 77 Discharge Suction Diameter Length Flow
8 78
879 s1 1800.000 2100.000 10.000 70.000 597.000
880 s2 2000.000 2100.000 10.000 70.000 597.000
881 s3 2000.000 2100.000 10.000 70.000 597.000
882 s4 2000.000 2100.000 10.000 70.000 597.000
883 s5 2000.000 2100.000 10.000 70.000 597.000
884 s6 2000.000 2100.000 10.000 70.000 597.000
D:\Users\Asp\Documents\gamsdir\projdir\Tuberias.lst sábado, 07 de Diciembre de 2019 05:30:22 p.m.
Page 16