theKingDidier
theKingDidier

Reputation: 7

Accessing the results from power flow calculations (Matpower 3.2)

Can someone please tell me how I can access results from power flow calculations using Matpower 3.2? In the manual, there is an instruction to do the following (to access for example real power injected at "from" bus end) :

mpc = loadcase('case14')
results = runpf(mpc)
branch_pf = results.branch(:, 14)

But, when I do that, nothing comes up, because results are saved as a variable and the value is 100, and it seems like the results (in this case real power from bus end, or any other variable) are not stored anywhere but printed in command list. 

Upvotes: 0

Views: 2021

Answers (1)

Stewie Griffin
Stewie Griffin

Reputation: 14939

When you run the first line of code, you load the system data into a struct called mpc. This struct contains all the information you need in order to perform power flow studies.

For the 'case14', it should look like this:

mpc =     
    version: '2'
    baseMVA: 100
        bus: [14x13 double]
        gen: [5x21 double]
     branch: [20x13 double]
    gencost: [5x7 double]

If you have something different here, then you have messed up.

When you run the second line of code you'll get something like this, followed by a large number of rows with results, all nicely formatted with headers etc.

MATPOWER Version 4.1, 14-Dec-2011 -- AC Power Flow (Newton)

Newton's method power flow converged in 2 iterations.

Converged in 1.14 seconds
================================================================================
|     System Summary                                                           |
================================================================================

How many?                How much?              P (MW)            Q (MVAr)
---------------------    -------------------  -------------  -----------------
Buses             14     Total Gen Capacity     772.4         -52.0 to 148.0
Generators         5     On-line Capacity       772.4         -52.0 to 148.0

Now, you didn't want to see the results, you want to store them, right? If you have a working version of Matpower, and haven't screwed up any files, you should get a results variable like this:

results = 
    version: '2'
    baseMVA: 100
        bus: [14x13 double]
        gen: [5x21 double]
     branch: [20x17 double]
    gencost: [5x7 double]
      order: [1x1 struct]
         et: 1.1400
    success: 1

Note the success attribute in the end. If this is not 1, that means the solution didn't converge. Obviously, as case14 is a sample case, that's wrong. Unless you have messed up, you should have success: 1.

The last row actually does what you want. The active power flow in the six first branches are:

branch_pf = results.branch(:, 14)
branch_pf =    
  156.8829
   75.5104
   73.2376
   56.1315
   41.5162
  -23.2857

After running those lines, this is what my workspace looks like: enter image description here

This is in fact an off-topic question, but since this is the first power system related question I've seen, and you're using Matpower (I've used it a lot), I couldn't not answer it.

Upvotes: 0

Related Questions