-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsectorsInit.gms
152 lines (138 loc) · 4.5 KB
/
sectorsInit.gms
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
* Loading general function definition
$INCLUDE tools%SLASH%macros.gms
********************************************************************************
* Initialize Sector Specific Data
********************************************************************************
* Initialize Sets
$INCLUDE src%SLASH%sets%SLASH%coal.gms
*$ontext
$INCLUDE src%SLASH%sets%SLASH%power.gms
$INCLUDE src%SLASH%sets%SLASH%transmission.gms
$INCLUDE src%SLASH%sets%SLASH%water.gms
$INCLUDE src%SLASH%sets%SLASH%refinery.gms
$INCLUDE src%SLASH%sets%SLASH%petchem.gms
$INCLUDE src%SLASH%sets%SLASH%cement.gms
$INCLUDE src%SLASH%sets%SLASH%emissions.gms
*$offtext
********************************************************************************
* Initialize Linking Variables
* This file makes the linking variable as positive
********************************************************************************
$INCLUDE src%SLASH%share%SLASH%linkingVariables.gms
* Initialize Variables
$INCLUDE src%SLASH%variables%SLASH%coal.gms
$ontext
$INCLUDE src%SLASH%variables%SLASH%fuel.gms
$INCLUDE src%SLASH%variables%SLASH%power.gms
$INCLUDE src%SLASH%variables%SLASH%transmission.gms
$INCLUDE src%SLASH%variables%SLASH%water.gms
$INCLUDE src%SLASH%variables%SLASH%refinery.gms
$INCLUDE src%SLASH%variables%SLASH%petchem.gms
$INCLUDE src%SLASH%variables%SLASH%cement.gms
$INCLUDE src%SLASH%variables%SLASH%emissions.gms
$offtext
* Initialize Model Coefficients (Scalars, Parameters)
$INCLUDE src%SLASH%data%SLASH%coal.gms
$ontext
$INCLUDE src%SLASH%data%SLASH%fuel.gms
$INCLUDE src%SLASH%data%SLASH%power.gms
$INCLUDE src%SLASH%data%SLASH%transmission.gms
$INCLUDE src%SLASH%data%SLASH%water.gms
$INCLUDE src%SLASH%data%SLASH%refinery.gms
$INCLUDE src%SLASH%data%SLASH%petchem.gms
$INCLUDE src%SLASH%data%SLASH%cement.gms
$INCLUDE src%SLASH%data%SLASH%emissions.gms
$offtext
********************************************************************************
* Calibration for current model instance
********************************************************************************
$ifThen exist calibFile
$include %calibFile%
$endIf
$ontext
* investment credit and fuel subsidy scenario
$INCLUDE tools%SLASH%credit_and_fuel_subsidy.gms
$INCLUDE tools%SLASH%projections.gms
$offtext
* For discounting
Parameters
UPdiscfact(time) 'discount factor for fuel sector'
ELdiscfact(time) 'discount factor for electricity sector'
TRdiscfact(time) 'discount factor for transmission sector'
WAdiscfact(time) 'discount factor for water sector'
PCdiscfact(time) 'discount factor for electricity sector'
RFdiscfact(time) 'discount factor for refining sector'
CMdiscfact(time) 'discount factor for cement sector'
;
* Discounting data is modified by projections
$INCLUDE tools%SLASH%discounting.gms
* loading previous solution
*$INCLUDE tools%SLASH%loadSolution.gms
* Model primal equations
$INCLUDE src%SLASH%equations%SLASH%coal.gms
$ontext
$INCLUDE src%SLASH%equations%SLASH%fuel.gms
$INCLUDE src%SLASH%equations%SLASH%power.gms
$INCLUDE src%SLASH%equations%SLASH%transmission.gms
$INCLUDE src%SLASH%equations%SLASH%water.gms
$INCLUDE src%SLASH%equations%SLASH%refinery.gms
$INCLUDE src%SLASH%equations%SLASH%petchem.gms
$INCLUDE src%SLASH%equations%SLASH%cement.gms
$INCLUDE src%SLASH%equations%SLASH%emissions.gms
$offtext
* Integrated LP
Equation objective;
variable objval;
objective.. objval =e=
sum(c,
+COobjval(c)$integrate('CO',c)
$ontext
+UPobjval(c)$integrate('UP',c)
+ELobjval(c)$integrate('EL',c)
+TRobjval(c)$integrate('TR',c)
+WAobjval(c)$integrate('WA',c)
+RFobjval(c)$integrate('RF',c)
+PCobjval(c)$integrate('PC',c)
+CMobjval(c)$integrate('CM',c)
+EMobjval(c)$integrate('EM',c)
$offtext
)
;
* To revert to a long-term static model:
If(card(trun)=1,
$ontext
ELleadtime(ELp)=0;
TRleadtime(r,c,rr,cc)=0;
WAleadtime(WAp)=0;
CMleadtime(CMu)=0;
RFleadtime(RFu)=0;
PCleadtime(PCp)=0;
UPtransleadtime(fup,r,c,rr,cc)=0;
UPregLeadtime=0;
UPliqLeadtime=0;
UPdiscfact(time)=1;
RFdiscfact(time)=1;
CMdiscfact(time)=1;
ELdiscfact(time)=1;
WAdiscfact(time)=1;
PCdiscfact(time)=1;
TRdiscfact(time)=1;
$offtext
COdiscfact(time)=1;
COleadtime(COf,mm,rco) = 1;
COtransleadtime(tr,rco,rrco) = 1;
);
model KEM /
objective
$ontext
,powerModel
,transmissionModel
,waterModel
,refiningModel
,petchemModel
,cementModel
,emissionsModel
,fuelModel
$offtext
,coalModel
/;