-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmain_plots.m
192 lines (163 loc) · 4.74 KB
/
main_plots.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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
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
%% Frequency plots
freqyMin=min(min([a.omegaVec, b.omegaVec]))./(2*pi);
freqyMax=max(max([a.omegaVec,b.omegaVec]))./(2*pi);
freqyOffSet=0;
x0=0;
y0=1;
width=8;
height=5;
figure1=figure('Units','inches',...
'Position',[x0 y0 width height],...
'PaperPositionMode','auto');
set(figure1, 'Name', 'LQR-OPF:genfreq');
plot(t,a.ZNEW(omegaIdx,:).'/(2*pi),'lineWidth',2);
xlabel('Time (sec)', 'FontWeight','bold');
ylabel('$\frac{1}{2\pi}\boldmath{\omega}$ (Hz)');
axis([0 Tfinal freqyMin-freqyOffSet freqyMax+freqyOffSet]);
set(gca,'box','on');
set(gca,'fontSize',22);
set(0,'defaulttextinterpreter','latex')
grid on;
title('LQR-OPF: Generator Frequencies');
print -dpdf figures/test39LQROPFfreq.pdf
print -depsc2 figures/test39LQROPFfreq
%
% %
figure2=figure('Units','inches',...
'Position',[x0 y0 width height],...
'PaperPositionMode','auto');
set(figure2, 'Name', 'OPF:genfreq');
plot(t,b.ZNEW(omegaIdx,:).'/(2*pi),'lineWidth',2);
xlabel('Time (sec)', 'FontWeight','bold');
ylabel('$\frac{1}{2\pi}$\boldmath$\omega$ (Hz)');
axis([0 Tfinal freqyMin-freqyOffSet freqyMax+freqyOffSet]);
set(gca,'box','on');
set(gca,'fontSize',22);
set(0,'defaulttextinterpreter','latex')
grid on;
title('OPF: Generator Frequencies');
print -dpdf figures/test39OPFfreq.pdf
print -depsc2 figures/test39OPFfreq
%
% %% Control inputs
myMin=min(min([a.mVec, b.mVec]));
myMax=max(max([a.mVec,b.mVec]));
x0=0;
y0=1;
width=8;
height=5;
figure3=figure('Units','inches',...
'Position',[x0 y0 width height],...
'PaperPositionMode','auto');
set(figure3, 'Name', 'LQR-OPF:mech');
plot(t,a.mVec.','lineWidth',2);
xlabel('Time (sec)', 'FontWeight','bold');
ylabel('$ \mathbf{m} $ (pu)');
axis([0 Tfinal myMin-1 myMax+1]);
set(gca,'box','on');
set(gca,'fontSize',22);
set(0,'defaulttextinterpreter','latex')
grid on;
title('LQR-OPF: Generator Mechanical Power Input');
print -dpdf figures/test39LQROPFdeltaM.pdf
print -depsc2 figures/test39LQROPFdeltaM
x0=0;
y0=1;
width=8;
height=5;
figure4=figure('Units','inches',...
'Position',[x0 y0 width height],...
'PaperPositionMode','auto');
set(figure4, 'Name', 'OPF:mech');
plot(t,b.mVec,'lineWidth',2);
xlabel('Time (sec)', 'FontWeight','bold');
ylabel('$ \mathbf{m}$ (pu)');
axis([0 Tfinal myMin-1 myMax+1]);
set(gca,'box','on');
set(gca,'fontSize',22);
set(0,'defaulttextinterpreter','latex')
grid on;
title('OPF: Generator Mechanical Power Input');
print -dpdf figures/test39OPFdeltaM.pdf
print -depsc2 figures/test39OPFdeltaM
fyMin=min(min([a.fVec, b.fVec]));
fyMax=max(max([a.fVec,b.fVec]));
x0=0;
y0=1;
width=8;
height=5;
figure5=figure('Units','inches',...
'Position',[x0 y0 width height],...
'PaperPositionMode','auto');
set(figure5, 'Name', 'LQR-OPF:field');
plot(t,a.fVec.','lineWidth',2);
axis([0 Tfinal fyMin-1 fyMax+1]);
xlabel('Time (sec)', 'FontWeight','bold');
ylabel('$ \mathbf{f} $ (pu)');
set(gca,'box','on');
set(gca,'fontSize',22);
set(0,'defaulttextinterpreter','latex')
grid on;
title('LQR-OPF: Generator Field Voltage');
print -dpdf figures/test39LQROPFdeltaF.pdf
print -depsc2 figures/test39LQROPFdeltaF
x0=0;
y0=1;
width=8;
height=5;
figure6=figure('Units','inches',...
'Position',[x0 y0 width height],...
'PaperPositionMode','auto');
set(figure6, 'Name', 'OPF:field');
plot(t,b.fVec.','lineWidth',2);
axis([0 Tfinal fyMin-1 fyMax+1]);
xlabel('Time (sec)', 'FontWeight','bold');
ylabel('$\mathbf{f}$ (pu)');
set(gca,'box','on');
set(gca,'fontSize',22);
set(0,'defaulttextinterpreter','latex')
grid on;
title('OPF: Generator Field Voltage');
print -dpdf figures/test39OPFdeltaF.pdf
print -depsc2 figures/test39OPFdeltaF
%% Voltage profile
vyMin=min(min([a.vVec, b.vVec]));
vyMax=max(max([a.vVec,b.vVec]));
x0=0;
y0=1;
width=8;
height=5;
figure7=figure('Units','inches',...
'Position',[x0 y0 width height],...
'PaperPositionMode','auto');
set(figure7, 'Name', 'LQR-OPF:voltageprofile');
plot(t,a.ZNEW(vIdx,:).','lineWidth',2);
xlabel('Time (sec)', 'FontWeight','bold');
ylabel('$\mathbf{v} $ (pu)');
axis([0 Tfinal vyMin-0.1 vyMax+0.1]);
set(gca,'box','on');
set(gca,'fontSize',22);
set(0,'defaulttextinterpreter','latex')
grid on;
title('LQR-OPF: Time-varying nodal voltages');
print -dpdf figures/test39LQROPFvoltage.pdf
print -depsc2 figures/test39LQROPFvoltage
x0=0;
y0=1;
width=8;
height=5;
figure8=figure('Units','inches',...
'Position',[x0 y0 width height],...
'PaperPositionMode','auto');
set(figure8, 'Name', 'OPF:voltageprofile');
plot(t,b.ZNEW(vIdx,:).','lineWidth',2);
xlabel('Time (sec)', 'FontWeight','bold');
ylabel('$\mathbf{v} $ (pu)');
axis([0 Tfinal vyMin-0.1 vyMax+0.1]);
set(gca,'box','on');
set(gca,'fontSize',22);
set(0,'defaulttextinterpreter','latex')
grid on;
title('OPF: Time-varying nodal voltages');
print -dpdf figures/test39OPFvoltage.pdf
print -depsc2 figures/test39OPFvoltage