2c_objective.gms 10.6 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
20
21
22

* =============================================================================
* --- Objective Function Definition -------------------------------------------
* =============================================================================

23
24
q_obj ..

25
    + v_obj * 1e6 // Objective function valued in MEUR instead of EUR (or whatever monetary unit the data is in)
26
27
28
29
30
31
32

    =E=

    // Sum over all the samples, forecasts, and time steps in the current model
    + sum(msft(m, s, f, t),
        // Probability (weight coefficient) of (s,f,t)
        + p_msft_probability(m, s, f, t)
33
            * p_s_discountFactor(s) // Discount costs
34
35
36
37
            * [
                // Time step length dependent costs
                + p_stepLength(m, f, t)
                    * [
38
39
                        // Variable O&M costs for inputs
                        - sum(gnuft(grid, node, unit, f, t)$gnu_input(grid, node, unit),
40
                            + v_gen(grid, node, unit, s, f, t)
41
                                * ts_vomCost_(grid, node, unit, t)
42
                            ) // END sum(gnuft)
43

44
45
46
47
48
                        // Variable O&M costs
                        + sum(gnuft(grid, node, unit, f, t)$gnu_output(grid, node, unit),
                            + v_gen(grid, node, unit, s, f, t)
                                * ts_vomCost_(grid, node, unit, t)
                            ) // END sum(gnuft)
49
50
51
52

                        // Node state slack variable costs
                        + sum(gn_stateSlack(grid, node),
                            + sum(slack${p_gnBoundaryPropertiesForStates(grid, node, slack, 'slackCost')},
53
                                + v_stateSlack(grid, node, slack, s, f, t)
54
55
56
57
58
59
60
61
                                    * p_gnBoundaryPropertiesForStates(grid, node, slack, 'slackCost')
                                ) // END sum(slack)
                            ) // END sum(gn_stateSlack)

                        // Dummy variable penalties
                        // Energy balance feasibility dummy varible penalties
                        + sum(inc_dec,
                            + sum(gn(grid, node),
62
                                + vq_gen(inc_dec, grid, node, s, f, t)
63
                                    *( PENALTY_BALANCE(grid, node)${not p_gnBoundaryPropertiesForStates(grid, node, 'balancePenalty', 'useTimeSeries')}
64
                                    + ts_node_(grid, node, 'balancePenalty', s, f, t)${p_gnBoundaryPropertiesForStates(grid, node, 'balancePenalty', 'useTimeSeries')}
65
                                      )
66
67
68
69
                                ) // END sum(gn)
                            ) // END sum(inc_dec)

                        // Reserve provision feasibility dummy variable penalties
70
71
                        + sum(restypeDirectionGroup(restype, up_down, group),
                            + vq_resDemand(restype, up_down, group, s, f+df_reservesGroup(group, restype, f, t), t)
72
                                * PENALTY_RES(restype, up_down)
73
                            + vq_resMissing(restype, up_down, group, s, f+df_reservesGroup(group, restype, f, t), t)${ ft_reservesFixed(group, restype, f+df_reservesGroup(group, restype, f, t), t) }
74
75
76
                                * PENALTY_RES_MISSING(restype, up_down)
                            ) // END sum(restypeDirectionNode)

77
                        // Capacity margin feasibility dummy variable penalties
78
                        + sum(gn(grid, node)${ p_gn(grid, node, 'capacityMargin') },
79
                            + vq_capacity(grid, node, s, f, t)
80
81
                                * PENALTY_CAPACITY(grid, node)
                            ) // END sum(gn)
82
83
84
85
86
                        ] // END * p_stepLength

                // Start-up costs, initial startup free as units could have been online before model started
                + sum(uft_online(unit, f, t),
                    + sum(unitStarttype(unit, starttype),
87
88
89
                        + [ // Unit startup variables
                            + v_startup_LP(unit, starttype, s, f, t)${ uft_onlineLP(unit, f, t) }
                            + v_startup_MIP(unit, starttype, s, f, t)${ uft_onlineMIP(unit, f, t) }
90
91
                          ]
                          * ts_startupCost_(unit, starttype, t)
92
93
                      ) // END sum(starttype)
                  ) // END sum(uft_online)
94

95
96
                // Shut-down costs, initial shutdown free?
                + sum(uft_online(unit, f, t),
97
98
99
100
101
102
103
                    + p_uShutdown(unit, 'cost')
                      * [
                            + v_shutdown_LP(unit, s, f, t)
                                ${ uft_onlineLP(unit, f, t) }
                            + v_shutdown_MIP(unit, s, f, t)
                                ${ uft_onlineMIP(unit, f, t) }
                        ]
104
105
                  ) // END sum(uft_online)

106
                // Ramping costs
107
                + sum(gnuft_rampCost(grid, node, unit, slack, f, t),
108
                    + p_gnuBoundaryProperties(grid, node, unit, slack, 'rampCost')
109
                        * v_genRampUpDown(grid, node, unit, slack, s, f, t)
110
111
                  ) // END sum(gnuft_rampCost)

112
                ]  // END * p_sft_probability(s,f,t)
113

114
                // Variable Transfer
115
                + sum(gn2n_directional(grid, node_, node),
116
                    + p_gnn(grid, node, node_, 'variableTransCost')
117
118
119
120
                    * v_transferLeftward(grid, node_, node, s, f, t)
                  ) // END sum(gn2n_directional(grid, node_, node))

                + sum(gn2n_directional(grid, node_, node),
121
                    + p_gnn(grid, node_, node, 'variableTransCost')
122
123
124
                    * v_transferRightward(grid, node_, node, s, f, t)
                  ) // END sum(gn2n_directional(grid, node_, node))

125
126
        ) // END sum over msft(m, s, f, t)

