rwl / pylon

Port of MATPOWER to Python.
http://rwl.github.com/pylon
Apache License 2.0
29 stars 10 forks source link

pylon_file d_006_mdl #4

Closed luistrebejo closed 13 years ago

luistrebejo commented 13 years ago

I got this error message using pylon. Please i would like to get your coments.

case = pylon.Case.load_psat("c:\data\d_006_mdl.m") print case <pylon.case.Case object at 0x017BCA10> pylon.NewtonPF(case).solve() {'converged': True, 'V': array([ 1.01465465-0.00629211j, 1.00000000+0.j , 1.01745306-0.0056558j , 1.01057561-0.00568935j, 1.02047654-0.00859203j, 1.01641633-0.00638149j]), 'iterations': 3, 'elapsed': 0.031000137329101563}

case.save_rst(sys.stdout)

d_006_mdl

System Summary

=================== ======== Object Quantity =================== ======== Bus 6 Generator 3 Committed Generator 3 Load 3 Fixed Load 3 Despatchable Load 0 Shunt 0 Branch 11 Transformer 11 Inter-tie 0 Area 1 =================== ======== ======================== ======== ======== Attribute P (MW) Q (MVAr) ======================== ======== ======== Total Gen Capacity 600.0 -4.5 to 4.5 On-line Capacity 600.0 -4.5 to 4.5 Generation (actual) 2.4 -50.8 Load 2.8 1.9 Fixed 2.8 1.9 Despatchable 0.0 of 0.0 0.0 Shunt (inj) 0.0 0.0 Losses (I^2 * Z) 0.3 0.7 Branch Charging (inj) - 53.4 Total Inter-tie Flow 0.0 0.0 ======================== ======== ======== =================== ====================== ====================== Attribute Minimum Maximum
=================== ====================== ====================== Voltage Amplitude 1.000 p.u. @ bus 1 1.021 p.u. @ bus 4 Voltage Phase Angle -0.482 0.000 =================== ====================== ======================

Bus Data

====== ======== ======== ======== ======== ======== ======== Name Voltage (pu) Generation Load

.. Amp Phase P (MW) Q (MVAr) P (MW) Q (MVAr) ====== ======== ======== ======== ======== ======== ======== Traceback (most recent call last): File "<pyshell#20>", line 1, in case.save_rst(sys.stdout) File "C:\Python26\lib\site-packages\pylon\case.py", line 971, in save_rst ReSTWriter(self).write(fd) File "C:\Python26\lib\site-packages\pylon\io\common.py", line 79, in write self._write_data(file) File "C:\Python26\lib\site-packages\pylon\io\rst.py", line 47, in _write_data self.write_bus_data(file) File "C:\Python26\lib\site-packages\pylon\io\rst.py", line 123, in write_bus_data file.write(bus.name[:col1_width].ljust(col1_width)) TypeError: 'int' object is unsubscriptable

rwl commented 13 years ago

PSAT data file support is patchy at best. Stick to using MATPOWER files if you can. Otherwise, PSS/E raw file parsing works reasonably well.

luistrebejo commented 13 years ago

I did this: import sys import logging import pylon logging.basicConfig(stream=sys.stdout, level=logging.debug) case = pylon.Case.load_psat("c:\data\d_006_mdl.m") buses = case.buses for bus in buses: bus.name = "Bus-"+str(bus.name) case.save_rst(sys.stdout)

and i finally got the results