Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LODF First Column Error #18

Open
rwl opened this issue May 12, 2015 · 1 comment
Open

LODF First Column Error #18

rwl opened this issue May 12, 2015 · 1 comment

Comments

@rwl
Copy link
Owner

rwl commented May 12, 2015

As reported by Xiang Lu on the mailing list:

from pypower.ext2int import ext2int1
from pypower.makePTDF import makePTDF
from pypower.makeLODF import makeLODF
from pypower.rundcpf import rundcpf
from pypower.idx_brch import BR_STATUS, PF
from pypower.loadcase import loadcase
from pypower.case9 import case9
ppc=loadcase(case9())
r=rundcpf(ppc)

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)  ## H is correct

LODF = makeLODF(branch, H)

The resulted LODF is as follows:

array([[             nan,   1.64313008e-15,   8.89223335e-16,
                 nan,  -1.49968221e-15,   0.00000000e+00,
                 nan,  -1.40839721e-15,   8.89223335e-16],
   [             inf,  -1.00000000e+00,  -1.00000000e+00,
                 nan,  -1.00000000e+00,  -1.00000000e+00,
                 nan,  -1.00000000e+00,  -1.00000000e+00],
   [             inf,  -1.00000000e+00,  -1.00000000e+00,
                 nan,  -1.00000000e+00,  -1.00000000e+00,
                 nan,  -1.00000000e+00,  -1.00000000e+00],
   [             nan,   0.00000000e+00,   0.00000000e+00,
                 nan,   0.00000000e+00,   0.00000000e+00,
                 nan,   0.00000000e+00,   0.00000000e+00],
   [            -inf,  -1.00000000e+00,  -1.00000000e+00,
                 nan,  -1.00000000e+00,  -1.00000000e+00,
                 nan,  -1.00000000e+00,  -1.00000000e+00],
   [             inf,  -1.00000000e+00,  -1.00000000e+00,
                 nan,  -1.00000000e+00,  -1.00000000e+00,
                 nan,  -1.00000000e+00,  -1.00000000e+00],
   [             nan,   0.00000000e+00,   0.00000000e+00,
                 nan,   0.00000000e+00,   0.00000000e+00,
                 nan,   0.00000000e+00,   0.00000000e+00],
   [            -inf,  -1.00000000e+00,  -1.00000000e+00,
                 nan,  -1.00000000e+00,  -1.00000000e+00,
                 nan,  -1.00000000e+00,  -1.00000000e+00],
   [             inf,  -1.00000000e+00,  -1.00000000e+00,
                 nan,  -1.00000000e+00,  -1.00000000e+00,
                 nan,  -1.00000000e+00,  -1.00000000e+00]])
@rwl
Copy link
Owner Author

rwl commented May 12, 2015

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant