Dear Matpower authors, I wish to use the Matpower software in my PhD research. I need to calculate power flow for the distribution system that consists of many constant impedance and constant power loads.
After I read in the manual that " (...) the constant impedance portions can be modeled as a shunt element (...)", I thought naively that it's gonna be easy ;-). I went through other messages from this mailing list and I understand that I need to changes the code of the Power Flow calculation. In particular, I was trying use this advise https://www.mail-archive.com/matpower-l%40cornell.edu/msg03254.html but it seems that since 2014 the code of Matpower has changed and this advice is not easy applicable to the newest version of the Matpower. Thus, I would like to ask you for help of the required code changes in the Matpower 5.1. I wish to achieve two targets: 1. correct power flow calculation assuming const P and const Z loads 2. output branch and power matrices showing updated (real) values of power from const Z loads. I started as follows: a) I assume that whole constant power loads are assigned to the bus matrix - Pd and Qd columns while all constant impedance loads are assigned to Gs and Bs columns b) I modified makeSbus() function by adding lines related to const P and Z line1: [Sbus, Sbus_gen, Sbus_constP, Sbus_constZ] = makeSbus(baseMVA, bus, gen) %adding Sbus_gen, Sbus_consP and Sbus_constZ vectors line36 to 38: Sbus = ( Cg * (gen(on, PG) + 1j * gen(on, QG)) ... %% power injected by generators - (bus(:, PD) + 1j * bus(:, QD)) ... %% plus power injected by const P loads ) / baseMVA; %% converted to p.u. replaced by: Sbus = ( Cg * (gen(on, PG) + 1j * gen(on, QG)) ... %% power injected by generators - (bus(:, PD) + 1j * bus(:, QD)) ... %% plus power injected by const P loads - (bus(:, GS) + 1j * bus(:, BS)) )/ ... %% plus power injected by const Z loads baseMVA; %% converted to p.u. Sbus_gen = (Cg * (gen(on, PG) + 1j * gen(on, QG))) / baseMVA; Sbus_constP = (bus(:, PD) + 1j * bus(:, QD)) / baseMVA; Sbus_constZ = (bus(:, GS) + 1j * bus(:, BS)) / baseMVA; c) I pass all Sbus vectors to newtonpf() function [V, converged, i] = newtonpf(Ybus, Sbus, Sbus_gen, Sbus_constP, Sbus_constZ, V0, ref, pv, pq, mpopt) d) In newtonpf(), I calculate 'mis' variable as line 54 and line 106: mis = V .* conj(Ybus * V) - (Sbus_gen - Sbus_constP - Sbus_constZ.*(Vm.^2)) (replacing the default mis = V .* conj(Ybus * V) - Sbus;) e) How should I change the dSbus_dV() function?? f) How to update bus matrix to show updated value of const Z power? g) Should I change other functions as well (e.g. makeYbus() function)? I will be grateful for your help and suggestions, BR, Jarek