Code Monkey home page Code Monkey logo

Comments (1)

rwl avatar rwl commented on July 19, 2024

As reported by Ben Warren on the mailing list:

Pypower:

from pypower.case9 import case9
from pypower.ext2int import ext2int1, ext2int
from pypower.idx_brch import BR_STATUS, PF
from pypower.loadcase import loadcase
from pypower.makeLODF import makeLODF
from pypower.makePTDF import makePTDF
from pypower.rundcpf import rundcpf
from pypower.api import case9, ppoption, runpf, printpf

ppc = case9()
ppopt = ppoption(PF_ALG=2)
r = runpf(ppc, ppopt)

baseMVA, bus, gen, branch = (
    r[0]['baseMVA'],
    r[0]['bus'],
    r[0]['gen'],
    r[0]['branch']
    )

_, bus, gen, branch = ext2int1(bus, gen, branch)

F0 = branch[:, PF]

H = makePTDF(baseMVA, bus, branch, 0)
LODF = makeLODF(branch, H)

for x in range(0,9):
    for y in range(0,9):
        print round(LODF[x][y],4), "\t",
    print ""

nan     0.0     0.0     nan     -0.0    0.0     nan     -0.0    0.0     
inf     -1.0    -1.0    inf     -1.0    -1.0    nan     -1.0    -1.0    
inf     -1.0    -1.0    inf     -1.0    -1.0    nan     -1.0    -1.0    
nan     0.0     0.0     nan     0.0     0.0     nan     0.0     0.0     
-inf    -1.0    -1.0    nan     -1.0    -1.0    nan     -1.0    -1.0    
inf     -1.0    -1.0    nan     -1.0    -1.0    nan     -1.0    -1.0    
nan     0.0     0.0     nan     0.0     0.0     nan     0.0     0.0     
-inf    -1.0    -1.0    nan     -1.0    -1.0    nan     -1.0    -1.0    
inf     -1.0    -1.0    nan     -1.0    -1.0    nan     -1.0    -1.0    

Note the first column.

Matpower:

mpc = loadcase('case9');
r = rundcpf(mpc); 
[baseMVA, bus, gen, branch] = ext2int(r.bus, r.gen, r.branch); 
H = makePTDF(baseMVA, bus, branch, 1) 
LODF = makeLODF(branch, H) 
LODF =

  -1.00000   0.00000   0.00000       NaN  -0.00000  -0.00000       NaN  -0.00000  -0.00000
  -0.79062  -1.00000  -1.00000       NaN  -1.00000  -1.00000       NaN  -1.00000  -1.00000
  -0.98827  -1.00000  -1.00000       NaN  -1.00000  -1.00000       NaN  -1.00000  -1.00000
  -0.00000   0.00000   0.00000       NaN   0.00000   0.00000       NaN   0.00000   0.00000
   0.33601  -1.00000  -1.00000       NaN  -1.00000  -1.00000       NaN  -1.00000  -1.00000
   0.59296  -1.00000  -1.00000       NaN  -1.00000  -1.00000       NaN  -1.00000  -1.00000
  -0.00000   0.00000   0.00000       NaN   0.00000   0.00000       NaN   0.00000   0.00000
   1.04756  -1.00000  -1.00000       NaN  -1.00000  -1.00000       NaN  -1.00000  -1.00000
   0.31625  -1.00000  -1.00000       NaN  -1.00000  -1.00000       NaN  -1.00000  -1.00000

Everything is the same, except the first column.

from pypower.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.