MAKE_ZPV Calculates loop impedances for all PV buses. Zpv = make_zpv(pv,nb,nl,f,Zb,Yd) Loop impedance of a PV bus is defined as impedance of the path between the bus and the slack bus. The mutual impedance between two PV buses is the impedance of the joint part of the two path going from each of the PV buses to the slack bus. The impedances are calculated as bus voltages in cases when at one of the PV buses we inject current of -1 A. All voltages are calculated with the backward-forward sweep method. The input variables are the vector of indicies with "from" buses for each branch, the vector of branch impedances and indicies of PV buses. See also CALC_V_PQ_SUM.
0001 function Zpv = make_zpv(pv,nb,nl,f,Zb,Yd) 0002 %MAKE_ZPV Calculates loop impedances for all PV buses. 0003 % 0004 % Zpv = make_zpv(pv,nb,nl,f,Zb,Yd) 0005 % 0006 % Loop impedance of a PV bus is defined as impedance of the path between 0007 % the bus and the slack bus. The mutual impedance between two PV buses is 0008 % the impedance of the joint part of the two path going from each of the 0009 % PV buses to the slack bus. The impedances are calculated as bus voltages 0010 % in cases when at one of the PV buses we inject current of -1 A. All 0011 % voltages are calculated with the backward-forward sweep method. The 0012 % input variables are the vector of indicies with "from" buses for each 0013 % branch, the vector of branch impedances and indicies of PV buses. 0014 % 0015 % See also CALC_V_PQ_SUM. 0016 0017 npv = length(pv); 0018 Zpv = zeros(npv); 0019 Ye = Yd; 0020 D = zeros(nl,1); 0021 for k = nl:-1:2 0022 D(k) = 1 / (1 + Zb(k)*Ye(k)); 0023 i = f(k); 0024 Ye(i) = Ye(i) + D(k)*Ye(k); 0025 end 0026 for ipv = 1:npv 0027 V = zeros(nb,1); 0028 Je = zeros(nb,1); 0029 Je(pv(ipv)) = -1; 0030 % backward sweep 0031 for k = nl:-1:2 0032 i = f(k); 0033 Je(i) = Je(i) + D(k)*Je(k); 0034 end 0035 % forward sweep 0036 for k = 2:nl 0037 i = f(k); 0038 V(k) = D(k) * (V(i)-Zb(k)*Je(k)); 0039 end 0040 Zpv(:,ipv) = V(pv); 0041 end