forked from tum-ens/mathprog-energy-models
-
Notifications
You must be signed in to change notification settings - Fork 0
/
intertemporal.mod
134 lines (108 loc) · 4.3 KB
/
intertemporal.mod
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
# INTERTEMPORAL: minimal intertemporal capacity expansion problem
# Last updated: 18 Nov 2016
# Author: johannes.dorfner@tum.de
# License: CC0 <http://creativecommons.org/publicdomain/zero/1.0/>
#
# USAGE
# glpsol -m intertemporal.mod
#
# OVERVIEW
# This LP model finds the minimum cost investment plan for for a set of two
# power plant technologies over multiple decades, allowing investment decisions
# every five years. Old investments phase out of the power plant fleet after
# their lifetime is over. A discount factor incentivises later investment, while
# demand must be satisfied throughout the years.
#
# SETS
set year; # all years
set yearM within year; # modelled years (investment decisions)
set year0 within year; # initial years (no investments allowed)
set season; # time steps within year
set process; # power plant technologies
# PARAMETERS
param interest_rate; # price change of invest/fuel over the years
param demand{s in season}; # seasonal demand
param weight{s in season}; # seasonal weight
param discount{yM in yearM} # investment cost reduction for later invest
default interest_rate**((yM - 2010)/5); # exponential decay (ir < 1) or
# exponential growth (ir > 1)
param invcost{p in process}; # plant investment costs (EUR/MW)
param fuelcost{p in process}; # plant fuel costs (EUR/MWh)
param efficiency{p in process}; # plant efficiency (MWh_out/MWh_in)
param lifetime{p in process}; # plant lifetime (years)
# helper data structure: contains all tuples (process, year1, year2) for each
# technology p in process, for which a new-built capacity from year1 is still
# available in year2 (as in: plant lifetime not exceeded yet)
set is_operational within process cross year cross year := setof{
p in process, y1 in year, y2 in year:
y1 <= y2 and y1 + lifetime[p] >= y2
} (p, y1, y2);
# VARIABLES
var costs;
var new_capacity{year, process} >= 0;
var available_capacity{yearM, process} >= 0;
var production{yearM, season, process} >= 0;
# OBJECTIVE
minimize obj: costs;
# CONSTRAINTS
s.t. def_costs:
costs = sum{yM in yearM, p in process}
new_capacity[yM, p] *
invcost[p] *
discount[yM]
+ sum{yM in yearM, s in season, p in process}
production[yM, s, p] *
fuelcost[p] /
efficiency[p] *
weight[s] *
discount[yM];
s.t. res_no_investment_in_initial_years{y0 in year0, p in process}:
new_capacity[y0, p] = 0;
s.t. def_available_capacity{this_year in yearM, p in process}:
available_capacity[this_year, p] = sum{
(p, earlier_year, this_year) in is_operational
} new_capacity[earlier_year, p];
s.t. res_demand{yM in yearM, s in season}:
demand[s] <= sum{p in process} production[yM, s, p];
s.t. res_production_available_capacity{yM in yearM, s in season, p in process}:
production[yM, s, p] <= available_capacity[yM, p];
# SOLVE
solve;
# OUTPUT
printf "\nRESULT\n";
printf "Total cost: %g kEUR\n", costs/1e3;
printf "Interest rate: %g\n", interest_rate;
printf "\nCAPACITIES\n";
printf "%-9s %4s: %6s\n", "Process", "Year", "New Cap";
printf "-----------------------\n";
printf{yM in yearM, p in process: new_capacity[yM,p] > 0}:
"%-6s in %4s: %4.0f MW\n", p, yM, new_capacity[yM,p];
printf "\nPRODUCTION\n";
printf "%14s %-6s\n", " ", "Season";
printf "%-9s %3s:", "Process", "Year";
printf{s in season}: " %2s", s;
printf "\n----------------------------------\n";
for {yM in yearM, p in process}: {
printf "%-6s in %2s:", p, yM;
printf{s in season}:
(if production[yM, s, p] > 0 then " %2.0f" else " %2s"),
(if production[yM, s, p] > 0 then production[yM, s, p] else " ");
printf "\n";
}
printf "\n";
# DATA
data;
set year := 2000 2005 2010 2015 2020 2025 2030 2035 2040;
set year0 := 2000 2005 2010;
set yearM := 2015 2020 2025 2030 2035 2040;
param interest_rate := 0.8;
param: season: demand weight:=
S1 10 7300
S2 20 7300
S3 40 7300
S4 70 7300
S5 50 7300
S6 40 7300;
param: process: invcost fuelcost efficiency lifetime :=
stcoal 1000 .01 .45 15
gtgas 450 .02 .40 15;