简体   繁体   中英

Get Mbase (MVA) of Machine from PSSE for Python code

Please help me to get Mbase (MVA) of Machine from PSSE for Python.

I would like to use this to calculate with inertia (H) value.

Although I can get H as syntax below, I don't know how to get Mbase (MVA).

 ierr = psspy.rwdy(option1=2,option2=0,out=0,ofile="C:\\Program Files (x86)\\PTI\\PSSE34\\EXAMPLE\\python_test1.out") 21421 'GENROU' 1 11.000 0.47000E-01 0.67000 0.50000E-01 6.2300 0.0000 2.1000 1.5500 0.21000 0.40000 0.16000 0.13000 0.36100 0.69300 

Thanks!

You can use psspy.macdat() as follows to store the value in a new variable mbase :

ierr, mbase = psspy.macdat(
    ibus=bus_number,  # bus number where machine is connected as an `int` object
    id=id_,           # machine ID as a `str` object
    string='MBASE',  
)

You will of course need to have already defined bus_number and id_ .

You may see the other options by reading the docstring:

import psse34
import psspy

help(psspy.macdat)

Thank you for your support.

Based on your introduction, I can get Mbase.

Due to a lot of machines, so I have to use for loop in order to get all of the power data of machines. Please give me some advice whether there is any other way than to use a for loop .

Please see the picture result on Notepad++ enter image description here

That's so kind of you.

import psse34
import psspy

# Last case:
CASE = r"C:\Program Files (x86)\PTI\PSSE34\EXAMPLE\savnw.sav"
psspy.psseinit(12000)
psspy.case(CASE)

ierr = psspy.dyre_add(dyrefile="C:\Program Files (x86)\PTI\PSSE34\EXAMPLE\savnw.dyr")
ierr = psspy.rstr("C:\Program Files (x86)\PTI\PSSE34\EXAMPLE\savnw.snp")
ierr = psspy.rwdy(1,1,ofile="C:\Program Files (x86)\PTI\PSSE34\EXAMPLE\python_test1.out") # find inertia (H) of machine
machine1=[101,102,206,211,3011,3018]
for x in machine1:
    ierr, mbase = psspy.macdat(ibus=x, id='1', string='MBASE') # find power of machine
    print(mbase)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM