rwl / pypower Goto Github PK
View Code? Open in Web Editor NEWPort of MATPOWER to Python
Home Page: http://rwl.github.io/PYPOWER/api/
License: Other
Port of MATPOWER to Python
Home Page: http://rwl.github.io/PYPOWER/api/
License: Other
Following the API Documentation link http://www.pypower.org/api
leads to a page that says "The domain pypower.org is for sale. To purchase, call ******. Click here for more details".
Unfortunately, this also means that the API documentation not available.
Line 101 in savecase.py has to be changed from "fd = open(fname, "wb")" to "fd = open(fname, "w")" By using the first version I get the error massage: "'str' does not support the buffer interface"
Python files used when the traceback occurred are attached as .txt files.
params_banshee_f1.txt
run_banshee_f1.txt
Traceback (most recent call last):
File "C:/Users/[...]/POWER FLOW/run_banshee_f1.py", line 26, in
printpf(r)
File "C:\Python36\lib\site-packages\pypower\printpf.py", line 128, in printpf
i2e = bus[:, BUS_I].astype(int)
TypeError: 'NoneType' object is not subscriptable
I found a issue in the "ext2int" function related to false indexing of the consecutive bus numbering in row 152 (see following code). The dictonary data type requires integer indices instead of float numbers that are used currently.
The issue appears with the latest numpy version "1.12.0" (it doesn't ignore anymore false indexing with float numbers).
Current implementation (error appears in row 152):
## apply consecutive bus numbering
o["bus"]["i2e"] = ppc["bus"][:, BUS_I].copy()
o["bus"]["e2i"] = zeros(max(o["bus"]["i2e"]) + 1)
Manual fix by changing the code in row 151 (it's not pretty, I know, but it works):
## apply consecutive bus numbering
o["bus"]["i2e"] = ppc["bus"][:, BUS_I].copy().astype(int)
o["bus"]["e2i"] = zeros(max(o["bus"]["i2e"]) + 1)
In line 245 (image below), the variable bi is indicating the index number which should be an integer. But values stored in the numpy array ‘gen’ are all floats. Thus, the variable should be converted to a float.
Line 245 in 5e71627
As reported via email by Aeishwarya Umesh Baviskar
It seems that there is a tiny mistake with the current master branch in ext2int.py Line 151
where o["bus"]["e2i"] = zeros(max(o["bus"]["i2e"]) + 1)
should be o["bus"]["e2i"] = zeros(max(o["bus"]["i2e"]).astype(int) + 1)
, or you will get a TypeError: 'numpy.float64' object cannot be interpreted as an integer
when you call ext2int().
I found in the chnagelog that continaution power flow is added as a new feature to pypower in 2020 but I could not find any documentation on how to use it. Can someone help with this please?
if any(bus[:, BUS_I] != list(range(nb))): stderr.write('buses must appear in order by bus number\n')
Should be:
if any(bus[:, BUS_I] != list(range(1, nb+1))): stderr.write('buses must appear in order by bus number\n')
Also:
f = branch[:, F_BUS] t = branch[:, T_BUS]
Should be:
f = branch[:, F_BUS] - ones(nl) t = branch[:, T_BUS] - ones(nl)
As reported by Puneet on the mailing list:
When I try to run DC power flow I get following error:
PYPOWER Version 4.1.2, 27-Oct-2014 -- DC Power Flow
Traceback (most recent call last):
File "<pyshell#15>", line 1, in
rundcpf(mpc)
File "C:\Python27\lib\site-packages\pypower\rundcpf.py", line 39, in rundcpf
return runpf(casedata, ppopt, fname, solvedcase)
File "C:\Python27\lib\site-packages\pypower\runpf.py", line 139, in runpf
Va = dcpf(B, Pbus, Va0, ref, pv, pq)
File "C:\Python27\lib\site-packages\pypower\dcpf.py", line 46, in dcpf
Va[pvpq] = spsolve(B[pvpq.T, pvpq], Pbus[pvpq] - B[pvpq.T, ref] * Va0[ref])
File "C:\Python27\lib\site-packages\scipy\sparse\linalg\dsolve\linsolve.py", line 108, in spsolve
% (A.shape, b.shape[0]))
ValueError: matrix - rhs dimension mismatch ((8, 8) - 1)
Based on this error it seems that latest Scipy version (0.15) is not compatible with PyPower.
Line 48 in 2b99f9f
Result in the error:
The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
import pypower
from pypower.case24_ieee_rts import case24_ieee_rts
from pypower.runpf import runpf
c = case24_ieee_rts()
results, success = runpf(c)
Traceback (most recent call last):
File "<pyshell#5>", line 1, in
results, success = runpf(c)
File "build\bdist.win32\egg\pypower\runpf.py", line 96, in runpf
ppc = ext2int(ppc)
File "build\bdist.win32\egg\pypower\ext2int.py", line 150, in ext2int
o["areas"]["status"]["on"] = find( ar )
KeyError: 'areas'
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]])
I'm unable to use makePTDF
.
from pypower.case9 import case9 as case
from pypower.makePTDF import makePTDF
H=makePTDF(case()['baseMVA'], case()['bus'], case()['branch'], 0)
Specifically, I seem to be getting an error in makeBdc
at this line
Cft = sparse((r_[ones(nl), -ones(nl)], (i, r_[f, t])), (nl, nb))
Any idea what might be going on?
It looks like you've caught a few of these before, so here's another one. In printpf, replace
gen(i, [PMIN, PG, PMAX]])
with
tuple(gen(i, [PMIN, PG, PMAX]]))
makeYbus fails when using pypower test cases due to one-indexing issues. For instance, for:
import pypower.api as pp ppc = pp.case14() baseMVA, bus, branch = ppc['baseMVA'], ppc['bus'], ppc['branch'] pp.makeYbus(baseMVA, bus, branch)
The output is
buses must appear in order by bus number Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Users/priyadonti/anaconda2/envs/acopf/lib/python3.7/site-packages/pypower/makeYbus.py", line 71, in makeYbus Ct = csr_matrix((ones(nl), (range(nl), t)), (nl, nb)) File "/Users/priyadonti/anaconda2/envs/acopf/lib/python3.7/site-packages/scipy/sparse/compressed.py", line 51, in __init__ other = self.__class__(coo_matrix(arg1, shape=shape)) File "/Users/priyadonti/anaconda2/envs/acopf/lib/python3.7/site-packages/scipy/sparse/coo.py", line 192, in __init__ self._check() File "/Users/priyadonti/anaconda2/envs/acopf/lib/python3.7/site-packages/scipy/sparse/coo.py", line 274, in _check raise ValueError('column index exceeds matrix dimensions') ValueError: column index exceeds matrix dimensions
FIXES:
Line 66 should be
f = branch[:, F_BUS] - 1
and line 67 should be
t = branch[:, T_BUS] - 1
Additionally, the check in line 35 should be
if any(bus[:, BUS_I] != list(range(1, nb+1))):
from pypower.case24_ieee_rts import case24_ieee_rts
from pypower.runpf import runpfc = case24_ieee_rts()
results, success = runpf(c)
Traceback (most recent call last):
File "<pyshell#13>", line 1, in
results, success = runpf(c)
File "build\bdist.win32\egg\pypower\runpf.py", line 79, in runpf
ppopt = ppoption() if ppopt is None else ppopt
TypeError: 'dict' object is not callable
Somebody could you help me?
Dear Author, i am trying to run a repository that utilizes the PYPOWER's opf.py file to run power flow but when it calls the 'ext2int.py' to convert to continuous indexing starting from 0,it gives following error. IndexError: index 23 is out of bounds for axis 0 with size 23. if ou could help me resolve this issue, i would be thankful to you and it will assist to my phd research. Thanks for consideration.
It would be nice if Pypower's test suite would support a test runner like pytest. This would make it a lot easier run only certain tests or skip certain tests.
In most cases, it should be sufficent to rename all files and methods from "t__" to "test__" and use simple assert statements.
When running runpf(casedata)
, if casedata['gen']
contains a generator that is off on the slack bus, then bustypes returns a ref as follows
ref = zeros(1, dtype=int)
ref = pv[0]
#37 states that ref must be a numpy array, and although 7a9b687 makes ref an empty numpy array in line 46, line 47 overrides that change.
Hello,
When I tried the source code as in the tutorial http://www.pypower.org/usage.html, I got an error with printpf as follows
In [5]: printpf(r)
Traceback (most recent call last):
File "", line 1, in
File "/ufs/luong/.local/lib/python2.7/site-packages/PYPOWER-4.0.1-py2.7.egg/pypower/printpf.py", line 139, in printpf
i2e = bus[:, BUS_I].astype(int)
TypeError: 'NoneType' object has no attribute 'getitem'
Note that if r is a result returned from a runopf then there is no problem printing it. But if r is a result return from runpf then I got the above error message.
As reported by Dominik on the mailing list:
When running a Powerflow in a very simple network of only 4 busses PYPOWER delivers the exact same result as when running the case in MATPOWER, however in its output it estimates an enormous power loss in the first branch, which is obviously false. (0.79MW compared to a value below 1kW).
def Testcase99():
## PYPOWER Case Format : Version 2
ppc = {'version': '2'}
##----- Power Flow Data -----##
## system MVA base
ppc['baseMVA'] = 10
## bus data
# bus_i type Pd Qd Gs Bs area Vm Va baseKV zone Vmax Vmin
ppc['bus'] = array([
[1, 3, 0, 0, 0, 0, 1, 1.02, 0, 20, 1, 1.06, 0.98],
[2, 1, 0, 0, 0, 0, 1, 1, -150, 0.4, 1, 1.1, 0.9],
[3, 1, 0.000425005103, 0, 0, 0, 1, 1, -150, 0.4, 1, 1.1, 0.9],
[4, 1, 0, 0, 0, 0, 1, 1, -150, 0.4, 1, 1.1, 0.9],
])
## generator data
# bus Pg Qg Qmax Qmin Vg mBase status Pmax Pmin Pc1 Pc2 Qc1min Qc1max Qc2min Qc2max ramp_agc ramp_10 ramp_30 ramp_q apf
ppc['gen'] = array([
[1, 0, 0, 10, -10, 1.02, 10, 1, 10, -10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[2, 0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[3, 0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[4, 0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
])
## branch data
# fbus tbus r x b rateA rateB rateC ratio angle status angmin angmax
ppc['branch'] = array([
[1, 2, 2.52, 5.17949805, 0, 0.1, 0.1, 0.1, 1, 150, 1, -360, 360],
[2, 3, 2.253125, 0.879645943, 0, 0.190525589, 0.190525589, 0.190525589, 0, 0, 1, -360, 360],
[3, 4, 0.721125, 0.0954258769, 0, 0.0997661265, 0.0997661265, 0.0997661265, 0, 0, 1, -360, 360],
])
return ppc
I meet an error when using runpf (enforce q limit):
Traceback (most recent call last):
File "/data2/wzr/opf/data/generate_data.py", line 31, in
results, success = runpf(ppc, opt)
File "/data2/wzr/anaconda3/envs/opf/lib/python3.7/site-packages/pypower/runpf.py", line 212, in runpf
(bus[gen[:, GEN_BUS], BUS_TYPE] == PV |
IndexError: arrays used as indices must be of integer (or boolean) type
Maybe the gen[:, GEN_BUS] is not integer type.
please help!
Dear all,
I run an OPF and pass the solved case over to a PF solver. Then, the PF solver iterates. This should not be happening (I have established that after a discussion with Zimmerman), since the OPF solution is also a PF solution.
In older versions of MATPOWER this would happen because the OPF solver would not update the generator voltage setpoints. I did some checking and this does not seem to be the case in PYPOWER.
Minimal example:
from pypower.api import case14, runopf , runpf , ppoption
opt = ppoption(VERBOSE=2)
mpc = runpf(runopf(case14(), opt), opt)
OPF is an important feature of Pypower. Pypower has kindly provided interface to IPOPT through pyIPOPT. However, in recent Python version, e.g., python 3.8, pyIPOPT is no longer supported. Is is possible to update the python-IPOPT interface? Thanks!
I find that the 30bus system in pypower is different from the ieee30 bus system. How could I get the case of IEEE30bus?
Hi,
I'm trying to warm start a solution, but it doesn't seem to have any effect
warm_started_ppc = runopf(warm_ppc, ppopt=ppopt)
What I've done is set all the variables in the bus and gen table with a warm solution thinking that the solver will start from there.
However, when measuring the time to solve the ppc now, I get the same time no matter what I put in the warm_ppc, be it a sollved opf or zeros or anything else, it's like it has no effect.
What is the correct way to warm start a ppc for an AC OPF solution?
Thanks!
I'm trying to use the Ipopt solver but am wondering if you made local changes to your pyipopt package. Specifically, solve only takes two arguments, x0 and userdata. What version of pyipopt and Ipopt are you using?
In ipopt_solver.m:
x, zl, zu, obj, status, zg = nlp.solve(x0, m, userdata)
Thank you for your great work on this port.
As reported by Minjiang Chen on the mailing list:
But when I tried to run OPF for the ‘case30pwl’, I has an error which I will show details below. I also tried to run with PF for the ‘case30pwl’, it is fine.
And I also run other cases which are using the polynomial ‘gencost’, they are all working on opf mode.
Here are the code I run:
from pypower.api import runopf, loadcase
ppc = loadcase('case30pwl')
r = runopf(ppc)
Here are the error I got:
PYPOWER Version 4.1.2, 27-Oct-2014 -- AC Optimal Power Flow
Traceback (most recent call last):
File "D:\Minjiang\PhD\Research Progress\Programming\PyPower\Work1\Test5.py", line 13, in <module>
r = runopf(ppc)
File "C:\Python27\lib\site-packages\pypower-4.1.2-py2.7.egg\pypower\runopf.py", line 44, in runopf
r = opf(casedata, ppopt)
File "C:\Python27\lib\site-packages\pypower-4.1.2-py2.7.egg\pypower\opf.py", line 185, in opf
results, success, raw = opf_execute(om, ppopt)
File "C:\Python27\lib\site-packages\pypower-4.1.2-py2.7.egg\pypower\opf_execute.py", line 94, in opf_execute
results, success, raw = pipsopf_solver(om, ppopt)
File "C:\Python27\lib\site-packages\pypower-4.1.2-py2.7.egg\pypower\pipsopf_solver.py", line 147, in pipsopf_solver
solution = pips(f_fcn, x0, A, l, u, xmin, xmax, gh_fcn, hess_fcn, opt)
File "C:\Python27\lib\site-packages\pypower-4.1.2-py2.7.egg\pypower\pips.py", line 275, in pips
f, df = f_fcn(x) # cost
File "C:\Python27\lib\site-packages\pypower-4.1.2-py2.7.egg\pypower\pipsopf_solver.py", line 143, in <lambda>
f_fcn = lambda x, return_hessian=False: opf_costfcn(x, om, return_hessian)
File "C:\Python27\lib\site-packages\pypower-4.1.2-py2.7.egg\pypower\opf_costfcn.py", line 118, in opf_costfcn
df_dPgQg[ipol] = baseMVA * polycost(gencost[ipol, :], xx[ipol], 1)
File "C:\Python27\lib\site-packages\pypower-4.1.2-py2.7.egg\pypower\polycost.py", line 48, in polycost
maxN = max( gencost[:, NCOST].astype(int) )
ValueError: max() arg is an empty sequence
I didn’t change anything in the ‘case30pwl’.
Line 112 in 2b99f9f
Should be
shape=(max(ppc["bus"][:, BUS_I]).astype(int) + 1, 1))
I installed PYPOWER along with numpy and scipy using pip install, and after that I tried running pf -h and I got the error
Traceback (most recent call last):
File "<pyshell#18>", line 1, in
pf -h
NameError: name 'pf' is not defined.
Even I tried to used runpf(ppe) by loading the case9 into ppe, and I got the error.
My code
from pypower.api import case9, ppoption,runpf,printpf
ppc = case9()
#ppopt = ppoption(PF_ALG=2)
r = runpf(ppc)
printpf(r)
error:
Traceback (most recent call last):
File "C:\Python27\test.py", line 4, in
r = runpf(ppc)
File "C:\Python27-64\lib\site-packages\pypower\runpf.py", line 95, in runpf
ppc = ext2int(ppc)
File "C:\Python27-64\lib\site-packages\pypower\ext2int.py", line 152, in ext2int
o["bus"]["e2i"] = zeros(max(o["bus"]["i2e"]) + 1)
TypeError: 'numpy.float64' object cannot be interpreted as an index.
Please help. Thanks in advance
You just need to pip install tox
add a tox.ini
in your main directory:
[tox]
envlist = py26,py27,py33,py34
[testenv]
deps = numpy scipy
commands = python pypower/t/test_pypower.py
Then run tox
from within your main directory. It will create a virtualenv for each interpreter and execute the tests with that vm. See https://pypi.python.org/pypi/tox for details.
Note: This would work very well along with py.test. Your tox.ini
would then look like:
[tox]
envlist = py26,py27,py33,py34
[testenv]
deps = pytest numpy scipy
commands = py.test
how to ' import pypower' to the script,i want to write the code,
I am receiving the following error when running an OPF
ValueError: shape mismatch: value array of shape (32,) could not be broadcast to indexing result of shape (16,2)
This is for a 15 bus system, the gencost array looks like this:
ppc["gencost"] = array([
[1, 0, 0, 2, 86., 1462., 430, 7310],
[1, 0, 0, 2, 86., 1204., 430, 6020],
[1, 0, 0, 2, 85., 1955., 425, 9775],
[1, 0, 0, 2, 85., 1445., 425, 7225],
[1, 0, 0, 2, 73., 1168., 365, 5840],
[1, 0, 0, 2, 73., 2920., 365, 14600],
[1, 0, 0, 2, 73., 1971., 365, 9855],
[1, 0, 0, 2, 79.8, 2872.8, 399, 14364],
[1, 0, 0, 2, 79.8, 1436.4, 399, 7182],
[1, 0, 0, 2, 79.8, 2633.4, 399, 13167],
[1, 0, 0, 2, 79.8, 2872.8, 399, 14364],
[1, 0, 0, 2, 79.8, 2234.4, 399, 11172],
[1, 0, 0, 2, 80., 1520., 400, 7600],
[1, 0, 0, 2, 80., 1440., 400, 7200],
[1, 0, 0, 2, 81.4, 1221., 407, 6105],
[1, 0, 0, 2, 81.4, 3093.2, 407, 15466]
])
Please help!
As reported by Dominik on the mailing list:
When including more than one generator in my grid, I get an error of creating a singular matrix:
[...]
File "pypower\runpf.py", line 183, in runpf
V, success, _ = newtonpf(Ybus, Sbus, V0, ref, pv, pq, ppopt)
File "pypower\newtonpf.py", line 101, in newtonpf
dx = -1 * spsolve(J, F)
File "C:\WinPython-64bit-2.7.9.1\python-2.7.9.amd64\lib\site-packages\scipy\sparse\linalg\dsolve\linsolve.py", line 143, in spsolve
b, flag, options=options)
RuntimeError: superlu failure (singular matrix?) at line 100 in file scipy\sparse\linalg\dsolve\SuperLU\SRC\dsnode_bmod.c
This does however not happen when solving the exact same case using MATPOWER after exporting it using 'savecase'.
def Testcase36():
## PYPOWER Case Format : Version 2
ppc = {'version': '2'}
##----- Power Flow Data -----##
## system MVA base
ppc['baseMVA'] = 10
## bus data
# bus_i type Pd Qd Gs Bs area Vm Va baseKV zone Vmax Vmin
ppc['bus'] = array([
[1, 3, 0, 0, 0, 0, 1, 1.02, 0, 20, 1, 1.06, 0.98],
[2, 1, 0, 0, 0, 0, 1, 1, -150, 0.4, 1, 1.1, 0.9],
[3, 1, 0.0006, 0, 0, 0, 1, 1, -150, 0.4, 1, 1.1, 0.9],
[4, 1, 0, 0, 0, 0, 1, 1, -150, 0.4, 1, 1.1, 0.9],
[5, 1, 0, 0, 0, 0, 1, 1, -150, 0.4, 1, 1.1, 0.9],
[6, 1, 0, 0, 0, 0, 1, 1, -150, 0.4, 1, 1.1, 0.9],
])
## generator data
# bus Pg Qg Qmax Qmin Vg mBase status Pmax Pmin Pc1 Pc2 Qc1min Qc1max Qc2min Qc2max ramp_agc ramp_10 ramp_30 ramp_q apf
ppc['gen'] = array([
[1, 0, 0, 10, -10, 1.02, 10, 1, 10, -10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[2, 0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[3, 0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[4, 0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[5, 0.00104344028, -0, -0, -0, 0, 10, 1, 0.00104344028, 0.00104344028, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[6, 0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
])
## branch data
# fbus tbus r x b rateA rateB rateC ratio angle status angmin angmax
ppc['branch'] = array([
[1, 2, 2.52, 5.17949805, 0, 0.1, 0.1, 0.1, 1, 150, 1, -360, 360],
[2, 3, 2.253125, 0.879645943, 0, 0.190525589, 0.190525589, 0.190525589, 0, 0, 1, -360, 360],
[3, 4, 0.721125, 0.0954258769, 0, 0.0997661265, 0.0997661265, 0.0997661265, 0, 0, 1, -360, 360],
[3, 5, 2.253125, 0.879645943, 0, 0.190525589, 0.190525589, 0.190525589, 0, 0, 1, -360, 360],
[5, 6, 1.3220625, 0.174947441, 0, 0.0997661265, 0.0997661265, 0.0997661265, 0, 0, 1, -360, 360],
])
return ppc
Hi Richard,
when I run python pypower/t/test_pypower.py
I get the following error:
---------- t_ext2int2ext ----------
1..85
Traceback (most recent call last):
File "pypower/t/test_pypower.py", line 135, in <module>
test_pypower(verbose=True)
File "pypower/t/test_pypower.py", line 78, in test_pypower
t_run_tests(tests, verbose)
File "/home/stefan/Code/PYPOWER/pypower/t/t_run_tests.py", line 67, in t_run_tests
eval('mod.%s(not verbose)' % tname)
File "<string>", line 1, in <module>
File "/home/stefan/Code/PYPOWER/pypower/t/t_ext2int2ext.py", line 50, in t_ext2int2ext
ppc = e2i_data(ppce)
TypeError: e2i_data() takes at least 3 arguments (1 given)
https://groups.google.com/forum/#!topic/pypower/0WD2fz9PqRQ
>>> from pypower.api import runopf
>>> runopf(ppc)
PYPOWER Version 4.0.1, 14-Jul-2011 -- AC Optimal Power Flow
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python27\lib\site-packages\pypower\runopf.py", line 37, in runopf
r = opf(casedata, ppopt)
File "C:\Python27\lib\site-packages\pypower\opf.py", line 180, in opf
results, success, raw = opf_execute(om, ppopt)
File "C:\Python27\lib\site-packages\pypower\opf_execute.py", line 91, in opf_execute
results, success, raw = pipsopf_solver(om, ppopt)
File "C:\Python27\lib\site-packages\pypower\pipsopf_solver.py", line 142, in pipsopf_solver
solution = pips(f_fcn, x0, A, l, u, xmin, xmax, gh_fcn, hess_fcn, opt)
File "C:\Python27\lib\site-packages\pypower\pips.py", line 265, in pips
be = uu[ieq, :]
IndexError: too many indice
Hey,
Sorry if it is a trivial question (I am new to pypower).
I am running the following code:
from pypower.api import mygrid,ppoption, runpf, runopf, printpf
ppc = mygrid()
Where "mygrid" is my case file, which is in the same format as all other case files.
However, I receive the following error:
Traceback (most recent call last):
File "C:/Users/ayman/PycharmProjects/Project1/RandomTest.py", line 2, in
from pypower.api import mygrid,ppoption, runpf, runopf, printpf
ImportError: cannot import name mygrid
I tried renaming one of the already case files (ex: case14) to "mygrid" to make sure it is the correct format, but I also received the same error. It seems that I cannot call any case file other than the ones that come with the pypower.
Am I doing something wrong ? Is there a fix for that ?
I need to use my own grid with my own parameters.
Thanks.
import sys
import logging
import pylon
logging.basicConfig(stream=sys.stdout, level=logging.debug)
case=pylon.Case.load_Matpower("c:\data\case30pwl.m")
Traceback (most recent call last):
File "<pyshell#4>", line 1, in
case=pylon.Case.load_Matpower("c:\data\case30pwl.m")
AttributeError: type object 'Case' has no attribute 'load_Matpower'
As reported by Prabakaran on the mailing list:
I recently installed PYPOWER in my Ubuntu 14.04, Python 2.7.6, scipy 0.13.3 and ran the sample commands given in GitHub project page's readme. When running the command,
$ opf -c case24_ieee_rts --solvedcase=rtsout.py
to solve an OPF for the IEEE Reliability Test System and write the solved case to file.
I cannot use makePTDF in pypower
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.