forked from Irieo/IntEG
-
Notifications
You must be signed in to change notification settings - Fork 0
/
IntEG_V20_S2(ECIU_EUCO).gms
177 lines (121 loc) · 9.11 KB
/
IntEG_V20_S2(ECIU_EUCO).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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
*#################################################################################################################################
* SCENARIO 2: ECIU - EUCO
*#################################################################################################################################
*Location of output files for this scenario
$set resultdir output_v20_EUCO\
$include IntEG_v20_clear.gms
$if "%Inc_Stoch%" == "" $goto ScenMatrixEnd
scen('EVP') = no;
scen('EUCO') = yes;
scen('ST') = no;
scen('DG') = no;
$Label ScenMatrixEnd
display scen;
number_scenarios = card(scen);
###############################################################################
* Defining RESULTS parameters
*###############################################################################
$include IntEG_v20_declar_results.gms
*############################# STEP 1: DECLARING PARAMETERS ####################
* DEFININING GAS PARAMETERS FOR SCENARIO
nonPowerDem(co,year,month,scen) = cons_EUCO(co, year, month)*(1-PS_EUCO(co, year));
* Scaling quantities in Gas Model
LP_prodCap(p,n,year,month) = LP_prodCap(p,n,year,month) /conversion_factor_gas ;
transCap(n,m) = transCap(n,m) /conversion_factor_gas ;
extra_cap(n,m, year, month) = extra_cap(n,m, year, month) /conversion_factor_gas ;
nonPowerDem(co,year,month,scen) = nonPowerDem(co,year,month,scen)/conversion_factor_gas ;
stor_cons_cap(co,year, month) = stor_cons_cap(co,year, month) /conversion_factor_gas ;
stor_cons_in(co, year, month) = stor_cons_in(co,year, month) /conversion_factor_gas ;
stor_cons_out(co,year, month) = stor_cons_out(co,year, month) /conversion_factor_gas ;
st_lev_start(co) = st_lev_start(co) /conversion_factor_gas ;
st_lev_end(co) = st_lev_end(co) /conversion_factor_gas ;
LTC(n,m,year, month) = LTC(n,m,year, month) /conversion_factor_gas ;
;
* DEFININING EL PARAMETERS FOR SCENARIO
demand(co,t,year,scen) = demand_upload(co,t,year,"EUCO_up");
cap_existing(i,n,year,scen) = cap_existing_upload(i,n,year,"EUCO_up");
fc(i,co,year,scen) = fc_upload(i,co,year,"EUCO_up") ;
co2_price(scen,year) = co2_price_upload("EUCO_up", year);
vc_f(i,co,year,scen) = (fc_upload(i,co,year,"EUCO_up")+ carb_cont(i)*co2_price_upload('EUCO_up',year))/ eta_f(i,co,year);
vc_m(i,co,year,scen) = (fc_upload(i,co,year,"EUCO_up")+ carb_cont(i)*co2_price_upload('EUCO_up',year))/ eta_m(i,co,year);
*############################# STEP 2: SOLVING DP #################################
$if %Inc_Det% == "*" $goto DetSolutionEnd
SOLVE LSEWglobal using lp minimizing Cost_GLobal;
$include IntEG_v20_resprocess.gms
execute_unload '%resultdir%%GlobalSCEN%_DET_Scen.gdx';
$label DetSolutionEnd
*############################# STEP 3: SOLVING SCENARIOS - SP ####################
$if %Inc_Stoch% == "*" $goto StochSolutionEnd
$include IntEG_v20_S2(ECIU_EUCO)_solve.gms
$include IntEG_v20_resprocess.gms
put_utility 'gdxout' / 'output_v20_EUCO\v20_STOCH_Scen_' UncPar.tl:0;
execute_unload ;
*$include IntEG_v20_clear.gms
nonPowerDem(co,year,month,scen) = cons_EUCO(co, year, month)*(1-PS_EUCO(co, year));
nonPowerDem(co,year,month,scen) = nonPowerDem(co,year,month,scen)/conversion_factor_gas;
LP_prodCap(p,n,year,month) = LP_prodCap(p,n,year,month) /conversion_factor_gas ;
transCap(n,m) = transCap(n,m) /conversion_factor_gas ;
extra_cap(n,m, year, month) = extra_cap(n,m, year, month) /conversion_factor_gas ;
stor_cons_cap(co,year, month) = stor_cons_cap(co,year, month) /conversion_factor_gas ;
stor_cons_in(co, year, month) = stor_cons_in(co,year, month) /conversion_factor_gas ;
stor_cons_out(co,year, month) = stor_cons_out(co,year, month) /conversion_factor_gas ;
st_lev_start(co) = st_lev_start(co) /conversion_factor_gas ;
st_lev_end(co) = st_lev_end(co) /conversion_factor_gas ;
LTC(n,m,year, month) = LTC(n,m,year, month) /conversion_factor_gas ;
demand(co,t,year,scen) = demand_upload(co,t,year,"EUCO_up");
cap_existing(i,n,year,scen) = cap_existing_upload(i,n,year,"EUCO_up");
fc(i,co,year,scen) = fc_upload(i,co,year,"EUCO_up") ;
co2_price(scen,year) = co2_price_upload("EUCO_up", year);
vc_f(i,co,year,scen) = (fc_upload(i,co,year,"EUCO_up")+ carb_cont(i)*co2_price_upload('EUCO_up',year))/ eta_f(i,co,year);
vc_m(i,co,year,scen) = (fc_upload(i,co,year,"EUCO_up")+ carb_cont(i)*co2_price_upload('EUCO_up',year))/ eta_m(i,co,year);
);
$label StochSolutionEnd
*############################# STEP 4: saving 'naive' first stage decisions ############
$if %Inc_StochFI% == "*" $goto StochFIEnd
*$Include IntEG_v20_FixInv.gms
$gdxin %resultdir%%GlobalSCEN%_DET_Scen
$Load geninv_DET_EUCO = CAP_new.l
$gdxin
CAP_new.fx(i,co,year) = geninv_DET_EUCO(i,co,year);
execute_unload '%resultdir%fixedcap.gdx' Cap_new;
*############################# STEP 5: SOLVING SCENARIOS - EEV #################
$include IntEG_v20_S2(ECIU_EUCO)_solve.gms
$include IntEG_v20_resprocess.gms
put_utility 'gdxout' / 'output_v20_EUCO\v20_STOCH_FINV_Scen_' UncPar.tl:0;
execute_unload ;
*$include IntEG_v20_clear.gms
* Setting default values
nonPowerDem(co,year,month,scen) = cons_EUCO(co, year, month)*(1-PS_EUCO(co, year));
nonPowerDem(co,year,month,scen) = nonPowerDem(co,year,month,scen)/conversion_factor_gas;
LP_prodCap(p,n,year,month) = LP_prodCap(p,n,year,month) /conversion_factor_gas ;
transCap(n,m) = transCap(n,m) /conversion_factor_gas ;
extra_cap(n,m, year, month) = extra_cap(n,m, year, month) /conversion_factor_gas ;
stor_cons_cap(co,year, month) = stor_cons_cap(co,year, month) /conversion_factor_gas ;
stor_cons_in(co, year, month) = stor_cons_in(co,year, month) /conversion_factor_gas ;
stor_cons_out(co,year, month) = stor_cons_out(co,year, month) /conversion_factor_gas ;
st_lev_start(co) = st_lev_start(co) /conversion_factor_gas ;
st_lev_end(co) = st_lev_end(co) /conversion_factor_gas ;
LTC(n,m,year, month) = LTC(n,m,year, month) /conversion_factor_gas ;
demand(co,t,year,scen) = demand_upload(co,t,year,"EUCO_up");
cap_existing(i,n,year,scen) = cap_existing_upload(i,n,year,"EUCO_up");
fc(i,co,year,scen) = fc_upload(i,co,year,"EUCO_up") ;
co2_price(scen,year) = co2_price_upload("EUCO_up", year);
vc_f(i,co,year,scen) = (fc_upload(i,co,year,"EUCO_up")+ carb_cont(i)*co2_price_upload('EUCO_up',year))/ eta_f(i,co,year);
vc_m(i,co,year,scen) = (fc_upload(i,co,year,"EUCO_up")+ carb_cont(i)*co2_price_upload('EUCO_up',year))/ eta_m(i,co,year);
);
* CONVERT TO BCM input data (to send correct GAS model's quantities for the next scenario)
LP_prodCap(p,n,year,month) = LP_prodCap(p,n,year,month) *conversion_factor_gas ;
transCap(n,m) = transCap(n,m) *conversion_factor_gas ;
extra_cap(n,m, year, month) = extra_cap(n,m, year, month) *conversion_factor_gas ;
nonPowerDem(co,year,month,scen) = nonPowerDem(co,year,month,scen) *conversion_factor_gas ;
stor_cons_cap(co,year, month) = stor_cons_cap(co,year, month) *conversion_factor_gas ;
stor_cons_in(co, year, month) = stor_cons_in(co,year, month) *conversion_factor_gas ;
stor_cons_out(co, year, month) = stor_cons_out(co,year, month) *conversion_factor_gas ;
st_lev_start(co) = st_lev_start(co) *conversion_factor_gas ;
st_lev_end(co) = st_lev_end(co) *conversion_factor_gas ;
LTC(n,m,year, month) = LTC(n,m,year, month) *conversion_factor_gas ;
$label StochFIEnd
*############################# STEP 6: Computing ECIU VALUES ###################
%Inc_ECIUvalues%$include IntEG_v20_ECIU_compute.gms
*############################# STEP 7: GDX to EXCEL ##################################
*$include IntEG_v20_GDXtoEXCEL.gms