-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmain_script.m
47 lines (36 loc) · 1.66 KB
/
main_script.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
clear all;
clc;
%% Problem Parameters:
% Network names
% casefiles={'case9wmac_con'; 'case14wmac_con';'case39wmac_con','case57','case_illinois200'};
% casefiles={'case39wmac_con'};
% casefiles={'case_illinois200'};
% casefiles={'case57'};
% casefiles={'case9wmac_con'};
casefiles={'case9wmac_con'};
LfControl='AGC';
Alpha=0.8;
for case_index=1:length(casefiles)
casefile=casefiles{case_index};
lqropf=workflow(casefile,'ALQR-OPF',LfControl,Alpha, 'WithPlots');
if lqropf.N<250
fprintf(fileID, '%-20s & %-10s & %-10.2f & %-20.2f & %-20.2f & %-20.4f %-20.4f\n', ...
casefile, 'lqr-opf', lqropf.SsCost, lqropf.TrCost, lqropf.SsCost+lqropf.TrCost, ...
max(max(abs(lqropf.omegaVec-lqropf.OMEGAS)))./(2*pi), max(max(abs(lqropf.vVec-repmat(lqropf.vS, 1,lqropf.NSamples)))));
else
fprintf(fileID, '%-20s & %-10s & %-10.2f & %-20.2f & %-20.2f & %-20.4f %-20.4f\n', ...
casefile, 'lqr-opf', lqropf.SsCost, lqropf.TrCostEstimate, lqropf.SsCost+lqropf.TrCostEstimate, ...
'----', '----');
end
opf=workflow(casefile,'OPF',LfControl,Alpha);
if lqropf.N<250
fprintf(fileID, '%-20s & %-10s & %-10.2f & %-20.2f & %-20.2f & %-20.4f %-20.4f\n', ...
casefile, 'opf', opf.SsCost, opf.TrCost, opf.SsCost+opf.TrCost, ...
max(max(abs(opf.omegaVec-opf.OMEGAS)))./(2*pi), max(max(abs(opf.vVec-repmat(opf.vS,1,opf.NSamples)))));
else
fprintf(fileID, '%-20s & %-10s & %-10.2f & %-20.2f & %-20.2f & %-20.4f %-20.4f\n', ...
casefile, 'opf', opf.SsCost, opf.TrCostEstimate, opf.SsCost+opf.TrCostEstimate, ...
'----', '----');
end
end
fclose(fileID);