Skip to content

Commit e697f61

Browse files
committed
Changes before merging
1 parent 2302378 commit e697f61

File tree

10 files changed

+116
-45
lines changed

10 files changed

+116
-45
lines changed

.DS_Store

-2 KB
Binary file not shown.

Project.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ version = "0.1.0"
77
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
88
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
99
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
10+
DelimitedFiles = "8bb1440f-4735-579b-a4ab-409b98df4dab"
1011
FileIO = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549"
1112
JLD = "4138dd39-2aa7-5051-a626-17a0bb65d9c8"
1213
JLD2 = "033835bb-8acc-5ee8-8aae-3f567f8a3819"

examples/.DS_Store

0 Bytes
Binary file not shown.

examples/structures/.DS_Store

6 KB
Binary file not shown.

examples/structures/._.DS_Store

4 KB
Binary file not shown.
6 KB
Binary file not shown.
4 KB
Binary file not shown.

src/io.jl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,12 @@ function change_time_parameters(params_path_ftr::AbstractString, instance_path_c
218218
# Declare representative periods
219219
rep_periods = JSON.parsefile(joinpath(instance_path_clust,"rep_periods.json"))
220220
T = 1:rep_periods["T"]
221-
ParamsDict["T"] = 1:rep_periods["T"]
221+
ParamsDict["T"] = T
222+
223+
# Load weights
224+
clust_weights = CSV.File(joinpath(instance_path_clust, "weights.csv")) |> DataFrame
225+
τ_t = clust_weights.Weights[T]
226+
ParamsDict["τ_t"] = τ_t
222227

223228
# Read time-dependent parameters
224229
D_nt = zeros(length(ParamsDict["N"]), length(T))

src/model.jl

Lines changed: 96 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ are not specified are included by default.
2020
ramping::Bool = false
2121
voltage_angles::Bool = false
2222
hydro::Bool = false
23+
hydro_simple::Bool = false
2324
end
2425

2526
"""Input indices and parameters for the model."""
@@ -113,7 +114,7 @@ end
113114
- `parameters::Params`
114115
- `variables::Variables`
115116
"""
116-
function Expressions(parameters::Params, variables::Dict{String, Array{Float64}})
117+
function Expressions(parameters::Params, specs::Specs, variables::Dict{String, Array{Float64}})
117118
@unpack G, G_r, N, T, H, R_E, e_g, E_g, τ_t = parameters
118119

119120
"""Expression values:
@@ -123,13 +124,23 @@ function Expressions(parameters::Params, variables::Dict{String, Array{Float64}}
123124
- `C′_E: CO2 emission reduction
124125
"""
125126
p_gnt = variables["p_gnt"]
126-
h_hnt = variables["h_hnt"]
127127

128-
κ′ = (sum(p_gnt[g,n,t]*τ_t[t] for g in G_r, n in N, t in T) + sum(h_hnt[h,n,t]*τ_t[t] for h in H, n in N, t in T)) /
129-
(sum(p_gnt[g,n,t]*τ_t[t] for g in G, n in N, t in T) + sum(h_hnt[h,n,t]*τ_t[t] for h in H, n in N, t in T))
130-
μ′ = sum(p_gnt[5,n,t]*τ_t[t] for n in N, t in T) /
131-
(sum(p_gnt[g,n,t]*τ_t[t] for g in G, n in N, t in T) + sum(h_hnt[h,n,t]*τ_t[t] for h in H, n in N, t in T))
132-
C′_E = 1 - ((sum(E_g[g] * (sum(p_gnt[g,n,t]*τ_t[t] for n in N, t in T) + sum(h_hnt[h,n,t]*τ_t[t] for h in H, n in N, t in T)) / e_g[g] for g in G)) / R_E)
128+
if (specs.hydro || specs.hydro_simple)
129+
h_hnt = variables["h_hnt"]
130+
hr_nt = variables["hr_nt"]
131+
132+
κ′ = (sum(p_gnt[g,n,t]*τ_t[t] for g in G_r, n in N, t in T) + sum(h_hnt[h,n,t]*τ_t[t] for h in H, n in N, t in T) + sum(hr_nt[n,t]*τ_t[t] for n in N, t in T)) /
133+
(sum(p_gnt[g,n,t]*τ_t[t] for g in G, n in N, t in T) + sum(h_hnt[h,n,t]*τ_t[t] for h in H, n in N, t in T) + sum(hr_nt[n,t]*τ_t[t] for n in N, t in T))
134+
μ′ = sum(p_gnt[5,n,t]*τ_t[t] for n in N, t in T) /
135+
(sum(p_gnt[g,n,t]*τ_t[t] for g in G, n in N, t in T) + sum(h_hnt[h,n,t]*τ_t[t] for h in H, n in N, t in T) + sum(hr_nt[n,t]*τ_t[t] for n in N, t in T))
136+
else
137+
κ′ = (sum(p_gnt[g,n,t]*τ_t[t] for g in G_r, n in N, t in T)) /
138+
(sum(p_gnt[g,n,t]*τ_t[t] for g in G, n in N, t in T))
139+
μ′ = sum(p_gnt[5,n,t]*τ_t[t] for n in N, t in T) /
140+
(sum(p_gnt[g,n,t]*τ_t[t] for g in G, n in N, t in T))
141+
end
142+
143+
C′_E = 1 - (sum(E_g[g] * (sum(p_gnt[g,n,t]*τ_t[t] for n in N, t in T)) / e_g[g] for g in G)) / R_E
133144

134145
ExpressionsDict = Dict("κ′" => κ′, "μ′" => μ′, "C′_E" => C′_E)
135146

@@ -142,10 +153,10 @@ end
142153
- `specs::Specs`
143154
"""
144155
function EnergySystemModel(parameters::Params, specs::Specs)
145-
@unpack max_dem_n, G, G_r, N, L, L_ind, T, S, κ, μ, C, C̄, C_E, R_E, τ_t, Gmin_gn, Gmax_gn, A_gnt, D_nt, I_g, M_g,
156+
@unpack max_dem_n, G, G_r, N, L, L_ind, T, S, H, κ, μ, C, C̄, C_E, R_E, τ_t, Gmin_gn, Gmax_gn, A_gnt, D_nt, I_g, M_g,
146157
C_g, e_g, E_g, r⁻_g, r⁺_g, I_l, M_l, C_l, B_l, e_l, Tmin_l, Tmax_l, ξ_s, I_s, C_s, Smin_sn, Smax_sn,
147158
Wmax_hn, Wmin_hn, Hmax_hn, Hmin_hn, HRmax_n, Fmin_n, AH_nt, AR_nt,
148-
H, I_h, M_h, r⁻_h, r⁺_h =
159+
I_h, M_h, r⁻_h, r⁺_h =
149160
parameters
150161

151162
# TODO: include hydro environment constraints: i.e., use C_h, e_h, E_h
@@ -214,16 +225,34 @@ function EnergySystemModel(parameters::Params, specs::Specs)
214225

215226
if specs.hydro
216227
# Hydro energy variables
217-
@variable(model, w_hnt[h in H, n in N, t in T] Wmin_hn[h,n])
228+
@variable(model, w_hnt[h in H, n in N, t in T] Wmin_hn[h,n])
218229
VariablesDict["w_hnt"] = w_hnt
219-
@variable(model, h_hnt[h in H, n in N, t in T]0)
230+
@variable(model, h_hnt[h in H, n in N, t in T] 0)
220231
VariablesDict["h_hnt"] = h_hnt
221-
@variable(model, hr_nt[n in N, t in T]0)
232+
@variable(model, hr_nt[n in N, t in T] 0)
222233
VariablesDict["hr_nt"] = hr_nt
223-
@variable(model, h̄_hn[h in H, n in N]Hmin_hn[h,n])
234+
@variable(model, h̄_hn[h in H, n in N] Hmin_hn[h,n])
224235
VariablesDict["h̄_hn"] = h̄_hn
225236
end
226237

238+
if specs.hydro_simple
239+
if !(specs.hydro)
240+
# Hydro energy variables
241+
@variable(model, h_hnt[h in H, n in N, t in T] 0)
242+
VariablesDict["h_hnt"] = h_hnt
243+
@variable(model, h̄_hn[h in H, n in N] Hmin_hn[h,n])
244+
VariablesDict["h̄_hn"] = h̄_hn
245+
@variable(model, 0 hr_nt[n in N, t in T] 0)
246+
VariablesDict["hr_nt"] = hr_nt
247+
end
248+
# Compute maximal levels
249+
a_n = zeros(length(N))
250+
for n in N
251+
a_n[n] = sum(AH_nt[n,:])/(sum(Hmin_hn[:,n]) * length(T))
252+
isnan(a_n[n]) ? a_n[n] = 0 : a_n[n] = a_n[n]
253+
end
254+
end
255+
227256
## -- Objective --
228257
# Investment and maintenance of generation capacity
229258
@expression(model, f1,
@@ -265,17 +294,15 @@ function EnergySystemModel(parameters::Params, specs::Specs)
265294
end
266295

267296
# Investment cost of hydro capacity
268-
if specs.hydro
269-
# TODO: create an index h for hydro plants
297+
if (specs.hydro || specs.hydro_simple)
270298
@expression(model, f8,
271299
sum(I_h*(h̄_hn[h,n] - Hmin_hn[h,n]) + M_h*h̄_hn[h,n] for h in H, n in N))
272300
ObjectivesDict["f8"] = f8
273301

274302
# TODO: add operational costs for hydro generation (i.e., C_h)
275-
276303
end
277304

278-
@objective(model, Min, sum(sum(flatten(ObjectivesDict[i])) for i in keys(ObjectivesDict))/10^3)
305+
@objective(model, Min, sum(sum(flatten(ObjectivesDict[i])) for i in keys(ObjectivesDict))/10^6)
279306

280307
## -- Constraints --
281308
# Transmission lines to node n
@@ -286,52 +313,52 @@ function EnergySystemModel(parameters::Params, specs::Specs)
286313
# TODO: add hydro generation efficiency dependencies (i.e., e_h)
287314

288315
# Energy balance (dependent on the features selected)
289-
if specs.transmission && specs.storage && specs.hydro # Trans/Stor/Hydro
316+
if specs.transmission && specs.storage && (specs.hydro || specs.hydro_simple) # Trans/Stor/Hydro
290317
@constraint(model,
291318
b1[n in N, t in T],
292319
(sum(p_gnt[g,n,t] for g in G) + σ_nt[n,t] +
293320
sum(e_l[l]*f_lt[l,t] for l in L⁻(n)) - sum(e_l[l]*f_lt[l,t] for l in L⁺(n)) +
294321
sum(τ_t[t]*(ξ_s[s]*b⁻_snt[s,n,t] - b⁺_snt[s,n,t]) for s in S) +
295322
sum(h_hnt[h,n,t] for h in H) + hr_nt[n,t])/1000
296323
== max_dem_n[n]*D_nt[n,t]/1000)
297-
elseif specs.transmission && specs.storage && !(specs.hydro) # Trans/Stor
324+
elseif specs.transmission && specs.storage && !(specs.hydro || specs.hydro_simple) # Trans/Stor
298325
@constraint(model,
299326
b1[n in N, t in T],
300327
(sum(p_gnt[g,n,t] for g in G) + σ_nt[n,t] +
301328
sum(e_l[l]*f_lt[l,t] for l in L⁻(n)) - sum(e_l[l]*f_lt[l,t] for l in L⁺(n)) +
302329
sum(τ_t[t]*(ξ_s[s]*b⁻_snt[s,n,t] - b⁺_snt[s,n,t]) for s in S))/1000
303330
== max_dem_n[n]*D_nt[n,t]/1000)
304-
elseif specs.transmission && !(specs.storage) && specs.hydro # Trans/Hydro
331+
elseif specs.transmission && !(specs.storage) && (specs.hydro || specs.hydro_simple) # Trans/Hydro
305332
@constraint(model,
306333
b1[n in N, t in T],
307334
(sum(p_gnt[g,n,t] for g in G) + σ_nt[n,t] +
308335
sum(e_l[l]*f_lt[l,t] for l in L⁻(n)) - sum(e_l[l]*f_lt[l,t] for l in L⁺(n)) +
309336
sum(h_hnt[h,n,t] for h in H) + hr_nt[n,t] )/1000
310337
== max_dem_n[n]*D_nt[n,t]/1000)
311-
elseif specs.transmission && !(specs.storage) && !(specs.hydro) # Trans
338+
elseif specs.transmission && !(specs.storage) && !(specs.hydro || specs.hydro_simple) # Trans
312339
@constraint(model,
313340
b1[n in N, t in T],
314341
(sum(p_gnt[g,n,t] for g in G) + σ_nt[n,t] +
315342
sum(e_l[l]*f_lt[l,t] for l in L⁻(n)) - sum(e_l[l]*f_lt[l,t] for l in L⁺(n)))/1000
316343
== max_dem_n[n]*D_nt[n,t]/1000)
317-
elseif !(specs.transmission) && !(specs.storage) && !(specs.hydro) # -
344+
elseif !(specs.transmission) && !(specs.storage) && !(specs.hydro || specs.hydro_simple) # -
318345
@constraint(model,
319346
b1[n in N, t in T],
320347
(sum(p_gnt[g,n,t] for g in G) + σ_nt[n,t])/1000
321348
== max_dem_n[n]*D_nt[n,t]/1000)
322-
elseif !(specs.transmission) && specs.storage && !(specs.hydro) # Stor
349+
elseif !(specs.transmission) && specs.storage && !(specs.hydro || specs.hydro_simple) # Stor
323350
@constraint(model,
324351
b1[n in N, t in T],
325352
(sum(p_gnt[g,n,t] for g in G) + σ_nt[n,t] +
326353
sum(τ_t[t]*(ξ_s[s]*b⁻_snt[s,n,t] - b⁺_snt[s,n,t]) for s in S))/1000
327354
== max_dem_n[n]*D_nt[n,t]/1000)
328-
elseif !(specs.transmission) && !(specs.storage) && specs.hydro # Hydro
355+
elseif !(specs.transmission) && !(specs.storage) && (specs.hydro || specs.hydro_simple) # Hydro
329356
@constraint(model,
330357
b1[n in N, t in T],
331358
(sum(p_gnt[g,n,t] for g in G) + σ_nt[n,t] +
332359
sum(h_hnt[h,n,t] for h in H) + hr_nt[n,t] )/1000
333360
== max_dem_n[n]*D_nt[n,t]/1000)
334-
elseif !(specs.transmission) && specs.storage && specs.hydro # Stor/Hydro
361+
elseif !(specs.transmission) && specs.storage && (specs.hydro || specs.hydro_simple) # Stor/Hydro
335362
@constraint(model,
336363
b1[n in N, t in T],
337364
(sum(p_gnt[g,n,t] for g in G) + σ_nt[n,t] +
@@ -343,22 +370,31 @@ function EnergySystemModel(parameters::Params, specs::Specs)
343370
# Generation capacity
344371
@constraint(model,
345372
g1[g in G, n in N, t in T],
346-
p_gnt[g,n,t]/1000 A_gnt[g,n,t] * p̄_gn[g,n]/1000)
373+
p_gnt[g,n,t] A_gnt[g,n,t] * p̄_gn[g,n])
374+
347375
# @constraint(model,
348376
# g2[g in G, n in N],
349377
# p̄_gn[g,n] ≤ Gmax_gn[g,n])
350378

351379
# Minimum renewables share
352380
if specs.renewable_target
353-
@constraint(model, g3,
354-
((sum(p_gnt[g,n,t]*τ_t[t] for g in G_r, n in N, t in T) + sum(h_hnt[h,n,t]*τ_t[t] for h in H, n in N, t in T)) / 1000)
355-
κ * (sum(p_gnt[g,n,t]*τ_t[t] for g in G, n in N, t in T) + sum(h_hnt[h,n,t]*τ_t[t] for h in H, n in N, t in T)) / 1000)
381+
if (specs.hydro || specs.hydro_simple)
382+
@constraint(model, g3,
383+
((sum(p_gnt[g,n,t]*τ_t[t] for g in G_r, n in N, t in T) + sum(h_hnt[h,n,t]*τ_t[t] for h in H, n in N, t in T)) + sum(hr_nt[n,t]*τ_t[t] for n in N, t in T))
384+
κ * (sum(p_gnt[g,n,t]*τ_t[t] for g in G, n in N, t in T) + sum(h_hnt[h,n,t]*τ_t[t] for h in H, n in N, t in T) + sum(hr_nt[n,t]*τ_t[t] for n in N, t in T)))
385+
else
386+
@constraint(model, g3,
387+
sum(p_gnt[g,n,t]*τ_t[t] for g in G_r, n in N, t in T)
388+
κ * sum(p_gnt[g,n,t]*τ_t[t] for g in G, n in N, t in T))
389+
end
356390
end
357391

358392
# Maximum nuclear share
359393
if specs.nuclear_limit
394+
#TODO: include a parameter with the index(es) of nuclear sources as a parameter in io.jl
360395
@constraint(model, g4,
361-
(sum(p_gnt[5,n,t] for n in N, t in T) / 1000) * (sum(p_gnt[g,n,t] for g in G, n in N, t in T) + sum(h_hnt[h,n,t] for h in H, n in N, t in T)) / 1000))
396+
sum(p_gnt[5,n,t] for n in N, t in T) / 1000 μ * (sum(p_gnt[g,n,t] for g in G, n in N, t in T) +
397+
sum(h_hnt[h,n,t] for h in H, n in N, t in T) + sum(hr_nt[n,t] for n in N, t in T)) / 1000)
362398
end
363399

364400
#Carbon cap
@@ -409,23 +445,23 @@ function EnergySystemModel(parameters::Params, specs::Specs)
409445
# Discharge limits (t = 1)
410446
@constraint(model,
411447
s2[s in S, n in N, t in [1]],
412-
τ_t[t]*b⁻_snt[s,n,t]/1000 b_snt[s,n,t]/1000)
448+
τ_t[t]*ξ_s[s]*b⁻_snt[s,n,t]/1000 b_snt[s,n,t]/1000)
413449
# Discharge limits (t > 1)
414450
@constraint(model,
415451
s3[s in S, n in N, t in T[T.>1]],
416-
τ_t[t]*b⁻_snt[s,n,t]/1000 τ_t[t-1]*b_snt[s,n,t-1]/1000)
452+
τ_t[t]*ξ_s[s]*b⁻_snt[s,n,t]/1000 τ_t[t-1]*b_snt[s,n,t-1]/1000)
417453
# Charge
418454
@constraint(model,
419455
s4[s in S, n in N, t in T],
420-
τ_t[t]*ξ_s[s]*b⁺_snt[s,n,t]/1000 (b̄_sn[s,n] - b_snt[s,n,t])/1000)
456+
τ_t[t]*b⁺_snt[s,n,t] (b̄_sn[s,n] - b_snt[s,n,t]))
421457
# Storage balance
422458
@constraint(model,
423459
s5[s in S, n in N, t in T[T.>1]],
424-
b_snt[s,n,t]/1000 == (b_snt[s,n,t-1] + τ_t[t]*(ξ_s[s]*b⁺_snt[s,n,t] - b⁻_snt[s,n,t]))/1000)
460+
b_snt[s,n,t] == (b_snt[s,n,t-1] + τ_t[t]*(b⁺_snt[s,n,t] - ξ_s[s]*b⁻_snt[s,n,t])))
425461
# Storage continuity
426462
@constraint(model,
427463
s6[s in S, n in N],
428-
b_snt[s,n,1]/1000 == b_snt[s,n,T[end]]/1000)
464+
b_snt[s,n,1] == b_snt[s,n,T[end]])
429465
# Storage capacity bounds
430466
# @constraint(model,
431467
# s7[s in S, n in N],
@@ -436,10 +472,10 @@ function EnergySystemModel(parameters::Params, specs::Specs)
436472
# Ramping limits
437473
@constraint(model,
438474
r1[g in G, n in N, t in T[T.>1]],
439-
(p_gnt[g,n,t]-p_gnt[g,n,t-1])/1000 r⁺_g[g] * p̄_gn[g,n]/1000)
475+
(p_gnt[g,n,t]-p_gnt[g,n,t-1]) r⁺_g[g] * p̄_gn[g,n])
440476
@constraint(model,
441477
r2[g in G, n in N, t in T[T.>1]],
442-
(p_gnt[g,n,t]-p_gnt[g,n,t-1])/1000 -r⁻_g[g] * p̄_gn[g,n]/1000)
478+
(p_gnt[g,n,t]-p_gnt[g,n,t-1]) -r⁻_g[g] * p̄_gn[g,n])
443479
end
444480

445481
if specs.voltage_angles
@@ -509,5 +545,28 @@ function EnergySystemModel(parameters::Params, specs::Specs)
509545
end
510546
end
511547

548+
if specs.hydro_simple
549+
if !(specs.hydro)
550+
# Maximum hydro flow (capacity)
551+
@constraint(model,
552+
hs1[h in H, n in N, t in T],
553+
h_hnt[h,n,t]/1000 h̄_hn[h,n]/1000)
554+
if specs.ramping
555+
# Hydro ramping up
556+
@constraint(model,
557+
hsr1[h in H, n in N, t in T[T.>1]],
558+
(h_hnt[h,n,t]-h_hnt[h,n,t-1])/1000 (r⁺_h[h] * h̄_hn[h,n])/1000)
559+
# Hydro ramping down
560+
@constraint(model,
561+
hsr2[h in H, n in N, t in T[T.>1]],
562+
(h_hnt[h,n,t]-h_hnt[h,n,t-1])/1000 (-r⁻_h[h] * h̄_hn[h,n])/1000)
563+
end
564+
end
565+
# Maximum hydro flow (accumulated)
566+
@constraint(model,
567+
hs2[n in N],
568+
sum(τ_t[t]*h_hnt[h,n,t] for h in H, t in T)/1000 a_n[n]*sum(τ_t[t]*h̄_hn[h,n] for h in H, t in T)/1000)
569+
end
570+
512571
return model, VariablesDict, ObjectivesDict
513572
end

src/plotting.jl

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ using Plots, StatsPlots, LaTeXStrings
33
techcolors = [:lightblue :cyan :yellow :darkgreen :lime :gray :orange :brown :blue]
44

55
function perform_plotting(Plots_specs::Dict{String, Bool}, parameters::Params, variables::Dict{String, Array{Float64}},
6-
objectives::Dict{String, Array{Float64}}, expressions::Dict{String, Array{Float64}}, plots_output_path::AbstractString)
6+
objectives::Dict{String, Float64}, expressions::Dict{String, Float64}, plots_output_path::AbstractString)
77

88
@info "Plotting"
99
ENV["GKSwstype"]="nul" # Prevent opening plots windows
@@ -193,7 +193,8 @@ function plot_generation_capacities(p̄_gn, h̄_hn, HRmax_n, G, n, region_n, tec
193193
titlefontsize = 10,
194194
color=techcolors,
195195
alpha=0.7,
196-
legend=false)
196+
legend=false,
197+
size = (800,600))
197198
end
198199

199200
function plot_generation_capacities_stacked(p̄_gn, h̄_hn, HRmax_n, N, H, region_n, technology_g, κ, C_E, κ′, C′_E)
@@ -210,7 +211,9 @@ function plot_generation_capacities_stacked(p̄_gn, h̄_hn, HRmax_n, N, H, regio
210211
color=techcolors,
211212
labels=permutedims([technology_g;"hydro"]),
212213
lw = 0,
213-
alpha=0.7)
214+
alpha=0.7,
215+
legend = :outertopright,
216+
size = (800,600))
214217
end
215218

216219
function plot_transmission_flow(f_lt, f̄_l, l, L, T, region_n, κ, C_E, κ′, C′_E)
@@ -237,8 +240,8 @@ function plot_transmission_bars(f_lt, L, L_ind, T, region_n, κ, C_E, κ′, C
237240
ylabel=L"\sum_t f_{l,t}\,\mathrm{[MWh]}",
238241
title = "Transmission flow by line\nRenewables share = $(round(κ′,digits=3))\nCO2 reduction = $(round(C′_E,digits=3))$C_E",
239242
titlefontsize = 10,
243+
xtickfontsize = 5,
240244
xticks=(L_ind, lines),
241-
xrotation = 90,
242245
legend=false,
243246
)
244247
bar!(L_ind, [f_l[l] for l in L_ind], alpha = 0.7, lw = 0)
@@ -253,8 +256,8 @@ function plot_transmission_capacities(f̄_l, L, L_ind, region_n, κ, C_E, κ′,
253256
StatsPlots.bar(L_ind, [f̄_l[l] for l in L_ind],
254257
title = "Transmission capacity by line\nRenewables share = $(round(κ′,digits=3))\nCO2 reduction = $(round(C′_E,digits=3))$C_E",
255258
titlefontsize = 10,
259+
xtickfontsize = 5,
256260
xticks=(L_ind, lines),
257-
xrotation = 90,
258261
ylabel=L"\bar{f}_l\,\mathrm{[MW]}",
259262
legend=false,
260263
alpha = 0.7,
@@ -291,7 +294,9 @@ function plot_storage_capacities(b̄_sn, N, region_n, κ, C_E, κ′, C′_E)
291294
title = "Storage capacity by region\nRenewables share = $(round(κ′,digits=3))\nCO2 reduction = $(round(C′_E,digits=3))$C_E",
292295
titlefontsize = 10,
293296
lw = 0,
294-
alpha=0.7)
297+
alpha=0.7,
298+
size=(800, 600),
299+
legend = :outertopright)
295300
end
296301

297302
function plot_loss_of_load(σ_nt, N, T, region_n, κ, C_E, κ′, C′_E)
@@ -377,7 +382,8 @@ function plot_dispatch_bars(max_dem_n, p_gnt, h_hnt, D_nt, N, T, H, region_n, te
377382
labels=permutedims([technology_g;"hydro"]),
378383
lw = 0,
379384
alpha=0.7,
380-
size = (800,600))
385+
size = (800,600),
386+
legend = :outertopright)
381387
bar!(N, D_n, bar_width=0.03, fillcolor = :black, label="demand")
382388
end
383389

0 commit comments

Comments
 (0)