├── input.gdx
├── res
├── 1.png
└── 2.png
├── WWTRun.gms
├── README.md
├── WWTInit.gms
└── WWTMod.gms
/input.gdx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zeonchen/opt_wastewater_treatment_strategies/HEAD/input.gdx
--------------------------------------------------------------------------------
/res/1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zeonchen/opt_wastewater_treatment_strategies/HEAD/res/1.png
--------------------------------------------------------------------------------
/res/2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zeonchen/opt_wastewater_treatment_strategies/HEAD/res/2.png
--------------------------------------------------------------------------------
/WWTRun.gms:
--------------------------------------------------------------------------------
1 | *model to optimize usage of PCM storage in cooling grid
2 |
3 | *Name of optimization
4 | $set Name WWTResource
5 |
6 | *reading in the parameters for optimization
7 | $GDXIN input.gdx
8 |
9 | $include WWTInitt.gms
10 |
11 | $include WWTMod.gms
12 |
13 | file hCplex_Option /cplex.opt/;
14 | put hCplex_Option "epgap=" gap:0:12/;
15 | put hCplex_Option "tilim="timelimit:0:0/;
16 | put hCplex_Option "threads="threads:0:0 /;
17 | put hCplex_Option 'mipkappastats 2' /;
18 | put hCplex_Option 'quality 1' /;
19 | put hCplex_Option 'mipstart 1' /;
20 | putclose;
21 |
22 | option limrow=0
23 | limcol=0
24 | Solprint=off;
25 | $Offsymlist
26 | $Offsymxref
27 |
28 | WWTModel.optfile=1;
29 |
30 | solve WWTModel USING MIP MAXIMIZING Objective;
31 |
32 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
33 | * Generate GDX
34 |
35 | execute_unload 'results_DisCostRec2.gdx' dis.l,len.l,PT.l,DelP.l,delt.l,mu.l,Chi.l,Pi.l,Z.l,alpha.l,v.l,phi.l,gamma.l,omega.l,dis.l,rs.l,fl.l,R.l,del_alt.l,epsil.l,z13.l,z1.l,z3.l,z4.l;
36 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Optimisation of wastewater treatment strategies in eco-industrial parks: Technology, location and transport
2 | Optimise wastewater supply chain based on Mixed Integer Linear Programming (MILP).
3 |
4 | ## Introduction
5 |
6 | The expanding population and rapid urbanisation, in particular in the Global South, are leading to global challenges on resource supply stress and rising waste generation. A transformation to resource-circular systems and sustainable recovery of carbon-containing and nutrient-rich waste offers a way to tackle such challenges. Eco-industrial parks have the potential to capture symbioses across individual waste producers, leading to more effective waste-recovery schemes. With whole-system design, economically attractive approaches can be achieved, reducing the environmental impacts while increasing the recovery of high-value resources. In this paper, an optimisation framework is developed to enable such design, allowing for wide ranging treatment options to be considered capturing both technological and financial detail. As well as technology selection, the framework also accounts for spatial aspects, with the design of suitable transport networks playing a key role. A range of scenarios are investigated using the network, highlighting the multi-faceted nature of the problem. The need to incorporate the impact of resource recovery at the design stage is shown to be of particular importance.
7 |
8 | ## Results
9 |
10 |
11 |
12 |
13 |
14 |
15 | ## Paper
16 | [Elsevier version](https://www.sciencedirect.com/science/article/pii/S1385894719320467)
17 |
18 | [Arxiv version](https://arxiv.org/abs/2005.09987)
19 |
20 | ### Cite the paper as follows:
21 |
22 | @article{o2020optimisation,
23 | title={Optimisation of wastewater treatment strategies in eco-industrial parks: Technology, location and transport},
24 | author={O’Dwyer, Edward and Chen, Kehua and Wang, Hongcheng and Wang, Aijie and Shah, Nilay and Guo, Miao},
25 | journal={Chemical Engineering Journal},
26 | volume={381},
27 | pages={122643},
28 | year={2020},
29 | publisher={Elsevier}}
30 |
--------------------------------------------------------------------------------
/WWTInit.gms:
--------------------------------------------------------------------------------
1 | SETS
2 | nx cell number From (X-direction)
3 | ny cell number From (Y-direction)
4 | j wastestream number
5 | t time steps
6 | p components paramters & resources associated with waste stream
7 | dp(p) Demand(useful) components associated with waste stream
8 | * mp(p) Resources that are input to plants
9 | m Technologies including treatment recovery and joints
10 | jm(m) Joints between different waste streams
11 | * tr(m) Treatment technology
12 | re(m) recovery technology
13 | trure(m) Union of tr re
14 | l piping material
15 | el elevation (between cells) sets
16 | obj_set objective functions;
17 |
18 | ALIAS (nx, np)
19 | (ny, nq);
20 |
21 | $LOAD nx ny j t p dp m jm re trure l el obj_set
22 |
23 | PARAMETERS
24 | * t_horizon time horizon in years
25 | gen(p,j,nx,ny) waste|resources generated in cell
26 | gYN(j,nx,ny) is there a generation source here?
27 | Capl(el,l) Transport capex
28 | Opl(l,el) Transport opex
29 | distance(nx,ny,np,nq) Distance between (nx ny) and (np nq)
30 | Flmin(m,p) minimum flow restriction of technology
31 | Promax(m) Maximum flow capacity for technology
32 | Con(m,p) conversion through technology
33 | Con2(m,p) Negative conversions through technology
34 | Con3(m,p) Positive conversions through technology
35 | C(j,p) Concentration of p in flow j
36 | pmax(p) Max allowable discharge quantity for a specific waste constituent
37 | pmin(p) Min allowable discharge quantity for a specific waste constituent
38 | Del(nx,ny,np,nq,el) Elevation classification between two cells
39 | Capm(m) Cost of different treatment technologies
40 | Opm(m) Operational cost of different treatment technologies
41 | Opdis(p) Cost of waste disposal
42 | Price(dp) Price of sellable component p
43 | Install(l,el) Unit installation costs for pipe l and elevation el
44 | FLOW(l) Flow rate through particular pipe type
45 | fl_up Upper flow bound
46 | small Small number for optimisation
47 | small1 Small number for optimisation
48 | * sig(p,re) User-defined binary - resource\compound p flow through recovery technology
49 | * Tax(p) Tax on discharge of component
50 | * Sub(dp) Subsidy for discharge of component
51 | gap relative optimization tolerance
52 | timelimit maximum allowed time for solver
53 | threads number of threads for solver;
54 |
55 | $LOAD gen gYN Capl Opl distance Flmin Promax Con Con2 Con3 C pmax pmin Del Capm Price Install FLOW Opm Opdis fl_up small small1 gap timelimit threads
56 |
--------------------------------------------------------------------------------
/WWTMod.gms:
--------------------------------------------------------------------------------
1 | FREE VARIABLE
2 | Z(obj_set) Objectives
3 | OBJECTIVE Objective
4 | Costl Transport costs
5 | Costt Treatment costs
6 | Costfin Miscellaneous costs (taxes subsidies etc.)
7 | DelP(j,p,nx,ny,m,t) Removal efficiency of a plant or technology unit for stream j
8 |
9 | POSITIVE VARIABLE
10 | PT(m,nx,ny,p,t) Production rate of tech m in cell x over t (output_unit time)
11 | fl(j,nx,ny,np,nq,t) Flowrate of j passing from x to x at time t
12 | dis(j,p,t) resources disposed of from stream
13 | rs(p,t) resources recovered of from stream
14 | R(m,nx,ny,p,t) Recovery_removal for p at removal_recovery plant m (output_unit time)
15 | len Total pipeline length
16 | mu(l) Hypothetical cost of pipeline all pipelines
17 | z1(l) Linearisation variable for Eq28
18 | z4(j,nx,ny,np,nq,t) Linearisation variable for Eq18
19 | * z8(j,nx,ny,np,nq,t) Linearisation variable for Eq24
20 | z13(j,nx,ny,np,nq,m,t) alpha(m_x)*fl(x'_x)
21 | * z13a(j,nx,ny,np,nq,jm,t) alpha(jm_x)*fl(x_x')
22 |
23 | BINARY VARIABLE
24 | alpha(j,nx,ny,m) Technology specifically applied to wastestream j in cell? (1->yes|0->no)
25 | omega(nx,ny,m) Technology applied to any wastestream in cell? (1->yes|0->no)
26 | v(j,nx,ny) Is at least one technology in a cell for waste stream j? (1->yes|0->no)
27 | gamma(nx,ny,np,nq) Is there a direct path between (nx ny) and (np nq) without passing a connection?
28 | delt(l) Pipe type installation method l is selected
29 | epsil(j) Does j pass through any joint? (1->yes|0->no)
30 | phi(nx,ny,np,nq) Does any stream go from a generation at x to a joint at x?
31 | PI(nx,ny,np,nq) Does any stream go from a joint at x to a technology at x?
32 | del_alt(nx,ny,np,nq) Is a pipe line present between x and x?
33 | Chi(j,nx,ny,np,nq) Is there a path between a joint and a treatment plant between x and x
34 | * z2(j,nx,ny,np,nq,jm,trure) Linearisation variable for Eq23
35 | z3(j,np,nq) Linearisation variable for Eq25
36 |
37 | EQUATIONS
38 | *Pipeline constraints:
39 | Eq1 Cost of stream j pipeline based on elevation
40 | Eq2 Only one pipe type
41 |
42 | Eq4 All generated waste in a cell must go somewhere
43 | Eq4_a All generated waste in a cell must go to somewhere
44 | Eq4_a1 All generated waste in a cell must go to somewhere
45 | Eq4_a2 All generated waste in a cell must go to somewhere
46 | Eq4_a3 All generated waste in a cell must go to somewhere
47 | Eq4_a4 All generated waste in a cell must go to somewhere
48 | Eq5 Flow bounds through pipe
49 | * Eq5_a Flow bounds through pipe
50 | ;
51 |
52 | Eq1(l).. mu(l) =e= sum((nx,ny,np,nq,el),Del(nx,ny,np,nq,el)*(Install(l,el)+Opl(l,el))*del_alt(nx,ny,np,nq)*distance(nx,ny,np,nq)*5);
53 | Eq2.. sum(l,delt(l))=e=1;
54 | *Flow rate calcs
55 | Eq4(j,nx,ny,p,t).. sum((np,nq),fl(j,nx,ny,np,nq,t)*C(j,p)) =l= gen(p,j,nx,ny)+sum((jm,np,nq),z13(j,nx,ny,np,nq,jm,t)*C(j,p));
56 | Eq4_a(j,nx,ny,np,nq,t).. sum(jm,z13(j,np,nq,nx,ny,jm,t)) =e= z4(j,nx,ny,np,nq,t)*gYN(j,nx,ny);
57 | Eq4_a1(j,nx,ny,np,nq,t).. z4(j,nx,ny,np,nq,t) =l= epsil(j)*36500000;
58 | Eq4_a2(j,nx,ny,np,nq,t).. z4(j,nx,ny,np,nq,t) =l= fl(j,nx,ny,np,nq,t);
59 | Eq4_a3(j,nx,ny,np,nq,t).. z4(j,nx,ny,np,nq,t) =g= fl(j,nx,ny,np,nq,t)-(1-epsil(j))*36500000;
60 | Eq4_a4(j,nx,ny,np,nq,t).. z4(j,nx,ny,np,nq,t) =g= 0;
61 | Eq5(nx,ny,np,nq,t).. sum(j,fl(j,nx,ny,np,nq,t)) =l= sum(l,FLOW(l)*delt(l));
62 | *Eq5_a(np,nq,t).. sum((j,nx,ny),fl(j,nx,ny,np,nq,t)) =l= sum(l,FLOW(l)*delt(l));
63 |
64 | *Treatment technology constraints
65 | EQUATIONS
66 | Eq7 The removed resource is ProductionRate x Conversion parameter associated with a technology
67 | Eq9 For each plant the amount converted is equal to the total flow into the cell times the Concentration of each times a binary (1 if tech is in cell 0 if not)
68 | Eq9_1 Linearisation of Eq9
69 | Eq9_2 Linearisation of Eq9
70 | Eq9_3 Linearisation of Eq9
71 | Eq9_4 Linearisation of Eq9
72 | * Eq9_5 Flow through joint
73 | Eq9a Flow into cell with joint is same as flow out of cell with joint
74 | * Eq9a_1 Linearisation of joint binary times flow out of cell
75 | * Eq9a_2 Linearisation of joint binary times flow out of cell
76 | * Eq9a_3 Linearisation of joint binary times flow out of cell
77 | * Eq9a_4 Linearisation of joint binary times flow out of cell
78 | Eq10 The resource removed is less than the upper capacity bound of technology
79 | Eq11 Removed resource by tech in stream in cell is the sum of total flow into the cell times the Concentration times the conversion times a binary (1 if tech is in cell 0 if not)
80 | Eq12 Discharged resource is generated plus change in resource
81 | Eq13 Recovered resources are the sum of the changes resource across all useful resources
82 | Eq15 Discharged is leq than some restricted limit
83 | Eq15a Discharged is leq than some restricted limit
84 | * Eq16 Discharged is geq than some restricted limit
85 | * Eq17 Removed resource is geq than some restricted limit
86 | ;
87 |
88 | Eq7(m,nx,ny,p,t).. R(m,nx,ny,p,t) =e= Con3(m,p)*PT(m,nx,ny,p,t);
89 |
90 | Eq9(trure,nx,ny,p,t)$(Con(trure,p)<0).. PT(trure,nx,ny,p,t) =l= -sum((j,np,nq),z13(j,nx,ny,np,nq,trure,t)*C(j,p)*Con(trure,p));
91 | Eq9_1(j,nx,ny,np,nq,m,p,t).. z13(j,nx,ny,np,nq,m,t) =l= alpha(j,nx,ny,m)*36500000;
92 | Eq9_2(j,nx,ny,np,nq,m,p,t).. z13(j,nx,ny,np,nq,m,t) =l= fl(j,np,nq,nx,ny,t);
93 | Eq9_3(j,nx,ny,np,nq,m,p,t).. z13(j,nx,ny,np,nq,m,t) =g= fl(j,np,nq,nx,ny,t)-(1-alpha(j,nx,ny,m))*36500000;
94 | Eq9_4(j,nx,ny,np,nq,m,p,t).. z13(j,nx,ny,np,nq,m,t) =g= 0;
95 |
96 | Eq9a(j,nx,ny,t).. sum((np,nq),fl(j,nx,ny,np,nq,t)) =g= sum((jm,np,nq),z13(j,nx,ny,np,nq,jm,t));
97 | *Eq9a(j,nx,ny,t).. sum((jm,np,nq),z13a(j,nx,ny,np,nq,jm,t)) =e= sum((jm,np,nq),z13(j,nx,ny,np,nq,jm,t));
98 | *Eq9a_1(j,nx,ny,np,nq,jm,p,t).. z13a(j,nx,ny,np,nq,jm,t) =l= alpha(j,nx,ny,jm)*36500000;
99 | *Eq9a_2(j,nx,ny,np,nq,jm,p,t).. z13a(j,nx,ny,np,nq,jm,t) =l= fl(j,nx,ny,np,nq,t);
100 | *Eq9a_3(j,nx,ny,np,nq,jm,p,t).. z13a(j,nx,ny,np,nq,jm,t) =g= fl(j,nx,ny,np,nq,t)-(1-alpha(j,nx,ny,jm))*36500000;
101 | *Eq9a_4(j,nx,ny,np,nq,jm,p,t).. z13a(j,nx,ny,np,nq,jm,t) =g= 0;
102 |
103 | Eq10(trure,nx,ny,p,t).. sum((j,np,nq),z13(j,nx,ny,np,nq,trure,t)) =l= Promax(trure);
104 | *Eq10(m,nx,ny,p,t).. sum(j,DelP(j,p,nx,ny,m,t)) =l= Promax(m,p);
105 | Eq11(j,p,nx,ny,trure,t).. DelP(j,p,nx,ny,trure,t) =e= sum((np,nq),z13(j,nx,ny,np,nq,trure,t)*C(j,p)*Con2(trure,p));
106 | Eq12(j,p,t).. dis(j,p,t) =e= sum((nx,ny),gen(p,j,nx,ny)+sum((trure),DelP(j,p,nx,ny,trure,t)));
107 | Eq13(dp,t).. rs(dp,t) =e= sum((nx,ny,re),R(re,nx,ny,dp,t));
108 | *Eq16(j,p,t).. pmin(p)-dis(j,p,t) =l= 0;
109 | Eq15(t).. sum(j,dis(j,'p_2',t)) =l= pmax('p_5');
110 | Eq15a(t).. sum(j,dis(j,'p_3',t)) =l= pmax('p_6');
111 | *Eq16(j,p,t).. pmin(p)-dis(j,p,t) =l= 0;
112 | *Eq17(m,p,nx,ny,t).. Flmin(m,p)-R(m,nx,ny,p,t) =l= 0;
113 |
114 |
115 | *Transport constraints
116 | EQUATIONS
117 | Eq19 For each stream in each cell is there a Treatment_recovery plant
118 | Eq19a For each stream in each cell is there a Treatment_recovery plant
119 | Eq20 For any of the streams in each cell is there a plant or joint
120 | Eq20a For any of the streams in each cell is there a plant or joint
121 | Eq21 Does each stream pass a joint in each cell
122 | Eq21a Does each stream pass a joint in each cell
123 | Eq22 Is there a pathway between a waste generator in x and a joint in x
124 | Eq22a Is there a pathway between a waste generator in x and a joint in x
125 | Eq23 Is there a potential pathway between a joint in x and a treatment plant in x
126 | Eq23_1 Linearisation of Eq23
127 | Eq23_2 Linearisation of Eq23
128 | * Eq23_3 Linearisation of Eq23
129 | * Eq23a Is there a potential pathway between a joint in x and a treatment plant in x
130 | Eq24 Is there flow between a joint in x and a treatment plant in x
131 | * Eq24_1 Linearisation of Eq24
132 | * Eq24_2 Linearisation of Eq24
133 | * Eq24_3 Linearisation of Eq24
134 | * Eq24_4 Linearisation of Eq24
135 | Eq24a Is there flow between a joint in x and a treatment plant in x
136 | Eq25 Is there a direct pathway between a generator and Treatment plant
137 | Eq25_1 Linearisation of Eq25
138 | Eq25_2 Linearisation of Eq25
139 | Eq25_3 Linearisation of Eq25
140 | Eq25a Is there a direct pathway between a generator and Treatment plant
141 | Eq26 Is there any pathway between x and x
142 | Eq27 Total transport distance calculaton;
143 |
144 |
145 | Eq19(j,nx,ny).. v(j,nx,ny) =g= small*sum(trure,alpha(j,nx,ny,trure));
146 | Eq19a(j,nx,ny).. 1-v(j,nx,ny) =g= -small*(sum(trure,alpha(j,nx,ny,trure)))+small/2;
147 | Eq20(nx,ny,m).. omega(nx,ny,m) =g= small*sum(j,alpha(j,nx,ny,m));
148 | Eq20a(nx,ny,m).. 1-omega(nx,ny,m) =g= -small*(sum(j,alpha(j,nx,ny,m)))+small/2;
149 | Eq21(j).. epsil(j) =g= small*sum((jm,nx,ny),alpha(j,nx,ny,jm));
150 | Eq21a(j).. 1-epsil(j) =g= -small*(sum((jm,nx,ny),alpha(j,nx,ny,jm)))+small/2;
151 | Eq22(nx,ny,np,nq,jm).. phi(nx,ny,np,nq) =g= small*sum(j,alpha(j,nx,ny,jm)*gYN(j,np,nq));
152 | Eq22a(nx,ny,np,nq,jm).. 1-phi(nx,ny,np,nq) =g= -small*(sum(j,alpha(j,nx,ny,jm)*gYN(j,np,nq)))+small/2;
153 |
154 | Eq23(j,nx,ny,np,nq).. Chi(j,nx,ny,np,nq) =g= -1+sum(jm,alpha(j,nx,ny,jm))+sum(trure,alpha(j,np,nq,trure));
155 | Eq23_1(j,nx,ny,np,nq).. Chi(j,nx,ny,np,nq) =l= sum(jm,alpha(j,nx,ny,jm));
156 | Eq23_2(j,nx,ny,np,nq).. Chi(j,nx,ny,np,nq) =l= sum(trure,alpha(j,np,nq,trure));
157 |
158 | *Eq23(j,nx,ny,np,nq).. Chi(j,nx,ny,np,nq) =g= small*sum((jm,trure),z2(j,nx,ny,np,nq,jm,trure));
159 | *Eq23_1(j,nx,ny,np,nq,jm,trure).. z2(j,nx,ny,np,nq,jm,trure) =l= alpha(j,nx,ny,jm);
160 | *Eq23_2(j,nx,ny,np,nq,jm,trure).. z2(j,nx,ny,np,nq,jm,trure) =l= alpha(j,np,nq,trure);
161 | *Eq23_3(j,nx,ny,np,nq,jm,trure).. z2(j,nx,ny,np,nq,jm,trure) =g= alpha(j,nx,ny,jm)+alpha(j,np,nq,trure)-1;
162 | *Eq23a(j,nx,ny,np,nq).. 1-Chi(j,nx,ny,np,nq) =g= -small*(sum((jm,trure),z2(j,nx,ny,np,nq,jm,trure)))+small/2;
163 |
164 | Eq24(nx,ny,np,nq).. Pi(nx,ny,np,nq) =g= small*sum(j,Chi(j,nx,ny,np,nq));
165 | *Eq24_1(j,nx,ny,np,nq,t).. z8(j,nx,ny,np,nq,t) =l= Chi(j,nx,ny,np,nq)*36500000;
166 | *Eq24_2(j,nx,ny,np,nq,t).. z8(j,nx,ny,np,nq,t) =l= fl(j,nx,ny,np,nq,t);
167 | *Eq24_3(j,nx,ny,np,nq,t).. z8(j,nx,ny,np,nq,t) =g= fl(j,nx,ny,np,nq,t)-(1-Chi(j,nx,ny,np,nq))*36500000;
168 | *Eq24_4(j,nx,ny,np,nq,t).. z8(j,nx,ny,np,nq,t) =g= 0;
169 |
170 | Eq24a(nx,ny,np,nq).. 1-Pi(nx,ny,np,nq) =g= -small*(sum(j,Chi(j,nx,ny,np,nq)))+small/2;
171 |
172 | Eq25(nx,ny,np,nq).. gamma(nx,ny,np,nq) =g= small*sum(j,gYN(j,nx,ny)*v(j,np,nq)-gYN(j,nx,ny)*z3(j,np,nq));
173 | Eq25_1(j,np,nq).. z3(j,np,nq) =l= v(j,np,nq);
174 | Eq25_2(j,np,nq).. z3(j,np,nq) =l= epsil(j);
175 | Eq25_3(j,np,nq).. z3(j,np,nq) =g= v(j,np,nq)+epsil(j)-1;
176 | Eq25a(nx,ny,np,nq).. 1-gamma(nx,ny,np,nq) =g= -small*(sum(j,gYN(j,nx,ny)*v(j,np,nq)-gYN(j,nx,ny)*z3(j,np,nq)))+small/2;
177 |
178 | Eq26(nx,ny,np,nq).. del_alt(nx,ny,np,nq) =g= small*(phi(np,nq,nx,ny)+gamma(nx,ny,np,nq)+Pi(nx,ny,np,nq));
179 | Eq27.. len =e= sum((nx,ny,np,nq),del_alt(nx,ny,np,nq)*distance(nx,ny,np,nq));
180 |
181 | *Costs and objectives
182 | EQUATIONS
183 | Eq28 Cost of the pipeline
184 | Eq28_1 Linearisation of Eq28
185 | Eq28_2 Linearisation of Eq28
186 | Eq28_3 Linearisation of Eq28
187 | Eq28_4 Linearisation of Eq28
188 | Eq29 Cost of the technology
189 | Eq30 Miscellaneous financial and policy based costs;
190 |
191 | Eq28.. Costl =e= sum((l),z1(l));
192 | Eq28_1(l).. z1(l) =l= delt(l)*1000000;
193 | Eq28_2(l).. z1(l) =l= mu(l);
194 | Eq28_3(l).. z1(l) =g= mu(l)-(1-delt(l))*1000000;
195 | Eq28_4(l).. z1(l) =g= 0;
196 |
197 | Eq29.. Costt =e= sum((nx,ny,m),Capm(m)*omega(nx,ny,m)+sum((j,np,nq,t),z13(j,nx,ny,np,nq,m,t))*Opm(m));
198 | Eq30.. Costfin =e= sum((j,p,t),dis(j,p,t)*(Opdis(p)));
199 |
200 | EQUATIONS
201 | CostTot Total costs
202 | CostPipe Pipeline cost
203 | CostTreat Treatment_recovery_connection costs
204 | CostMisc Miscellaneous financial and policy costs
205 | MoneyIn Resources sold
206 | TotObj Full problem objective
207 | total Set objective variable;
208 |
209 | CostTot.. Z('TotalCost') =e= Costl + Costt + Costfin;
210 | *CostTot.. Z('TotalCost') =e= Costl + Costfin;
211 | CostPipe.. Z('PipeCost') =e= Costl;
212 | CostTreat.. Z('TreatCost') =e= Costt;
213 | CostMisc.. Z('MiscCost') =e= Costfin;
214 | MoneyIn.. Z('ResourceSold') =e= sum((t,dp),rs(dp,t)*Price(dp)/2);
215 | TotObj.. Z('Obj') =e= Z('ResourceSold')-Z('TotalCost');
216 | total.. Z('Obj') =e= OBJECTIVE;
217 |
218 |
219 | EQUATIONS
220 | ExtraEq1 Set inputs and outputs
221 | ExtraEq2 Set inputs and outputs
222 | ExtraEq3 Set inputs and outputs
223 | ExtraEq4 Set inputs and outputs
224 | ExtraEq5 Set inputs and outputs
225 | ExtraEq6 Set inputs and outputs
226 |
227 | ExtraEq100 Set inputs and outputs
228 | ExtraEq101 Set inputs and outputs
229 | ExtraEq102 Set inputs and outputs
230 | * ExtraEq103 Set inputs and outputs
231 | * ExtraEq104 Set inputs and outputs
232 | * ExtraEq105 Set inputs and outputs
233 | * ExtraEq106 Set inputs and outputs
234 | * ExtraEq107 Set inputs and outputs
235 | * ExtraEq108 Set inputs and outputs
236 | * ExtraEq7 Set inputs and outputs
237 | * ExtraEq8 Set inputs and outputs
238 | * ExtraEq9 Set inputs and outputs
239 | * ExtraEq10 Set inputs and outputs
240 | * ExtraEq11 Set inputs and outputs
241 | * ExtraEq12 Set inputs and outputs
242 | * ExtraEq13 Set inputs and outputs
243 |
244 | * ExtraEq7 Set inputs and outputs
245 | * ExtraEq8 Set inputs and outputs
246 | * ExtraEq9 Set inputs and outputs
247 | * ExtraEq10 Set inputs and outputs
248 | * ExtraEq11 Set inputs and outputs
249 | * ExtraEq12 Set inputs and outputs
250 | * ExtraEq13 Set inputs and outputs
251 | * ExtraEq14 Set inputs and outputs
252 | * ExtraEq15 Set inputs and outputs
253 | * ExtraEq16 Set inputs and outputs
254 | * ExtraEq17 Set inputs and outputs
255 | * ExtraEq18 Set inputs and outputs
256 | * ExtraEq19 Set inputs and outputs
257 | * ExtraEq20 Set inputs and outputs
258 | ;
259 |
260 | ExtraEq1(m,nx,ny,t).. PT(m,nx,ny,'p_1',t) =e= PT(m,nx,ny,'p_4',t);
261 | ExtraEq2(m,nx,ny,t).. PT(m,nx,ny,'p_2',t) =e= PT(m,nx,ny,'p_5',t);
262 | ExtraEq3(m,nx,ny,t).. PT(m,nx,ny,'p_3',t) =e= PT(m,nx,ny,'p_6',t);
263 |
264 | ExtraEq4(j).. sum((trure,nx,ny),alpha(j,nx,ny,trure)) =e= 1;
265 | ExtraEq5(j).. sum((jm,nx,ny),alpha(j,nx,ny,jm)) =l= 1;
266 | ExtraEq6(j,nx,ny).. sum(m,alpha(j,nx,ny,m)) =l= 1;
267 |
268 | ExtraEq100(j).. sum((trure,nx,ny),alpha(j,nx,ny,trure)) =g= sum((jm,nx,ny),alpha(j,nx,ny,jm));
269 | ExtraEq101(nx,ny,np,nq).. phi(nx,ny,np,nq) =l= sum((j,jm),alpha(j,nx,ny,jm));
270 | ExtraEq102(nx,ny,np,nq).. phi(np,nq,nx,ny) =l= sum(j,gYN(j,nx,ny));
271 |
272 | *ExtraEq103(t).. sum((np,nq),fl('j_1','nx_2','ny_1',np,nq,t)) =e= 36500000;
273 | *ExtraEq104(t).. sum((np,nq),fl('j_2','nx_1','ny_2',np,nq,t)) =e= 36500000;
274 | *ExtraEq105(t).. sum((np,nq),fl('j_3','nx_4','ny_1',np,nq,t)) =e= 29200000;
275 | *ExtraEq106(t).. sum((np,nq),fl('j_4','nx_7','ny_6',np,nq,t)) =e= 14600000;
276 | *ExtraEq106(t).. sum((np,nq),fl('j_4','nx_3','ny_4',np,nq,t)) =e= 14600000;
277 | *ExtraEq107(t).. sum((np,nq),fl('j_5','nx_6','ny_6',np,nq,t)) =e= 10950000;
278 | *ExtraEq107(t).. sum((np,nq),fl('j_5','nx_4','ny_4',np,nq,t)) =e= 10950000;
279 |
280 | *ExtraEq108(j,nx,ny,jm).. alpha(j,nx,ny,jm) =e= 0;
281 |
282 | *ExtraEq108.. sum((trure,nx,ny),omega(nx,ny,trure)) =e= 1;
283 |
284 | *ExtraEq7.. delt('l_2') =e= 1;
285 | **ExtraEq4.. rs('p_4','t_1') =g= 0.001;
286 | **ExtraEq6.. phi('nx_5','ny_3','nx_7','ny_6') =e= 1;
287 | *ExtraEq9.. fl('j_4','nx_7','ny_6','nx_5','ny_3','t_1') =g= 0.0001;
288 | *ExtraEq10.. fl('j_4','nx_5','ny_3','nx_4','ny_1','t_1') =g= 0.0001;
289 | *ExtraEq11.. alpha('j_4','nx_4','ny_1','m_2') =e= 1;
290 | *ExtraEq12.. fl('j_5','nx_6','ny_6','nx_5','ny_3','t_1') =g= 0.0001;
291 | *ExtraEq13.. fl('j_5','nx_5','ny_3','nx_4','ny_1','t_1') =g= 0.0001;
292 | **phi('nx_6','ny_6','nx_5','ny_3') =e= 1;
293 |
294 | *ExtraEq7.. alpha('j_1','nx_2','ny_2','m_1') =e= 1;
295 | *ExtraEq8.. alpha('j_2','nx_2','ny_2','m_1') =e= 1;
296 | *ExtraEq9.. alpha('j_1','nx_5','ny_4','m_3') =e= 1;
297 | *ExtraEq10.. alpha('j_2','nx_5','ny_4','m_3') =e= 1;
298 | *ExtraEq11.. alpha('j_3','nx_5','ny_4','m_3') =e= 1;
299 | *ExtraEq12.. alpha('j_4','nx_5','ny_4','m_3') =e= 1;
300 | *ExtraEq13.. alpha('j_5','nx_5','ny_4','m_3') =e= 1;
301 | *ExtraEq14.. fl('j_1','nx_2','ny_1','nx_2','ny_2','t_1') =e= 36500000;
302 | *ExtraEq15.. fl('j_1','nx_2','ny_2','nx_5','ny_4','t_1') =e= 36500000;
303 | *ExtraEq16.. fl('j_2','nx_1','ny_2','nx_2','ny_2','t_1') =e= 36500000;
304 | *ExtraEq17.. fl('j_2','nx_2','ny_2','nx_5','ny_4','t_1') =e= 36500000;
305 | *ExtraEq18.. fl('j_3','nx_4','ny_1','nx_5','ny_4','t_1') =e= 29200000;
306 | *ExtraEq19.. fl('j_4','nx_7','ny_6','nx_5','ny_4','t_1') =e= 14600000;
307 | *ExtraEq20.. fl('j_5','nx_6','ny_6','nx_5','ny_4','t_1') =e= 10950000;
308 |
309 |
310 | *alpha.l('j_1','nx_2','ny_2','m_1') = 1;
311 | *alpha.l('j_2','nx_2','ny_2','m_1') = 1;
312 | *alpha.l('j_1','nx_5','ny_4','m_3') = 1;
313 | *alpha.l('j_2','nx_5','ny_4','m_3') = 1;
314 | *alpha.l('j_3','nx_5','ny_4','m_3') = 1;
315 | *alpha.l('j_4','nx_5','ny_4','m_3') = 1;
316 | *alpha.l('j_5','nx_5','ny_4','m_3') = 1;
317 | *fl.l('j_1','nx_2','ny_1','nx_2','ny_2','t_1') = 36500000;
318 | *fl.l('j_1','nx_2','ny_2','nx_5','ny_4','t_1') = 36500000;
319 | *fl.l('j_2','nx_1','ny_2','nx_2','ny_2','t_1') = 36500000;
320 | *fl.l('j_2','nx_2','ny_2','nx_5','ny_4','t_1') = 36500000;
321 | *fl.l('j_3','nx_4','ny_1','nx_5','ny_4','t_1') = 29200000;
322 | *fl.l('j_4','nx_7','ny_6','nx_5','ny_4','t_1') = 14600000;
323 | *fl.l('j_5','nx_6','ny_6','nx_5','ny_4','t_1') = 10950000;
324 | *z13.l('j_1','nx_2','ny_2','nx_2','ny_1','m_1','t_1') = 36500000;
325 | *z13.l('j_1','nx_5','ny_4','nx_2','ny_2','m_3','t_1') = 36500000;
326 | *z13.l('j_2','nx_2','ny_2','nx_1','ny_2','m_1','t_1') = 36500000;
327 | *z13.l('j_2','nx_5','ny_4','nx_2','ny_2','m_3','t_1') = 36500000;
328 | *z13.l('j_3','nx_5','ny_4','nx_4','ny_1','m_3','t_1') = 29200000;
329 | *z13.l('j_4','nx_5','ny_4','nx_7','ny_6','m_3','t_1') = 14600000;
330 | *z13.l('j_5','nx_5','ny_4','nx_6','ny_6','m_3','t_1') = 10950000;
331 | *Pi.l('nx_2','ny_2','nx_5','ny_4') = 1;
332 | *phi.l('nx_2','ny_2','nx_1','ny_2') = 1;
333 | *phi.l('nx_2','ny_2','nx_2','ny_1') = 1;
334 | model WWTModel /all/;
335 |
336 |
--------------------------------------------------------------------------------