127
    // Cost of energy storage change (note: not discounted)
128
    + sum(gn_state(grid, node),
129
        + sum(mft_start(m, f, t)${ active(m, 'storageValue') },
Topi Rasku's avatar
Topi Rasku committed
130
            + sum(ms(m, s)${ p_msft_probability(m, s, f, t) },
131
132
133
134
135
136
137
                + [
                    + p_storageValue(grid, node)${ not p_gn(grid, node, 'storageValueUseTimeSeries') }
                    + ts_storageValue_(grid, node, s, f+df_central(f,t), t)${ p_gn(grid, node, 'storageValueUseTimeSeries') }
                  ]
                    * p_msft_probability(m, s, f, t)
                    * v_state(grid, node, s, f+df_central(f,t), t)
               ) // END sum(s)
138
            ) // END sum(mftStart)
139
        - sum(mft_lastSteps(m, f, t)${ active(m, 'storageValue') },
Topi Rasku's avatar
Topi Rasku committed
140
            + sum(ms(m, s)${p_msft_probability(m, s, f, t)},
141
142
143
144
145
146
147
                + [
                    + p_storageValue(grid, node)${ not p_gn(grid, node, 'storageValueUseTimeSeries') }
                    + ts_storageValue_(grid, node, s, f+df_central(f,t), t)${ p_gn(grid, node, 'storageValueUseTimeSeries') }
                  ]
                    * p_msft_probability(m, s, f, t)
                    * v_state(grid, node, s, f+df_central(f,t), t)
                ) // END sum(s)
148
149
150
151
            ) // END sum(mftLastSteps)
        ) // END sum(gn_state)

    // Investment Costs
152
    + sum(ms(m, s)${ sum(msft(m, s, f, t), 1) }, // consider ms only if it has active msft
153
        + p_msAnnuityWeight(m, s) // Sample weighting to calculate annual costs
154
            * p_s_discountFactor(s) // Discount costs
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
            * [
                // Unit investment costs (including fixed operation and maintenance costs)
                + sum(gnu(grid, node, unit),
                    + v_invest_LP(unit)${ unit_investLP(unit) and sum(msft(m, s, f, t_), uft(unit, f, t_))} // consider unit only if it is active in the sample
                        * p_gnu(grid, node, unit, 'unitSize')
                        * [
                            + p_gnu(grid, node, unit, 'invCosts') * p_gnu(grid, node, unit, 'annuity')
                            + p_gnu(grid, node, unit, 'fomCosts')
                          ]
                    + v_invest_MIP(unit)${ unit_investMIP(unit) and sum(msft(m, s, f, t_), uft(unit, f, t_))} // consider unit only if it is active in the sample
                        * p_gnu(grid, node, unit, 'unitSize')
                        * [
                            + p_gnu(grid, node, unit, 'invCosts') * p_gnu(grid, node, unit, 'annuity')
                            + p_gnu(grid, node, unit, 'fomCosts')
                          ]
                    ) // END sum(gnu)

                + sum(t_invest(t)${ord(t) <= msEnd(m, s)},
                    // Transfer link investment costs
                    + sum(gn2n_directional(grid, from_node, to_node),
                        + v_investTransfer_LP(grid, from_node, to_node, t)${ gn2n_directional_investLP(grid, from_node, to_node) }
                            * [
                                + 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 * v_investTransfer_LP
                        + v_investTransfer_MIP(grid, from_node, to_node, t)${ gn2n_directional_investMIP(grid, from_node, to_node) }
                            * [
                                + p_gnn(grid, from_node, to_node, 'unitSize')
                                    * p_gnn(grid, from_node, to_node, 'invCost')
                                    * p_gnn(grid, from_node, to_node, 'annuity')
                                + p_gnn(grid, to_node, from_node, 'unitSize')
                                    * p_gnn(grid, to_node, from_node, 'invCost')
                                    * p_gnn(grid, to_node, from_node, 'annuity')
                                ] // END * v_investTransfer_MIP
                        ) // END sum(gn2n_directional)
                    ) // END sum(t_invest)

                ] // END * p_s_discountFactor(s)

196
        ) // END sum(ms)
197

198
$ifthen.addterms exist '%input_dir%/2c_additional_objective_terms.gms'
199
    $$include '%input_dir%/2c_additional_objective_terms.gms';
200
$endif.addterms
201
;