1- i use version 3.2 matpower and i want to increase the number of iteration 
in "runpf" function but this errors appears 


opt = mpoption(PF_MAX_IT, 20 )
??? Undefined function or variable 'PF_MAX_IT'.

>> runpf('case39',opt)
??? Undefined function or variable 'opt'.

mpopt=mpoption(PF_MAX_IT, 20 )
??? Undefined function or variable 'PF_MAX_IT'.

>> runppf('case39',mpopt)
??? Undefined function or variable 'mpopt'.








2- if i
use version 4.1 


2-1-what the equivalent for 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;


[baseMVA, bus, gen, branch] =
runpf('case39.m');
H = branch(:,
PF);
V= bus(:,VM);


2-2- also i want to ask if the attached function " get_losses"attached  still 
working or not 

thank you in advance 
Eng. Mahmoud abdallah
Teaching Assistant
Ain Shams University
Faculty of Engineering
function loss = get_losses(baseMVA, bus, branch)
%GET_LOSSES   Returns losses per branch.
%
%   loss = get_losses(results)
%   loss = get_losses(baseMVA, bus, branch)
%
%   Returns a complex nl x 1 vector of losses, where nl is the number of
%   branches in system. So, for example sum(real(loss)) is the total
%   real power loss in the system.

%   MATPOWER
%   $Id$
%   by Ray Zimmerman, PSERC Cornell
%   Copyright (c) 1996-2009 by Power System Engineering Research Center (PSERC)
%   See http://www.pserc.cornell.edu/matpower/ for more info.

%%----- initialization -----
%% default arguments
if isstruct(baseMVA)
    results = baseMVA;
    [baseMVA, bus, branch] = deal(results.baseMVA, results.bus, results.branch);
end

%% define named indices into bus, gen, branch matrices
[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;
[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;

%% internal bus number
i2e = bus(:, BUS_I);
e2i = sparse(max(i2e), 1);
e2i(i2e) = (1:size(bus, 1))';

%% sizes of things
nl = size(branch, 1);   %% number of branches

%% parameters
tap = ones(nl, 1);                              %% default tap ratio = 1 for 
lines
xfmr = find(branch(:, TAP));                    %% indices of transformers
tap(xfmr) = branch(xfmr, TAP);                  %% include transformer tap 
ratios
tap = tap .* exp(1j*pi/180 * branch(:, SHIFT)); %% add phase shifters
V = bus(:, VM) .* exp(sqrt(-1) * pi/180 * bus(:, VA));
loss = baseMVA * abs(V(e2i(branch(:, F_BUS))) ./ tap - V(e2i(branch(:, 
T_BUS)))) .^ 2 ./ ...
            (branch(:, BR_R) - 1j * branch(:, BR_X));
out = find(branch(:, BR_STATUS) == 0);          %% out-of-service branches
nout = length(out);
loss(out) = zeros(nout, 1);

Reply via email to