-
Notifications
You must be signed in to change notification settings - Fork 1
/
check.m
120 lines (118 loc) · 5.6 KB
/
check.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
function check(iBranch)
%%
[PQ, PV, REF, NONE, BUS_I, BUS_TYPE, PD, QD, GS, BS, BUS_AREA, VM, ...
VA, BASE_KV, ZONE, VMAX, VMIN, LAM_P, LAM_Q, MU_VMAX, MU_VMIN] = idx_bus;
[F_BUS, T_BUS, BR_R, BR_X, BR_B, RATE_A, RATE_B, RATE_C, ...
TAP, SHIFT, BR_STATUS, PF, QF, PT, QT, MU_SF, MU_ST, ...
ANGMIN, ANGMAX, MU_ANGMIN, MU_ANGMAX] = idx_brch;
[GEN_BUS, PG, QG, QMAX, QMIN, VG, MBASE, GEN_STATUS, PMAX, PMIN, ...
MU_PMAX, MU_PMIN, MU_QMAX, MU_QMIN, PC1, PC2, QC1MIN, QC1MAX, ...
QC2MIN, QC2MAX, RAMP_AGC, RAMP_10, RAMP_30, RAMP_Q, APF] = idx_gen;
filename = 'my_case14.m';
%% 断开支路1-2
% iBranch = 15;
switch iBranch
case 1
[bOff, fV, V, fP, P] = SecurityCertification(filename, iBranch)
% 修改电网参数,使得线路功率不越限
MPC = loadcase(filename);
MPC.gen(2, [PG, QG]) = MPC.gen(1, [PG, QG]); % 调整发电机2输出功率
[bOff, fV, V, fP, P] = SecurityCertification(MPC, iBranch)
case 2
[bOff, fV, V, fP, P] = SecurityCertification(filename, iBranch)
MPC = loadcase(filename);
MPC.gen(4, [PG, QG]) = MPC.gen(1, [PG, QG]); % 调整发电机4输出功率
[bOff, fV, V, fP, P] = SecurityCertification(MPC, iBranch)
case 3 % 支路2-3双回路断开一回路
[bOff, fV, V, fP, P] = SecurityCertification(filename, iBranch)
MPC = loadcase(filename);
MPC.gen(3, [PG, QG]) = MPC.gen(1, [PG, QG]);
MPC.bus(4, [PD, QD]) = MPC.bus(4, [PD, QD]) * 1.1;
[bOff, fV, V, fP, P] = SecurityCertification(MPC, iBranch)
case 4
[bOff, fV, V, fP, P] = SecurityCertification(filename, iBranch)
MPC = loadcase(filename);
MPC.gen(4, [PG, QG]) = MPC.gen(1, [PG, QG]);
[bOff, fV, V, fP, P] = SecurityCertification(MPC, iBranch)
case 5
[bOff, fV, V, fP, P] = SecurityCertification(filename, iBranch)
case 6
[bOff, fV, V, fP, P] = SecurityCertification(filename, iBranch)
case 7
[bOff, fV, V, fP, P] = SecurityCertification(filename, iBranch)
MPC = loadcase(filename);
MPC.gen(4, [PG, QG]) = MPC.gen(1, [PG, QG]);
MPC.gen(5, [PG, QG]) = MPC.gen(1, [PG, QG]);
[bOff, fV, V, fP, P] = SecurityCertification(MPC, iBranch)
case 8
[bOff, fV, V, fP, P] = SecurityCertification(filename, iBranch)
MPC = loadcase(filename);
MPC.gen(4, [PG, QG]) = MPC.gen(1, [PG, QG]);
MPC.bus(9, [PD, QD]) = MPC.bus(9, [PD, QD]) * 1.1;
[bOff, fV, V, fP, P] = SecurityCertification(MPC, iBranch)
case 9
[bOff, fV, V, fP, P] = SecurityCertification(filename, iBranch)
MPC = loadcase(filename);
MPC.gen(5, [PG, QG]) = MPC.gen(1, [PG, QG]);
[bOff, fV, V, fP, P] = SecurityCertification(MPC, iBranch)
case 10
[bOff, fV, V, fP, P] = SecurityCertification(filename, iBranch)
MPC = loadcase(filename);
MPC.gen(5, [PG, QG]) = MPC.gen(1, [PG, QG]);
[bOff, fV, V, fP, P] = SecurityCertification(MPC, iBranch)
case 11
[bOff, fV, V, fP, P] = SecurityCertification(filename, iBranch)
MPC = loadcase(filename);
MPC.bus(10, [PD, QD]) = MPC.bus(10, [PD, QD]) * 0.1;
MPC.bus(11, [PD, QD]) = MPC.bus(11, [PD, QD]) * 0.1;
[bOff, fV, V, fP, P] = SecurityCertification(MPC, iBranch)
case 12
[bOff, fV, V, fP, P] = SecurityCertification(filename, iBranch)
MPC = loadcase(filename);
MPC.bus(12, [PD, QD]) = MPC.bus(12, [PD, QD]) * 0.1;
[bOff, fV, V, fP, P] = SecurityCertification(MPC, iBranch)
case 13
[bOff, fV, V, fP, P] = SecurityCertification(filename, iBranch)
MPC = loadcase(filename);
MPC.gen(4, [PG, QG]) = MPC.gen(1, [PG, QG]);
MPC.bus([9, 10, 11, 13, 14], [PD, QD]) = MPC.bus([9, 10, 11, 13, 14], [PD, QD]) * 0.2;
MPC.branch(19, [BR_R, BR_X]) = MPC.branch(19, [BR_R, BR_X]) * 1e9; % 支路12-13
[bOff, fV, V, fP, P] = SecurityCertification(MPC, iBranch)
case 14
[bOff, fV, V, fP, P] = SecurityCertification(filename, iBranch)
case 15
[bOff, fV, V, fP, P] = SecurityCertification(filename, iBranch)
MPC = loadcase(filename);
MPC.gen(4, [PG, QG]) = MPC.gen(1, [PG, QG]);
MPC.branch(9, [BR_R, BR_X]) = MPC.branch(9, [BR_R, BR_X]) * 1e9; % 支路4-9
[bOff, fV, V, fP, P] = SecurityCertification(MPC, iBranch)
case 16
[bOff, fV, V, fP, P] = SecurityCertification(filename, iBranch)
MPC = loadcase(filename);
MPC.bus(10, [PD, QD]) = MPC.bus(10, [PD, QD]) * 0.1;
[bOff, fV, V, fP, P] = SecurityCertification(MPC, iBranch)
case 17
[bOff, fV, V, fP, P] = SecurityCertification(filename, iBranch)
MPC = loadcase(filename);
MPC.bus(14, [PD, QD]) = MPC.bus(14, [PD, QD]) * 0.1;
[bOff, fV, V, fP, P] = SecurityCertification(MPC, iBranch)
case 18
[bOff, fV, V, fP, P] = SecurityCertification(filename, iBranch)
MPC = loadcase(filename);
MPC.bus(10, [PD, QD]) = MPC.bus(10, [PD, QD]) * 0.1;
[bOff, fV, V, fP, P] = SecurityCertification(MPC, iBranch)
case 19
[bOff, fV, V, fP, P] = SecurityCertification(filename, iBranch)
case 20
[bOff, fV, V, fP, P] = SecurityCertification(filename, iBranch)
MPC = loadcase(filename);
MPC.bus(14, [PD, QD]) = MPC.bus(14, [PD, QD]) * 0.1;
[bOff, fV, V, fP, P] = SecurityCertification(MPC, iBranch)
case 21
[bOff, fV, V, fP, P] = SecurityCertification(filename, iBranch)
MPC = loadcase(filename);
MPC.gen(3, [PG, QG]) = MPC.gen(1, [PG, QG]);
MPC.bus(4, [PD, QD]) = MPC.bus(4, [PD, QD]) * 1.1;
[bOff, fV, V, fP, P] = SecurityCertification(MPC, iBranch)
otherwise
end