Hi iman,
I am surprise you said the code reported error.
I ran it and got this result
define_constants;
mpc = loadcase('case14');
[PLOSS,MVAbase, bus, gen, branch, success, et]=runpf(mpc);
loss=get_losses(MVAbase, bus, branch)

loss =

   4.2976 +13.1212i
   2.7629 +11.4054i
   2.3233 + 9.7880i
   1.6767 + 5.0874i
   0.9038 + 2.7593i
   0.3734 + 0.9531i
   0.5144 + 1.6226i
        0 + 1.7032i
        0 + 1.3047i
        0 + 4.4212i
   0.0554 + 0.1160i
   0.0718 + 0.1495i
   0.2121 + 0.4177i
        0 + 0.4605i
        0 + 0.8021i
   0.0129 + 0.0342i
   0.1162 + 0.2471i
   0.0126 + 0.0295i
   0.0063 + 0.0057i
   0.0541 + 0.1101i

I am not sure for now why you are getting the error. I will think over it.

Idris

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

Dear Idris,
Thank you for your reply. I also tried your codes as:

define_constants;
mpc = loadcase('case14');
[PLOSS,MVAbase, bus, gen, branch, success, et]=runpf(mpc);
loss=get_losses(MVAbase, bus, branch); % getting losses in each branches

but got the error as :

??? Error using ==> runpf
Too many output arguments.

Error in ==> Powerlosses at 32
[PLOSS,MVAbase, bus, gen, branch, success, et]=runpf(mpc);

Where do u think there exist the problem??

Best  regards
Iman
-------------------------------------------------------------------------------------------------------------------------------------------------------------
On Tue, Nov 22, 2011 at 5:42 PM, Idris Musa 
<[email protected]<mailto:[email protected]>> wrote:
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]>
 
[mailto:[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



--
Best regards
Iman

Reply via email to