4b_outputInvariant.gms 22.9 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_output(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
32
33
34
        = 1e-6 // Scaling to MEUR
            * p_stepLengthNoReset(m, f, t)
            * r_gen(grid, node, unit, f, t)
            * p_unit(unit, 'omCosts');

    // Fuel and emission costs during normal operation
35
    r_uFuelEmissionCost(fuel, unit_fuel(unit), ft_realizedNoReset(f,t))${ uFuel(unit, 'main', fuel) and [ord(t) > mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')]}
Topi Rasku's avatar
Topi Rasku committed
36
37
38
39
40
41
42
43
44
45
        = 1e-6 // Scaling to MEUR
            * p_stepLengthNoReset(m, f, t)
            * r_fuelUse(fuel, unit, f, t)
            * [ // Fuel price
                + ts_fuelPrice(fuel, t)
                // Emission costs
                + sum(emission, p_unitFuelEmissionCost(unit, fuel, emission))
                ];

    // Unit startup costs
46
    r_uStartupCost(unit, ft_realizedNoReset(f,t))${uft_online(unit, f, t) and sum(starttype, unitStarttype(unit, starttype)) and [ord(t) > mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')]}
Topi Rasku's avatar
Topi Rasku committed
47
48
49
50
        = 1e-6 // Scaling to MEUR
            * sum(unitStarttype(unit, starttype),
                + r_startup(unit, starttype, f, t)
                    * [ // Startup VOM
51
                        + p_uStartup(unit, starttype, 'cost')
Topi Rasku's avatar
Topi Rasku committed
52
53
54

                        // Startup fuel consumption and emissions
                        + sum(uFuel(unit, 'startup', fuel),
55
                            + p_uStartup(unit, starttype, 'consumption')
56
                                * p_uFuel(unit, 'startup', fuel, 'fixedFuelFraction')
Topi Rasku's avatar
Topi Rasku committed
57
58
59
60
61
62
63
64
65
66
67
68
                                * [ // Fuel price
                                    + ts_fuelPrice(fuel, t)
                                    // Emission costs
                                    + sum(emission, // Emission taxes
                                        + p_unitFuelEmissionCost(unit, fuel, emission)
                                        ) // END sum(emission)
                                    ] // END * p_uStartup
                            ) // END sum(uFuel)
                        ] // END * r_startup
                ); // END sum(unitStarttype)

    // Node state slack costs
69
    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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
        = 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)
85
                - 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
86
87
88
89
90
                    + 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
91
92
93
94
* --- Total Cost Components ---------------------------------------------------

    // Total VOM costs
    r_gnuTotalVOMCost(gnu_output(grid, node, unit))
95
        = sum(ft_realizedNoReset(f,t)$[ord(t) > mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')],
Topi Rasku's avatar
Topi Rasku committed
96
            + r_gnuVOMCost(grid, node, unit, f, t)
Niina Helistö's avatar
Niina Helistö committed
97
                * sum(msft_realizedNoReset(m, s, f, t), p_msProbability(m, s))
Topi Rasku's avatar
Topi Rasku committed
98
99
100
101
            );

    // Total fuel & emission costs
    r_uTotalFuelEmissionCost(fuel, unit)${ uFuel(unit, 'main', fuel) }
102
        = sum(ft_realizedNoReset(f,t)$[ord(t) > mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')],
Topi Rasku's avatar
Topi Rasku committed
103
            + r_uFuelEmissionCost(fuel, unit, f, t)
Niina Helistö's avatar
Niina Helistö committed
104
                * sum(msft_realizedNoReset(m, s, f, t), p_msProbability(m, s))
Topi Rasku's avatar
Topi Rasku committed
105
106
107
108
            );

    // Total unit startup costs
    r_uTotalStartupCost(unit)${ sum(starttype, unitStarttype(unit, starttype)) }
109
        = sum(ft_realizedNoReset(f,t)$[ord(t) > mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')],
Topi Rasku's avatar
Topi Rasku committed
110
            + r_uStartupCost(unit, f, t)
Niina Helistö's avatar
Niina Helistö committed
111
                * sum(msft_realizedNoReset(m, s, f, t), p_msProbability(m, s))
Topi Rasku's avatar
Topi Rasku committed
112
113
114
115
            );

    // Total state variable slack costs
    r_gnTotalStateSlackCost(gn_stateSlack(grid, node))
116
        = sum(ft_realizedNoReset(f,t)$[ord(t) > mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')],
Topi Rasku's avatar
Topi Rasku committed
117
            + r_gnStateSlackCost(grid, node, f, t)
Niina Helistö's avatar
Niina Helistö committed
118
                * sum(msft_realizedNoReset(m, s, f, t), p_msProbability(m, s))
Topi Rasku's avatar
Topi Rasku committed
119
120
            );

Niina Helistö's avatar
Niina Helistö committed
121
122
123
    // Fixed O&M costs
    r_gnuFOMCost(gnu(grid, node, unit))
        = 1e-6 // Scaling to MEUR
124
125
126
127
128
129
            * [
                + p_gnu(grid, node, unit, 'maxGen') // Not in v_obj 
                + p_gnu(grid, node, unit, 'maxCons') // Not in v_obj
                + r_invest(unit)
                    * p_gnu(grid, node, unit, 'unitSizeTot')
                ]
Niina Helistö's avatar
Niina Helistö committed
130
131
132
133
134
            * p_gnu(grid, node, unit, 'fomCosts');

    // Unit investment costs
    r_gnuUnitInvestmentCost(gnu(grid, node, unit))
        = 1e-6 // Scaling to MEUR
135
136
            * r_invest(unit)
            * p_gnu(grid, node, unit, 'unitSizeTot')
Niina Helistö's avatar
Niina Helistö committed
137
138
139
140
141
142
143
144
145
146
147
148
149
150
            * 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;

151
152
* --- Realized Nodal System Costs ---------------------------------------------

Niina Helistö's avatar
Niina Helistö committed
153
    // Total realized gn operating costs
154
    r_gnRealizedOperatingCost(gn(grid, node), ft_realizedNoReset(f, t))$[ord(t) > mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')]
Topi Rasku's avatar
Topi Rasku committed
155
156
157
158
159
160
        = sum(gnu_output(grid, node, unit),

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

            // Divide fuel and startup costs based on output capacities
161
162
163
164
165
166
167
168
169
170
171
172
            + [
                + p_gnu(grid, node, unit, 'maxGen')${p_unit(unit, 'outputCapacityTotal')}
                + p_gnu(grid, node, unit, 'unitSizeGen')${not p_unit(unit, 'outputCapacityTotal')}
                ]
                    / [
                        + p_unit(unit, 'outputCapacityTotal')${p_unit(unit, 'outputCapacityTotal')}
                        + p_unit(unit, 'unitOutputCapacityTotal')${not p_unit(unit, 'outputCapacityTotal')}
                        ] // END /
                    * [
                        + sum(uFuel(unit, 'main', fuel), r_uFuelEmissionCost(fuel, unit, f, t))
                        + r_uStartupCost(unit, f, t)
                        ] // END *
Topi Rasku's avatar
Topi Rasku committed
173
174
175
176
            ) // END sum(gnu_output)

            // Node state slack costs
            + r_gnStateSlackCost(grid, node, f, t);
177
178
179
180

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

181
    r_gnConsumption(gn(grid, node), ft_realizedNoReset(f, t))$[ord(t) > mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')]
182
183
184
185
186
187
188
189
        = 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)
                ];

190
191
192
* --- Total Energy Generation -------------------------------------------------

    // Total energy generation
193
    r_gnuTotalGen(gnu_output(grid, node, unit))
194
        = sum(ft_realizedNoReset(f, t)$[ord(t) > mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')],
195
196
            + r_gen(grid, node, unit, f, t)
                * p_stepLengthNoReset(m, f, t)
Niina Helistö's avatar
Niina Helistö committed
197
                * sum(msft_realizedNoReset(m, s, f, t), p_msProbability(m, s))
198
            ); // END sum(ft_realizedNoReset)
199
200

    // Energy generation by fuels
201
    r_genFuel(gn(grid, node), fuel, ft_realizedNoReset(f, t))$[ord(t) > mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')]
202
203
204
205
        = sum(uFuel(unit, 'main', fuel)${ gnu_output(grid, node, unit) },
            + r_gen(grid, node, unit, f, t)
            ); // END sum(uFuel)

Juha Kiviluoma's avatar
Juha Kiviluoma committed
206
    // Energy generation by fuels
207
208
209
210
    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
211
        = sum(unit${unitUnittype(unit, unittype) and gnu_output(grid, node, unit)},
212
            + r_gen(grid, node, unit, f, t)
Juha Kiviluoma's avatar
Juha Kiviluoma committed
213
214
            ); // END sum(unit)

215
216
    // Total generation on each node by fuels
    r_gnTotalGenFuel(gn(grid, node), fuel)
217
        = sum(ft_realizedNoReset(f, t)$[ord(t) > mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')],
218
219
            + r_genFuel(grid, node, fuel, f, t)
                * p_stepLengthNoReset(m, f, t)
Niina Helistö's avatar
Niina Helistö committed
220
                * sum(msft_realizedNoReset(m, s, f, t), p_msProbability(m, s))
221
            ); // END sum(ft_realizedNoReset)
222

223
224
    // Total dummy generation/consumption
    r_gnTotalqGen(inc_dec, gn(grid, node))
225
        = sum(ft_realizedNoReset(f,t)$[ord(t) > mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')],
226
227
            + r_qGen(inc_dec, grid, node, f, t)
                * p_stepLengthNoReset(m, f, t)
Niina Helistö's avatar
Niina Helistö committed
228
                * sum(msft_realizedNoReset(m, s, f, t), p_msProbability(m, s))
229
230
            ); // END sum(ft_realizedNoReset)

231
* --- Total Unit Online Results -----------------------------------------------
232

233
234
    // Total sub-unit-hours for units over the simulation
    r_uTotalOnline(unit)
235
        = sum(ft_realizedNoReset(f, t)$[ord(t) > mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')],
236
            + r_online(unit, f, t)
237
                * p_stepLengthNoReset(m, f, t)
Niina Helistö's avatar
Niina Helistö committed
238
                * sum(msft_realizedNoReset(m, s, f, t), p_msProbability(m, s))
239
            ); // END sum(ft_realizedNoReset)
240

241
    // Approximate utilization rates for gnus over the simulation
242
    r_gnuUtilizationRate(gnu_output(grid, node, unit))${r_gnuTotalGen(grid, node, unit)}
243
244
        = r_gnuTotalGen(grid, node, unit)
            / [
Niina Helistö's avatar
Niina Helistö committed
245
                + (p_gnu(grid, node, unit, 'maxGen') + r_invest(unit)*p_gnu(grid, node, unit, 'unitSizeGen'))
246
                    * (mSettings(m, 't_end') - (mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')) + 1)
247
                    * mSettings(m, 'stepLengthInHours')
248
249
250
251
                ]; // END division

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

252
253
    // Total reserve provisions over the simulation
    r_nuTotalReserve(nuRescapable(restype, up_down, node, unit))
254
        = sum(ft_realizedNoReset(f, t)$[ord(t) > mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')],
255
256
            + r_reserve(restype, up_down, node, unit, f, t)
                * p_stepLengthNoReset(m, f, t)
Niina Helistö's avatar
Niina Helistö committed
257
                * sum(msft_realizedNoReset(m, s, f, t), p_msProbability(m, s))
258
259
            ); // END sum(ft_realizedNoReset)

260
261
    // Total dummy reserve provisions over the simulation
    r_nTotalqResDemand(restypeDirectionNode(restype, up_down, node))
262
        = sum(ft_realizedNoReset(f, t)$[ord(t) > mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')],
263
264
            + r_qResDemand(restype, up_down, node, f, t)
                * p_stepLengthNoReset(m, f, t)
Niina Helistö's avatar
Niina Helistö committed
265
                * sum(msft_realizedNoReset(m, s, f, t), p_msProbability(m, s))
266
267
            ); // END sum(ft_realizedNoReset)

268
269
270
271
* --- Total Transfer and Spill ------------------------------------------------

    // Total transfer of energy between nodes
    r_gnnTotalTransfer(gn2n(grid, from_node, to_node))
272
        = sum(ft_realizedNoReset(f, t)$[ord(t) > mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')],
273
            + r_transfer(grid, from_node, to_node, f, t)
274
                * p_stepLengthNoReset(m, f, t)
Niina Helistö's avatar
Niina Helistö committed
275
                * sum(msft_realizedNoReset(m, s, f, t), p_msProbability(m, s))
276
277
            ); // END sum(ft_realizedNoReset)

278
279
    // Total energy spill from nodes
    r_gnTotalSpill(grid, node_spill(node))
280
        = sum(ft_realizedNoReset(f, t)$[ord(t) > mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')],
281
282
            + r_spill(grid, node, f, t)
                * p_stepLengthNoReset(m, f, t)
Niina Helistö's avatar
Niina Helistö committed
283
                * sum(msft_realizedNoReset(m, s, f, t), p_msProbability(m, s))
284
            ); // END sum(ft_realizedNoReset)
285

286
287
288
289
* =============================================================================
* --- Futher Time Step Independent Results ------------------------------------
* =============================================================================

290
* --- Scaling Marginal Values to EUR/MWh from MEUR/MWh ------------------------
291
292

// Energy balance
293
r_balanceMarginal(gn(grid, node), ft_realizedNoReset(f, t))$[ord(t) > mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')]
294
295
296
    = 1e6 * r_balanceMarginal(grid, node, f, t);

// Reserve balance
297
r_resDemandMarginal(restypeDirectionNode(restype, up_down, node), ft_realizedNoReset(f, t))$[ord(t) > mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')]
298
299
    = 1e6 * r_resDemandMarginal(restype, up_down, node, f, t);

300
301
* --- Total Generation Results ------------------------------------------------

302
303
// Total generation in gn
r_gnTotalGen(gn(grid, node))
304
305
    = sum(gnu_output(grid, node, unit), r_gnuTotalGen(grid, node, unit));

306
307
308
// Total generation in g
r_gTotalGen(grid)
    = sum(gn(grid, node), r_gnTotalGen(grid, node));
309

310
311
312
313
314
315
316
317
318
319
// Total generation gnu/gn shares
r_gnuTotalGenShare(gnu_output(grid, node, unit))${ r_gnTotalGen(grid, node) }
    = r_gnuTotalGen(grid, node, unit)
        / r_gnTotalGen(grid, node);

// Total generation gn/g shares
r_gnTotalGenShare(gn(grid, node))${ r_gTotalGen(grid) }
    = r_gnTotalGen(grid, node)
        / r_gTotalGen(grid);

320
321
322
323
324
325
* --- Total Dummy Generation Results ------------------------------------------

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

326
327
* --- Total Energy Consumption Results ----------------------------------------

328
329
// Total consumption on each gn over the simulation
r_gnTotalConsumption(gn(grid, node))
330
    = sum(ft_realizedNoReset(f, t)$[ord(t) > mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')],
Niina Helistö's avatar
Niina Helistö committed
331
332
333
        + r_gnConsumption(grid, node, f ,t)
            * sum(msft_realizedNoReset(m, s, f, t), p_msProbability(m, s))
        );
334

335
336
337
// Total consumption in each grid over the simulation
r_gTotalConsumption(grid)
    = sum(gn(grid, node), r_gnTotalConsumption(grid, node));
338

339
340
341
342
343
344
345
// Total consumption gn/g share
r_gnTotalConsumptionShare(gn(grid, node))${ r_gTotalConsumption(grid) }
    = r_gnTotalConsumption(grid, node)
        / r_gTotalConsumption(grid);

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

346
347
348
// Total fuel consumption in grids over the simulation
r_gTotalGenFuel(grid, fuel)
    = sum(gn(grid, node), r_gnTotalGenFuel(grid, node, fuel));
349

350
351
// Total fuel consumption over the simulation
r_totalGenFuel(fuel)
352
    = sum(gn(grid, node), r_gnTotalGenFuel(grid, node, fuel));
353

354
// Total fuel consumption gn/g shares
355
r_gnTotalGenFuelShare(gn(grid, node), fuel)${ r_gnTotalGen(grid, node) }
356
    = r_gnTotalGenFuel(grid, node, fuel)
357
        / r_gnTotalGen(grid, node);
358
359
360

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

361
362
363
// Total spilled energy in each grid over the simulation
r_gTotalSpill(grid)
    = sum(gn(grid, node_spill(node)), r_gnTotalSpill(grid, node));
364

365
366
367
368
369
370
371
// Total spilled energy gn/g share
r_gnTotalSpillShare(gn(grid, node_spill))${ r_gTotalSpill(grid) }
    = r_gnTotalSpill(grid, node_spill)
        / r_gTotalSpill(grid);

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

Niina Helistö's avatar
Niina Helistö committed
372
373
// Total realized operating costs on each gn over the simulation
r_gnTotalRealizedOperatingCost(gn(grid, node))
374
    = sum(ft_realizedNoReset(f, t)$[ord(t) > mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')],
Niina Helistö's avatar
Niina Helistö committed
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
        + r_gnRealizedOperatingCost(grid, node, f ,t)
            * sum(msft_realizedNoReset(m, s, f, t), p_msProbability(m, s))
        );

// 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
r_gnTotalRealizedOperatingCostShare(gn(grid, node))${ r_gTotalRealizedOperatingCost(grid) }
    = 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));

404
405
// Total realized costs on each gn over the simulation
r_gnTotalRealizedCost(gn(grid, node))
Niina Helistö's avatar
Niina Helistö committed
406
407
408
409
410
411
412
413
414
415
416
417
418
    = 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
            );
419

420
421
422
423
// Total realized net costs on each gn over the simulation
r_gnTotalRealizedNetCost(gn(grid, node))
    = r_gnTotalRealizedCost(grid, node) - r_gnStorageValueChange(grid, node);

424
425
426
// Total realized costs on each grid over the simulation
r_gTotalRealizedCost(grid)
    = sum(gn(grid, node), r_gnTotalRealizedCost(grid, node));
427

428
429
430
431
// Total realized net costs on each grid over the simulation
r_gTotalRealizedNetCost(grid)
    = sum(gn(grid, node), r_gnTotalRealizedNetCost(grid, node));

432
433
434
435
436
// Total realized costs gn/g share
r_gnTotalRealizedCostShare(gn(grid, node))${ r_gTotalRealizedCost(grid) }
    = r_gnTotalRealizedCost(grid, node)
        / r_gTotalRealizedCost(grid);

437
438
// Total realized costs over the simulation
r_totalRealizedCost
439
    = sum(gn(grid, node), r_gnTotalRealizedCost(grid, node));
440

Niina Helistö's avatar
Niina Helistö committed
441
// Total realized net operating costs over the simulation
442
443
444
r_totalRealizedNetCost
    = sum(gn(grid, node), r_gnTotalRealizedNetCost(grid, node));

445
446
* --- Total Reserve Provision Results -----------------------------------------

447
448
449
450
// Total reserve provision in nodes over the simulation
r_nTotalReserve(restypeDirectionNode(restype, up_down, node))
    = sum(nuRescapable(restype, up_down, node, unit), r_nuTotalReserve(restype, up_down, node, unit));

451
452
453
454
455
456
r_nuTotalReserveShare(nuRescapable(restype, up_down, node, unit))${ r_nTotalReserve(restype, up_down, node) }
    = r_nuTotalReserve(restype, up_down, node, unit)
        / r_nTotalReserve(restype, up_down, node);

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

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

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

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

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

// Estimated coefficients of performance
479
480
481
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)
                                         }
482
483
484
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))}
            ];

// Estimated efficiency
492
d_eff(unit_fuel(unit), ft_realizedNoReset(f, t))$[ord(t) > mSettings(m, 't_start') + mSettings(m, 't_initializationPeriod')]
493
494
495
496
497
498
499
500
501
    = 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))}
            ];

502

503
); // END loop(m)
504