For a case that has consecutive bus numbers (e.g. one that has been converted 
to internal indexing via ext2int() 
<http://www.pserc.cornell.edu/matpower/docs/ref/matpower6.0/ext2int.html>), 
simply use makeSbus() 
<http://www.pserc.cornell.edu/matpower/docs/ref/matpower6.0/makeSbus.html>. It 
returns the complex bus injections in per-unit, so you’ll need to take only the 
real part and multiply by baseMVA to get the MW values.

E.g.

mpc = rundcpf('case30', mpoption('out.all', 0));
Pbus = real(makeSbus(mpc.baseMVA, mpc.bus, mpc.gen)) * mpc.baseMVA

— Ray



> On Jul 19, 2017, at 9:43 PM, Saeed Ahmed <[email protected]> wrote:
> 
> Hi All, 
> 
> I need to calculate the the injected power(Pi) matrix at each bus . It is 
> equal to the generated power(Pg) - demand/load power. Now how to extract it 
> using matpower
> 
> 

Reply via email to