Hi Iman,
The problem is with the syntax you have used.
If you use the results structure ‘results=runpf(mpc)’ you cannot extract the 
losses results using ‘loss=get_losses(MVAbase, bus, branch)’ because it is only 
compatible with the previous versions of MATPOWER. To return results as 
individual output arguments, use this


define_constants;
mpc = loadcase('case14');
[PLOSS,MVAbase, bus, gen, branch, success, et]=runpf(mpc);
loss=get_losses(MVAbase, bus, branch)

You can go through the MATPOWER M- file ‘ runpf.m’  it  will help a lot.

Idris

From: [email protected] 
[mailto:[email protected]] On Behalf Of iman
Sent: 22 November 2011 17:06
To: MATPOWER discussion forum
Subject: Re: extracting elemnts from powerflow results

Dear Alvaro,
Thank you for your help.I added function loss = get_losses(baseMVA, bus, 
branch) based on the presented scripts.My problem is that I don't know how to 
call it in my program.
for example I called this function as :

define_constants;
mpc = loadcase('case14');
results=runpf(mpc);
loss=get_losses(baseMVA, bus, branch);
I get the error message .
In the next step I thought that I have not passed the values 
(baseMVA,bus,branch) to the function so I corrected it as :

loss=get_losses(100, 1, 1);

but again a new error as follows:
??? Error: File: get_losses.m Line: 47 Column: 72
Expression or statement is incorrect--possibly unbalanced (, {, or [.

I suspect that my function calling is wrong.So for example what should I write 
if I want to say the get the losses in branch 1-2?

Thank you Alvaro and everyone else.
Best wishes
Iman

On Mon, Nov 21, 2011 at 9:37 PM, Álvaro Jaramillo Duque 
<[email protected]<mailto:[email protected]>> 
wrote:
Hi Iman

Follow this mail thread

http://www.mail-archive.com/[email protected]/msg01163.html

Álvaro



--
Best regards
Iman

Reply via email to