-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathrunCase200.m
68 lines (53 loc) · 2.31 KB
/
runCase200.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
clear all;
clc;
CaseFiles={'case_illinois200'};
% Perturbation
PRatio=0.1;
QRatio=0.0484;
SsControlOptions={ 'ALQR-OPF','OPF'};
SteadyStateOutput=cell(length(CaseFiles),length(SsControlOptions));
% Coupling parameter
Alpha=0.6;
% LQR time importance
Tlqr=1000;
%% Steady-state runs
if exist('Results')~=7
mkdir('Results');
end
SaveName=['Case200SteadyStateProgressReport',num2str(Alpha*100),'Percent.txt'];
FileID=fopen(['Results/',SaveName],'w');
fprintf(FileID,'%-15s & %-15s & %-15s & %-15s & %-15s & %-15s & %-15s\n',...
'Network', 'SsMethod','ObjValue', 'SsCost', 'StCostEst.','TotalCostEst.', 'CompTime');
for kk=1:length(CaseFiles)
CaseFile=CaseFiles{kk};
for ii=1:length(SsControlOptions)
SteadyStateCase=steadyStateDriver(CaseFile,SsControlOptions{ii},Alpha, Tlqr, PRatio, QRatio);
SteadyStateOutput{kk,ii}=SteadyStateCase;
fprintf(FileID, '%-15s & %-15s & %-15.2f & %-15.2f & %-15.2f & %-15.2f & %-15.2f \n', ...
CaseFile, SsControlOptions{ii}, SteadyStateCase.SsObjEst, SteadyStateCase.SsCost,...
SteadyStateCase.TrCostEstimate, SteadyStateCase.TotalCostEstimate, SteadyStateCase.CompTime);
end
end
fclose(FileID);
%% Dynamical simulations
LfControlOptions={'LQR','AGC'};
DynamicOutput=cell(length(CaseFiles), length(SsControlOptions), length(LfControlOptions));
SaveName=['Case200DynamicalProgressReport',num2str(Alpha*100),'Percent.txt'];
FileID=fopen(['Results/',SaveName],'w');
for kk=1:length(CaseFiles)
CaseFile=CaseFiles{kk};
for jj=1:length(LfControlOptions)
LfControl=LfControlOptions{jj};
fprintf(FileID,['---------------------', LfControl, '-----------------', '\n']);
fprintf(FileID,'%-15s & %-15s & & %-15s & %-15s & %-15s & %-15s & %-15s \n',...
'Network', 'SsMethod', 'SsCost','StCost','TotalCost.', 'MaxFreqDev', 'MaxVoltDev');
for ii=1:length(SsControlOptions)
DynamicCase=dynamicDriver([SteadyStateOutput{kk,ii}.SteadyStatePath, '/',SteadyStateOutput{kk,ii}.SteadyStateFileName], LfControl,'YesPlots');
DynamicOutput{kk,ii,jj}=DynamicCase;
fprintf(FileID, '%-15s & %-15s & %-15.2f & %-15.2f & %-15.2f & %-15.4f & %-15.4f \n', ...
CaseFile, SsControlOptions{ii}, DynamicCase.SsCost, DynamicCase.TrCost, DynamicCase.TotalCost,...
DynamicCase.MaxFreqDev, DynamicCase.MaxVoltDev );
end
end
end
fclose(FileID);