Using these I, V and S to denote complex current, voltage and power, 
respectively. We have, by definition ...

S = V * conj(I)

… which can be re-written ...

I = conj(S/V)

So, we can compute them as follows (some of the following may require a new 
version of MATPOWER than 3.2) …

define_constants;
j = sqrt(-1);
mpopt = mpoption('ENFORCE_Q_LIMS', 1);
mpc = loadcase('case30pdrH.m');
mpc = ext2int(mpc);     % only needed if bus numbers are not consecutive
r = runpf(mpc, mpopt);
V = r.bus(:, VM) * exp(j * pi/180 * r.bus(:, VA));

% option 1 - compute them from the power flows
Sf = r.branch(:, PF) + j * r.branch(:, QF);
St = r.branch(:, PT) + j * r.branch(:, QT);
If = conj(Sf ./ V(r.branch(:, F_BUS)));
It = conj(St ./ V(r.branch(:, T_BUS)));

% option 2 - compute them directly using admittance matrices
[Ybus, Yf, Yt] = makeYbus(mpc);
If = Yf * V;
It = Yt * V;

Hope this helps,

     Ray




> On Jan 28, 2016, at 4:16 AM, Mahmoud Abdallah 
> <[email protected]> wrote:
> 
> Dear professor
> i need to get the current in each branch automatic after runpf what can i add 
> to the following :
> 
> [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;
> [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;
> opt=mpoption('ENFORCE_Q_LIMS', 1); 
> [baseMVA, bus, gen, branch] = runpf('case30pdrH.m',opt);
> H = branch(:, PF);
> V= bus(:,VM);
> y=bus(:,VA); 
> 
> 
> Matpower V 3.2
> 
> 
> 
> thank you in advance 
> Kind regards,  
>  Dr. Mahmoud Abdallah Attia 
>  Electrical Power & Machines Department
>  Faculty of Engineering,  Ain Shams University  
>  Reviewer in Ain Shams Engineering Journal (ASEJ) 
>  Reviewer in Electric Power Components & Systems Journal  
>  Reviewer in International Transactions on Electrical Energy Systems
>  Member of "Continuous Improvement & Quality Assurance Unit"               
>  Abdo Basha square, Abbassia, 11517 Cairo, Egypt

Reply via email to