-
Notifications
You must be signed in to change notification settings - Fork 0
/
ETM_merit_order_import_make_graph_v2.m
145 lines (99 loc) · 3.38 KB
/
ETM_merit_order_import_make_graph_v2.m
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
135
136
137
138
close all
clear
clc
set(groot,'defaultLineLineWidth',2)
%% copy ETM merit order table -> google sheets -> sort -> export as .xlsx -> import
merit_xlsx_import_generated_script % etm_merit_loaded
%% Construct data
names = etm_merit_loaded.Technology;
prices = etm_merit_loaded.MarginalCosts; % Y-axis
instal_capacity = etm_merit_loaded.InstalledCapacity./1000; % X-axis %[GW] power
instal_capacity_cumsum = cumsum(instal_capacity);
%% Plot using single bar graphs and hold function
% found idea on: https://comp.soft-sys.matlab.narkive.com/fWK4AmsP/varying-width-of-bar-graphs
instal_capacity_cumsum_from_zero = [0; instal_capacity_cumsum];
close all
h0 = figure;
hold on
newcolors = [0.9290 0.6940 0.1250 % PV
0.9290 0.6940 0.1250
0.9290 0.6940 0.1250
0.9290 0.6940 0.1250
0 0.4470 0.7410 % Wind
0 0.4470 0.7410
0 0.4470 0.7410
0 0 1 % hydro
0 0 0 % nuclear
0.4660 0.6740 0.1880 % biomass
0.83 0.14 0.14
1.00 0.54 0.00
0.47 0.25 0.80
0.25 0.80 0.54
0.8500 0.3250 0.0980
0.4940 0.1840 0.5560
0.4660 0.6740 0.1880
0.3010 0.7450 0.9330
0.6350 0.0780 0.1840
rand rand rand
rand rand rand
rand rand rand
rand rand rand
rand rand rand
rand rand rand
];
%newcolors = {'#F00','#F80','#FF0','#0B0','#00F','#50F','#A0F'};
colororder(newcolors)
for ii = 1:length(instal_capacity_cumsum)
center_x = (instal_capacity_cumsum_from_zero(ii) + instal_capacity_cumsum_from_zero(ii+1)) /2;
height = prices(ii)+2;
width = instal_capacity(ii);
bar(center_x,height,width)
end
grid
ylabel('Marginal generation costs of electricity [€/MWh]')
xlabel('Installed generation capacity (cumulative) [GW]')
title('(at a gas TTF price of €50/MWh thermal)')
% TODO: how to make legend from a array of strings
%legend('a','b','Location','NorthWest')
legend(names,'Location','NorthWest')
save_fig(h0,'ETM_merit_order_import_make_graph_v2');
%% other idea to plot using: rectangles
% %% Plot using rectangles
%
% % sample data: set the start of each bar, the bottom (here 0), the width and the height
%
% x = [0; instal_capacity_cumsum(1:end-1,:)]; % start of bar
% dx = instal_capacity; % width of bar
% y = zeros(length(x),1); % start rectangle from bottom
% dy = prices; % rectanlge height stops at price
%
% figure, hold on
% for ii=1:length(x)
% color = [rand rand rand]; % https://www.mathworks.com/help/matlab/ref/rectangle.html
% rectangle('position',[x(ii) y(ii) dx(ii) dy(ii)],'FaceColor',color)
% end
% grid
% legend('a','b')
%
% ylabel('Electricity price')
% xlabel('Generation power')
%
%
% %% Plot example using rectangles
% % https://stackoverflow.com/questions/18419339/how-to-plot-bar-with-different-height-and-differenth-width-in-matlab
% % sample data: set the start of each bar, the bottom (here 0), the width and the height
%
% x = [0.5 0.6 0.9 1 1.2]; % start of bar
% y = zeros(length(x),1);
% dx = diff([x 1.8]); % width of bar
% dy = [1 3 2 .5 .1];
%
% figure, hold on
% for ii=1:length(x)
% rectangle('position',[x(ii) y(ii) dx(ii) dy(ii)])
% end
% axis([0.5 2 0 4.1])
%
% ylabel('Prob density')
% xlabel('Time')
%% ABC