4b_outputInvariant.gms 24.1 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
$ontext
This file is part of Backbone.

Backbone is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

Backbone is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License
along with Backbone.  If not, see <http://www.gnu.org/licenses/>.
$offtext

18
* =============================================================================
19
* --- Time Step Dependent Results ---------------------------------------------
20
* =============================================================================
21

22
23
// Need to loop over the model dimension, as this file is no longer contained in the modelSolves loop...
loop(m,
24

Topi Rasku's avatar
Topi Rasku committed
25
26
27
* --- Realized Individual Costs ----------------------------------------------

    // Variable O&M costs
28
    r_gnuVOMCost(gnu(grid, node, unit), ft_realizedNoReset(f,t))$[ord(t) > mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')]
Topi Rasku's avatar
Topi Rasku committed
29
30
31
        = 1e-6 // Scaling to MEUR
            * p_stepLengthNoReset(m, f, t)
            * r_gen(grid, node, unit, f, t)
32
            * p_gnu(grid, node, unit, 'vomCosts');
Topi Rasku's avatar
Topi Rasku committed
33
34

    // Fuel and emission costs during normal operation
35
    r_uFuelEmissionCost(commodity, unit_commodity(unit), ft_realizedNoReset(f,t))${ un_commodity(unit, commodity) and [ord(t) > mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')]}
Topi Rasku's avatar
Topi Rasku committed
36
37
        = 1e-6 // Scaling to MEUR
            * p_stepLengthNoReset(m, f, t)
38
            * r_fuelUse(commodity, unit, f, t)
39
40
41
42
43
44
            * [ // Fuel price when input
                + p_price(commodity, 'price')${p_price(commodity, 'useConstant') and un_commodity_in(unit, commodity)}
                + ts_price(commodity, t)${p_price(commodity, 'useTimeSeries')  and un_commodity_in(unit, commodity)}
                // Fuel price when output
                - p_price(commodity, 'price')${p_price(commodity, 'useConstant') and un_commodity_out(unit, commodity)}
                - ts_price(commodity, t)${p_price(commodity, 'useTimeSeries')  and un_commodity_out(unit, commodity)}
Topi Rasku's avatar
Topi Rasku committed
45
                // Emission costs
46
47
                + sum(emission, p_unitEmissionCost(unit, commodity, emission))
              ];
Topi Rasku's avatar
Topi Rasku committed
48
49

    // Unit startup costs
50
    r_uStartupCost(unit, ft_realizedNoReset(f,t))${sum(starttype, unitStarttype(unit, starttype)) and [ord(t) > mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')]}
Topi Rasku's avatar
Topi Rasku committed
51
52
53
        = 1e-6 // Scaling to MEUR
            * sum(unitStarttype(unit, starttype),
                + r_startup(unit, starttype, f, t)
54
55
                    * ts_startupCost_(unit, starttype, t)
              ); // END sum(starttype)
Topi Rasku's avatar
Topi Rasku committed
56
57

    // Node state slack costs
58
    r_gnStateSlackCost(gn_stateSlack(grid, node), ft_realizedNoReset(f,t))$[ord(t) > mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')]
Topi Rasku's avatar
Topi Rasku committed
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
        = 1e-6 // Scaling to MEUR
            * p_stepLengthNoReset(m, f, t)
            * sum(slack${ p_gnBoundaryPropertiesForStates(grid, node, slack, 'slackCost') },
                + r_stateSlack(grid, node, slack, f, t)
                    * p_gnBoundaryPropertiesForStates(grid, node, slack, 'slackCost')
                ); // END sum(slack)

    // Storage Value Change
    r_gnStorageValueChange(gn_state(grid, node))${ sum(t_full(t), p_storageValue(grid, node, t)) }
        = 1e-6
            * [
                + sum(ft_realizedNoReset(f,t)${ ord(t) = mSettings(m, 't_end') + 1 },
                    + p_storageValue(grid, node, t)
                        * r_state(grid, node, f, t)
                    ) // END sum(ft_realizedNoReset)
74
                - sum(ft_realizedNoReset(f,t)${ ord(t) = mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod') }, // INITIAL v_state NOW INCLUDED IN THE RESULTS
Topi Rasku's avatar
Topi Rasku committed
75
76
77
78
79
                    + p_storageValue(grid, node, t)
                        * r_state(grid, node, f, t)
                    ) // END sum(ft_realizedNoReset)
                ]; // END * 1e-6

Topi Rasku's avatar
Topi Rasku committed
80
81
82
83
* --- Total Cost Components ---------------------------------------------------

    // Total VOM costs
    r_gnuTotalVOMCost(gnu_output(grid, node, unit))
84
        = sum(ft_realizedNoReset(f,t)$[ord(t) > mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')],
Topi Rasku's avatar
Topi Rasku committed
85
            + r_gnuVOMCost(grid, node, unit, f, t)
86
                * sum(msft_realizedNoReset(m, s, f, t), p_msProbability(m, s) * p_msWeight(m, s))
Topi Rasku's avatar
Topi Rasku committed
87
88
89
            );

    // Total fuel & emission costs
90
    r_uTotalFuelEmissionCost(commodity, unit)$un_commodity(unit, commodity)
91
        = sum(ft_realizedNoReset(f,t)$[ord(t) > mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')],
92
            + r_uFuelEmissionCost(commodity, unit, f, t)
93
                * sum(msft_realizedNoReset(m, s, f, t), p_msProbability(m, s) * p_msWeight(m, s))
Topi Rasku's avatar
Topi Rasku committed
94
95
96
97
            );

    // Total unit startup costs
    r_uTotalStartupCost(unit)${ sum(starttype, unitStarttype(unit, starttype)) }
98
        = sum(ft_realizedNoReset(f,t)$[ord(t) > mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')],
Topi Rasku's avatar
Topi Rasku committed
99
            + r_uStartupCost(unit, f, t)
100
                * sum(msft_realizedNoReset(m, s, f, t), p_msProbability(m, s) * p_msWeight(m, s))
Topi Rasku's avatar
Topi Rasku committed
101
102
103
104
            );

    // Total state variable slack costs
    r_gnTotalStateSlackCost(gn_stateSlack(grid, node))
105
        = sum(ft_realizedNoReset(f,t)$[ord(t) > mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')],
Topi Rasku's avatar
Topi Rasku committed
106
            + r_gnStateSlackCost(grid, node, f, t)
107
                * sum(msft_realizedNoReset(m, s, f, t), p_msProbability(m, s) * p_msWeight(m, s))
Topi Rasku's avatar
Topi Rasku committed
108
109
            );

Niina Helistö's avatar
Niina Helistö committed
110
111
112
    // Fixed O&M costs
    r_gnuFOMCost(gnu(grid, node, unit))
        = 1e-6 // Scaling to MEUR
113
            * [
114
                + p_gnu(grid, node, unit, 'capacity') // Not in v_obj
115
                + r_invest(unit)
116
                    * p_gnu(grid, node, unit, 'unitSize')
117
                ]
Niina Helistö's avatar
Niina Helistö committed
118
119
120
121
122
            * p_gnu(grid, node, unit, 'fomCosts');

    // Unit investment costs
    r_gnuUnitInvestmentCost(gnu(grid, node, unit))
        = 1e-6 // Scaling to MEUR
123
            * r_invest(unit)
124
            * p_gnu(grid, node, unit, 'unitSize')
Niina Helistö's avatar
Niina Helistö committed
125
126
127
128
129
130
131
132
133
134
135
136
137
138
            * p_gnu(grid, node, unit, 'invCosts')
            * p_gnu(grid, node, unit, 'annuity');

    // Transfer link investment costs
    r_gnnLinkInvestmentCost(grid, from_node, to_node)
        = 1e-6 // Scaling to MEUR
            * sum(t_invest, r_investTransfer(grid, from_node, to_node, t_invest))
            * [
                + p_gnn(grid, from_node, to_node, 'invCost')
                    * p_gnn(grid, from_node, to_node, 'annuity')
                + p_gnn(grid, to_node, from_node, 'invCost')
                    * p_gnn(grid, to_node, from_node, 'annuity')
                ]; // END * r_investTransfer;

139
140
* --- Realized Nodal System Costs ---------------------------------------------

Niina Helistö's avatar
Niina Helistö committed
141
    // Total realized gn operating costs
142
    r_gnRealizedOperatingCost(gn(grid, node), ft_realizedNoReset(f, t))$[ord(t) > mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')]
143
        = sum(gnu(grid, node, unit),
Topi Rasku's avatar
Topi Rasku committed
144
145
146
147
148

            // VOM costs
            + r_gnuVOMCost(grid, node, unit, f, t)

            // Divide fuel and startup costs based on output capacities
149
            + [
150
151
                + p_gnu(grid, node, unit, 'capacity')${p_unit(unit, 'outputCapacityTotal')}
                + p_gnu(grid, node, unit, 'unitSize')${not p_unit(unit, 'outputCapacityTotal')}
152
153
                ]
                    / [
154
155
                        + p_unit(unit, 'outputCapacityTotal')${p_unit(unit, 'outputCapacityTotal') > 0}
                        + p_unit(unit, 'unitOutputCapacityTotal')${not p_unit(unit, 'outputCapacityTotal') > 0}
156
157
                        ] // END /
                    * [
158
                        + sum(un_commodity(unit, node), r_uFuelEmissionCost(node, unit, f, t))
159
160
                        + r_uStartupCost(unit, f, t)
                        ] // END *
Topi Rasku's avatar
Topi Rasku committed
161
162
163
164
            ) // END sum(gnu_output)

            // Node state slack costs
            + r_gnStateSlackCost(grid, node, f, t);
165
166
167
168

* --- Realized Nodal Energy Consumption ---------------------------------------
// !!! NOTE !!! This is a bit of an approximation at the moment !!!!!!!!!!!!!!!

169
    r_gnConsumption(gn(grid, node), ft_realizedNoReset(f, t))$[ord(t) > mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')]
170
171
172
173
174
175
176
177
        = p_stepLengthNoReset(m, f, t)
            * [
                + min(ts_influx(grid, node, f, t), 0) // Not necessarily a good idea, as ts_influx contains energy gains as well...
                + sum(gnu_input(grid, node, unit),
                    + r_gen(grid, node, unit, f, t)
                    ) // END sum(gnu_input)
                ];

178
179
180
* --- Total Energy Generation -------------------------------------------------

    // Total energy generation
181
    r_gnuTotalGen(gnu_output(grid, node, unit))
182
        = sum(ft_realizedNoReset(f, t)$[ord(t) > mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')],
183
184
            + r_gen(grid, node, unit, f, t)
                * p_stepLengthNoReset(m, f, t)
185
                * sum(msft_realizedNoReset(m, s, f, t), p_msProbability(m, s) * p_msWeight(m, s))
186
            ); // END sum(ft_realizedNoReset)
187
188

    // Energy generation by fuels
189
    r_genFuel(gn(grid, node), commodity, ft_realizedNoReset(f, t))$[sum(unit, un_commodity(unit, node)) and sum(gnu_input(grid, node_, unit)$gnu(grid, node, unit), r_gen(grid, node_, unit, f, t)) and ord(t) > mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')]
190
        = sum(gnu_output(grid, node, unit),
191
            + r_gen(grid, node, unit, f, t)
192
193
          )
          * sum(gnu_input(grid, commodity, unit), r_gen(grid, commodity, unit, f, t))
194
          / sum(gnu_input(grid, node_, unit)$gnu(grid, node, unit), r_gen(grid, node_, unit, f, t));
195

Juha Kiviluoma's avatar
Juha Kiviluoma committed
196
    // Energy generation by fuels
197
198
199
200
    r_genUnittype(gn(grid, node), unittype, ft_realizedNoReset(f,t))
        ${  sum(unit,gnu_output(grid, node, unit))
            and [ord(t) > mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')]
            }
Juha Kiviluoma's avatar
Juha Kiviluoma committed
201
        = sum(unit${unitUnittype(unit, unittype) and gnu_output(grid, node, unit)},
202
            + r_gen(grid, node, unit, f, t)
Juha Kiviluoma's avatar
Juha Kiviluoma committed
203
204
            ); // END sum(unit)

205
    // Total generation on each node by fuels
206
    r_gnTotalGenFuel(gn(grid, node), commodity)
207
        = sum(ft_realizedNoReset(f, t)$[ord(t) > mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')],
208
            + r_genFuel(grid, node, commodity, f, t)
209
                * p_stepLengthNoReset(m, f, t)
210
                * sum(msft_realizedNoReset(m, s, f, t), p_msProbability(m, s) * p_msWeight(m, s))
211
            ); // END sum(ft_realizedNoReset)
212

213
214
    // Total dummy generation/consumption
    r_gnTotalqGen(inc_dec, gn(grid, node))
215
        = sum(ft_realizedNoReset(f,t)$[ord(t) > mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')],
216
217
            + r_qGen(inc_dec, grid, node, f, t)
                * p_stepLengthNoReset(m, f, t)
218
                * sum(msft_realizedNoReset(m, s, f, t), p_msProbability(m, s) * p_msWeight(m, s))
219
220
            ); // END sum(ft_realizedNoReset)

221
* --- Total Unit Online Results -----------------------------------------------
222

223
224
    // Total sub-unit-hours for units over the simulation
    r_uTotalOnline(unit)
225
        = sum(ft_realizedNoReset(f, t)$[ord(t) > mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')],
226
            + r_online(unit, f, t)
227
                * p_stepLengthNoReset(m, f, t)
228
                * sum(msft_realizedNoReset(m, s, f, t), p_msProbability(m, s) * p_msWeight(m, s))
229
            ); // END sum(ft_realizedNoReset)
230

231
    // Approximate utilization rates for gnus over the simulation
232
    r_gnuUtilizationRate(gnu_output(grid, node, unit))${r_gnuTotalGen(grid, node, unit) and (p_gnu(grid, node, unit, 'capacity') or r_invest(unit))}
233
234
        = r_gnuTotalGen(grid, node, unit)
            / [
235
                + (p_gnu(grid, node, unit, 'capacity') + r_invest(unit)*p_gnu(grid, node, unit, 'unitSize'))
236
                    * (mSettings(m, 't_end') - (mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')) + 1)
237
                    * mSettings(m, 'stepLengthInHours')
238
239
240
241
                ]; // END division

* --- Total Reserve Provision -------------------------------------------------

242
    // Total reserve provisions over the simulation
243
    r_gnuTotalReserve(gnuRescapable(restype, up_down, grid, node, unit))
244
        = sum(ft_realizedNoReset(f, t)$[ord(t) > mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')],
245
            + r_reserve(restype, up_down, grid, node, unit, f, t)
246
                * p_stepLengthNoReset(m, f, t)
247
                * sum(msft_realizedNoReset(m, s, f, t), p_msProbability(m, s) * p_msWeight(m, s))
248
249
            ); // END sum(ft_realizedNoReset)

250
    // Total dummy reserve provisions over the simulation
251
    r_groupTotalqResDemand(restypeDirectionGroup(restype, up_down, group))
252
        = sum(ft_realizedNoReset(f, t)$[ord(t) > mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')],
253
            + r_qResDemand(restype, up_down, group, f, t)
254
                * p_stepLengthNoReset(m, f, t)
255
                * sum(msft_realizedNoReset(m, s, f, t), p_msProbability(m, s) * p_msWeight(m, s))
256
257
            ); // END sum(ft_realizedNoReset)

258
259
260
261
* --- Total Transfer and Spill ------------------------------------------------

    // Total transfer of energy between nodes
    r_gnnTotalTransfer(gn2n(grid, from_node, to_node))
262
        = sum(ft_realizedNoReset(f, t)$[ord(t) > mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')],
263
            + r_transfer(grid, from_node, to_node, f, t)
264
                * p_stepLengthNoReset(m, f, t)
265
                * sum(msft_realizedNoReset(m, s, f, t), p_msProbability(m, s) * p_msWeight(m, s))
266
267
            ); // END sum(ft_realizedNoReset)

268
269
    // Total energy spill from nodes
    r_gnTotalSpill(grid, node_spill(node))
270
        = sum(ft_realizedNoReset(f, t)$[ord(t) > mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')],
271
272
            + r_spill(grid, node, f, t)
                * p_stepLengthNoReset(m, f, t)
273
                * sum(msft_realizedNoReset(m, s, f, t), p_msProbability(m, s) * p_msWeight(m, s))
274
            ); // END sum(ft_realizedNoReset)
275

276
277
278
279
* =============================================================================
* --- Futher Time Step Independent Results ------------------------------------
* =============================================================================

280
* --- Scaling Marginal Values to EUR/MWh from MEUR/MWh ------------------------
281
282

// Energy balance
283
r_balanceMarginal(gn(grid, node), ft_realizedNoReset(f, t))$[ord(t) > mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')]
284
285
286
    = 1e6 * r_balanceMarginal(grid, node, f, t);

// Reserve balance
287
288
r_resDemandMarginal(restypeDirectionGroup(restype, up_down, group), ft_realizedNoReset(f, t))$[ord(t) > mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')]
    = 1e6 * r_resDemandMarginal(restype, up_down, group, f, t);
289

290
291
* --- Total Generation Results ------------------------------------------------

292
293
// Total generation in gn
r_gnTotalGen(gn(grid, node))
294
295
    = sum(gnu_output(grid, node, unit), r_gnuTotalGen(grid, node, unit));

296
297
298
// Total generation in g
r_gTotalGen(grid)
    = sum(gn(grid, node), r_gnTotalGen(grid, node));
299

300
// Total generation gnu/gn shares
301
r_gnuTotalGenShare(gnu_output(grid, node, unit))${ r_gnTotalGen(grid, node) > 0 }
302
303
304
305
    = r_gnuTotalGen(grid, node, unit)
        / r_gnTotalGen(grid, node);

// Total generation gn/g shares
306
r_gnTotalGenShare(gn(grid, node))${ r_gTotalGen(grid) > 0 }
307
308
309
    = r_gnTotalGen(grid, node)
        / r_gTotalGen(grid);

310
311
312
313
314
315
* --- Total Dummy Generation Results ------------------------------------------

// Total dummy generaion in g
r_gTotalqGen(inc_dec, grid)
    = sum(gn(grid, node), r_gnTotalqGen(inc_dec, grid, node));

316
317
* --- Total Energy Consumption Results ----------------------------------------

318
319
// Total consumption on each gn over the simulation
r_gnTotalConsumption(gn(grid, node))
320
    = sum(ft_realizedNoReset(f, t)$[ord(t) > mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')],
Niina Helistö's avatar
Niina Helistö committed
321
        + r_gnConsumption(grid, node, f ,t)
322
            * sum(msft_realizedNoReset(m, s, f, t), p_msProbability(m, s) * p_msWeight(m, s))
Niina Helistö's avatar
Niina Helistö committed
323
        );
324

325
326
327
// Total consumption in each grid over the simulation
r_gTotalConsumption(grid)
    = sum(gn(grid, node), r_gnTotalConsumption(grid, node));
328

329
// Total consumption gn/g share
330
r_gnTotalConsumptionShare(gn(grid, node))${ r_gTotalConsumption(grid) > 0 }
331
332
333
334
335
    = r_gnTotalConsumption(grid, node)
        / r_gTotalConsumption(grid);

* --- Total Fuel Consumption Results ------------------------------------------

336
// Total fuel consumption in grids over the simulation
337
338
r_gTotalGenFuel(grid, commodity)
    = sum(gn(grid, node), r_gnTotalGenFuel(grid, node, commodity));
339

340
// Total fuel consumption over the simulation
341
342
r_totalGenFuel(commodity)
    = sum(gn(grid, node), r_gnTotalGenFuel(grid, node, commodity));
343

344
// Total fuel consumption gn/g shares
345
346
r_gnTotalGenFuelShare(gn(grid, node), commodity)${ r_gnTotalGen(grid, node) }
    = r_gnTotalGenFuel(grid, node, commodity)
347
        / r_gnTotalGen(grid, node);
348
349
350

* --- Total Spilled Energy Results --------------------------------------------

351
352
353
// Total spilled energy in each grid over the simulation
r_gTotalSpill(grid)
    = sum(gn(grid, node_spill(node)), r_gnTotalSpill(grid, node));
354

355
// Total spilled energy gn/g share
356
r_gnTotalSpillShare(gn(grid, node_spill))${ r_gTotalSpill(grid) > 0 }
357
358
359
360
361
    = r_gnTotalSpill(grid, node_spill)
        / r_gTotalSpill(grid);

* --- Total Costs Results -----------------------------------------------------

Niina Helistö's avatar
Niina Helistö committed
362
363
// Total realized operating costs on each gn over the simulation
r_gnTotalRealizedOperatingCost(gn(grid, node))
364
    = sum(ft_realizedNoReset(f, t)$[ord(t) > mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')],
Niina Helistö's avatar
Niina Helistö committed
365
        + r_gnRealizedOperatingCost(grid, node, f ,t)
366
            * sum(msft_realizedNoReset(m, s, f, t), p_msProbability(m, s) * p_msWeight(m, s))
Niina Helistö's avatar
Niina Helistö committed
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
        );

// Total realized net operating costs on each gn over the simulation
r_gnTotalRealizedNetOperatingCost(gn(grid, node))
    = r_gnTotalRealizedOperatingCost(grid, node) - r_gnStorageValueChange(grid, node);

// Total realized operating costs on each grid over the simulation
r_gTotalRealizedOperatingCost(grid)
    = sum(gn(grid, node), r_gnTotalRealizedOperatingCost(grid, node));

// Total realized net operating costs on each grid over the simulation
r_gTotalRealizedNetOperatingCost(grid)
    = sum(gn(grid, node), r_gnTotalRealizedNetOperatingCost(grid, node));

// Total realized operating costs gn/g share
382
r_gnTotalRealizedOperatingCostShare(gn(grid, node))${ r_gTotalRealizedOperatingCost(grid) > 0 }
Niina Helistö's avatar
Niina Helistö committed
383
384
385
386
387
388
389
390
391
392
393
    = r_gnTotalRealizedOperatingCost(grid, node)
        / r_gTotalRealizedOperatingCost(grid);

// Total realized operating costs over the simulation
r_totalRealizedOperatingCost
    = sum(gn(grid, node), r_gnTotalRealizedOperatingCost(grid, node));

// Total realized net operating costs over the simulation
r_totalRealizedNetOperatingCost
    = sum(gn(grid, node), r_gnTotalRealizedNetOperatingCost(grid, node));

394
395
// Total realized costs on each gn over the simulation
r_gnTotalRealizedCost(gn(grid, node))
Niina Helistö's avatar
Niina Helistö committed
396
397
398
399
400
401
402
403
404
405
406
407
408
    = r_gnTotalRealizedOperatingCost(grid, node)
        + sum(gnu(grid, node, unit),
            + r_gnuFOMCost(grid, node, unit)
            + r_gnuUnitInvestmentCost(grid, node, unit)
            )
        + sum(gn2n_directional(grid, from_node, node),
            + r_gnnLinkInvestmentCost(grid, from_node, node)
                / 2
            )
        + sum(gn2n_directional(grid, node, to_node),
            + r_gnnLinkInvestmentCost(grid, node, to_node)
                / 2
            );
409

410
411
412
413
// Total realized net costs on each gn over the simulation
r_gnTotalRealizedNetCost(gn(grid, node))
    = r_gnTotalRealizedCost(grid, node) - r_gnStorageValueChange(grid, node);

414
415
416
// Total realized costs on each grid over the simulation
r_gTotalRealizedCost(grid)
    = sum(gn(grid, node), r_gnTotalRealizedCost(grid, node));
417

418
419
420
421
// Total realized net costs on each grid over the simulation
r_gTotalRealizedNetCost(grid)
    = sum(gn(grid, node), r_gnTotalRealizedNetCost(grid, node));

422
// Total realized costs gn/g share
423
r_gnTotalRealizedCostShare(gn(grid, node))${ r_gTotalRealizedCost(grid) > 0 }
424
425
426
    = r_gnTotalRealizedCost(grid, node)
        / r_gTotalRealizedCost(grid);

427
428
// Total realized costs over the simulation
r_totalRealizedCost
429
    = sum(gn(grid, node), r_gnTotalRealizedCost(grid, node));
430

Niina Helistö's avatar
Niina Helistö committed
431
// Total realized net operating costs over the simulation
432
433
434
r_totalRealizedNetCost
    = sum(gn(grid, node), r_gnTotalRealizedNetCost(grid, node));

435
436
437
* --- Reserve Provision Overlap Results ---------------------------------------

// Calculate the overlapping reserve provisions
438
439
440
441
r_reserve2Reserve(gnuRescapable(restype, up_down, grid, node, unit), restype_, ft_realizedNoReset(f, t))
    ${ p_gnuRes2Res(grid, node, unit, restype, up_down, restype_) }
    = r_reserve(restype, up_down, grid, node, unit, f, t)
        * p_gnuRes2Res(grid, node, unit, restype, up_down, restype_);
442

443
444
* --- Total Reserve Provision Results -----------------------------------------

445
446
447
448
449
// Total reserve provision in groups over the simulation
r_groupTotalReserve(restypeDirectionGroup(restype, up_down, group))
    = sum(gnuRescapable(restype, up_down, grid, node, unit)${gnGroup(grid, node, group)},
        + r_gnuTotalReserve(restype, up_down, grid, node, unit)
    ); // END sum(gnuRescapable)
450

451
452
453
454
r_gnuTotalReserveShare(gnuRescapable(restype, up_down, grid, node, unit))
    ${ sum(gnGroup(grid, node, group), r_groupTotalReserve(restype, up_down, group)) > 0 }
    = r_gnuTotalReserve(restype, up_down, grid, node, unit)
        / sum(gnGroup(grid, node, group), r_groupTotalReserve(restype, up_down, group));
455
456
457

* --- Total Unit Online State Results -----------------------------------------

458
// Total unit online hours per sub-unit over the simulation
459
r_uTotalOnlinePerUnit(unit)${ p_unit(unit, 'unitCount') > 0 }
460
461
462
    = r_uTotalOnline(unit)
        / p_unit(unit, 'unitCount');

463
464
// Total sub-unit startups over the simulation
r_uTotalStartup(unit, starttype)
465
    = sum(ft_realizedNoReset(f, t)$[ord(t) > mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')],
466
        + r_startup(unit, starttype, f, t)
467
            * sum(msft_realizedNoReset(m, s, f, t), p_msProbability(m, s) * p_msWeight(m, s))
468
469
470
471
        ); // END sum(ft_realizedNoReset)

// Total sub-unit shutdowns over the simulation
r_uTotalShutdown(unit)
472
    = sum(ft_realizedNoReset(f, t)$[ord(t) > mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')],
473
        + r_shutdown(unit, f, t)
474
            * sum(msft_realizedNoReset(m, s, f, t), p_msProbability(m, s) * p_msWeight(m, s))
475
476
        ); // END sum(ft_realizedNoReset)

477
478
* --- Diagnostic Results ------------------------------------------------------

479
// Only include these if '--diag=yes' given as a command line argument
480
$iftheni.diag '%diag%' == yes
481
// Estimated coefficients of performance
482
483
484
d_cop(unit, ft_realizedNoReset(f, t))${  [ord(t) > mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')]
                                         and sum(gnu_input(grid, node, unit), 1)
                                         }
485
486
487
488
489
490
491
    = sum(gnu_output(grid, node, unit),
        + r_gen(grid, node, unit, f, t)
        ) // END sum(gnu_output)
        / [ sum(gnu_input(grid_, node_, unit),
                -r_gen(grid_, node_, unit, f, t)
                ) // END sum(gnu_input)
            + 1${not sum(gnu_input(grid_, node_, unit), -r_gen(grid_, node_, unit, f, t))}
492
493
            ]
        + Eps; // Eps to correct GAMS plotting (zeroes are not skipped)
494
495

// Estimated efficiency
496
d_eff(unit_commodity(unit), ft_realizedNoReset(f, t))$[ord(t) > mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')]
497
498
499
500
501
502
503
    = sum(gnu_output(grid, node, unit),
        + r_gen(grid, node, unit, f, t)
        ) // END sum(gnu_output)
        / [ sum(uFuel(unit, 'main', fuel),
                + r_fuelUse(fuel, unit, f, t)
                ) // END sum(uFuel)
            + 1${not sum(uFuel(unit, 'main', fuel), r_fuelUse(fuel, unit, f, t))}
504
505
            ]
        + Eps; // Eps to correct GAMS plotting (zeroes are not skipped)
506
$endif.diag
507

508
); // END loop(m)
509