Of course; sorry, the part about "branch" current slipped to the back of my mind.  The code would be similar:

% Run power flow
results = runpf(mpc);
% Get column pointers
define_constants;
% Compute vector of complex bus voltages
V = results.bus(:, VM) .* exp(sqrt(-1)*results.bus(:, VA)*pi/180);
% Compute nodal admittance matrix, and line admittance matrices at both the 'from' and 'to' ends of branches
[Ybus, Yf, Yt]  = makeYbus(results);
% Compute vector of complex bus injection currents
Ibus = Ybus * V;
% Compute vector of complex currents injected at 'from' end of branches
If = Yf * V;
% Compute vector of complex currents injected at 'to' end of branches
It = Yt * V;

Carlos.

Arkan Arkan wrote:
Thank you so much. I appreciate your help. What do you mean by starting from 1? I think all of the buses in Matpower are number consecutively and start from 1. The injection current is different than branch current. How about phase angle of the branch current. Thanks.

On Sat, Mar 31, 2018 at 12:41 PM, Carlos E Murillo-Sanchez <ce.murillosanc...@gmail.com> wrote:
Assuming that the system data is in structure 'mpc', and that the buses are numbered consecutively starting from 1,  this should give you the injection currents:

% Run power flow
results = runpf(mpc);
% Get column pointers
define_constants;
% Compute vector of complex bus voltages
V = results.bus(:, VM) .* exp(sqrt(-1)*results.bus(:, VA)*pi/180);
% Compute nodal admittance matrix
Ybus = makeYbus(results);
% Compute vector of complex bus injection currents
Ibus = Ybus * V;

Carlos.

Mostafa Mohammadpourfard wrote:
Thank you, Carlos. May I ask you to write the code here? I am not a power system student. Thanks


On Sat, Mar 31, 2018 at 9:41 AM, Carlos E Murillo-Sanchez <ce.murillosanc...@gmail.com> wrote:
You have the bus voltages; now you just need to multiply the system's nodal admittance matrix by the complex voltage vector to get the complex currents vector.  See the makeYbus function in MATTPOWER.

Carlos.

Arkan Arkan wrote:
Thank you, Ilias. But, unfortunately, there is not any direct information about current in the Manpower like you mentioned and we should calculate based on the information obtained from runpf.

On Fri, Mar 30, 2018 at 9:06 AM, Ilias Sarantakos <il.saranta...@gmail.com <mailto:il.saranta...@gmail.com>> wrote:

    Hi Arkan,

    If you type ''result = runpf(mpc)'', then you will get the power
    flow results of your network, stored in the ''result'' variable.
    Now that you have the voltages (magnitudes and angles) at all
    buses, you can calculate the current at each branch. I think it
    would be helpful to check Appendix B in MATPOWER manual, which can
    guide you how to access the results of your network. For example,
    ''result.bus(1,8)'' and ''result.bus(1,9)'', contain the magnitude
    and angle of voltage at bus 1.

    Hope this helps.

    Kind regards,

    Ilias Sarantakos

    2018-03-29 2:25 GMT+01:00 Arkan Arkan <arkan.m2...@gmail.com
    <mailto:arkan.m2...@gmail.com>>:

        Hi everyone,

        I am wondering how can I get the magnitude and the phase angle
        of the current in the branches of any case file in the Matpower.

        Thanks for your help.









Reply via email to