本程序参考Applied energy论文《Optimal siting and sizing of distributed generation in distribution systems with PV solar farm utilized as STATCOM (PV-STATCOM)》,文中主要对光伏电站、微燃机等分布式电源进行优化配置,程序较为简单和基础,具有较强的可扩展性和适用性,注释清晰,干货满满,下面对文章和程序作简要介绍。
创新点:
1. 在分布式电源的优化配置问题中计及了光伏电站的快速无功响应特性,以体现PV-STATCOM这一新技术对分布式电源配置方案的影响,进而有效响应了近年来因产业升级而日渐增加的敏感负荷的用电需求。
2. 选取了光伏电站、微型燃气轮机两种典型的分布式电源进行优化配置问题的研究,通过构建加权电压支撑能力指标以表征配电系统中光伏电站对敏感负荷节点的电压支撑能力,并将其嵌入到分布式电源优化配置模型中以求解最优的分布式电源安装位置和安装容量,以及对应的电压暂降过程仿真,充分证明了本研究的价值和意义。
文中结果:
程序结果:
部分程序:
%计算电压支撑能力指标
% Program for Newton-Raphson Load Flow Analysis..
nbus = 33;
mpc=IEEE33BW;
T=24;
nb=33;
nl=32;
N=5;%光伏断面数量
Wref=0;%电力支撑指标下限
pref=0;%光伏渗透率约束下限
rmt=0.0001;%微燃机出力下限
dw_pv=[1 3 8 5 2];%每个光伏区间单位光伏有功出力
Y =[8.60890545517020 - 4.38848759645336i,-8.60890545517020 + 4.38848759645336i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 00.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,-0.675684973458593 + 0.889394050182110i,1.61983928437771 - 1.72970736243838i,-0.944154310919121 + 0.840313312256273i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i;0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.638181753905898i,1.15270060498254 - 1.01042169531650i,-0.278801443624791 + 0.372239941410601i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i;0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i;0.00000000000000 + 0.00000000000000i,-3.19139102810467 + 3.04544326767306i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i;0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.000.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000.00000000000000i,0.00000000000000 + 0.00000000000000i;0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,-0.685901016646612 + 0.541617384080303i,1.37813650857855 - 1.08327620483196i,-0.692235491931937 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,-0.692235491931937 + 0.541658820751653i,0.692235491931937 - 0.541658820751653i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i;0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,-3.91132581228411 + 1.99227137433585i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,-2.79428122129950 + 1.42270405602406i,3.32556722153864 - 1.89112873819902i,-0.531286000239134 + 0.468424682174957i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.0007 + 0.615869856836191i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i;0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.0000.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000.513100757068179i,1.88471913450910 - 2.10469649825879i,-1.36554428748186 + 1.59159574119061i,0.00000000000000 + 0.00000000000000i;0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,0.00000000000000 + 0.00000000000000i,-0.858092532269815 + 1.33419548565823i,0.858092532269815 - 1.33419548565823i]; % Calling ybusppg.m to get Y-Bus Matrix..
busd =[1,1,1,0,0,0,0,0,0,0;
2,3,1,0,0,0,0.100000000000000,0.0600000000000000,0,0;
3,3,1,0,0,0,0.0900000000000000,0.0400000000000000,0,0;
4,3,1,0,0,0,0.120000000000000,0.0800000000000000,0,0;
5,3,1,0,0,0,0.0600000000000000,0.0300000000000000,0,0;
6,3,1,0,0,0,0.0600000000000000,0.0200000000000000,0,0;
7,3,1,0,0,0,0.200000000000000,0.100000000000000,0,0;
8,3,1,0,0,0,0.200000000000000,0.100000000000000,0,0;
9,3,1,0,0,0,0.0600000000000000,0.0200000000000000,0,0;
10,3,1,0,0,0,0.0600000000000000,0.0200000000000000,0,0;
11,3,1,0,0,0,0.0450000000000000,0.0300000000000000,0,0;
12,3,1,0,0,0,0.0600000000000000,0.0350000000000000,0,0;
13,3,1,0,0,0,0.0600000000000000,0.0350000000000000,0,0;
14,3,1,0,0,0,0.120000000000000,0.0800000000000000,0,0;
15,3,1,0,0,0,0.0600000000000000,0.0100000000000000,0,0;
16,3,1,0,0,0,0.0600000000000000,0.0200000000000000,0,0;
17,3,1,0,0,0,0.0600000000000000,0.0200000000000000,0,0;
18,3,1,0,0,0,0.0900000000000000,0.0400000000000000,0,0;
19,3,1,0,0,0,0.0900000000000000,0.0400000000000000,0,0;
20,3,1,0,0,0,0.0900000000000000,0.0400000000000000,0,0;
21,3,1,0,0,0,0.0900000000000000,0.0400000000000000,0,0;
22,3,1,0,0,0,0.0900000000000000,0.0400000000000000,0,0;
23,3,1,0,0,0,0.0900000000000000,0.0500000000000000,0,0;
24,3,1,0,0,0,0.420000000000000,0.200000000000000,0,0;
25,3,1,0,0,0,0.420000000000000,0.200000000000000,0,0;
26,3,1,0,0,0,0.0600000000000000,0.0250000000000000,0,0;
27,3,1,0,0,0,0.0600000000000000,0.0250000000000000,0,0;
28,3,1,0,0,0,0.0600000000000000,0.0200000000000000,0,0;
29,3,1,0,0,0,0.120000000000000,0.0700000000000000,0,0;
30,3,1,0,0,0,0.200000000000000,0.600000000000000,0,0;
31,3,1,0,0,0,0.150000000000000,0.0700000000000000,0,0;
32,3,1,0,0,0,0.210000000000000,0.100000000000000,0,0;
33,3,1,0,0,0,0.0600000000000000,0.0400000000000000,0,0]; % Calling busdatas..
BMva = 100; % Base MVA..
bus = busd(:,1); % Bus Number..
type = busd(:,2); % Type of Bus 1-Slack, 2-PV, 3-PQ..
V = busd(:,3); % Specified Voltage..
del = busd(:,4); % Voltage Angle..
Pg = busd(:,5)/BMva; % PGi..
Qg = busd(:,6)/BMva; % QGi..
Pl = busd(:,7)/BMva; % PLi..
Ql = busd(:,8)/BMva; % QLi..
Qmin = busd(:,9)/BMva; % Minimum Reactive Power Limit..
Qmax = busd(:,10)/BMva; % Maximum Reactive Power Limit..
P = Pg - Pl; % Pi = PGi - PLi..
Q = Qg - Ql; % Qi = QGi - QLi..
Psp = P; % P Specified..
Qsp = Q; % Q Specified..
G = real(Y); % Conductance matrix..
B = imag(Y); % Susceptance matrix..
pv = find(type == 2 | type == 1); % PV Buses..
pq = find(type == 3); % PQ Buses..
npv = length(pv); % No. of PV buses..
npq = length(pq); % No. of PQ buses..
Tol = 1;
Iter = 1;
while (Tol > 1e-5) % Iteration starting..
P = zeros(nbus,1);
Q = zeros(nbus,1);
% Calculate P and Q
for i = 1:nbus
for k = 1:nbus
P(i) = P(i) + V(i)* V(k)*(G(i,k)*cos(del(i)-del(k)) + B(i,k)*sin(del(i)-del(k)));
Q(i) = Q(i) + V(i)* V(k)*(G(i,k)*sin(del(i)-del(k)) - B(i,k)*cos(del(i)-del(k)));
end
end
% Checking Q-limit violations..
if Iter <= 7 && Iter > 2 % Only checked up to 7th iterations..
for n = 2:nbus
if type(n) == 2
QG = Q(n)+Ql(n);
if QG < Qmin(n)
V(n) = V(n) + 0.01;
elseif QG > Qmax(n)
V(n) = V(n) - 0.01;
end
end
end
end
% Calculate change from specified value
dPa = Psp-P;
dQa = Qsp-Q;
k = 1;
dQ = zeros(npq,1);
for i = 1:nbus
if type(i) == 3
dQ(k,1) = dQa(i);
k = k+1;
end
end
dP = dPa(2:nbus);
M = [dP; dQ]; % Mismatch Vector
% Jacobian
% J1 - Derivative of Real Power Injections with Angles..
J1 = zeros(nbus-1,nbus-1);
for i = 1:(nbus-1)
m = i+1;
for k = 1:(nbus-1)
n = k+1;
if n == m
for n = 1:nbus
J1(i,k) = J1(i,k) + V(m)* V(n)*(-G(m,n)*sin(del(m)-del(n)) + B(m,n)*cos(del(m)-del(n)));
end
J1(i,k) = J1(i,k) - V(m)^2*B(m,m);
else
J1(i,k) = V(m)* V(n)*(G(m,n)*sin(del(m)-del(n)) - B(m,n)*cos(del(m)-del(n)));
end
end
end
% J2 - Derivative of Real Power Injections with V..
J2 = zeros(nbus-1,npq);
for i = 1:(nbus-1)
m = i+1;
for k = 1:npq
n = pq(k);
if n == m
for n = 1:nbus
J2(i,k) = J2(i,k) + V(n)*(G(m,n)*cos(del(m)-del(n)) + B(m,n)*sin(del(m)-del(n)));
end
J2(i,k) = J2(i,k) + V(m)*G(m,m);
else
J2(i,k) = V(m)*(G(m,n)*cos(del(m)-del(n)) + B(m,n)*sin(del(m)-del(n)));
end
end
end
% J3 - Derivative of Reactive Power Injections with Angles..
J3 = zeros(npq,nbus-1);
for i = 1:npq
m = pq(i);
for k = 1:(nbus-1)
n = k+1;
if n == m
for n = 1:nbus
J3(i,k) = J3(i,k) + V(m)* V(n)*(G(m,n)*cos(del(m)-del(n)) + B(m,n)*sin(del(m)-del(n)));
end
J3(i,k) = J3(i,k) - V(m)^2*G(m,m);
else
J3(i,k) = V(m)* V(n)*(-G(m,n)*cos(del(m)-del(n)) - B(m,n)*sin(del(m)-del(n)));
end
end
end
欢迎感兴趣的小伙伴关注下方公众号获取完整版代码,小编会不定期更新高质量的学习资料、文章和程序代码,为您的科研加油助力!