Revision history  [back]

Take a look at the BRNDT2 function in the API. For example:

ierr, line_rx = psspy.brndt2(113987,113973,'1','RX')

would give you a complex value for the line impedance. line_rx.real and line_rx.imag will then separate the resistance and reactance values of the impedance.


You were also interested in accessing the data from caspy. It is quite a bit different beast, and is a little more difficult to get the data you are requesting.

Here is the gist of how to get the same data:

rx = None
sav = 'c:/path/to/your/case.sav'
from_bus = '113987'
to_bus = '113973'
ckt_id = ' 1'

case = caspy.Savecase(sav)
# Look for from bus in FRMBUS list
for i in range(len(case.pssbrn.frmbus)):        
    if ((case.pssbrn.frmbus[i] == float(from_bus)) and (case.pssbrn.tobus[i]==float(to_bus)) and case.pssbrn.ckt[i].strip() == ckt_id.strip()):
        rx = case.pssbrn.rx[i]
# Look for from bus in TOBUS list
for i in range(len(case.pssbrn.tobus)):       
    if ((case.pssbrn.frmbus[i] == float(to_bus)) and (case.pssbrn.tobus[i]==float(from_bus)) and case.pssbrn.ckt[i].strip() == ckt_id.strip()):
        rx = case.pssbrn.rx[i]

if rx:
    print('%05f + %05fi' % (rx.real,rx.imag))
else:
    print('Branch not found in case')

Take a look at the BRNDT2 function in the API. For example:

ierr, line_rx = psspy.brndt2(113987,113973,'1','RX')

would give you a complex value for the line impedance. line_rx.real and line_rx.imag will then separate the resistance and reactance values of the impedance.


You were also interested in accessing the data from caspy. It is quite a bit different beast, and is a little more difficult to get the data you are requesting.

Here is the gist of how to get the same data:

rx = None
sav = 'c:/path/to/your/case.sav'
from_bus = '113987'
to_bus = '113973'
ckt_idckt = ' 1'

case = caspy.Savecase(sav)
# Look for from bus in FRMBUS list
for i in range(len(case.pssbrn.frmbus)):        
    if ((case.pssbrn.frmbus[i] == float(from_bus)) and (case.pssbrn.tobus[i]==float(to_bus)) and case.pssbrn.ckt[i].strip() == ckt_id.strip()):
        rx = case.pssbrn.rx[i]
# Look for from bus in TOBUS list
for i in range(len(case.pssbrn.tobus)):       
    if ((case.pssbrn.frmbus[i] == float(to_bus)) and (case.pssbrn.tobus[i]==float(from_bus)) and case.pssbrn.ckt[i].strip() == ckt_id.strip()):
        rx = case.pssbrn.rx[i]

if rx:
    print('%05f + %05fi' % (rx.real,rx.imag))
else:
    print('Branch not found in case')

Take a look at the BRNDT2 function in the API. For example:

ierr, line_rx = psspy.brndt2(113987,113973,'1','RX')

would give you a complex value for the line impedance. line_rx.real and line_rx.imag will then separate the resistance and reactance values of the impedance.


You were also interested in accessing the data from caspy. It is quite a bit different beast, and is a little more difficult to get the data you are requesting.

Here is the gist of how to get the same data:

rx = None
sav = 'c:/path/to/your/case.sav'
from_bus = '113987'
to_bus = '113973'
ckt = ' 1'

case = caspy.Savecase(sav)
# Look for from bus in FRMBUS list
for i in range(len(case.pssbrn.frmbus)):        
    if ((case.pssbrn.frmbus[i] == float(from_bus)) and (case.pssbrn.tobus[i]==float(to_bus)) and case.pssbrn.ckt[i].strip() == ckt_id.strip()):
        rx = case.pssbrn.rx[i]
# Look for from bus in TOBUS list
for i in range(len(case.pssbrn.tobus)):       
    if ((case.pssbrn.frmbus[i] == float(to_bus)) and (case.pssbrn.tobus[i]==float(from_bus)) and case.pssbrn.ckt[i].strip() == ckt_id.strip()):
        rx = case.pssbrn.rx[i]

if rx:
    print('%05f + %05fi' % (rx.real,rx.imag))
else:
    print('Branch not found in case')